Skip to content

feat(instruction-placement): add a quote-check script over the mechanics source list - #10617

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-9697-40640254879-1
Oct 28, 2026
Merged

melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-9697-40640254879-1

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #9697

Summary

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

Adds scripts/quote-check.sh. It reads only context/mechanics-sources.tsv and takes no arguments. It fetches each page once through fetch-docs.sh --cache --max-age 0, takes the section the URL's anchor names with docs-cache.sh slice, and prints verified <id>, drift <id> <url> with the stored and fetched sentences, or unverified <id> as of <as_of>, exiting 0 whatever the results are. QUOTE_CHECK_FIXTURE_DIR points it at local page snapshots, and scripts/quote-check.test.sh uses that to cover the verified, drift and unverified cases without touching the network.

Not verified

  • bash plugins/instruction-placement/scripts/quote-check.test.sh was not executed: this lane runs no bash script outside its named wrappers, and check-affected runs without --tests. Left to the PR's CI (affected-tests --run). Its assertions were traced by hand only.
  • bash scripts/affected-tests.sh --run (an issue Done-when item) was not executed here for the same reason; left to the PR's CI.
  • The 'extra-arg exits non-zero with a usage message' Done-when item was checked by reading the code and a test assertion, not by running the script.
  • A live run against code.claude.com was not made, so whether the 34 shipped quotes verify against today's pages (including whether real docs anchors match headings under the letters-and-digits rule) is unchecked.
  • Tidy skipped: the change is about 380 changed lines, over the 300-line tidy cutoff.
  • The new .sh files were written without the executable bit (the lane cannot chmod). Both are run with bash <path>, as the issue's commands do.
  • git status lists untracked dotfiles and directories at the checkout root (.bashrc, .bash_profile, .gitconfig, .idea, .mcp.json, .profile, .ripgreprc, .vscode, .zprofile, .zshrc). This run did not create them and they are not part of the change; they look like sandbox artifacts.
  • Wiring quote-check.sh into the audit or realign skills' allowed-tools is not in this issue's scope and was not done.

Fix

  • plugins/instruction-placement/scripts/quote-check.sh: new script. Rejects any argument with a usage message (exit 2). Fetches through fetch-docs.sh with no network request of its own. Matches each quote per the verified-mechanics.md quote rule: link markup dropped, bold dropped outside code spans, t
  • plugins/instruction-placement/scripts/quote-check.test.sh: new suite over fixture snapshots, run through the real fetch-docs.sh and docs-cache.sh. Covers verified (plain, link and bold, table row, glob inside a code span, no-anchor URL), drift (changed sentence with both wordings printed, quote foun
  • .changes/instruction-placement/feat-9697-quote-check-script-7c2e41b9.md: minor changelog fragment for the new script.

Verification

The runner ran each check from the base copy against b8a07d7:

  • scripts/check-changelog-fragments.sh --check: passed

The run reports:

  • .lane/checks/bin/check-changelog-fragments: all 8 fragments under .changes/ valid
  • .lane/checks/bin/check-affected: 12 passed, 6 skipped over the 3 changed files. The first run failed shellcheck SC2016 in the test file; that is fixed and the rerun passed
  • .lane/verify/bin/cant-fail-scan --file plugins/instruction-placement/scripts/quote-check.test.sh --check: PASS, no gating findings
  • Grep for curl|wget in plugins/instruction-placement/scripts/quote-check.sh: no matches
  • Fresh-context review subagent: hand-traced every test assertion against fetch-docs.sh and docs-cache.sh and expected all to pass. It found four bugs, all fixed: '**' was stripped inside code spans (shipped record MS-24 would always drift), a URL with no anchor always drifted, an empty middle TSV fie
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/40640254879

Left out: the items under Not verified.

Related

#9697

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

Copy link
Copy Markdown
Contributor

claude-security-review reviewed b8a07d77f6344d7394ed66f1f17e695962a0c13c: 0 finding(s), 0 as inline comments.

I found no security issues in this pull request.

The pull request adds three files: plugins/instruction-placement/scripts/quote-check.sh, plugins/instruction-placement/scripts/quote-check.test.sh and a changelog fragment. None matches a trusted path, and no plugin.json or marketplace.json changed, so there are no manifest <field> lines to report. I read only the diff and the PR context, and I did not run the scripts.

What I checked in quote-check.sh:

  • Fetch scope: It takes no arguments and exits 2 on any (quote-check.sh:89-93). Its URLs come from the shipped context/mechanics-sources.tsv, and it makes no request of its own. The list override QUOTE_CHECK_SOURCES is read only when QUOTE_CHECK_FIXTURE_DIR is also set (quote-check.sh:96-99), and in that case the fetch is also redirected to local snapshots, so an environment variable cannot point a live run at other URLs. A caller who sets those variables already controls the process environment.
  • Injection: The quote reaches awk through ENVIRON (QC_QUOTE) and the anchor through awk -v, not through string interpolation into program text. jq receives the URL through --arg. The values from the list are always quoted when expanded. Nothing from a fetched page is evaluated: page text only goes to awk for comparison and is printed.
  • Fetched docs content: sid is the first field of the docs-cache.sh map output and goes to docs-cache.sh slice as an argument. A docs page is not an attacker-controlled source here, and a malformed value would at worst fail the slice. The script then reports unverified or drift, and exit stays 0.
  • Temp files and secrets: It uses a mktemp -d work directory that a trap removes. It handles no tokens or credentials, and it sets FETCH_DOCS_CLAUDE_BIN='', which disables the Claude binary path in the fetcher.
  • Test file: It only uses local fixtures under a mktemp scratch directory and asserts the script contains no curl or wget.

Spend: none, since the change touches no model, turn or schedule settings. It adds no workflow, permission, token or trust-control change.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed b8a07d77f6344d7394ed66f1f17e695962a0c13c: 0 finding(s), 0 as inline comments.

No findings. Nothing was run, since this lane has no shell. I read the three changed files against fetch-docs.sh, docs-cache.sh, the shipped context/mechanics-sources.tsv and the closing issue #9697.

What I traced by hand

  • docs-cache.sh interface:
    • map --file prints id, level, start, end, bytes, hash, heading-path, so $7 in SECTION_AWK is the heading path.
    • --escalate-percent and --escalate-bytes are accepted before slice.
    • 999999999999999999 passes the 18-digit validation.
    • At 100 percent, cnt*100 > 100*total can never hold, so a large section never escalates to the whole page.
    • A parent's slice includes its children, which the script's section-scoped match relies on.
  • Heading match: the letters-and-digits reduction matches the shipped anchors, including how-claude-md-files-load against How `CLAUDE.md` files load. It also matches the instructions-seem-lost-after-/compact anchor.
  • quote-check.test.sh: I hand-traced the expected output for T-1 to T-11. The drift sentence picked for T-4 and the "no sentence shares a word" result for T-5 both follow from the awk.
  • Closing issue feat(instruction-placement): add a quote-check script over the mechanics source list #9697, Done-when items:
    • The curl|wget grep is a test assertion, and the script text contains neither word.
    • The extra-arg exit 2 with usage is in the script and tested.
    • The verified, drift and unverified cases are all covered.
    • Running quote-check.test.sh and affected-tests.sh --run is left to CI, as the PR says.
  • Manifest: the lane's manifest checks don't apply, since no plugin manifest changed. The bump: minor fragment fits a new script.
  • Spend: the change spends no money. Live runs fetch about 34 docs pages through the existing fetch-docs.sh.

Not verified (author-claimed or unreachable here)

  • I did not confirm that the 34 shipped quotes verify against today's live docs. This is the PR's own caveat. The first live run may report drift where the docs markup differs from what rendered() handles, for example italics or HTML components. That would be a quote-list matter, not a script defect.
  • I did not run the suite. CI has to show it passing.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head b8a07d77f6344d7394ed66f1f17e695962a0c13c.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Oct 28, 2026
Merged via the queue into main with commit 0fc9a0a Oct 28, 2026
43 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-9697-40640254879-1 branch October 28, 2026 06:36
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 5, survived 3, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 63%; mutation score 63%.

File Killed Survived Timeout No coverage Invalid Not run
plugins/instruction-placement/scripts/quote-check.sh 5 3 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
plugins/instruction-placement/scripts/quote-check.sh:78 LCR productive input-gap
plugins/instruction-placement/scripts/quote-check.sh:97 SBR productive input-gap
plugins/instruction-placement/scripts/quote-check.sh:105 ROR productive input-gap

The run's summary has the full report.

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.

feat(instruction-placement): add a quote-check script over the mechanics source list

0 participants