Repository navigation
feat(lefthook): run each hygiene hook once and document each lint config's layering - #1132
Conversation
…fig's layering The standards lefthook remote keeps only Gitleaks and EditorConfig-checker. Typos, markdownlint-cli2 and ShellCheck move to the claude-code-plugins aggregate remote, which every repository lists and which reads these configs for a repository that names standards_repository (melodic-software/claude-code-plugins#18972), so listing both remotes runs each tool once per commit. The two remaining wrappers use the repository's own root config when it has one (both tools read one file) and the standards config otherwise, as the ci-workflows composites do. Each lint component README gains a "Defaults, extensions and overrides" section: where the default lives, how a repository extends, partly or completely overrides it, and which readers apply it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
claude-security-review reviewed Security review: PR #1132I read every hunk of all 12 listed files in What I checked
critical-findings: 0 |
| # Typos, markdownlint-cli2, ShellCheck and actionlint run from the | ||
| # claude-code-plugins remote, which reads these same standards configs for a | ||
| # repository whose source-control config names standards_repository, so each | ||
| # tool runs once per commit. |
There was a problem hiding this comment.
Fail a change that loosens a check (check removed) — blocking
This PR removes three jobs from the remote (old lines 20-24 and 35-40), along with their scripts and components/lefthook-shellcheck/lefthook-remote.yml:
standards-typosstandards-markdownlintstandards-shellcheck
It also deletes the tests for those jobs in lefthook-remote.test.sh:
- Case 4 (missing markdownlint-cli2)
- the typos missing-tool case
- Case 6 (real typos and ShellCheck against fixtures only the standards config rejects)
Before: a consumer listing this remote got Typos, markdownlint-cli2 and ShellCheck on every commit, each with the standards config.
After: this remote runs none of them. They run only if the claude-code-plugins remote is listed, the repository names standards_repository, and melodic-software/claude-code-plugins#18972 has merged. The PR body says #18972 has not merged yet.
Missing reason: no closing issue (spec) names these removals, and the PR body has no ## Loosened checks section. Under the criterion, the reasoning in the Summary and Fix sections does not count.
Fix: either restore the jobs, or add a ## Loosened checks section to the PR body that names each removed job and its tests and says why. For example: the claude-code-plugins remote runs the same tool with this config, and no consumer lists this remote yet.
claude-lane: claude-review
| # gitleaks reads one config: the repository's own .gitleaks.toml replaces this one whole. | ||
| if [ -f .gitleaks.toml ]; then | ||
| exec gitleaks git --pre-commit --staged --no-banner --config .gitleaks.toml | ||
| fi |
There was a problem hiding this comment.
Fail a change that loosens a check (a secret scanner's own code accepts more, kind 9) — blocking
Before: the hook always ran Gitleaks with the standards .gitleaks.toml, which the README calls its rule set and no repository could replace.
After: any repository-local .gitleaks.toml replaces it whole. A consumer file with broad allowlists, or with fewer rules, lets secrets through that the standards config would block. The fail_text change in lefthook-remote.yml also stops pointing at .gitleaks.toml as the place to allowlist.
Missing reason: Gitleaks is a secret scanner, and only the spec (a closing issue's text) can allow loosening one; a PR-body ## Loosened checks section cannot. This PR has no closing issue. "Matches the ci-workflows composites" is in the Fix section, which does not count.
Fix: either keep the standards config forced in the hook, or link an issue whose text names this change to the Gitleaks hook and says why.
Same class as the standards-editorconfig.sh change, which can be cleared differently because EditorConfig-checker is an ordinary check.
claude-lane: claude-review
| # editorconfig-checker reads one config: the repository's own replaces this one whole. | ||
| if [ -f .editorconfig-checker.json ]; then | ||
| exec editorconfig-checker -config .editorconfig-checker.json "$@" | ||
| fi |
There was a problem hiding this comment.
Fail a change that loosens a check (a check's own code accepts more, kind 9) — blocking
Before: the hook always passed -config with the standards .editorconfig-checker.json.
After: a repository-local .editorconfig-checker.json replaces it whole. That file can exclude paths or disable checks the standards config enforces, so the hook accepts files it used to reject.
Missing reason: no closing issue names this, and the PR body has no ## Loosened checks section. The Fix section's reasoning (matching the ci-workflows composites) does not count under the criterion.
Fix: EditorConfig-checker is an ordinary check, so either undo the switch, or add a ## Loosened checks section that names this hook change and says why, for example that it matches what the CI composite already accepts.
Same class as the standards-gitleaks.sh change.
claude-lane: claude-review
|
claude-review reviewed Code review: PR #1132The PR narrows the standards lefthook remote to Gitleaks and EditorConfig-checker. It removes the Typos, markdownlint-cli2 and ShellCheck jobs and their scripts, which the claude-code-plugins remote now runs. The two remaining wrappers now use a repository's own root config when it has one, and six component READMEs gain a "Defaults, extensions and overrides" table. The code is correct as far as I traced it:
I did not run the test suite or the mutation check. The PR description reports both, but I have not confirmed them. Blocking findings (all under "Fail a change that loosens a check")There is no closing issue, so there is no spec, and the PR body has no
Loosened checks would be marked: fail (default: the prompt carried no Other notes
No verifier subagents were dispatched; I checked all three candidates against the criterion text myself. |
…ted word (#1133) Follow-up to #1132 (its last commit was pushed after the merge). Owner decision Q295 (Z2 layering rule): [owner-decisions.md L423](https://github.com/melodic-software/architecture/blob/f32d7178d132bf8a5402add0985e0ee557ec37ef/docs/owner-decisions.md#L423), owner verbatim: "OK go w/ recommendations". ## Summary The typos mode table says a key this file sets keeps its value. That holds within `extend-words`, but typos also has a native route for a repository to accept a word this file corrects: an `[default.extend-identifiers]` entry mapping the word to itself is matched before word corrections. ## Fix `components/typos/README.md`, Partial override row: names the `extend-identifiers` route. ## Verification typos 1.52.2, this repository's `_typos.toml` passed with `-c`, a file with one British spelling this file corrects: - repository `_typos.toml` with the word under `[default.extend-identifiers]` mapped to itself: exit 0. - control, no repository config: exit 2, the correction reported. - the same word under `[default.extend-words]` in the repository file: exit 2 (this file's value wins), as the row already said. ci-workflows#1219 (merged) made the CI composite pass this file as the base, so this is the route a repository such as songwriting has if it wants to keep a word standards corrects. ## Related - #1132, melodic-software/ci-workflows#1219, melodic-software/claude-code-plugins#18972. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
…ents (#1136) No related issue: owner decisions Q295 (Z2) and Q298 (L3) (melodic-software/architecture `docs/owner-decisions.md` L423 and L426) authorize this retirement directly. ## Summary Stops syncing eight components whose readers already read this repository's root configs at run time: - the lefthook fragments `lefthook-base` (`.lefthook/base.yml`) and `lefthook-shellcheck` (`.lefthook/shellcheck.yml`); - the lint configs `typos` (`_typos.toml`), `markdownlint` (`.markdownlint-cli2.jsonc`), `gitleaks` (`.gitleaks.toml`), `editorconfig-checker` (`.editorconfig-checker.json`), `actionlint` (`.github/actionlint.yaml`) and `shellcheck` (`.shellcheckrc`). This is the manifest step of the retirement procedure (`distribution/README.md` Lifecycle "Retire" row, `docs/component-lifecycle.md` "Retirement"). Readers moved first. Deselection never deletes, so nothing changes in a target until its own deletion pull request removes its copies. Readiness checks, run on each target's `origin/HEAD` before writing: - No target's root `lefthook.yml` extends `.lefthook/base.yml` or `.lefthook/shellcheck.yml`. The remaining `extends` entries name `.lefthook/python.yml`, `.lefthook/powershell.yml`, `.lefthook/dotnet.yml` or repository-owned files. claude-code-proxy, dotfiles, github-iac and provisioning list the standards remote and set `min_version`, `assert_lefthook_installed` and `glob_matcher: doublestar` themselves. - 18 of 19 targets set `standards_repository: melodic-software/standards` in `docs/conventions/source-control.yaml`. songwriting does not. This PR changes nothing for songwriting: it manages none of these components (only `dependabot-automerge-fleet-caller`, `dependabot-policy` and `managed-files-guard-fleet-caller`). Its `_typos.toml`, `.markdownlint-cli2.jsonc`, `.gitleaks.toml`, `.shellcheckrc` and `.github/actionlint.yaml` are its own files, which no sync wrote. Until it sets the key, the claude-code-plugins adapters use its own files where it has them and their bundled defaults where it does not. - Every `managed` copy in a target is byte-identical to the current source, so every reader sees the same rules after the copy is deleted. The `locally-owned` copies (actionlint in ci-runner, github-iac and medley; shellcheck in dotfiles; all six lint configs in medley) are each repository's own whole-file override and stay. ## Fix - `distribution/sync-manifest.yml`: - removes the eight component entries; - removes the `requires` edges that pointed at them: lefthook-base's six (`editorconfig-checker`, `gitleaks`, `markdownlint`, `node-runtime`, `repository-text`, `typos`), editorconfig-checker's `repository-text`, lefthook-shellcheck's `lefthook-base` and `shellcheck`, and the `lefthook-base` edge on `lefthook-dotnet`, `lefthook-powershell` and `lefthook-python`; - removes every target's `managed` and `locally-owned` entry for the eight, and the comments that described them (the actionlint exclusion block, medley's per-file divergence notes, ci-workflows' actionlint parity note, architecture's typos note, claude-code-proxy's lefthook-base closure). The managed-files guard resolves destinations at run time, so it has no static path list to prune. `node-runtime` and `repository-text` stay: every target that needed them through these edges still lists them under `managed`. - Kept, with reason: - Root `_typos.toml`, `.markdownlint-cli2.jsonc`, `.gitleaks.toml`, `.editorconfig-checker.json`, `.github/actionlint.yaml` and `.shellcheckrc`. They are this repository's own configs, and the ci-workflows composites (`download-standards`), the claude-code-plugins adapters (`rt_standards_file`) and `components/lefthook-base/lefthook-remote.yml` read them from here. - `components/<tool>/` for each lint config: READMEs, contract tests and fixtures. These prove the policy and hold no sync wiring. - `components/lefthook-base/lefthook-remote.yml` and `.lefthook/pre-commit/standards-*.sh`: the standards remote. - `components/lefthook-base/lefthook.yml` and `components/lefthook-shellcheck/lefthook.yml`. This repository's own root `lefthook.yml` extends both. `lefthook-merge-skip.test.sh`, `lefthook-shellcheck.test.sh` and `dotnet-format-staged.test.mjs` exercise them. Their READMEs now say the manifest no longer distributes them. - READMEs: - The six lint-config READMEs say each config is read at run time, not synced. The "Managed consumers do not edit" escape-hatch text in gitleaks and editorconfig-checker now points at the complete-override row. - markdownlint's component table names only `markdownlint-home` as a manifest component. - The lefthook-base and lefthook-shellcheck READMEs are updated as above. - The dotnet, powershell, python and typescript adapter READMEs now say the consumer root sets the strict settings itself, where they said "compose with `lefthook-base`". - The root `README.md` names run-time reads beside native references and sync PRs. - `standards/review/overlays/bash.md` no longer says the shellcheck component "ships" `.shellcheckrc`. - The first header line of `components/lefthook-{dotnet,powershell,python,typescript}/lefthook.yml` drops "alongside the base". Dotnet, powershell and python are synced, so github-iac, claude-code-account-rotation, claude-code-proxy, dotfiles and provisioning each get a small sync PR (that header line plus the `glob_matcher` line below). Without this, the synced header would keep naming `.lefthook/base.yml` after the deletion PRs remove it. - `components/lefthook-{dotnet,powershell,python,typescript}/lefthook.yml` each set `glob_matcher: doublestar` themselves. Their `**/*.ext` globs miss root-level files under Lefthook's default matcher, and these fragments used to rely on lefthook-base for the setting. Lefthook merges an extended file's top-level setting into the consumer config, so no consumer has to remember it. All current consumers (claude-code-proxy, dotfiles, github-iac, provisioning) already set it in their root files, so nothing changes for them. - New `components/lefthook-base/lefthook-adapter-globs.test.sh`, run in CI's lefthook job, extends each adapter alone from a root that sets no matcher and checks that a staged root-level file reaches the lane. - `distribution/sync-manifest.test.sh`: - the lefthook-python direct-dependency assertion now expects `ruff` (it expected `lefthook-base,ruff`); - the retired-component loop gains the eight names. ## Verification - `distribution/sync-manifest.sh validate`: `Manifest valid: 39 components, 19 targets` (47 before). - `bash distribution/sync-manifest.test.sh`: exit 0, 334 assertions pass (326 before), including `PASS: [161]`-`[168]` for the eight new retired names. - Each new retired assertion fails if its name returns. The loop's expression `[.components | keys[] | select(. == strenv(COMPONENT))] | length` counts 0 for each of the eight on this branch. On `origin/main`'s manifest, where each still exists, it counts 1, so `assert_eq ... '0'` fails. - `harness/shell/run-tests.sh` on `lefthook-base.test.sh`, `lefthook-remote.test.sh`, `lefthook-merge-skip.test.sh`, `lefthook-shellcheck.test.sh` and `lefthook-typescript.test.sh`: 5 passed. `node --test components/lefthook-dotnet/dotnet-format-staged.test.mjs`: 12 passed. - `lefthook-adapter-globs.test.sh`: 12 assertions pass. Without the fragment matcher it fails for all four adapters: the root-level `setup.py`, `build.ps1`, `eslint.config.mjs` and `Program.cs` never reach their lanes. - markdownlint-cli2: 0 issues across the 14 changed Markdown files. The pre-commit hooks (typos, gitleaks, shellcheck, comment lint, content scan) pass. ## Loosened checks No assertion is removed. One expected value changes: - `Lefthook Python carries its complete direct dependencies` now expects `ruff` instead of `lefthook-base,ruff`. It still checks the exact list. The `lefthook-base` edge goes because the component is retired under Q295 and Q298 (melodic-software/architecture `docs/owner-decisions.md` L423 and L426, owner words "OK go w/ recommendations"). A target extending `.lefthook/python.yml` now sets the strict settings in its own root `lefthook.yml`, as all four current consumers do. ## Related - Owner decisions Q295 (Z2, config layering rule) and Q298 (L3, lefthook lint-config fallback), melodic-software/architecture `docs/owner-decisions.md` L423 and L426, owner words "OK go w/ recommendations". Loosened-check reasons follow D4 (L349). - Readers that moved first: - [melodic-software/claude-code-plugins#18972](melodic-software/claude-code-plugins#18972): the aggregate lefthook remote adapters fall back to these configs when `standards_repository` is set. - [melodic-software/ci-workflows#1219](melodic-software/ci-workflows#1219): the CI composites read these configs. - [#1132](#1132): the standards remote keeps only gitleaks and editorconfig-checker. - github-iac, provisioning, claude-code-proxy and dotfiles moved from `extends: .lefthook/base.yml` to the standards remote. - Same procedure as [#1135](#1135). - Next: one deletion PR per target, removing its synced copies (`.lefthook/base.yml`, `.lefthook/shellcheck.yml`, and the lint configs it managed). songwriting's deletion PR waits until it sets `standards_repository`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
No linked issue: owner decision Q298 (L3) (melodic-software/architecture
`docs/owner-decisions.md` L426) authorizes this directly.
## Summary
In this repository, five hygiene tools ran twice on every commit. The
root `lefthook.yml` extended `components/lefthook-base/lefthook.yml`,
`lefthook-shellcheck`, `lefthook-python` and `lefthook-typescript`, and
it also listed the claude-code-plugins aggregate remote. The duplicate
pairs were:
- `typos` and `spelling-remote-lint`;
- `markdownlint` and `markdown-format-remote-lint`;
- `shellcheck` and `bash-format-remote-lint`;
- `ruff-lint`/`ruff-format` and `python-format-remote-*`;
- `biome` and `javascript-format-remote-*`.
The ccp jobs read the same root configs (`_typos.toml`,
`.markdownlint-cli2.jsonc`, `.shellcheckrc`, `ruff.toml`,
`biome.jsonc`). Q298 asks for each hook to run once. Now every hygiene
tool runs once, from a remote.
## Fix
- `lefthook.yml`:
- drops all four `extends` entries;
- lists this repository's own remote
(`components/lefthook-base/lefthook-remote.yml` at `main`) for
`standards-gitleaks` and `standards-editorconfig`. It is a remote, not
an `extends`, because the remote's scripts act only from the fetched
copy under `info/lefthook-remotes/`. A local `extends` would run them
from `.lefthook/pre-commit/`, where they exit 0 (lefthook-base README,
"Remote form");
- carries the strict settings the base fragment supplied, as that README
prescribes for a remote consumer: `min_version: "2.0.5"`,
`assert_lefthook_installed: true`, `glob_matcher: doublestar` and
`pre-commit.parallel: true`;
- keeps the fixture `exclude` and the `psscriptanalyzer` and
`dotnet-format` source-slice lanes unchanged.
- The component fragments stay. The contract tests still compose them in
temporary consumers: `lefthook-base.test.sh`,
`lefthook-merge-skip.test.sh`, `lefthook-shellcheck.test.sh`,
`lefthook-typescript.test.sh` and `dotnet-format-staged.test.mjs`.
- `docs/conventions/ecosystems/{bash,markdown,python,typescript}.yaml`:
the comments name the claude-code-plugins hook that runs each tool
locally, in place of the dropped lane.
- `pr-require-checks.yml`:
- the `lefthook validate` step is renamed "Validate the root hook
config", because the fragments are no longer merged into the root;
- a new step, "Validate each lefthook component fragment", runs
`components/lefthook-base/lefthook-fragments-validate.test.sh`. That
test extends each `components/lefthook-*/lefthook.yml` alone from a
scratch consumer and runs `lefthook validate`, so the root no longer has
to load the fragments for CI to check them.
## Verification
- `lefthook dump --format json`, after `lefthook install` fetched both
remotes: every pre-commit job and command name appears once. A
`group_by` over the names finds no duplicates.
- `standards-gitleaks` and `standards-editorconfig` appear once each.
- None of `typos`, `markdownlint`, `shellcheck`, `ruff-*`, `biome`,
`gitleaks` or `editorconfig` appears as a local command.
- The settings dump as `min_version 2.0.5`, `assert_lefthook_installed
true`, `glob_matcher doublestar`, `parallel true`.
- This commit's own pre-commit run executed each job once, including
`standards-gitleaks` ("no leaks found") and `standards-editorconfig`.
The hook took 0.60 s.
- `lefthook-fragments-validate.test.sh`: 9 assertions pass. Planting an
unknown key (`commands:` renamed) in the real
`components/lefthook-python/lefthook.yml` fails `[4]`, and restoring the
file makes it pass.
- `lefthook validate`: All good.
- `harness/shell/run-tests.sh` on lefthook-base, lefthook-remote,
lefthook-merge-skip, lefthook-shellcheck and lefthook-typescript: 5
passed. `node --test
components/lefthook-dotnet/dotnet-format-staged.test.mjs`: 12 passed.
Known overlap I left in place: the `psscriptanalyzer` lane and ccp's
`powershell-format-remote-lint` both run PSScriptAnalyzer with
`PSScriptAnalyzerSettings.psd1`. The lane stays as a repo-specific
adapter that dogfoods
`components/lefthook-powershell/psscriptanalyzer-staged.ps1`. Removing
it would make PSScriptAnalyzer run once too.
## Related
- Owner decision Q298 (L3), melodic-software/architecture
`docs/owner-decisions.md` L426, owner words "OK go w/ recommendations".
- [#1132](#1132)
narrowed the standards remote to gitleaks and editorconfig-checker.
[#1136](#1136) stops
syncing the fragments and lint configs. This PR is independent of #1136.
-
[melodic-software/claude-code-plugins#18972](melodic-software/claude-code-plugins#18972):
the ccp adapters read the standards configs.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5.5 <[email protected]>
No linked issue in this repository: owner decisions Q295 (Z2 layering rule) and Q298 (L3), owner-decisions.md L423 and L426. Owner, verbatim: "OK go w/ recommendations".
Summary
Each hygiene hook runs once per commit, and each lint config documents its layering modes.
Before: this repository's lefthook remote ran typos, gitleaks, editorconfig-checker and markdownlint (plus ShellCheck from lefthook-shellcheck's remote), while every repository already runs the melodic-software/claude-code-plugins aggregate remote, whose spelling, markdown-format, bash-format and actionlint jobs cover typos, markdownlint, ShellCheck and actionlint. A repository listing both ran three tools twice. melodic-software/claude-code-plugins#18972 makes those ccp jobs read this repository's configs when the repository's source-control config names
standards_repository, so this remote keeps only the two tools ccp does not run.Fix
components/lefthook-base/lefthook-remote.yml: onlystandards-gitleaksandstandards-editorconfig. Removedstandards-typos.sh,standards-markdownlint.sh,standards-shellcheck.shandcomponents/lefthook-shellcheck/lefthook-remote.yml. No repository lists this remote yet (layering plan: E3 not started), so nothing consumes the removed jobs..gitleaks.toml/.editorconfig-checker.jsonwhen present (both tools read one config file), else the fetched standards config, matching the ci-workflows composites (download-standards/lib.shstandards_config). Before, they always forced the standards config, so local and CI disagreed for a repository with its own file.-cmerges with the discovered config (checked with typos 1.52.2). The gitleaks section records why[extend] pathcannot point at this file portably (it resolves relative to the directory gitleaks runs in, per the gitleaks README).Per-tool modes (merge-capable tools layer; single-file tools: repo file replaces whole):
extend-*entries addconfig:other path; local skip the ccp jobconfig:other path# shellcheck disable=.shellcheckrc.github/actionlint.yamlexclude.editorconfig-checker.jsongitleaks:allow,.gitleaksignore.gitleaks.tomlNot in this PR: dropping the lint configs and lefthook fragments from the sync manifest. Per R5 that waits until every reader uses the new rule (melodic-software/claude-code-plugins#18972 and melodic-software/ci-workflows#1219 merged, and the five repositories extending
.lefthook/base.ymlswitched to this remote).Verification
bash harness/shell/run-tests.sh components/lefthook-base/lefthook-remote.test.sh components/lefthook-base/lefthook-merge-skip.test.sh components/lefthook-shellcheck/lefthook-shellcheck.test.sh components/lefthook-base/lefthook-base.test.sh: 4 passed. The remote test adds a case per tool where the consumer's own config is passed instead of the standards one, and asserts the merged config holds no typos, markdownlint or ShellCheck job.standards-gitleaks.shfails "standards-gitleaks passes the repository's own .gitleaks.toml, not the standards one".Related
🤖 Generated with Claude Code