Repository navigation
docs(bash-format): document project scope + setup gotchas; add opt-in/shfmt-fallback test coverage (F1, F2, F6) - #1171
Conversation
…/shfmt-fallback test coverage (F1, F2, F6) Consumer-side audit polish for [email protected] (handoff-inbox item 20260723-095036), findings F1/F2/F6 — no behavioral change. - F1: document the in-project-only scope (README "Scope" note + setup `check` project-scope probe) so the shared membership guard's silent out-of-project skip is not a surprise for an advisory linter. The guard itself is already tested centrally in lib/hook-utils.test.sh (Test 12), so F1 is docs-only. - F2 (bash-format-local): test the `[*.{sh,bash}]` brace-list and `[**/*.sh]` path-prefixed .editorconfig opt-in forms, and the shfmt<3.8 `--apply-ignore` fallback (`|| shfmt -w`) via a stub shfmt. - F6: add a `## Gotchas` section to the setup skill. F3 (dim-9 label) and the shared-lib F2 test gaps moved to #1169 — they are fleet-scope, not bash-format-local. F5 filed as #1170 (HITL). Version 0.6.2. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Claude finished @kyle-sexton's task in 2m 14s —— View job PR Review:
|
| File | Verdict | Notes |
|---|---|---|
plugin.json |
✅ | Clean patch bump |
CHANGELOG.md |
✅ | Non-standard ### Tests heading (nit) |
README.md |
✅ | Missing shfmt -w in workaround (nit) |
bash-format.test.sh |
✅ | ${*: -1} → ${@: -1} in stub (minor) |
SKILL.md |
✅ | Well-structured, no issues |
No correctness bugs, no security concerns, no behavioral changes. The F1/F2/F6 findings are fully addressed, the PR's claimed scope is accurate, and the reasoning in the description (especially the F1 grounding note about hook-utils.test.sh Test 12 already covering the membership guard) is sound. Approve when the ${@: -1} nit is resolved (or accepted as-is given the low real-world risk).
|
Claude finished @kyle-sexton's task in 1m 20s —— View job Security Review
No security issues found. This PR is docs + tests only (no behavioral change). I reviewed each of the five changed files for the vulnerability classes in scope:
No injection surfaces, credential exposure, authorization gaps, or dangerous CI patterns were introduced by this PR. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: acb1b21359
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…fine dim-9; cover buffer_stdin timeout & EPOCHREALTIME skip (F4, F3, F2-shared) (#1172) Closes #1169. Fleet-scope findings surfaced by the `bash-format` consumer audit (handoff-inbox item `20260723-095036`), re-verified and rescoped against current source. **No runtime behavior change** — a fleet-doc correction plus shared-lib test coverage. ## Changes - **F4 — `statusMessage` adoption doc was badly stale.** The doc claimed "no `hooks.json` in the fleet declares `statusMessage` yet — all 27 wired `type: command` handlers across 12 plugins need it added." Scripted count of current source (jq over every `plugins/*/hooks/hooks.json`): **31 command-type handlers across 15 hook-bearing plugins, 30 declare `statusMessage`; sole holdout `plugins/disk-hygiene`** (a `PreToolUse` destructive-guard). Doc now records near-complete adoption, names the holdout, and states the #836 close condition. - **F3 — `dim-9 doctrine` defined.** Grounding refuted the "bash-format-local" premise: the label is fleet vocabulary cited in **9 hook scripts** (actionlint, bash-format, biome-format, desktop-notification, eol-normalizer, go-format, powershell-format, ruff-format, typos-format) with **no central glossary** (verified — no dimensions registry exists). Defined it authoritatively in the visible-skip (`systemMessage`) section it names, and noted the broader undefined `dim-N` scheme as a separate follow-up. **Not** stripped from bash-format — that would fragment a fleet-wide convention (`reuse-or-replace`). - **F2-shared — shared-lib test coverage.** Added `lib/hook-utils.test.sh` cases for `hook::buffer_stdin`'s timeout path (`return 2` / `BLOCKED` on stderr) and `hook::emit_telemetry`'s `EPOCHREALTIME`-absent (Bash < 5.0) skip-fail-open. Shared-lib behavior → tests live centrally, not duplicated into a plugin. ## Verification - `bash lib/hook-utils.test.sh` → **PASS=85 FAIL=0** (2 new cases green) on bash 5.3. - `shellcheck -x -S warning lib/hook-utils.test.sh` → clean. - Only `lib/hook-utils.sh`'s **test** was touched (not the SSOT lib itself), so no `sync-hook-utils.sh` run and no plugin version bumps are needed. ## Notes - F1's original "add a membership-guard test" was **already satisfied** by `lib/hook-utils.test.sh` Test 12 — see sibling **#1168** (bash-format docs/tests, PR #1171). - The `disk-hygiene` holdout is left as the documented remaining item; adding its `statusMessage` (or marking it a deliberate exception) would close #836 but pulls a third plugin into this PR, so it is deferred per the group-by-plugin boundary. 🤖 Generated with [Claude Code](https://claude.com/claude-code) ## Related - #1171 — sibling PR for the bash-format-local findings (F1, F2-local, F6) from the same audit item. - #1170 — HITL follow-up (F5, `--config` fresh-install claim), not closed here. - #836 — statusMessage fleet-adoption tracking issue this PR updates (not closed; one holdout remains). - Handoff-inbox item `20260723-095036-bash-format-audit-docs-tests-polish` (producer SW2030). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5 <[email protected]>
…_PROJECT_DIR is set (PR review P2) Codex review (P2) on #1171: the F1 scope note claimed out-of-project files are "silently skipped" unconditionally, but hook::read_file_path only runs the membership check inside the `[[ -n "${CLAUDE_PROJECT_DIR:-}" ]]` branch (hook-utils.sh:198); when the var is unset (e.g. some headless -p sessions) it returns any existing file (:210). Qualified the README "Scope" note, setup probe 9, and the Gotchas bullet to state the skip applies only when CLAUDE_PROJECT_DIR is set, and that it is bypassed (any edited file processed) when unset. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Addressed the P2 (README:36) in da42914. Confirmed the finding: |
|
Claude finished @kyle-sexton's task in 1m 46s —— View job Review of commit
|
| File | Before | After |
|---|---|---|
README.md:31 |
"Scope: files inside the current project only" — unconditional | Correctly qualified: "when CLAUDE_PROJECT_DIR is set" + unset-case explanation |
SKILL.md probe 9 |
"the hook acts only on shell files inside CLAUDE_PROJECT_DIR" — unconditional |
"when CLAUDE_PROJECT_DIR is set … When … unset … the guard is skipped" |
SKILL.md Gotchas |
"The hook is project-scoped … shell files written outside … are silently skipped" — unconditional | Qualified with the set/unset split; parenthetical points back to probe 9 |
CHANGELOG.md |
Claimed unconditional scope | Qualified; cites the PR review source |
One very minor nit (non-blocking)
"Either way, to lint a file the hook skipped, run
shellcheckon it directly."
When CLAUDE_PROJECT_DIR is unset, the hook doesn't skip any file — so "a file the hook skipped" only applies in the set-variable case. "Either way" is slightly misleading. A minor reword would tighten it: "To lint a file directly (bypassing the hook), run shellcheck." Non-blocking — the intent is clear enough.
Outstanding nit from the prior review
The ${*: -1} → ${@: -1} stub issue noted in the prior review (bash-format.test.sh:297) was not addressed in this commit — it was called out as low real-world risk given mktemp paths never have spaces. Still worth a follow-up ticket if you want the stub to be strictly correct, but not a blocker here.
Summary
The P2 correctness finding is fully and accurately addressed. Documentation is internally consistent and matches the source implementation. Ready to merge.
|
Claude finished @kyle-sexton's task in 2m 7s —— View job Security Review — PR #1171 (
|
| Surface | Assessment |
|---|---|
Stub written via <<'STUB' (single-quoted heredoc) |
No variable expansion at write time. Safe. |
STUBDIR=$(mktemp -d -p "$WORK" …) |
Stub lives in the test's own temp tree. Safe. |
PATH="$STUBDIR:$PATH" prepend |
Scoped to a subshell (…). The stub directory is test-controlled. Standard tool-substitution testing pattern. Safe. |
env -u CLAUDE_PROJECT_DIR |
Intentional; tests the headless/unset-var code path. Safe. |
printf '{"tool_input":{"file_path":"%s"},…}' "$REPO_OLDSHFMT/x.sh" |
JSON construction via %s. $REPO_OLDSHFMT is "$WORK/old-shfmt" — a mktemp-derived path with no special characters. No attacker-controlled input reaches this format string in any test invocation. Safe in context. |
bash "$HOOK" |
$HOOK is set at test startup to the hook under test. No injection. |
f="${*: -1}" in stub body (line 297) |
$* joins args on $IFS; a path with spaces would be mangled. The file argument is always a mktemp-derived path without spaces, so this does not fail in practice. This is the code-quality nit already flagged by the prior code review (${@: -1} is the robust form) — not a security vulnerability given the controlled test context. |
No command injection, no path traversal, no secrets exposed, no privilege escalation, no dangerous CI patterns. Temp-dir cleanup via trap … EXIT (pre-existing) covers the new dirs created under $WORK.
…eralize CRLF gotcha; correct install_new render doc (F1-F3) (#1177) Closes #1176. Consumer-audit fixes for the claude-ops `plugins` sync skill (handoff-inbox item `20260723-155027`), re-verified against current source (0.19.0). Version `0.19.0` → `0.19.1`. ## Changes - **F1 (bug).** `fleet-state.sh`'s `resolve_default_marketplace` exact-matched the running plugin root against the version-pinned `installPath`, so any skew between the session's loaded version and the installed one — a marketplace `autoUpdate` after session start, or `sync`'s own Step-3 self-update of claude-ops — broke the primary no-`--marketplace` path with "could not resolve the default marketplace". Added a **version-agnostic fallback** matching the version-stripped `…/cache/<marketplace>/<plugin>` prefix (exact match still tried first; the marketplace stays distinguishable via the path), plus a clearer error that prints the searched root and names the skew cause. - **F2a (doc).** Generalized `context/gotchas.md`'s CRLF entry from "this host's `jq` build" to **any captured Windows value** (`python` print, PowerShell interop, `git config`, CRLF file read): a trailing `\r` on a constructed `claude plugin` id makes the CLI report `Plugin "<name>" not found` with the full id passed (marketplace suffix corrupted), colliding with the bare-name symptom — documented and cross-referenced both ways. - **F3a (doc).** `plugins/SKILL.md` now reads an unset `${user_config.install_new}` — which renders the literal placeholder, since the manifest `default` is not substituted for an unset key (verified vs CC 2.1.218) — as the **expected unset state → default `ask`**, not an invalid value; only an explicitly-set unsupported value is flagged. ## Verification - `bash plugins/claude-ops/skills/plugins/scripts/fleet-state.test.sh` → **28 cases, 0 failed** (new version-skew case green). - `shellcheck -x -S warning fleet-state.sh` → clean. - `scripts/check-changed-skills.sh origin/main` → PASS for the `plugins` skill (runs the fleet-state test). ## Deferred (noted on #1176, not in this PR) - **F2b:** ship a `sync-sweep.sh` sibling owning the Step 2+3 update loop (CR-stripping, fail-loud, structured per-id JSON) so `sync.md` shrinks to "run this, report from its output". Bigger net-new surface with its own test. - **F3b:** verify upstream whether a declared `userConfig` default is *intended* to substitute for an unset key; file a CC docs issue if docs and behavior disagree. F3a is correct regardless. ## Related - Handoff-inbox item `20260723-155027-claude-ops-plugins-sync-audit` (producer: KyleSexton workstation, CC 2.1.218). - Prior inbox items landed this session: #1171 (bash-format), #1172 (hook-observability + hook-utils). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5 <[email protected]>
Closes #1168.
Consumer-side audit polish for
[email protected](handoff-inbox item20260723-095036), findings F1, F2 (bash-format-local), F6. No behavioral change — docs + tests only. Version0.6.2.Changes
CLAUDE_PROJECT_DIR(symlink-resolved membership guard in the shared library); files written outside the project are silently skipped. Added a README "Scope" note and a project-scope probe to the setup skill'scheck(which no longer reports "fully operational" without the caveat).lib/hook-utils.test.shTest 12 thoroughly tests the guard (in-project accept, prefix-sibling reject, escaping-symlink reject, symlinked-root). The producer only readbash-format.test.sh(which deliberately unsetsCLAUDE_PROJECT_DIR). So F1 reduces to docs.bash-format.test.shcoverage for the[*.{sh,bash}]brace-list and[**/*.sh]path-prefixed.editorconfigopt-in forms, and theshfmt < 3.8--apply-ignorefallback (|| shfmt -w) via a stub shfmt.## Gotchassection to the setup skill (cache-pathENAMETOOLONG,check-PASS-≠-full-coverage, opt-in-conditionalshfmtFAIL).Verification
bash plugins/bash-format/hooks/bash-format.test.sh→ PASS=42 FAIL=0 (3 new cases green).shellcheck -x -S warningon the test file → clean.plugin.jsonvalid; version bumped0.6.1→0.6.2; CHANGELOG updated.Scope moved out of this PR
dim-9 doctrinelabel) → hook-observability + hook-utils: refresh statusMessage adoption doc (30/31) + shared-lib tests for buffer_stdin timeout & EPOCHREALTIME degradation (F2-shared, F4) #1169. Grounding refuted the "bash-format-local" premise: the label is fleet vocabulary cited in 9 hook scripts with no shared glossary. Stripping it from bash-format alone would fragment the convention; the fix is a shared-doc definition (fleet-scope).buffer_stdintimeout,EPOCHREALTIMEdegradation) → hook-observability + hook-utils: refresh statusMessage adoption doc (30/31) + shared-lib tests for buffer_stdin timeout & EPOCHREALTIME degradation (F2-shared, F4) #1169 (belong inlib/hook-utils.test.sh).--configfresh-install claim) → bash-format: verify setup skill '--config only applies on fresh install' claim (F5) #1170 (HITL — verifying mutates shared machine install state).🤖 Generated with Claude Code
Related
--configfresh-install claim), not closed here.20260723-095036-bash-format-audit-docs-tests-polish(producer SW2030).🤖 Generated with Claude Code