Skip to content

feat(toolchain): warn at turn end when the tree's recorded check or lint result is not a pass - #11684

Merged
kyle-sexton merged 5 commits into
mainfrom
replace/11519-toolchain-tree-warn
Oct 31, 2026
Merged

kyle-sexton merged 5 commits into
mainfrom
replace/11519-toolchain-tree-warn

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Closes #11500

Summary

Replaces #11519, a lanes App pull request that conflicted with main. Merging main into it stages .github/workflows files, which the App cannot push, so this owner-login branch carries the same change: #11519's head (baf98ff) merged into current main.

/toolchain:check and check-mode /toolchain:lint record their Overall line per working-tree id, and a new Stop hook (plugins/toolchain/hooks/result-gate.mjs) warns at turn end when the tree's recorded result is not a pass, or no result is recorded for a changed tree. The turn_end_result_gate option (advisory by default, enforce blocks once on a recorded FAIL, off is silent) is read from user and managed settings only. #11519's body has the full design notes and its known limits.

Fix

  • Same files as feat(toolchain): warn at turn end when the tree's recorded check or lint result is not a pass #11519: plugins/toolchain/lib/tree-result.mjs, scripts/record-result.mjs, hooks/result-gate.mjs, hooks/hooks.json, hooks/result-gate.test.sh, hooks/plugin-options.mjs (shared copy of lib/plugin-options.mjs), plugin.json, prerequisites.json, the check and lint skills, the README, scripts/shared-copies.txt, and the changelog fragment.
  • Conflict in docs/catalog.md (generated from the manifests): took main's file and reran scripts/generate-catalog.mjs, which keeps main's newer sql-server line and this change's toolchain description.
  • The diff against main touches no .github/workflows file.
  • File and directory swaps (review thread on tree-result.mjs): before this fix, an unstaged change that replaced a tracked file with a directory, or a tracked directory with a file, made update-index fail on the scratch index. treeHash threw, record-result.mjs exited 2, and the Stop hook stayed silent. Now a listed path that has become a directory over a file or symlink entry is removed with --force-remove first and left out of the add pass, and the add pass runs with --replace, so a path that has become a file drops the entries under it. Submodule (gitlink) entries are kept.

Verification

  • bash plugins/toolchain/hooks/result-gate.test.sh: 48 passed, 0 failed, exit 0. The four new cases ("a tracked file replaced by a directory hashes to the staged tree", "a file-to-directory swap records a result", "a tracked directory replaced by a file hashes to the staged tree", "a directory-to-file swap records a result") failed before the fix: 44 passed, 4 failed, exit 1.
  • scripts/check-affected.sh --uncommitted on the swap fix: 13 passed, 5 skipped, exit 0.
  • Earlier, on the merge: scripts/check-affected.sh --tests --no-fetch 14 passed, 2 skipped; node scripts/generate-catalog.mjs --check in sync; bash scripts/sync-shared-copies.sh --check all 548 copies match; all exit 0.

Related

🤖 Generated with Claude Code

melodic-automation-lanes Bot and others added 4 commits October 31, 2026 10:59
Lane-Activity: work-resolve-issue/resolve-issue
Lane-Activity: pr-unblock/address-feedback
Lane-Thread: PRRT_kwDOTCGFQM6yQO1c
Lane-Thread: PRRT_kwDOTCGFQM6yQO5L
…11519-toolchain-tree-warn

# Conflicts:
#	docs/catalog.md
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T19:52:15.934906Z 9cf1a3f PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

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

Incremental review of the changes since 9cf1a3f: the changelog fragment, plugins/toolchain/hooks/result-gate.test.sh and plugins/toolchain/lib/tree-result.mjs. I found nothing to flag. I did not run the tests or the code, so the checks below come from reading.

  • File-to-directory swap. The old tracked path f is listed by ls-files --modified/--deleted, and lstatSync shows it is now a directory. ls-files --stage with GIT_LITERAL_PATHSPECS finds its index entry, and --force-remove drops it. The later --add --remove --replace pass then adds f/inner, which matches what git add -A stages.
  • Directory-to-file swap. --replace on d drops d/x and d/y. The later --remove of those two paths hits an ENOTDIR lstat error, which update-index treats as a missing file. Either processing order gives the same index.
  • Submodules. A submodule entry (mode 160000) is not removed, so a modified submodule keeps its gitlink.
  • Nested repositories. Untracked nested repositories ending in / are still filtered out first.
  • Tests. The new cases compare against a real git add -A / write-tree on a copied index, and each also checks that record-result.mjs exits 0.

No closing-issue criteria or manifest items were touched by this delta. No spend or billing change is involved.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9cf1a3f726

ℹ️ 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".

Comment thread plugins/toolchain/lib/tree-result.mjs Resolved
@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

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

No security issues found in the incremental change since 9cf1a3f. It covers three files: the changelog fragment, result-gate.test.sh, and tree-result.mjs.

I read the whole tree-result.mjs change and the surrounding file. This is what I checked:

  • Command injection: git is run with execFileSync and an argument array, so there is no shell. Paths reach git in two ways. In update-index they go over stdin with -z. In ls-files --stage they come after --, with GIT_LITERAL_PATHSPECS=1, so a path such as -x or one containing glob characters can't be read as an option or pattern.
  • Path traversal and symlinks: lstatSync(join(repo.top, path)) only receives paths that git ls-files printed for this repository. lstat doesn't follow symlinks, so a symlink that points at a directory is not mistaken for one, and nothing outside the repository is read.
  • Index safety: every index write targets the scratch copy through GIT_INDEX_FILE, so the real index is never changed. --force-remove only runs against that copy, and the scratch directory is removed in finally.
  • Gate behaviour: the new code makes the recorded tree id match what git add -A would stage in the file-to-directory and directory-to-file swap cases. This fixes a case where a result could be matched to the wrong tree. It adds no way to make a stale PASS count for a changed tree. The code touches no token, secret, trusted-actor list, kill switch or merge hold. The turn_end_result_gate option is advisory by default and is read from user or managed settings.
  • Tests: the new cases run in $WORK temporary repositories with fixed -c user.name and -c user.email values and no network access. The LIB path is interpolated into a node -e string, but it comes from the test's own $INSTALL, not from untrusted input.
  • Changelog fragment: documentation only.

No manifest fields changed and no instruction surface was touched, so there are no manifest <field> lines.

critical-findings: 0

An unstaged change that replaced a tracked file with a directory, or a
tracked directory with a file, made update-index fail on the scratch index,
so treeHash threw, record-result.mjs exited 2 and the Stop hook stayed
silent. A listed path that is now a directory over a file or symlink entry
is force-removed first and left out of the add pass; --replace lets a path
that became a file drop the entries under it. Submodule entries are kept.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 31, 2026
Merged via the queue into main with commit 32366fa Oct 31, 2026
63 checks passed
@kyle-sexton
kyle-sexton deleted the replace/11519-toolchain-tree-warn branch October 31, 2026 21:50
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

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

File Killed Survived Timeout No coverage Invalid Not run
plugins/toolchain/hooks/plugin-options.mjs 0 0 0 0 0 1
plugins/toolchain/hooks/result-gate.mjs 0 0 0 0 0 1
plugins/toolchain/lib/tree-result.mjs 2 1 0 0 0 0
plugins/toolchain/scripts/record-result.mjs 1 1 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
plugins/toolchain/lib/tree-result.mjs:164 SBR productive input-gap
plugins/toolchain/scripts/record-result.mjs:30 SBR 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(toolchain): warn at turn end when the tree's recorded check or lint result is not a pass

1 participant