@@ -594,6 +594,94 @@ const RESOLUTION_CONTROLS = [
594594 } ,
595595] ;
596596
597+ /**
598+ * What the tier-1 worklist PRINTS, pinned against a declared population.
599+ *
600+ * ## Why a fixture, in an instrument that measures
601+ *
602+ * The worklist body has three readings and this tree can only reach one of
603+ * them: it prints a row per file with an outstanding DARK member, and there is
604+ * one outstanding member here (`auth-manager.ts::verifyMcpAccessToken`) beside
605+ * three DETERMINED rows. So neither `(none …)` line has ever been printed by a
606+ * run of this instrument, and an unreachable reading is a reading nobody
607+ * proofreads.
608+ *
609+ * That is measured, not feared. The empty-worklist line said the ruling's gate
610+ * handover step "is unblocked" — and went on saying it after PR #15458
611+ * performed that step and PR #15472 closed #12981, and through the sweep that
612+ * repaired the four stale statements around it (#15459, #15473, PR #15502),
613+ * because a string no run can print is a string no run can contradict (#15503).
614+ *
615+ * ## What is asserted, and what is deliberately not
616+ *
617+ * `worklistLines` is handed a population this tree does not have, and what it
618+ * returns is pinned BY VALUE below. The pin is a SECOND, INDEPENDENT spelling
619+ * of each line on purpose: a control that compared the producer against a
620+ * shared constant would pass whatever that constant said, which is the vacuous
621+ * shape the rest of this file argues against.
622+ *
623+ * ⛔ No row here is a claim about the tree. Membership is measured from
624+ * `packages/**` and is decided before this family is consulted; the only thing
625+ * asserted is what the report SAYS about a population it is handed. The
626+ * census's own reading is byte-identical across the change that added this
627+ * family.
628+ *
629+ * The third row is the family's NEGATIVE leg and is not optional: without a
630+ * population that must NOT print either `(none …)` line, the two pins above
631+ * would stay green against a producer that had stopped consulting its
632+ * population at all. It pins the row format and the by-file sort with the same
633+ * stroke.
634+ *
635+ * Asserted in BOTH self-test modes, by the test `SELF_TEST_MODES` states: can a
636+ * successful repair destroy it? No — the empty worklist it pins is the state
637+ * the repair programme is trying to reach, so the day this family matters most
638+ * is the day the programme succeeds.
639+ */
640+ const WORKLIST_READING_CONTROLS = [
641+ {
642+ when : 'no outstanding member and no DETERMINED row — the programme has finished' ,
643+ outstanding : [ ] ,
644+ determined : [ ] ,
645+ expect : [
646+ ' (none — the family is repaired; the gate handover step landed in PR #15458, and #12981 closed with PR #15472)' ,
647+ ] ,
648+ why :
649+ 'The reading this family was added for (#15503). It must state the handover as LANDED: PR #15458 '
650+ + 'declared `tryInsert`/`tryUpdate` in the gate\'s `DURABILITY_CRITICAL_CALLEES` and PR #15472 closed '
651+ + '#12981. A future tense here would announce a step that already happened, on the one day this '
652+ + 'instrument is finally read for its verdict rather than its worklist.' ,
653+ } ,
654+ {
655+ when : 'no outstanding member, but the register still holds rows' ,
656+ outstanding : [ ] ,
657+ determined : [ { file : 'packages/fixture/src/register-only.ts' } ] ,
658+ expect : [
659+ ' (none outstanding — every DARK member is DETERMINED below, and every one is still a member)' ,
660+ ] ,
661+ why :
662+ 'The other unreachable reading. It has to keep saying that a DETERMINED site is STILL A MEMBER — '
663+ + 'the whole point of the #13886 register is that it partitions the printed worklist and moves no '
664+ + 'count, and this is the one line a reader meets that claim in.' ,
665+ } ,
666+ {
667+ when : 'two outstanding members in two files — the shape this tree actually prints' ,
668+ outstanding : [
669+ { file : 'packages/fixture/src/beta.ts' } ,
670+ { file : 'packages/fixture/src/alpha.ts' } ,
671+ { file : 'packages/fixture/src/alpha.ts' } ,
672+ ] ,
673+ determined : [ ] ,
674+ expect : [
675+ ' 2× packages/fixture/src/alpha.ts' ,
676+ ' 1× packages/fixture/src/beta.ts' ,
677+ ] ,
678+ why :
679+ 'The NEGATIVE leg: a population with work in it must print the work and NEITHER `(none …)` line. '
680+ + 'Without it the two pins above would also pass for a producer that ignored its population and '
681+ + 'printed the empty reading unconditionally. It pins the count column and the by-file sort too.' ,
682+ } ,
683+ ] ;
684+
597685/**
598686 * The DETERMINED register (#13886) — DARK sites whose determination is settled.
599687 *
@@ -1588,6 +1676,35 @@ function formatSite(f) {
15881676 + `${ f . healthySummaryInFile ? ' healthySummary' : '' } \n ${ f . snippet } ` ;
15891677}
15901678
1679+ /**
1680+ * The BODY of the tier-1 worklist: one row per file that still holds an
1681+ * outstanding DARK member, or the one line the report prints when it holds
1682+ * none.
1683+ *
1684+ * Split out of `report()` so the two `(none …)` readings can be exercised
1685+ * against a declared population instead of only against this tree — see
1686+ * `WORKLIST_READING_CONTROLS`, which is the reason this function exists as a
1687+ * function. It takes its population as arguments and reads nothing else, so a
1688+ * control can hand it a tree that does not exist without touching the census.
1689+ *
1690+ * @param outstanding tier-1 DARK members with no DETERMINED row honouring them.
1691+ * @param determined tier-1 DARK members a DETERMINED row does honour. Only its
1692+ * LENGTH is read here: the rows themselves are printed by the
1693+ * register's own block below this one in `report()`.
1694+ */
1695+ function worklistLines ( outstanding , determined ) {
1696+ const out = [ ] ;
1697+ const byFile = new Map ( ) ;
1698+ for ( const m of outstanding ) byFile . set ( m . file , ( byFile . get ( m . file ) ?? 0 ) + 1 ) ;
1699+ for ( const [ file , count ] of [ ...byFile . entries ( ) ] . sort ( ) ) out . push ( ` ${ count } × ${ file } ` ) ;
1700+ if ( byFile . size === 0 && determined . length === 0 ) {
1701+ out . push ( ' (none — the family is repaired; the gate handover step landed in PR #15458, and #12981 closed with PR #15472)' ) ;
1702+ } else if ( byFile . size === 0 ) {
1703+ out . push ( ' (none outstanding — every DARK member is DETERMINED below, and every one is still a member)' ) ;
1704+ }
1705+ return out ;
1706+ }
1707+
15911708function report ( { sites = false } = { } ) {
15921709 const { stats, members, quiet } = census ( ) ;
15931710 const dark = members . filter ( ( m ) => m . tier === 'dark' ) ;
@@ -1636,14 +1753,7 @@ function report({ sites = false } = {}) {
16361753 const outstanding = dark . filter ( ( m ) => ! excused . has ( determinedKey ( m ) ) ) ;
16371754 const determined = dark . filter ( ( m ) => excused . has ( determinedKey ( m ) ) ) ;
16381755 out . push ( ' [1] DARK members, by file — the repair worklist:' ) ;
1639- const byFile = new Map ( ) ;
1640- for ( const m of outstanding ) byFile . set ( m . file , ( byFile . get ( m . file ) ?? 0 ) + 1 ) ;
1641- for ( const [ file , count ] of [ ...byFile . entries ( ) ] . sort ( ) ) out . push ( ` ${ count } × ${ file } ` ) ;
1642- if ( byFile . size === 0 && determined . length === 0 ) {
1643- out . push ( ' (none — the family is repaired; the gate handover step is unblocked)' ) ;
1644- } else if ( byFile . size === 0 ) {
1645- out . push ( ' (none outstanding — every DARK member is DETERMINED below, and every one is still a member)' ) ;
1646- }
1756+ for ( const line of worklistLines ( outstanding , determined ) ) out . push ( line ) ;
16471757 if ( determined . length > 0 ) {
16481758 out . push ( '' ) ;
16491759 out . push ( ` DETERMINED, not outstanding ${ determined . length } site(s) in ${ memberFiles ( determined ) . length } file(s)` ) ;
@@ -1950,6 +2060,36 @@ function selfTest(mode = 'all') {
19502060 }
19512061 }
19522062
2063+ // ── What the WORKLIST PRINTS (#15503), asserted in BOTH modes ────────────
2064+ //
2065+ // See WORKLIST_READING_CONTROLS for why these readings are exercised against
2066+ // a declared population rather than against the tree — two of the three
2067+ // cannot be reached from `packages/**` today — and SELF_TEST_MODES for why
2068+ // this family is gated: it compares a producer against a declared population
2069+ // and never touches membership, so no repair can destroy it.
2070+ //
2071+ // The table is pinned to its own length first (#13799's floor recipe): a loop
2072+ // over an emptied table runs zero cases and prints nothing, which reads in a
2073+ // CI log exactly like a pass.
2074+ const WORKLIST_READING_CONTROL_COUNT = 3 ;
2075+ if ( WORKLIST_READING_CONTROLS . length !== WORKLIST_READING_CONTROL_COUNT ) {
2076+ problems . push ( `the worklist reading table holds ${ WORKLIST_READING_CONTROLS . length } control(s), not the `
2077+ + `${ WORKLIST_READING_CONTROL_COUNT } it is pinned at. Both empty readings and the negative leg that `
2078+ + 'keeps them honest are declared there; a row deleted rather than re-pointed takes its reading out '
2079+ + 'of every run silently, which is the failure this family exists to close.' ) ;
2080+ }
2081+ for ( const control of WORKLIST_READING_CONTROLS ) {
2082+ const printed = worklistLines ( control . outstanding , control . determined ) ;
2083+ const same = printed . length === control . expect . length
2084+ && printed . every ( ( line , i ) => line === control . expect [ i ] ) ;
2085+ if ( ! same ) {
2086+ problems . push ( `the worklist's reading moved: ${ control . when } \n`
2087+ + `${ control . expect . map ( ( l ) => ` declared: |${ l } |` ) . join ( '\n' ) } \n`
2088+ + `${ printed . map ( ( l ) => ` printed: |${ l } |` ) . join ( '\n' ) || ' printed: (nothing)' } \n`
2089+ + ` ${ control . why } ` ) ;
2090+ }
2091+ }
2092+
19532093 // The durability filter must actually filter: the raw shape is ~3.5x this.
19542094 if ( members . length === 0 ) {
19552095 problems . push ( 'census found ZERO members — on this tree that is a broken matcher, not a clean repo.' ) ;
@@ -1968,6 +2108,7 @@ function selfTest(mode = 'all') {
19682108 + `${ RESOLUTION_CONTROLS . length } resolution control(s) resolve as declared, `
19692109 + `${ DETERMINED . size } DETERMINED register row(s) cross-check clean, `
19702110 + `${ copiedGateNames . length } copied gate-vocabulary name(s) match the gate's own declaration, `
2111+ + `${ WORKLIST_READING_CONTROLS . length } worklist reading(s) print as declared over a fixture population, `
19712112 + `${ members . length } member site(s) total\n`
19722113 + ` ${ POSITIVE_CONTROLS . length } positive control(s) are NOT asserted here, permanently: they pin `
19732114 + 'members of the #12981 worklist, which\n that programme exists to remove — a control the repair '
@@ -1983,6 +2124,7 @@ function selfTest(mode = 'all') {
19832124 + `${ RESOLUTION_CONTROLS . length } resolution control(s) resolve as declared, `
19842125 + `${ DETERMINED . size } DETERMINED register row(s) cross-check clean, `
19852126 + `${ copiedGateNames . length } copied gate-vocabulary name(s) match the gate's own declaration, `
2127+ + `${ WORKLIST_READING_CONTROLS . length } worklist reading(s) print as declared over a fixture population, `
19862128 + `${ members . length } member site(s) total\n` ,
19872129 ) ;
19882130 return 0 ;
0 commit comments