The prober names 6% of the unnamed releases it finishes and the pending queue (44M) grows eleven times faster than it probes. A sample of 44,530 finished pending rows shows the headers predict a name: size bucket, name shape, completeness, tool and group separate 0% classes from 95% ones, while the learner keyed on tool and group alone (LOG.md (130)). - lib/release/classes.ts, names::pending_class, SQL pending_class(): a release's class (size × shape × partial, 1..70), the three in step. - Migration 6800: pending_releases.klass and target_bytes (the first target's article; candidates carry bytes now), pending_classes with each class's climbs, names, waiting and verdict, the claim's index. - The ladder claims the classes with the best record first (a prior for the unexplored, at most a quarter of a claim from one), the cheapest target first within one, then the oldest of the rest; records classes like signatures and drops them at the same thresholds; discards their waiting releases. Claimed rows sorted in code: an UPDATE returns none. - The rule set's droppedClasses: the edge keeps unnamed releases of a dropped class out of the pending store (counted as garbage), the explored sample excepted. - hash_twins.ts: a probed file whose first 16 KiB and size match a named catalog release's names a pending release the probe didn't, and sets the inner name of a catalog release without one. - pending:classes classes the rows from before and seeds the record from the finished ones; rules:classes publishes the dropped classes; releases:readable also marks the rows' candidates unreadable. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
55 lines
2.3 KiB
TypeScript
55 lines
2.3 KiB
TypeScript
import { BaseCommand, flags } from '@adonisjs/core/ace'
|
|
import type { CommandOptions } from '@adonisjs/core/types/ace'
|
|
import db from '@adonisjs/lucid/services/db'
|
|
import RuleSets from '#services/rule_sets'
|
|
import { classKey, describeClass } from '#lib/release/index'
|
|
|
|
/**
|
|
* Publishes a rule set whose dropped classes are the pending ladder's (pending_classes.dropped; LOG.md (130)): the
|
|
* edge keeps unnamed releases of those classes out of the pending store from then on, their explored sample
|
|
* excepted. Run again as the record grows; unchanged classes publish nothing.
|
|
*/
|
|
export default class RulesClasses extends BaseCommand {
|
|
static commandName = 'rules:classes'
|
|
static description = "Publishes a rule set with the pending ladder's dropped classes"
|
|
static options: CommandOptions = { startApp: true }
|
|
|
|
@flags.boolean({ description: 'Show what would be published, write nothing' })
|
|
declare dryRun: boolean
|
|
|
|
async run() {
|
|
const { rows } = await db.rawQuery(
|
|
`SELECT c.tool, g.name AS grp, c.klass, c.probed, c.named FROM pending_classes c JOIN groups g ON g.id = c.group_id WHERE c.dropped ORDER BY 1, 2, 3`
|
|
)
|
|
const next = new Set<string>(rows.map((r: any) => classKey(r.tool, r.grp, Number(r.klass))))
|
|
const { version, priorities: _p, ...current } = await RuleSets.current()
|
|
const before = new Set(current.droppedClasses ?? [])
|
|
const added = [...next].filter((c) => !before.has(c))
|
|
const removed = [...before].filter((c) => !next.has(c))
|
|
if (added.length === 0 && removed.length === 0) {
|
|
this.logger.info(
|
|
`Unchanged: rule set ${version} has the ${before.size} dropped classes already.`
|
|
)
|
|
return
|
|
}
|
|
for (const r of rows.slice(0, 40)) {
|
|
this.logger.info(
|
|
` ${r.tool.padEnd(10)} ${r.grp.padEnd(32)} ${describeClass(Number(r.klass)).padEnd(26)} ${r.named} of ${r.probed} named`
|
|
)
|
|
}
|
|
if (this.dryRun) {
|
|
this.logger.info(
|
|
`Would publish ${next.size} dropped classes (${added.length} added, ${removed.length} removed).`
|
|
)
|
|
return
|
|
}
|
|
const published = await RuleSets.publish(
|
|
{ ...current, droppedClasses: [...next].sort() },
|
|
`${next.size} dropped classes from the pending ladder`
|
|
)
|
|
this.logger.info(
|
|
`Rule set ${published}: ${next.size} dropped classes (${added.length} added, ${removed.length} removed).`
|
|
)
|
|
}
|
|
}
|