Skip to content

code-hygiene-check: do not treat heredoc delimiters as debt markers - #210

Merged
hyperpolymath merged 5 commits into
mainfrom
fix/code-hygiene-heredoc-delimiter
Dec 1, 2026
Merged

hyperpolymath merged 5 commits into
mainfrom
fix/code-hygiene-heredoc-delimiter

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Summary

code-hygiene-check reports a shell heredoc delimiter as untracked debt. The scan matches the whole word STUB (and TODO, FIXME, XXX, HACK) anywhere in a source line, so cat > f <<'STUB' and its closing STUB line are flagged even though they are quoting syntax, not debt.

Seen downstream: metadatastician/lintel's Central Estate audit (which runs this gate) fails on main because tests/workflows/hypatia_scan_test.sh writes fixture CLIs with <<'STUB' heredocs (lines 48, 54, 55, 64).

Change

actions/code-hygiene-check/check.sh, in the debt-marker filter only:

  • strip heredoc openers (<<WORD, <<-WORD, <<'WORD', <<"WORD") before matching;
  • accept a bare marker line only in *.sh / *.bash, where it can only be a terminator and never a comment.

Not changed: the allowlist mechanism, the proof-circumvention scan, the Coq scanner, and which file types are scanned.

Testing

actions/code-hygiene-check/test.sh gains controls, run locally (All code-hygiene positive and negative controls passed.):

  • positive: a shell fixture with a <<'STUB' heredoc passes;
  • negative: cat > x <<'EOF' # TODO: ... (real debt on the opener line), # STUB: implement this, echo todo # HACK around the parser, and a bare TODO line inside a /* */ comment in a .ts file all still fail.

Negative control for the test itself: the new positive control fails against the previous check.sh (it flags src/fixture.sh:1: ... <<'STUB'). Reproduced on a checkout of lintel main: the previous scanner reports tests/workflows/hypatia_scan_test.sh four times, this one none.

Follow-up (not in this PR)

Once merged, repos that pin this gate need a re-pin to pick it up. lintel pins 0da816c.


Generated by Claude Code

The debt scan matched the whole word STUB (and TODO/FIXME/XXX/HACK) anywhere in
a source line, so a shell heredoc written <<'STUB' ... STUB was reported as
untracked debt. Downstream, lintel's tests/workflows/hypatia_scan_test.sh
(fixture CLIs written with such heredocs) failed the Central Estate audit
with four false positives.

Strip heredoc openers (<<WORD, <<-WORD, <<'WORD', <<"WORD") before matching,
and accept a bare marker line only in .sh/.bash files, where it can only be a
terminator and never a comment. A real marker next to a delimiter, a marker
comment, and a bare TODO inside a block comment of any other language still
fail; test.sh gains a positive control and three negative controls, and the
new controls fail against the previous scanner.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDhpjzE2JPengmZCyb4
@gitnotebooks

gitnotebooks Bot commented Nov 30, 2026

Copy link
Copy Markdown

tests/lock-transitive-closure.sh requires every literal-SHA self-reference in
this workflow to serve HEAD's composite, so a change under
actions/code-hygiene-check must advance this pin or consumers keep running the
old gate. A commit cannot pin its own SHA, so the repin follows the change
(6bdc89a) in the same PR. tests/lock-transitive-closure.sh passes locally
(PASS=28 FAIL=0).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDhpjzE2JPengmZCyb4
A pre-merge repin cannot satisfy this repo's invariants: pinning a commit that
lives only on a PR branch fails tests/self-pin-reachable.sh (not reachable
from origin/main) and would leave main-estate-audit.yml pointing at a commit
that disappears with the branch, the failure mode that startup-fails
consumers. The established process (fb91470, #175) is a separate repin PR to
the merge commit once the change has landed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDhpjzE2JPengmZCyb4

Copy link
Copy Markdown
Owner Author

One known red on this PR, and it is by design: Composite shell contract → tests/lock-transitive-closure.sh.

That test requires this repo's own main-estate-audit.yml to pin actions/code-hygiene-check at a commit whose composite equals HEAD's. This PR changes that composite (check.sh, test.sh), so the current pin (697f559) is stale until the change lands.

I tried repinning inside this PR (de44385) and reverted it (15c8835): a commit that exists only on this branch fails tests/self-pin-reachable.sh (not reachable from origin/main) and would leave main-estate-audit.yml pointing at a commit that vanishes with the branch. With the revert, self-pin-reachable passes (9/0) and the closure test is the only expected failure.

The established process in this repo is a follow-up repin PR to the merge commit once this lands (precedent: fb91470, #175 after #136). I can open that PR after merge, and then re-pin the downstream consumer (metadatastician/lintel, which currently fails its audit on the false positive this fixes).

The earlier proven / verdict failure on 6bdc89a was a cancelled job (superseded by a later push), not a real failure.


Generated by Claude Code

Repository owner deleted a comment from coderabbitai Bot Dec 1, 2026
@hyperpolymath
hyperpolymath marked this pull request as ready for review December 1, 2026 01:23
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@hyperpolymath
hyperpolymath enabled auto-merge (squash) December 1, 2026 01:23
Repository owner deleted a comment from coderabbitai Bot Dec 1, 2026
@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@hyperpolymath
hyperpolymath merged commit d862173 into main Dec 1, 2026
21 of 24 checks passed
@hyperpolymath
hyperpolymath deleted the fix/code-hygiene-heredoc-delimiter branch December 1, 2026 01:39
@sonarqubecloud

sonarqubecloud Bot commented Dec 1, 2026

Copy link
Copy Markdown

hyperpolymath added a commit that referenced this pull request Dec 1, 2026
…) (#214)

## What
Hub request (2026-12-01): bump the `actions/code-hygiene-check` self-pin
in `.github/workflows/main-estate-audit.yml` (line 124) from `697f559`
(#136) to `d862173` (#210). One line. One concern.

`tests/lock-transitive-closure.sh` refuses a self-pin that differs from
HEAD's version of the action ("every consumer reaching this pin runs the
OLD composite; a cure landed here is inert downstream"). #210 changed
`actions/code-hygiene-check/check.sh` and `test.sh` after the pin was
set, so the check fails on `main` itself and on every PR whose tree
contains #210. Seen on #205 (job `Composite shell contract`): PASS=27
FAIL=1, the one FAIL being this pin.

`d862173` is the last commit that touches `actions/code-hygiene-check`
on `main` (checked with `git log -1 -- actions/code-hygiene-check`), so
it is the pin whose action tree equals HEAD's.

## Evidence
- Before (CI log of `Composite shell contract` on #205, head a0fec52):
`PASS=27 FAIL=1`, the failure being `main-estate-audit.yml pins
actions/code-hygiene-check at 697f559...`.
- After, locally: `bash tests/lock-transitive-closure.sh` on a full
(unshallowed) clone, run on unmodified `main` and on this branch: the
pin FAIL line is gone (PASS 22 to 23, FAIL 6 to 5).
- **Not shown locally:** the other 5 FAILs on this box (`dependencies:
has no such key`, `reaches ... through a composite but does not declare
it`) are the checks that need mikefarah `yq` v4; this environment has
the Python `yq` 3.1.0, so they fail identically on unmodified `main`
here. In CI those pass (the #205 log shows `ok dependencies: defines
...`). So the **28/0 the hub asked for is not demonstrated locally; it
is CI's to show on this PR.**

## Is it a gate change for the tamper guard?
**No.** `scripts/ci-gate-tamper-guard.sh` protects
`.github/workflows/ci-gate*.yml`, `scripts/check-required-contexts.sh`,
`scripts/ci-gate-*.sh`, `scripts/validate-ci-gate-profile.sh`,
`templates/ci-gate*.yml` and `profiles/ci-gate/*`.
`main-estate-audit.yml` is none of those, so no `gate-change-approved`
label is needed. Note that its jobs (`governance`, `hygiene`,
`languages`, `manifests`) are required contexts in this repo's gate
profile, so a workflow edit here deserves a normal review even though
the guard does not cover it.

## Not done
- Not touching the unpinned `just` curl|bash on the same file (separate
estate item, per the hub).
- No pin bump of any other action; only `code-hygiene-check` was stale
in this check.

---
_Generated by [Claude Code](https://claude.ai/code)_

Co-authored-by: Claude <noreply@anthropic.com>
hyperpolymath added a commit to metadatastician/lintel that referenced this pull request Dec 1, 2026
…redoc fix (#38)

## Summary

lintel's `Central Estate CI/CD Audit` is red on `main`: `Code Hygiene
Gate` flags the heredoc delimiter `STUB` in
`tests/workflows/hypatia_scan_test.sh` (lines 48, 54, 55, 64). That is a
false positive of the gate, fixed upstream in
hyperpolymath/proven-cicd-and-workflows#210 (squash `d862173`). This PR
picks up the fix.

It is more than a pin bump: the inline audit here mirrored upstream's
old single-job 26-gate form, and upstream has since changed its roster.
Per the owner's choice ("Mirror upstream's roster"), this PR mirrors
upstream's current audit.

## Change

- `.github/workflows/main-estate-audit.yml`: upstream's current audit
run inline: five component jobs (`governance`, `hygiene`, `manifests`,
`languages`, `advisory`), every gate guarded by `!cancelled() &&
steps.checkout.outcome == 'success'` so one push reports every failing
gate. Gates keep upstream's per-gate pins; `code-hygiene-check` is at
`d862173`.
- `.github/workflows/actions.lock`: one record per distinct pinned
revision; `manifest-check`'s record keeps its nested `deed`/`k9` refs.
- `tests/workflows/reusable_callers_startup_test.sh`: now asserts the
five components, the ordered roster, guard-only gate conditions and the
lock records, with two new mutation controls (a dropped gate, an
unguarded gate).

## Coverage change (owner-approved)

Gates 26 → **21**.
- Dropped as upstream dropped them: `custom-tools-check`,
`contractile-validation-check`, `proof-runner-check` (they passed when
the tool they run was absent) and `prat-check`, `semantic-audit-check`
(stubs that pass unconditionally). Upstream's words: "a green tick
credited assurance that nothing checked."
- `zig-hexadeca-check` was removed upstream; replaced by
`zig-unified-api-adapter-check`.

## Testing (local)

- `tests/workflows/reusable_callers_startup_test.sh` (Mike Farah yq
v4.44.3): PASS, including the mutation self-tests.
- `scripts/check-lock-sync.sh`: in sync, transitively closed.
- `scripts/check-action-pinning.js`, invisible-character scan, no-a2ml,
no-placeholders: pass.
- Not yet shown: that the gates pass on this repo in CI; the run on this
PR is that test. Some of the added gates (e.g.
`zig-unified-api-adapter-check`, `secrets-check`) have not run here
before.

---
_Generated by [Claude Code](https://claude.ai/code)_

Co-authored-by: Claude <noreply@anthropic.com>
hyperpolymath added a commit that referenced this pull request Dec 1, 2026
## Summary

Follow-up to #210 (heredoc delimiters are not debt markers). #210
changed `actions/code-hygiene-check`, so this repo's own
`main-estate-audit.yml` still pins the previous composite (`697f559`,
#136) and `tests/lock-transitive-closure.sh` fails on `main` ("pins
actions/code-hygiene-check at 697f559, which differs from HEAD's").

A change cannot pin its own commit, and a pre-merge pin to a PR-branch
commit fails `tests/self-pin-reachable.sh`, so the repin is a separate
PR after the change lands (same two-step as fb91470 / #175 after #136).
This PR repins to the #210 squash commit `d862173`, which is on `main`.

## Change

One line in `.github/workflows/main-estate-audit.yml`:
`code-hygiene-check@697f559…` → `@d862173…` (comment updated). No other
pin, no lock change (this workflow is de-onboarded from the lock).

## Testing

Run locally on `origin/main` + this commit (Mike Farah yq v4.44.3):
- `tests/lock-transitive-closure.sh`: PASS=28 FAIL=0 (was 27/1 on main)
- `tests/self-pin-reachable.sh`: PASS=9 FAIL=0

Downstream: metadatastician/lintel runs this gate and fails its Central
Estate audit on the false positive #210 fixes; it needs a re-pin to a
commit at or after `d862173`.

---
_Generated by [Claude Code](https://claude.ai/code)_

Co-authored-by: Claude <noreply@anthropic.com>
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.

2 participants