Repository navigation
TDD 0068: format-and-lint honors the repo's configuration (fixes #180) - #189
Merged
cahenesy merged 8 commits intoOct 6, 2026
Merged
Conversation
Stub-tool eval of hooks/format-and-lint.sh (TDD 0068 observations 1-12), registered in tests/implement-gate.test.sh. Red against the current hook. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Ki3TDnP2bNqqpEkFoZaEXq
Fixes #180. Config is discovered from the edited file's directory up to its git toplevel, never $PWD. Lint runs only when configured and is report-only (no --fix; diagnostics on stderr, exit 2). Formatting is opt-in for Python ([tool.ruff.format] / [format]) and JS/TS (Prettier config + local bin); Rust/Go format only a git file whose HEAD copy is formatter-clean or new, Rust via stdin so child modules are untouched. golangci-lint needs a .golangci.* config; debounce is keyed by project root. Bootstrap writes the format opt-in on every formatter-writing path; README gains the hook paragraph and the 3.50.0 Python upgrade note. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Ki3TDnP2bNqqpEkFoZaEXq
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Ki3TDnP2bNqqpEkFoZaEXq
Review pass 1 findings 1-3: hostile debounce marker content (arithmetic subscript injection) and symlinked markers, JS/TS tools outside any git work tree, and a failing clippy run masked by the debounce marker. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Ki3TDnP2bNqqpEkFoZaEXq
…review)
- Debounce markers move to a per-user 0700 dir
(${XDG_RUNTIME_DIR:-${TMPDIR:-/tmp}}/throughline-lint-<uid>); a dir that is
a symlink or not ours, or a symlinked marker, is never read or written (the
linter runs). Marker content is used only when all digits, so `x[$(cmd)]`
can no longer execute via bash arithmetic.
- A failing clippy/golangci-lint run removes its marker, so the next edit
re-runs and re-reports instead of passing silently for the window.
- JS/TS: a file outside any git work tree runs no prettier/eslint, so a
planted ancestor config + node_modules/.bin can't execute.
- rustfmt temp file is removed by an EXIT trap; README states clippy runs for
any Cargo project and the debounce behaviour.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Ki3TDnP2bNqqpEkFoZaEXq
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Ki3TDnP2bNqqpEkFoZaEXq
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NpGG21Y2VGGhTQaFr4oshB
Outside a git work tree the Cargo.toml / go.mod walk has no repo toplevel to stop at and can reach a shared ancestor such as /tmp, where another user can plant a crate (build.rs, proc macros) or a golangci config that loads plugins. The rs and go branches now exit early outside git, matching the JS branch. Formatting was already skipped there. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NpGG21Y2VGGhTQaFr4oshB
cahenesy
deleted the
build/20261006-131111/0068-format-and-lint-honors-config
branch
October 6, 2026 20:08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements TDD 0068 (PRD FR-21, issue #180). It supersedes only the hook component of TDD 0001.
Fixes #180.
What changed
hooks/format-and-lint.sh:$PWD.ruff.toml>.ruff.toml>pyproject.toml([tool.ruff…]).[tool.ruff.format]/[format].ruff check --no-fix --output-format concise. Diagnostics go to stderr, with exit 2.package.jsonkey; adevDependenciesentry does not count.node_modules/.bin(nonpx --versionprobes). eslint runs without--fix..golangci.*config exists at or above the module root.0700directory. Their content must be digits only, and symlinks are never followed.Also:
/bootstrap-projectwrites the formatter opt-in on every path that creates a formatter config.README.mdhas a hook section and an upgrade note: Python repos bootstrapped before 3.50.0 must add[tool.ruff.format]to keep auto-formatting.Security (pre-existing, fixed here)
Review found three issues; all are fixed in
102b45aand test-covered in [S]:/tmpwas evaluated in bash arithmetic, so a plantednow[$(cmd)]rancmdas the developer. It is fixed and test-covered./tmp/.prettierrc+node_modules/.bin.Post-review fix (
aa44ab3, test46710e3): a follow-up security scan found a problem this PR introduced. Config discovery now walks up from the edited file, so for a.rs/.gofile outside git the walk could reach a shared ancestor such as a planted/tmp/Cargo.toml(orgo.mod+.golangci.yml). It then rancargo clippy(which executesbuild.rsand proc macros) orgolangci-lintthere. The rs and go branches now exit early outside git, like the JS branch. New cases S/(g) cover this. format-and-lint is now 62/0, and ci-checks PASS.Gates
986ac38red 41 fail →323556d; securityae393dcred 5 fail →102b45a)lib.rsformatting leavesfoo.rsbyte-identical5a48e5c, then a focused security re-review of the fix pass with planted payloadsFollow-ups (nits, not blocking)
08) is read as octal and errors, silently skipping the linter until the marker is removed. It can't be planted: the directory is0700and the hook only writesdate +%s. Fix with10#$last.Version 3.49.0 → 3.50.0, plus a
releases.jsonentry.🤖 Generated with Claude Code
https://claude.ai/code/session_01Ki3TDnP2bNqqpEkFoZaEXq