Skip to content

docs(agents): raise the tech-debt sweep bar and stop its churn - #5191

Merged
tyler-dane merged 2 commits into
mainfrom
claude/kind-dirac-ksh9h9
Nov 9, 2026
Merged

tyler-dane merged 2 commits into
mainfrom
claude/kind-dirac-ksh9h9

Conversation

@tyler-dane

Copy link
Copy Markdown
Contributor

What and why

The scheduled tech-debt sweep merged eight refactors out of 50 merges in the 2026-11-02 to 2026-11-09 window. Five reworked the same date-picker hint cluster: EventFormDateField.tsx and LifeBirthDateField.tsx were each rewritten four times in seven days, by PRs titled "share the helpers", then "fold leftover copies", then "fold the duplication", then "own the key semantics", then "fold leftover hint copies". Each was individually defensible and each passed review. In aggregate they spent review attention, CI time and regression risk on code that was already correct, for no user-visible change. The same window held exactly one finding worth shipping (#5187, a drifted WEEKS_PER_ROW copy that could silently desync the life PDF grid from the percentage printed beside it).

This adds .agents/skills/tech-debt-sweep/ to govern the sweep, and diagnoses three causes rather than just asking future runs to try harder:

  1. A prompt listing many debt categories guarantees a category matches. Replaced with one question: what breaks, or will break, if nobody touches this. Three admissible finding classes, each with required evidence (mechanical knip/lint/type signal; a drifted copy of a shared definition, with the observable divergence named; an expired hack). Taste, collapsing things that change for different reasons, load-bearing mess, and fixes larger than the problem are explicitly inadmissible.
  2. Re-reading a fixed trailing window re-surfaces the files the sweep itself just edited, which look like the densest debt precisely because they are freshest. The gate now excludes prior sweep commits, and a churn guard puts any file a sweep touched in the last 30 days off limits absent a mechanical finding or a real bug.
  3. Nothing recorded a decision to leave code alone, so each run re-litigated settled ground. judged-fine.md is that record, seeded with the seven areas examined and kept on 2026-11-09 (the providerVersion cluster, the date-picker key-util split, date-picker-keyboard-dom.util.ts as load-bearing mess, the life-image typography iteration, and three smaller calls).

No PR is now the stated expected result of a sweep, a sweep is capped at one, and the cheap mechanical detectors run before any diff reading, so a clean sweep costs three commands and a ledger read instead of a pass over a week of diffs.

Scope note: the trigger and its stored prompt live in the owner's Claude app, so this PR cannot and does not change the schedule. The bar reaches every future run through the new AGENTS.md Lookups entry, which is auto-loaded regardless of how that prompt is worded. The routine doc records that the merge cadence suggests roughly daily and that weekly or fortnightly would do, as an owner-side change.

Docs and agent-instruction files only. No product code.

Verify

VERDICT: PASS from bun run verify --strict.

Checks run: type-check, lint, knip. Checks skipped: none. Selected packages: none (docs-only diff).

bun lint passes all rules including agent-constraints, which is the one that governs these files.

PRE-EXISTING: none. FLAKY: none.


Generated by Claude Code

The scheduled sweep merged eight refactors in the 2026-11-02 to 2026-11-09
window, out of 50 merges. Five reworked the same date-picker hint cluster:
EventFormDateField.tsx and LifeBirthDateField.tsx were each rewritten four
times in seven days. Each PR was defensible and each passed review; in
aggregate they spent review attention, CI time, and regression risk on code
that was already correct, for no user-visible change. The same window held
one finding worth shipping (#5187).

Three causes, each addressed:

- A prompt listing many debt categories guarantees a category matches.
  The skill replaces the list with one question: what breaks if nobody
  touches this. Three admissible finding classes, each with required
  evidence; taste, load-bearing mess, and fixes larger than the problem
  are inadmissible.
- Re-reading a fixed trailing window re-surfaces the files the sweep itself
  just edited, which look densest precisely because they are freshest. The
  gate excludes prior sweep commits, and a churn guard puts any file a
  sweep touched in the last 30 days off limits absent a mechanical finding
  or a real bug.
- Nothing recorded a decision to leave code alone, so every run
  re-litigated settled ground. judged-fine.md is that record, seeded with
  the seven areas examined and kept on 2026-11-09.

No PR is now the expected result, a sweep is capped at one, and the cheap
mechanical detectors run before any diff reading so a clean sweep is cheap.
The trigger lives in the owner's Claude app and is not changed here; the bar
reaches each run through the AGENTS.md Lookups entry.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HmwVQGU4sTAu5rbJPLsEbE
@tyler-dane
tyler-dane enabled auto-merge November 9, 2026 13:32
@tyler-dane
tyler-dane added this pull request to the merge queue Nov 9, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 9, 2026
The Lookups entry added in the previous commit took AGENTS.md to exactly
700 words, one over the budget asserted by
agent-os-pack-deletion.test.ts ("loads one instruction file for every
harness"). The merge queue caught it in unit-leg (scripts).

The budget is the point of that test: AGENTS.md is auto-loaded into every
agent session, so it stays short, and detail belongs in the skill it
points at. So this shortens the entry to one terse line rather than
touching the assertion. 696 words, which leaves headroom instead of
scraping under at 699.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HmwVQGU4sTAu5rbJPLsEbE

Copy link
Copy Markdown
Contributor Author

Dequeued on CI_FAILURE. The failure was mine, root-caused and fixed in 614e825.

Check: unit-leg (scripts) in the queue's Unit run (42626534267), one test:

(fail) agent instruction surface > loads one instruction file for every harness
expect(received).toBeLessThan(expected)
Expected: < 700
Received: 700

Cause: agent-os-pack-deletion.test.ts:23 budgets AGENTS.md at under 700 words. main sits at 689, and the two-line Lookups entry this PR added took it to exactly 700, one word over.

Fix: shortened the entry to one line, - Tech-debt sweep (usually no PR): ..., bringing the file to 696. The budget is the whole point of that assertion, since AGENTS.md is auto-loaded into every agent session and the detail belongs in the skill it points at, so the entry gave way rather than the test. 696 rather than 699 so the next person to add a lookup has room.

Reproduced locally before and after:

  • before: bun test packages/scripts/src/testing/agent-os-pack-deletion.test.ts reproduced Received: 700
  • after: that file 2 pass / 0 fail; bun test:scripts:fast 274 pass / 0 fail; bun run verify --strict VERDICT: PASS

Note for anyone reading the earlier green tick: unit-leg (scripts) passed on the PR head run but failed in the queue on identical content, and the two ran different test counts (274 vs 297 across 45 vs 53 files). So the PR-head leg does not appear to cover this file while the queue leg does. Not something this PR changes, but it means a word-budget regression here is only caught at the queue, which is late. Flagging rather than widening this PR to chase it.


Generated by Claude Code

@tyler-dane
tyler-dane enabled auto-merge November 9, 2026 13:41
@tyler-dane
tyler-dane added this pull request to the merge queue Nov 9, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Dequeued a second time, on a different check. This one is not this PR's, evidence below. Re-queuing once.

Check: e2e-shard (1, e2e/accessibility e2e/allday) in queue run 42627886515.

✘ e2e/accessibility/ui-focus-u-i.spec.ts:8:5 › u returns focus from the month picker to the grid
   expect(locator).toBeVisible() failed   locator: .react-datepicker__day:focus
   Timeout: 10000ms   Error: element(s) not found
1 failed, 79 passed (5.2m)

The month-picker day never takes focus after i, so the first assertion fails.

Why it is not this PR's:

  • This PR changes six Markdown files and no application code at all: AGENTS.md, docs/README.md, docs/CI-CD/tech-debt-sweep-routine.md, and three files under .agents/skills/. There is no mechanism by which they affect runtime focus behavior.
  • The same shard passed on main at this PR's exact base f86ef768 (42622039847, e2e-shard (1, ...) success), so the spec is green on the base.
  • main is still at f86ef768 and nothing else merged in the window, so this was not a grouped batch: no other PR's code was in the queue branch.
  • e2e passed on this PR's head.

On the three failures within the job: the initial run plus both retries failed, but all three ran inside the same job on the same runner, so that shows the condition persisted for the duration of that job, not that the spec is deterministic across runs. It passed on the same base 40 minutes earlier.

No fix exists to port. I looked for a regression to attribute it to and did not find one I can stand behind. #5190 did touch this area (it added a shouldFocus guard to focusKeyboardSelectedDay and made date-picker effect dependencies more precise), which was my first hypothesis, but focusKeyboardSelectedDay is called only from LifeBirthDateField.tsx and EventFormDateField.tsx, not from the grid month picker this spec drives, so that guard is not on this path. I am not going to widen a docs PR with a speculative fix to a focus race I have not reproduced.

Worth a separate look regardless of this PR: this spec asserts a focus handoff with no settling wait between press("i") and toBeVisible() on a :focus pseudo-selector, which is the shape of a spec that fails under a slow runner. If it recurs, it likely wants an explicit wait rather than a retry budget.


Generated by Claude Code

@tyler-dane
tyler-dane added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit 1b62813 Nov 9, 2026
28 checks passed
@tyler-dane
tyler-dane deleted the claude/kind-dirac-ksh9h9 branch November 9, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants