Skip to content

refactor(scripts): simplify check-docs-only-gate, check-docs-only and check-drive-root-litter - #14581

Merged
kyle-sexton merged 1 commit into
mainfrom
work-resolve-issue/issue-14354-42612719318-1
Nov 9, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
work-resolve-issue/issue-14354-42612719318-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #14354

Summary

Opened by the work-resolve-issue lane. The run's own summary:

Simplified the three scripts without changing what they do. In check-docs-only-gate.sh, the duplicated table readers became one row_names helper and two one-line membership tests, the two copies of the 'find the published expression' lookup became one find_published helper, the shape_errors/jobs_all aliases and a has_line check that was always true were dropped, and the draft-gate probe now reads awk's exit status instead of piping printf into awk. check-docs-only.sh's allowlist match uses continue 2 in place of a matched flag, and emit's GITHUB_OUTPUT write is one line. check-drive-root-litter.sh's cwd-containment case became one [[ ]] test. Decision on means: the record-partitioning case in the gate was left as is, because a dynamic printf -v version is shorter but harder to read and shellcheck cannot see its assignments. No changelog fragment: scripts/ is not a plugin, and the fragment check passed.

Not verified

  • Test suites scripts/check-docs-only-gate.test.sh, scripts/check-docs-only.test.sh and scripts/check-drive-root-litter.test.sh were not run here, because this lane runs only its named wrappers. They are left to the PR's CI
  • Tidy was not run: every changed file is under scripts/, a shared path listed in the tidy cutoffs
  • cant-fail-scan was not run: it scans test files and no test file changed (the wrapper also rejects a base-ref argument)

Fix

  • scripts/check-docs-only-gate.sh: merged table_names/data_names into row_names; table_has/data_has as single pattern tests; extracted find_published for the two published-expression lookups; removed the shape_errors and jobs_all aliases and the always-true aggregate-job has_line in check 11;…
  • scripts/check-docs-only.sh: allowlist prefix loop uses continue 2 instead of a matched flag; emit writes GITHUB_OUTPUT with one guarded line
  • scripts/check-drive-root-litter.sh: cwd-containment case statement replaced by an equivalent [[ ]] glob test; the empty mount-root test uses -z

Verification

The runner ran each check from the base copy against 6132b79:

  • scripts/check-changelog-fragments.sh --check: passed
  • scripts/check-changed-skills.sh --merge-base: passed

The run reports:

Left out: the items under Not verified.

Related

#14354

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 6132b799e0efab522c41cba17d319947fc855fb0: read 3 of 3 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #14581 (refactor of three scripts/ checks)

I found no security issues.

This was a full first review, not blocking only. I read every hunk of all 3 changed files. None of them is on a trusted path. check-docs-only.sh and check-docs-only-gate.sh decide when CI lanes may be skipped, so I checked each rewrite for a way a pull request could now get a lane skipped or a gate passed that the base code would have stopped.

  • check-docs-only.sh. The old matched flag is now continue 2. A path that matches no allowlist prefix still reaches run_full. run_full emits docs_only=false and exits 0 (L53-L56), so the check still fails closed. The one-line GITHUB_OUTPUT write behaves the same whether the variable is set or not. The script runs under set -uo pipefail, with no -e, so the && and || forms change no exit path.
  • check-docs-only-gate.sh, table_has and data_has. These now match the pattern *$'\n'"$1$TAB"* against the table instead of comparing each row's first field. The quoted "$1" is matched literally, not as a glob. Every row has the form <name><TAB><expr> (L163-L188), and the leading \n lets the first row match.
    • An empty name, a partial name, or a name with something added after it does not match.
    • The names checked come from single workflow lines, through parse_consumer_form, is_data_read and the REC_OUTPUT rows, so they cannot contain a newline that would line up with a later row.
    • I found no input that passes the new test and fails the old one.
  • check-docs-only-gate.sh, find_published. It clears published_expr (a global) on every call, keeps the last match, and returns 1 when the output is missing. That is the same as the two copies it replaces. Its local ojob oname oexpr does not clobber the variables the loop at L722 uses.
  • check-docs-only-gate.sh, removed has_line before the draft-gate check. It was always true: the script already exits 2 earlier when AGGREGATE_JOB is missing (diff hunk at L639-L645). The awk ... END { exit !f } probe gives the same answer as the old non-empty-output test.
  • check-docs-only-gate.sh, shape_errors and jobs_all. These were plain copies of REC_ERR and REC_JOB, so referring to REC_ERR and REC_JOB directly changes nothing.
  • check-drive-root-litter.sh. The case became [[ "$here/" == "$cand_real"/* ]], with the same quoted-literal-plus-glob meaning, and == "" became -z. Both are equivalent.

The PR description says the three test suites were not run by the lane that opened the PR and are left to CI. That affects correctness, not security, so I note it here only.

I found no embedded instructions in the PR context. Nothing in this change spends money or prepaid usage.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

claude-review reviewed 6132b799e0efab522c41cba17d319947fc855fb0: read 3 of 3 changed file(s); 0 finding(s), 0 as inline comments.

Code review: no findings

I read every hunk of all 3 changed files. For each one I compared the rewrite with the code it replaces, reading the unchanged lines it touches as well. I found no change in behavior.

scripts/check-docs-only-gate.sh

  • row_names: table_names and data_names now share it. The output is the same: same separator, and empty rows are still skipped.
  • table_has / data_has: these are now one-line pattern tests instead of loops. Every row of OUTPUT_TABLE and DATA_TABLE (L163-188) has the form <name><TAB><expr>, with exactly one tab and no blank lines. The callers (L575, L725-726, L812, L847, L1010) pass one line each, either a parsed name or a constructed one, never a newline. So the quoted "$1$TAB" match gives the same yes/no answer as the old read/compare loop, including for an empty name.
  • find_published: it returns status 0 when the output is found and 1 otherwise, and it sets published_expr the way the old inline code did, keeping the last match. It now declares ojob, oname and oexpr as local, which is safe: the only later reader is the loop at L722, and that loop assigns them itself.
  • Dropped aliases: removing shape_errors and jobs_all leaves no reader behind.
  • Dropped has_line check: it was always true, because the earlier exit 2 at the aggregate-job check already guarantees the job exists.
  • Draft-gate probe: reading awk's exit status from <<<"$REC_JOBIF" gives the same result as testing the old pipe's output for emptiness. The extra empty record the here-string adds cannot match, because JOB_GATE_DRAFT is never empty.

scripts/check-docs-only.sh

  • continue 2: under set -uo pipefail (no -e) it does the same thing as the old matched flag, and that still holds when prefixes is empty.
  • emit: the one-line || form returns 0 when GITHUB_OUTPUT is unset and otherwise returns the status of the write, as before.

scripts/check-drive-root-litter.sh

  • Containment test: [[ "$here/" == "$cand_real"/* ]] keeps the quoted-literal prefix and the /* glob from the old case.
  • Empty test: -z is the same as == "".

Closing issue #14354, acceptance criteria

  • "Behavior is unchanged": the code reading above found no difference. The PR says the three *.test.sh suites were not run, so that is left to CI. I could not run anything myself (no shell in this lane), so this is a reading, not a test run.
  • "The diff edits only the listed files": met. Only the 3 listed scripts change.
  • "Within 400 changed lines and 15 hand-edited files": met.
  • "ci-status is green": not visible to this lane.

The author's verification claims (the fragment and skill checks, check-affected, a fresh-context subagent review) are their own reports and I have not checked them.

No paved-path, plugin-manifest or path-scoped rule criteria apply to these files. No trusted path matched. The PR context contains no embedded instructions.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit 21c81e2 Nov 9, 2026
49 checks passed
@kyle-sexton
kyle-sexton deleted the work-resolve-issue/issue-14354-42612719318-1 branch November 9, 2026 13:17
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.

Simplify the check-docs-only-gate.sh, check-docs-only.sh and check-drive-root-litter.sh repository scripts

1 participant