Repository navigation
feat(pin-comment-convention): add dual-form pin-comment convention lint - #248
Conversation
Documents and lints the dual-form trailing-comment convention on `uses:` references to melodic-software/ci-workflows reusable workflows and composite actions pinned by 40-character SHA (`# vX.Y.Z` primary, `# <short-sha> <date>[ <note>]` fallback for untagged pins). The check covers form only and explicitly cedes short-SHA provenance correctness to runner-policy's existing pin-provenance-drift check, cross-pointered from both READMEs. Wired into this repo's own CI as the live consumer, scanning its real .github/workflows/*.yml (currently clean). Closes #244 ## Related - Refs #102 (reaffirmed with updated rationale, see PR comment) - Refs #197 (deferred pin-alignment mechanism, unaffected) - Refs melodic-software/medley#1624 (fleet pin-comment census) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
Claude finished @kyle-sexton's task in 4m 42s —— View job Code Review — PR #248:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b72ed5d86c
ℹ️ 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".
…ensions Two Codex review findings on standards#248: - pin-comment-patterns.sh's uses: regex required melodic-software immediately after the colon, so a single- or double-quoted YAML scalar (`uses: 'owner/repo@sha'`) skipped the check entirely — a silent false pass. The regex now accepts an optional matching-not- required quote character before and after the ref, covering both quote styles without touching the comment-format check itself. Adds inline test cases for both quote styles, valid and invalid comment. - ci.yml's live-consumer step only globbed .github/workflows/*.yml, so a future .yaml workflow would escape scanning. Globs both extensions now; the driver's existing `[[ -f "$file" ]] || continue` guard already tolerates the currently-unmatched .yaml glob. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
Claude finished @kyle-sexton's task in 2m 59s —— View job Code Review — PR #248:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3cf4f8a4d4
ℹ️ 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".
|
🔒 babysit-prs lane claiming this PR for on-branch fix work this cycle (amendment-round: 16, safe tier). Will fix clear branch-owned findings and push; will not resolve threads or merge (safe tier). |
The exec-bit CI gate requires files carrying a shebang to be mode 100755 in the git index. scan-workflow-files.sh and pin-comment-convention.test.sh both begin with `#!/usr/bin/env bash` but were committed 100644, failing the gate. pin-comment-patterns.sh is a sourced library with no shebang and correctly stays 100644. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
Claude finished @kyle-sexton's task in 1m 49s —— View job Code Review — PR #248:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c64815c06a
ℹ️ 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".
The fallback form's short-SHA is lowercase hex only (`[0-9a-f]`), and an uppercase short-SHA is already rejected as invalid-form, but no case exercised that boundary. Adds the assertion so the lowercase-only constraint is locked by a test. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
Claude finished @kyle-sexton's task in 2m 23s —— View job Code Review — PR #248:
|
babysit-prs safe-tier classification — review nits (head
|
| # | Finding | Classification | Evidence | Action |
|---|---|---|---|---|
| 1 | Single-space strictness undocumented (pin-comment-patterns.sh L68–69) |
VALID | tag_re/fallback_re use [[:space:]] (exactly one char) after # and between fallback fields, so # v1.0.0 (two spaces) is flagged invalid-form. Confirmed against the code. |
Deferred to author — document-as-intentional vs relax to [[:space:]]+ is a policy choice on a normative FORM check; a normative change carries the cross-doc reconciliation step (distribution/governance-process.md). Safe tier does not decide it. |
| 2 | Uppercase-hex short-SHA boundary untested (pin-comment-convention.test.sh) |
VALID — fixed | fallback_re is [0-9a-f] (lowercase-only); an uppercase short-SHA was already rejected but never exercised. Added an assertion that # 90F1C54 2026-07-18 is invalid-form; all 17 tests pass, shellcheck -x clean. |
Fixed in c05179e |
| 3 | Pre-release SemVer exclusion undocumented (README.md L9) |
VALID | tag_re v[0-9]+\.[0-9]+\.[0-9]+ rejects v1.0.0-rc.1 → invalid-form (the fallback form covers untagged/pre-tag pins). Confirmed. |
Deferred to author — a one-line README clarification of the deliberate exclusion is a normative-doc change (author intent + reconciliation). |
| 4 | Raw-text scan can false-positive on non-uses:-key occurrences (pin-comment-patterns.sh L67) |
VALID | uses_re is unanchored, so a run:-block line (or a commented-out line) containing literal uses: melodic-software/ci-workflows/...@<40-hex> matches and is flagged missing-comment. Same finding as the Codex inline thread. Confirmed. |
Deferred to author — anchoring to a real YAML uses: key / node-parsing changes the documented FORM-only design (header L27–37, complementary to runner-policy's parser); architectural, needs reconciliation. |
Nits 1, 3, 4 are non-blocking and left for author triage (this review itself frames them as "triage or defer with documented rationale"). This safe-tier lane fixed only the judgment-free, branch-owned item (Nit 2) and did not resolve any threads.
…not text lines
Codex flagged a real structural gap in the line-regex scanner: it could
both false-flag uses:-shaped text inside a run: block body or a YAML
comment, and miss a YAML-anchored/aliased uses: scalar the existing
runner-policy parser already handles. Fixing this as a third
band-aid on top of the earlier quote-handling patch would still leave
the same class of gap open for the next YAML shape; replacing the
line regex with yq-based tree extraction closes it structurally
instead.
pcc::scan_text now pipes <content> through yq (explode(.) to resolve
anchors/aliases first, then `.. | select(has("uses")) | .uses` to walk
every uses: node at any depth) and validates each in-scope pin's
line_comment against the two documented forms. This subsumes the
prior quote-handling fix (yq resolves quoted scalars to their plain
value) and correctly distinguishes a whole aliased step (comment
travels with it) from a bare scalar-value alias (comment does not).
Along the way, found and fixed a real bug the yq output surfaced:
`IFS=$'\t' read -r a b c` coalesces adjacent tabs because bash treats
tab as "IFS whitespace" regardless of what IFS is set to, silently
losing a genuinely empty comment field and therefore never reporting
missing-comment. Replaced with parameter-expansion field extraction,
the pattern this file's own driver and the original version already
used elsewhere.
Adds the checksum-pinned yq 4.53.3 install step (matching the
`distribution` job's exact block) to the pin-comment-convention CI
job, and a yq-availability skip_suite guard to the test file matching
distribution/sync-manifest.test.sh's existing precedent. New test
cases: whole-step anchor/alias (valid + invalid comment), bare
scalar-value alias (valid + invalid — and that the comment does not
propagate), run:-block false-positive, YAML-comment false-positive.
Fixtures updated to match; row-count assertions recomputed against
actual yq output rather than assumed.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
Claude finished @kyle-sexton's task in 3m 39s —— View job Code Review — PR #248:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 16726803c2
ℹ️ 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".
…ept uppercase pinned SHA
Two more Codex findings on the yq rewrite, fixed together with a
defensive self-review pass rather than one commit each:
- The untargeted `.. | select(has("uses"))` walk matched any map
anywhere in the document with a key literally named "uses" — a
strategy.matrix.include entry or a step's own with: input could
false-positive. Extraction is now scoped to exactly the two
positions GitHub Actions executes a uses: value from:
jobs.<id>.uses and jobs.<id>.steps[*].uses.
- The pinned 40-character SHA in uses:...@<sha> required lowercase
hex only, so an uppercase-hex pin silently escaped the check
entirely (same false-negative class as the earlier quoted-ref bug).
It is now matched case-insensitively, matching how the
runner-policy provenance scanner already treats it. The fallback
comment's own short-SHA stays lowercase-only exactly as the
concurrently-landed test locked it: that field is an authored
documentation string with a fixed canonical spelling, not a
resolved git object.
Defensive pass (same false-negative/false-positive classes Codex
kept finding: case sensitivity, quoting, YAML structure position,
field conflation): confirmed the org/repo segment and the
.github/(workflows|actions)/ directory segment are deliberately left
case-sensitive (the former has no known real-world alternate
spelling in this fleet and would require case-insensitively widening
the latter, which are real case-sensitive git tree paths, to match
it; the latter's case sensitivity is a fact of how GitHub resolves
the path, not a policy choice) and documented that reasoning in the
README rather than silently leaving it unaddressed. Verified a
document with no jobs: key, jobs: null, jobs: {}, and a malformed
jobs: scalar all scan clean rather than erroring (the driver's file
glob can plausibly reach a non-workflow file) and added a test
locking that. Verified the .github/(workflows|actions)/ path segment
already handles arbitrarily nested subdirectories.
New tests: uppercase pinned SHA (valid + invalid comment),
matrix.include decoy, with: input decoy, no-jobs-key document. All
30 assertions pass; shellcheck, markdownlint, typos, editorconfig
clean; driver dogfood against this repo's real workflow files stays
clean.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
Claude finished @kyle-sexton's task in 3m 49s —— View job Code Review — PR #248:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3f109bc21e
ℹ️ 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".
… at source Codex's sixth finding: the fallback form accepted any 7-40 lowercase hex token as <short-sha>, but runner-policy's isShaClaim heuristic (scoped to free-form comments across the whole repository) only treats a token as a SHA claim when it mixes digits/letters or is exactly 40 characters, so an all-digit or all-a-through-f short-sha could pass this component's format check while runner-policy never attempted to verify it. Root-caused rather than aligned to the heuristic: at the fallback form's position, the token is an unambiguous SHA claim about the exact pin on the same line, so there is no ambiguity to defer a heuristic classifier to. pcc::_check_comment now takes the pinned SHA alongside the raw comment and requires the fallback short-sha to case-insensitively prefix it directly. This closes the gap without touching runner-policy, and does NOT reject a legitimate all-digit abbreviated SHA (a real git prefix shape, ~1 in 25 real 7-character hex prefixes) the way subset-aligning to isShaClaim would have. The two checks now genuinely overlap for a ci-workflows fallback comment: this component is authoritative there (verified directly against the pin it annotates), and pin-provenance-drift remains the sole check for every other SHA-pin comment shape this convention does not govern. Updated both READMEs' boundary description accordingly. New tests: matching prefix (already covered, reconfirmed), a non-matching prefix (flagged), an all-digit prefix that genuinely matches (clean), a short-sha under 7 characters (still invalid-form on shape, unaffected by the new prefix check). Audited every existing fallback-form test case before this change confirmed none would regress (all already used a genuine short+full SHA pair); all 34 assertions pass. shellcheck, markdownlint, typos, editorconfig clean; driver dogfood against this repo's real workflow files stays clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
Claude encountered an error after 1s —— View job I'll analyze this and get back to you. |
|
Warning Automated review did not complete — this is an infrastructure failure, not a review verdict. Treat any Claude comment on this PR (including a placeholder like "I'll analyze this and get back to you") as incomplete, not "no findings."
Re-running the job, or pushing a new commit, will retry the review. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e8056d7168
ℹ️ 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".
| [[ "$raw" =~ ^[[:space:]]*v[0-9]+\.[0-9]+\.[0-9]+[[:space:]]*$ ]] && return 0 | ||
| if [[ "$raw" =~ ^[[:space:]]*([0-9a-f]{7,40})[[:space:]][0-9]{4}-[0-9]{2}-[0-9]{2}([[:space:]]+.+)?[[:space:]]*$ ]]; then |
There was a problem hiding this comment.
Disable nocasematch while enforcing case-sensitive forms
When this library is sourced from a shell that already has shopt -s nocasematch enabled, Bash makes these [[ =~ ]] checks case-insensitive, so comments such as # V0.7.0 or # 90F1C54 2026-07-18 are accepted even though the README and header deliberately make lowercase v and lowercase short-SHAs canonical. The current CI driver starts a fresh shell, but this file is also distributed as a sourceable policy library; save, clear, and restore nocasematch around the scan so caller shell state cannot weaken the convention.
Useful? React with 👍 / 👎.
Closes #244
Summary
# vX.Y.Zprimary /# <short-sha> <date>[ <note>]fallback) foruses:references tomelodic-software/ci-workflowsreusable workflows and composite actions pinned by 40-character SHA, in a newpin-comment-conventioncomponent README following thecomment-hygiene/path-detectionshape.pin-comment-patterns.shscans real YAML nodes via yq (Mike Farah's yq v4, this repo's established YAML tool), not a per-line text regex:explode(.)resolves anchors/aliases first, then extraction is scoped to exactly the two positions GitHub Actions executes auses:value from —jobs.<id>.usesandjobs.<id>.steps[*].uses— so a plain, quoted, anchored, or aliased pin is scanned the same way, anduses:-shaped text inside arun:block, a YAML comment, astrategy.matrix.includeentry, or a step's ownwith:input is never a false-positive candidate.scan-workflow-files.shis a minimal driver (file enumeration, exit-code mapping) that this repo's own CI runs as its live consumer.# vX.Y.Z) is format-only — GitHub tag data isn't verifiable by a static scan. The fallback form (# <short-sha> <date>[ <note>]) is provenance-checked:<short-sha>must case-insensitively prefix the same line's pinned SHA, verified directly rather than deferred torunner-policy's whole-repositoryisShaClaimheuristic. Both READMEs cross-point to each other so this boundary — and where it now genuinely overlapsrunner-policy'spin-provenance-driftcheck versus where that check remains the sole authority — is explicit, not silent.vstay case-sensitive by deliberate, documented design (an authored documentation string with a fixed canonical spelling, and a tag's case being part of its git-ref identity, respectively).pin-comment-conventionjob, added toci-status, with the same checksum-pinned yq install thedistributionjob uses) as the live consumer: it scans this repo's real.github/workflows/*.ymland*.yamltoday and passes cleanly, satisfying the component-lifecycle admission evidence with a real baseline rather than a deferred claim.distribution/sync-manifest.ymlcomponent entry so the policy is distributable to other repositories via the existing materialization mechanism (notargets:adoption yet — that's a separate consumer-side integration).Review history and defensive pass
This PR went through several rounds of automated review findings, each fixed structurally rather than patched around:
uses:scalar (uses: 'owner/repo@sha') bypassed the original line-regex scanner entirely..github/workflows/*.yml, missing.yaml.uses:-shaped text inside arun:block/YAML comment and miss a YAML-anchored/aliaseduses:scalar — root-caused by replacing the line regex with yq-based YAML-node extraction (findings 1 and 2 became structurally subsumed by this change)... | select(has("uses"))), which could false-positive on an unrelated data field named "uses" (astrategy.matrix.includeentry, a step'swith:input).<short-sha>accepted any 7-40 lowercase-hex token by shape, butrunner-policy'sisShaClaimheuristic wouldn't recognize an all-digit or all-a-ftoken as a SHA claim, so that narrow shape could pass this component's check whilerunner-policynever attempted to verify it.Findings 4 and 5 were fixed together with a deliberate defensive self-review pass hunting the same classes (case sensitivity, quoting, YAML structure position, field conflation) before that push, rather than waiting for another round:
melodic-software/ci-workflows) and the.github/(workflows|actions)/directory segment are correctly left case-sensitive — the former has no known real-world alternate spelling in this fleet, and case-insensitively matching it would require widening the latter too, which are genuinely case-sensitive git tree paths; documented this reasoning in the README rather than leaving it silently unaddressed.jobs:key,jobs: null,jobs: {}, and a malformedjobs:scalar all scanning clean rather than erroring — the driver's file glob can plausibly reach a non-workflow file..github/(workflows|actions)/path segment already handles arbitrarily nested action subdirectories.Finding 6 was root-caused rather than aligned to
runner-policy's subset: since the fallback form's position makes the token an unambiguous SHA claim about the exact pin on the same line, the short-sha is now checked directly against that pin (a real provenance check) instead of widening the accepted character shape to match a heuristic meant for free-form, whole-repository scanning — which would have also rejected a legitimate all-digit abbreviated SHA, a real git prefix shape.Also found and fixed along the way (not a review finding, surfaced by the yq rewrite):
IFS=$'\t' read -r a b ccoalesces adjacent tab delimiters because bash treats tab as "IFS whitespace" regardless of what IFS is set to, silently losing a genuinely empty comment field and therefore never reportingmissing-comment. Replaced with parameter-expansion field extraction, the pattern already used elsewhere in this file.Test plan
bash harness/shell/run-tests.sh components/pin-comment-convention/pin-comment-convention.test.sh— 34 assertions, all passbash components/pin-comment-convention/scan-workflow-files.sh .github/workflows/*.yml .github/workflows/*.yaml— clean (this repo's existing pins already conform)bash distribution/sync-manifest.sh validate— 30 components, 8 targets, validshellcheck --rcfile .shellcheckrcon all scripts — cleanmarkdownlint-cli2,typos,editorconfig-checkeron all changed files — cleanRelated
Known issue: hosted CI may fail 0-step/2s (billing) — environmental, unrelated to this change.
🤖 Generated with Claude Code