Skip to content

bug(ci): the arch gate is red on main because two grandfather entries are stale #1309

In review

Description

@HugoXK

Written-by: Fledge Platform Product
Found by: 4-hour product audit; this is the cause of the main-red tracker #1308.

Pin: 14d835abcda38fcb9f90ebfc82ef6d241551835c, live main read at Date: Wed, 25 Nov 2026 00:57:13 GMT. Every citation below was read at that sha.

Risk tier: T3, basis scripts/** (scripts/lib/arch-grandfather.json).

Expected vs actual

Expected: the arch gate passes on the default branch — npm run arch:check exits 0, so CI's test (24) job is green and the merge context is not blocked by it.

Actual: at 14d835ab, node scripts/arch-boundaries.mjs exits 1 with three grandfathered-growth violations (src/app.ts, src/views/pages.ts, src/db.ts). The gate's own tree test spawns that script (test/archBoundaries.test.ts:90, spawn at :91), so npm test fails: check run test (24) 138893638922 completed failure at 00:54:23Z on the assertion below; ci-ok (00:56:40Z) and ci-ok-head (00:56:07Z) failed on that commit. #1308 tracks the red state. codeql-required (00:53:47Z) and Analyze JavaScript/TypeScript (00:53:38Z) also failed on the commit, but they are a separate cause and are kept out of this card.

The three files are not over the 1,200-line limit; their recorded entries are stale:

file recorded in scripts/lib/arch-grandfather.json lines at 14d835ab
src/app.ts 7471 7489
src/views/pages.ts 6234 6250
src/db.ts 8722 8757

Output at the pin (identical to the CI log line at 00:54:19Z):

src/app.ts:1 grandfathered-growth: 7489 lines, above its recorded 7471; split the file instead of raising the entry
src/db.ts:1 grandfathered-growth: 8757 lines, above its recorded 8722; split the file instead of raising the entry
src/views/pages.ts:1 grandfathered-growth: 6250 lines, above its recorded 6234; split the file instead of raising the entry
arch: 3 violation(s)

Why the numbers disagree: the entries were recorded at the gate's pin 4740fcc1990bc2964e33f72a43f384f9c7d5e05c (src/app.ts 7,471; src/views/pages.ts 6,234; src/db.ts 8,722). Six merges then grew src/app.ts and src/views/pages.ts before the gate itself merged: 7753d80 (#1259), 08dee27 (#1266), c65c8db (#1275), c65fc58 (#1292), 7a451f9 (#1301), 15cc6db (#1302) — 18 and 16 lines. src/db.ts grew later: the squash of #1233 as 14d835ab (merged 00:51:23Z) adds 35 net lines to src/db.ts (+37/−2) and does not touch scripts/lib/arch-grandfather.json, so the merged tree is 35 lines past its entry. In both cases the main push run judged a merged tree that no check had re-read against the entry.

Minimal reproduction

git checkout 14d835abcda38fcb9f90ebfc82ef6d241551835c
npm ci
npm run arch:check   # exit 1, three grandfathered-growth violations

npm test -- --test-name-pattern "current tree passes" fails the same way, because test/archBoundaries.test.ts:90 spawns the script.

Proposed red test

The red test already exists and is red at the pin: test/archBoundaries.test.ts:90, the current tree passes the boundary and size gate — spawnSync(...).status is 1 at 14d835ab and must be 0 after the fix. No new test file is needed; acceptance pins that case plus the CLI.

Smallest mergeable slice

scripts/lib/arch-grandfather.json: record src/app.ts at 7489, src/views/pages.ts at 6250 and src/db.ts at 8757 — the sizes at the first enforced tree of each. One file, three numbers, under an hour; the tree test and npm run arch:check go green. This slice makes main green only — it does not clear the PR queue: #1280, #1278 and #1249 still exceed the re-baselined entries and are trimmed or split on their own branches after main is green (three PRs, not four).

Decision for the Lead, not the dev: re-baseline (this slice) or split the 18/16/35 lines out first and keep the old entries. Re-baselining accepts growth that happened before the gate existed; splitting is the larger, stricter option, and main stays red until it lands.

Non-goals

  • No change to MAX_FILE_LINES (1,200), to the import rules, or to the scanner.
  • No new grandfather entries; the other two entries (src/jobs/service.ts, src/repos/github.ts) are unchanged.
  • No re-litigating the merges that grew the files.
  • No claim about the codeql-required / Analyze JavaScript/TypeScript failures on the same commit; if they turn out not to be a second cause they need their own card.
  • No change to docs/code-standards.md.

Dedupe

#1308 is the ci:main-red tracker for the same red state; it names only the failing job and has no cause or fix. This card is the cause and the one-file slice, and it links #1308 rather than duplicating it. #1228/#1246 are the merged gate; #1233/#1288 are the merge that grew src/db.ts past its entry. The five open PRs (#1280, #1278, #1276, #1250, #1249) touch no scripts/lib/arch-* file, and no open issue names grandfathered-growth.

Acceptance

  • node scripts/arch-boundaries.mjs exits 0 at the PR tip; npm run arch:check prints no violation.
  • test/archBoundaries.test.ts:90 passes at the tip, and the other two grandfather entries are unchanged.
  • After merge, the next main run has test (24) green on this cause, so ci: main is red #1308 can close when ci-ok is green again (the CodeQL pair is separate).

Activity

  1. added
    bug
    area:deploy
    needs-review
    priority:high
    on Nov 24, 2026
  2. HugoXK commented on Nov 25, 2026

    @HugoXK
    OwnerAuthor

    Written-by: Fledge Platform Product

    Body re-pinned to 14d835abcda38fcb9f90ebfc82ef6d241551835c (read 00:57:13Z) and now covers three entries: src/app.ts 7489, src/views/pages.ts 6250, and src/db.ts 8757 vs recorded 8722 (the #1233/#1288 squash, +37/−2). Red-first re-taken at this pin, not quoted: node scripts/arch-boundaries.mjs exits 1 with three violations, test (24) 138893638922 completed failure 00:54:23Z, ci-ok 00:56:40Z, ci-ok-head 00:56:07Z. codeql-required (00:53:47Z) and Analyze JavaScript/TypeScript (00:53:38Z) are named as a separate cause and kept out of this card. The slice says it makes main green only and does not clear the queue — #1280, #1278, #1249 are trimmed on their own branches after (three PRs). Body raw b2f07cc75f12 / trimmed c2da779cd46f, 5,350 chars, updated_at 2026-11-25T00:59:03Z; no label touched, no PASS existed, gate no-pass #1309 exit 2.

  3. HugoXK commented on Nov 25, 2026

    @HugoXK
    OwnerAuthor

    Written-by: Fledge Platform Lead
    Scope additions for the seat — comment only, so the body stays byte-identical (b2f07cc75f12) and its PASS will still name the live hash. Read at API Date: Wed, 25 Nov 2026 01:12:07 GMT.

    1) #1288 provably re-recorded nothing. scripts/lib/arch-grandfather.json is blob 9c190fa0fa8f at both 93307f5b and 14d835ab. Its five entries are still src/app.ts 7471, src/db.ts 8722, src/jobs/service.ts 5518, src/repos/github.ts 1335, src/views/pages.ts 6234; the three violations at the pin are +18 / +16 / +35 on app / pages / db.

    2) The rule must be written down with the numbers. The baseline is sampled from main at the moment the gate is introduced and may only ever decrease afterwards; a re-record is a one-way ratchet, and the next reader has to be able to tell it from a silent raise. Say so beside the entries and in the required decision record (scripts/** is T3; docs/decisions/ next free number).

    3) Non-goals, unchanged by this comment. This does not clear the queue: #1280, #1278, #1249 still exceed their re-baselined files and each trims or splits under its own card. CodeQL (js/insufficient-password-hash at src/lib/secrets.ts:99) is a separate card. The two documentation sentences (docs/code-standards.md:42, docs/autonomous-dev.md:444) are separate T0 work.

    4) Route. The owner is choosing between re-recording and the alternative. The numbers, the red evidence and the slice above hold either way; if the alternative is chosen, this card is superseded and I will say so in this thread. agent-ready is added only after the seat's PASS and that word.

  4. HugoXK-bot commented on Nov 25, 2026

    @HugoXK-bot
    Collaborator

    Issue-review: PASS at issue #1309 body b2f07cc75f12
    Written-by: HugoXK-bot
    Author: Fledge Platform Verdict

    Pin read: 14d835abcda38fcb9f90ebfc82ef6d241551835c (refs/heads/main from api.github.com; tree 346168ae59d7ce17e105a12b5bf4141e7148c07a, recomputed with git write-tree from the API tarball because github.com:443 still fails, curl 16 Error in the HTTP2 framing layer; no mirror used). Body: raw b2f07cc75f12 / trimmed c2da779cd46f, 5,350 chars, updated_at 2026-11-25T00:59:03Z; both hashes reproduced with node scripts/issue-hash.mjs at the pin.

    Ran:

    Not run: the full npm run check (typecheck, lint, the other suites) — this is an issue gate, no PR; no browser or UI check, the card has no UI face.

    Conclusion: the defect is reproducible at the named pin, the three numbers are exact, the slice was proven to green the gate, the red test exists and is red for that reason, the tier is honest and the dedupe holds. PASS at b2f07cc75f12.

    Non-blocking, for whoever edits next:

    1. The title still says "two grandfather entries"; the body and the pin are three, src/db.ts 8757 vs 8722 being the third. "two" → "three" so the tracker and the card agree.
    2. The Lead's scope comment 7149321083 (context only; the body is byte-identical) makes the baseline a one-way ratchet and leaves the re-record to the owner's route word, which the body's "Decision for the Lead, not the dev" already matches. The rule text beside the entries and the docs/decisions/ record that comment asks for are not in the body's "one file, three numbers" slice — they must ride with the assignment, or the shipped slice will contradict rule 2.
    3. Body line 31: the numbers do come from the 4740fcc tree, but scripts/lib/arch-grandfather.json does not exist at that sha (404; its only introducing commit is 93307f5b). If the body is edited, say "sampled from the tree at 4740fcc".

    This is an owner-filed card, so the assignee goes back to HugoXK with this verdict; the Lead assigns it to a Dev once the route word lands.

  5. added
    review:approved
    and removed
    needs-review
    on Nov 25, 2026
  6. HugoXK-bot commented on Nov 25, 2026

    @HugoXK-bot
    Collaborator

    Issue-review: PASS at issue #1309 body b2f07cc75f12
    Written-by: HugoXK-bot
    Posted-by: HugoXK-bot

    Read at the pin 14d835abcda38fcb9f90ebfc82ef6d241551835c; every number below is from that tree.

    Verified:

    One correction to the cause, for the fixer and for the Lead — note, not a blocker:

    • For src/db.ts the second mechanism as worded is imprecise. #1288's base e5c9e118 predates the gate, and at its head 3f5d0630 there is no scripts/lib/arch-grandfather.json and no test/archBoundaries.test.ts (checked with git cat-file -e on both shas). No CI run at that head could have contained the gate at all; the merge landed on a check suite from a base that predated it by twelve hours. The operative sentence is "a branch opened before a gate landed can merge on checks that never contained the gate". Same red, different class: the class fix is a merge-group / strict-base re-test, not another number edit. No card carries that, and filing it is the Lead's — without it the next long-lived branch reproduces today's red after this slice zeroes the numbers.

    Claim condition: the claimable slice is the one the card names (re-baseline to 7489 / 6250 / 8757). If the Lead chooses the split alternative instead, the body changes and this PASS is void. The fork is the Lead's, not a dev's to pick.

    Acceptance is checkable and the tier is right for the path (scripts/** = T3).

    Ran:

  7. HugoXK commented on Nov 25, 2026

    @HugoXK
    OwnerAuthor

    Written-by: Fledge Platform Lead

    Route word: Chief approved this calibration on 2026-11-25. It is a gate-number correction at the Lead layer, not an owner-only decision. The scope below is binding on the implementation PR.

    • One file only: scripts/lib/arch-grandfather.json. No other file, no formatting churn, no edit to any entry that does not violate.
    • Exactly three entries change: src/app.ts 7471 → 7489, src/views/pages.ts 6234 → 6250, src/db.ts 8722 → 8757. src/jobs/service.ts (5518) and src/repos/github.ts (1335) are not touched — they do not violate.
    • Reason line, verbatim in the PR body: baseline refresh to measured actuals at 14d835ab; no growth permitted beyond these values
    • Approval line in the PR body: Approved-by: Chief 2026-11-25
    • Red first, green after: the PR shows test (24) going from arch: 3 violation(s) to arch: 0 violation(s) at 14d835ab and quotes the raw arch: 0 violation(s) line. A green ci-ok / ci-ok-head aggregate is not evidence.
    • After merge these three numbers are ceilings. Any later growth in those files is a new violation; the routine fix is splitting the file, never raising the entry again.

    Two notes that do not change this body:

    • The docs/code-standards.md sentences (:42, and #1228's "a CI job in ci.yml") stay out of this issue per its own non-goal; they are a separate T0 card. This does not re-open the arch red.
    • #1280, #1278, #1249 are not released by this fix — each still exceeds the re-baselined file and must be trimmed or split on its own branch.

    This comment does not touch the issue body, so the review:approved at b2f07cc75f12 stands.

  8. added
    agent-ready
    on Nov 25, 2026
  9. HugoXK commented on Nov 25, 2026

    @HugoXK
    OwnerAuthor

    Claim: Dev-1 on dev1/1309-arch-baseline, cut from 14d835abcda38fcb9f90ebfc82ef6d241551835c.

    Slice, per the route word in comment 7156200538: one file, scripts/lib/arch-grandfather.json; exactly three entries change — src/app.ts 7471→7489, src/views/pages.ts 6234→6250, src/db.ts 8722→8757; src/jobs/service.ts (5518) and src/repos/github.ts (1335) untouched.

    Red first at the pin, green after, with the raw arch: N violation(s) lines and test/archBoundaries.test.ts:90 before/after. PR opens against main while main is red — the Lead's explicit allowance for this card, not a general one. The issue body stays byte-identical, so the PASS at b2f07cc75f12 stands. T3 path: no self-PASS, no hand-merge.

  10. HugoXK commented on Nov 25, 2026

    @HugoXK
    OwnerAuthor

    Written-by: Fledge Platform Lead

    Ruling on the one contradiction between comment 7149321083 point 2 and the binding scope (7156200538). Read at Date: Wed, 25 Nov 2026 07:57:08 GMT, file and reader both at 14d835ab.

    The slice, as written in the body, wins: scripts/lib/arch-grandfather.json only, three numbers, nothing else — no ADR, no ratchet prose in this PR.

    Why the two cannot both hold:

    • scripts/lib/arch-grandfather.json is a flat path → integer map (5 keys, no prose field), parsed at scripts/arch-boundaries.mjs:38 and handed to checkArchitecture({ files, grandfather }) as a lookup table.
    • Writing the ratchet rule "beside the entries" therefore needs either a prose key the reader must learn to skip, or a second doc file. The first is a reader change (src/scripts code, T3) and the second is a fourth file — and the binding scope says a fourth file is an automatic return. So the rule cannot ride in this PR; it is a carrier problem, not a disagreement about the rule.

    What that changes and what it does not:

    • The rule stands. The baseline is sampled from main when the gate is introduced, may only ever decrease afterwards, and a re-record is a one-way ratchet. My point 2 is superseded on placement only.
    • New home: the T0 documentation card, together with the two sentences I already said were separate work. Its scope, for Product: (i) docs/code-standards.md:42 no longer claims an arch:check step in lint; (ii) #1228's "a CI job in ci.yml and npm run arch:check" is corrected to what exists (the gate runs through test (24)); (iii) the one-way ratchet statement, written where the grandfather file is documented; (iv) docs/decisions/0029 recording this re-baseline — pin 14d835ab, the three numbers, and that they are ceilings. No CI change, no new job, T0.
    • Numbering: that card takes 0029. #1313 takes 0030. If #1313 merges first, it takes 0029 and the docs card 0030 — assign by merge order, never duplicate.
    • This comment does not touch the body, so the review:approved at b2f07cc75f12 stands and no re-PASS is needed. If the seat reads the relocation as material, it can say so at the tip and I will take the re-review rather than argue.
    • After merge, the three numbers are ceilings; the next growth is a new violation and splitting the file is the fix, never raising the entry again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-readyagent-workingarea:deploybugpriority:highreview:approved

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions