Skip to content

feat(TP-193): code-quality formatter adoption — biome format --write applied across codebase#572

Merged
HenryLach merged 11 commits into
mainfrom
feat/tp-193-cq-format-adoption
May 10, 2026
Merged

feat(TP-193): code-quality formatter adoption — biome format --write applied across codebase#572
HenryLach merged 11 commits into
mainfrom
feat/tp-193-cq-format-adoption

Conversation

@HenryLach
Copy link
Copy Markdown
Owner

Third of five sequenced packets implementing the code-quality-gates spec. Enables the Biome formatter and applies it once across the entire codebase as a single mechanical pass.

What ships

Three atomic commits per the spec's prescribed structure

  1. chore(TP-193): configure Biome formatter rulesbiome.json formatter block enabled (tabs, 100-char line width, double quotes, trailing commas, semicolons)
  2. chore(TP-193): apply biome format --write to entire codebase — the format pass itself; this is the SHA listed in .git-blame-ignore-revs
  3. chore(TP-193): add format-adoption commit to .git-blame-ignore-revs — preserves git blame archaeology

Pre-format format-resilience hardening (commit 2c803c78)

Before the format pass, the worker added expect().toContainNormalized() helper and updated 22 source-grep test sites so they're robust to formatter-induced wrapping. This was a deliberate prep step so the format-pass diff stays purely mechanical.

Documentation

  • docs/maintainers/development-setup.md updated with the git config blame.ignoreRevsFile .git-blame-ignore-revs setup note for new contributors

Two post-merge folds (sage-recommended pattern)

Fold 1: fix(TP-193): bump slice windows in tests 9.5 and 11.6 (commit 833449c8)

The format pass slightly shifted merge.ts length, pushing one source-grep test's expected match (spawnMergeAgentV2( at offset ~15999) just outside its 16000-char slice window. Bumped 16000 → 24000 in tests 9.5 and 11.6 of engine-runtime-v2-routing.test.ts (preemptively for both, same pattern). Discovered when the merger's post-merge verification failed; fixed on the lane branch and orch_resume re-ran the merge cleanly.

Fold 2: chore(TP-193): add .gitattributes to enforce LF line endings (commit c9ae7f8b)

After the merge, Windows local format:check reported 175 spurious format errors. Root cause: repo's index correctly stored LF, but Windows default core.autocrlf=true converted files to CRLF in the working tree. Biome's lineEnding: "lf" config flagged every file. CI on Linux would have passed (no autocrlf there). Fixed by adding .gitattributes with * text=auto eol=lf — overrides autocrlf at the repo level so all platforms get LF in the working tree.

Validation

Check Before TP-193 After TP-193
npm run format:check exit 0 (formatter disabled) exit 0 (formatter active, all files conformant)
npm run lint 0 errors / 277 warnings / 660 infos 0 errors / 277 warnings / 668 infos (+8 from formatter activation)
npm run typecheck 267 errors 264 errors (3 incidentally fixed by format normalization)
Tests 3624 passing 3624 passing (unchanged)
File diff 166 files changed, +26810 / −16763 (mechanical only)
.git-blame-ignore-revs listed format-pass SHA

What this does NOT do (per spec scope boundaries)

  • ❌ Doesn't address the 264 typecheck errors (TP-195's job)
  • ❌ Doesn't address the 277 warnings + 668 infos (advisory; future polish if desired)
  • ❌ Doesn't remove continue-on-error: true from CI (TP-194's job)
  • ❌ Doesn't activate the reviewer downgrade rule (TP-194's job)

Closes

(none — third of five-packet sequence; TP-194 will close the gate-flip work after TP-195 lands)

HenryLach added 11 commits May 10, 2026 13:04
…S.md

TP-193's Step 0 has a CRITICAL operator confirmation check:

  > Operator freeze-window confirmation captured in Discoveries
  > (CRITICAL gate)

Without this, the task aborts rather than landing a 50+-file format
diff. Per spec section 6.3.4, the operator must confirm no in-flight
PRs will be tangled.

Operator confirmed (this session, 2026-05-10): TP-192 just merged
(PR #571), no other internal PRs in flight. The two open community
PRs (#520, #516) are external forks — their rebase pain is the
contributors' responsibility, not ours.

Pre-recording this in STATUS.md Discoveries so the worker's Step 0
check finds the confirmation immediately and proceeds without pausing
for operator interaction.
… format pass)

Adds expect().toContainNormalized(needle) helper that whitespace-normalizes
both haystack and needle before substring matching. Source-grep tests that
match literal multi-word substrings of taskplane source files are brittle
against Biome's lineWidth=100 / arrowParentheses=always rules, which wrap
multi-arg calls vertically and add parens around single-param arrows.

Updated 22 distinct assertion sites across these test files to either:
  - Use toContainNormalized() instead of toContain() for source-grep checks,
  - Pre-normalize whitespace before regex .match() / .indexOf(),
  - Bump fixed-size source-slice windows that were tight (e.g. 5000 -> 8000)
    so formatter-induced vertical re-wrapping doesn't push expected strings
    outside the inspected window.

This change is intentionally separate from the format-write commit so the
'.git-blame-ignore-revs' SHA points at a single mechanical commit.
…5 and 11.6 (post-merge fold)

Merger verification of the format-pass merge into the topic branch
caught one source-grep test that the format-resilience prep
(commit 2c803c7) missed: 'engine-runtime-v2-routing.test.ts:307'
test 9.5 'mergeWave routes spawn to V2 when backend is v2'.

The test slices merge.ts source for 16000 chars from the start of
the mergeWave function declaration and counts spawnMergeAgentV2(
occurrences. After the format pass, the merge state shifted the
second call's opening paren to ~offset 15999 \u2014 within the
function body but past the slice window. Test expected >= 2 matches,
got 1, failed verification.

Fix: bump the slice window 16000 \u2192 24000 in both test 9.5 (line
310) and test 11.6 (line 422, same pattern). 24000 leaves
comfortable headroom for future formatter-induced length variance.
Matches the prep commit's pattern: 'bump fixed-size source-slice
windows that were tight'.

No semantic test change \u2014 same assertions, just larger inspection
window. Verified locally:
  - tests/engine-runtime-v2-routing.test.ts: 78/78 pass
  - Full merger filter (non-integration): 3124 pass / 0 fail / 1 skipped

After this commit lands on the lane, orch_resume(force=true) will
re-run the merge with the corrected lane state. Verification should
pass.
…rge fold)

Fixes 175 spurious 'format/use-line-feed' errors that surfaced after
the format pass merged. The repo's index correctly stores LF, but
Windows local checkouts with default 'core.autocrlf=true' converted
files to CRLF in the working tree. Biome's 'lineEnding: "lf"' rule
flagged every file as a format violation on Windows, while CI on
Linux (no autocrlf) would have passed cleanly.

Adding '.gitattributes' with '* text=auto eol=lf' overrides autocrlf
at the repo level — ensures LF in the working tree on all platforms
regardless of per-developer git config. Standard cross-platform
pattern for repos that pin to a specific line-ending style.

Also explicit binary-file declarations (.png, .jpg, etc.) and
explicit text declarations for our common source extensions, both
defensive.

After this commit + a working-tree refresh ('git rm --cached -r . &&
git reset --hard'), 'npm run format:check' exits 0 cleanly on
Windows. CI behavior on Linux is unchanged (was already LF there).
@HenryLach HenryLach merged commit 19954ae into main May 10, 2026
1 check passed
@HenryLach HenryLach deleted the feat/tp-193-cq-format-adoption branch May 10, 2026 17:53
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.

1 participant