Skip to content

feat(testing): keep test writes in a temp dir and destructive tests in a sandbox - #16955

Merged
kyle-sexton merged 2 commits into
mainfrom
feat/testing-write-isolation-rules
Nov 17, 2026
Merged

kyle-sexton merged 2 commits into
mainfrom
feat/testing-write-isolation-rules

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

No related issue: workshop 06 close-out, owner decision Q774 (2026-11-17)

Summary

/testing:write had no rule keeping a test's writes inside a temporary directory, and none keeping a test of a destructive command away from the real machine. Its determinism controls now carry both, beside the order-independence and parallel-isolation rules.

Fix

  • Writes stay in a temp directory: every test, and the code under test, writes only under a per-test or per-suite temporary directory, removed on every exit path through the runner's teardown or cleanup hook.
  • Destructive commands run in a sandbox: a test of a command that deletes, overwrites, rewrites history, changes system or user configuration, or touches the network or credentials runs only in a throwaway sandbox (temporary home and working directory, stubbed PATH or tool, or a container), never against the real machine, repository or home.
  • Both rules are stack-neutral and name no tool. A testing changelog fragment (minor) is added.

Verification

  • scripts/validate-plugins.sh --only testing: "All plugin manifests and the catalog validated."
  • validate-cases.py plugins/testing/evals: WARN lines only (pre-existing allowed_tools and calibration notes), no FAIL.
  • scripts/check-changelog-fragments.sh --check-required origin/main: every changed fragment-mode plugin (1) has a fragment.

Related

  • testing:audit has no rule id for a missing temp-dir cleanup or a write outside a temp dir; its rule table covers tests that cannot fail or check little, so nothing was added there.

🤖 Generated with Claude Code

…n a sandbox

testing:write's determinism controls gain two rules: every test, and
the code under test, writes only under a per-test or per-suite temporary
directory removed on every exit path; a test of a destructive command
runs only in a throwaway sandbox, never against the real machine,
repository or home.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 17, 2026 21:56
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T21:58:14.931330Z 2a2c4a1 Draft marked ready
ℹ️ 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 Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 78cae540e1d2af9ca3e2fd22ffe6f97a935a7936: read 1 of 1 changed file(s); 0 finding(s), 0 as inline comments.

Security review (incremental, blocking only): no security issues found

Scope. This review covers only the change since 2a2c4a17. That change is one hunk in plugins/testing/skills/write/context/write.md (the "Destructive commands run in a sandbox" bullet), and I read all of it. This lane already reviewed an earlier head (blocking only: yes), so only CRITICAL and IMPORTANT findings would be reported.

What changed. The bullet now handles remote and credential effects separately from local filesystem and configuration effects:

  • A command that deletes, overwrites, rewrites history or changes system or user configuration still runs in a throwaway sandbox: a temporary home and working directory, a stubbed PATH or tool, or a container.
  • A command that writes to a remote or uses credentials must also run with credential variables cleared and its remote replaced by a local fake, such as a bare repository or a stub server. The text now says that a temporary home, or a container with network access, does not isolate such a command.
  • The bullet now defers to the Network control at write.md#L114. An integration test may opt in only to hosts it owns for testing, which is narrower than "the hosts it needs". The bullet's guarantee now also covers "a real remote".

Instruction-surface lens. The phrase "touches the network" was dropped from the first sentence. That removes no protection:

  • Remote writes and credential use are now covered by a stricter rule in the second sentence.
  • Network access in general stays under the Network control on line 114 (blocked by default in unit tests), and this bullet now restricts that control further.

So the change narrows what a generated test may do and softens nothing. It adds no tool grant, no command the session runs, and no path for untrusted input to reach an action.

Trust controls and manifests. The file matches no trusted-path glob. The change touches no trust control, plugin manifest, userConfig key, workflow, token request or merge hold.

Settled threads. The thread on this bullet (resolved, owner reply by kyle-sexton) asked for cleared credentials, a faked remote and a reconciliation with the Network control. The new text does all three. I raise nothing again.

PR context. The description's Fix section still describes the earlier wording of the sandbox bullet, the one that included "touches the network or credentials". The code is stricter than that description, so this is not a security issue. The description contains no instructions aimed at this lane.

Prior findings. The only earlier entry is the clean summary from the previous head, so nothing needed to be marked as already posted.

critical-findings: 0

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

claude-review: 1 inline finding(s) on 2a2c4a17bd584c91d2d79a722f1a4b390ee10171; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 78cae540e1d2af9ca3e2fd22ffe6f97a935a7936: read 1 of 1 changed file(s); 0 finding(s), 0 as inline comments.

Code review: PR #16955 (incremental, blocking only). Since 2a2c4a17 the only change is a rewrite of the Destructive commands run in a sandbox bullet in plugins/testing/skills/write/context/write.md. I found no blocking problems in it.

The earlier finding is fixed. My earlier comment on line 119 (the thread is now resolved) said the bullet's sandbox options did not isolate network and credential effects, and that it conflicted with the Network control. The new text answers both points:

  • Network and credential effects: a command that writes to a remote or uses credentials now also runs with credential variables cleared and its remote replaced by a local fake (a bare repository or a stub server). The text also says outright that a temporary home, or a container with network access, does not isolate it.
  • Conflict with the Network control: the bullet now defers to that control and narrows its opt-in to hosts the test owns for testing. The closing clause adds "a real remote".

Advisory points left out. The review was blocking only, because this lane already reviewed an earlier head. So it left out two advisory points about wording:

  • The Network control on line 114 still reads "the hosts it needs".
  • The PR description's Fix section still describes the bullet with its old scope ("touches the network or credentials").

Other checks:

  • Closing issue: none. The PR cites owner decision Q774, so there are no acceptance criteria to check.
  • Path-scoped rule: .claude/rules/skill-bodies-state-current-rules.md matches this file. The revised bullet states the repository's own rule and names no tool, so it breaks no part of that rule.
  • Verification: the PR's verification section is the author's claim and I did not check it. This lane ran nothing.
  • Embedded text: none found in the PR context, the settled threads or the prior findings.

Loosened-check verdict: fail (the default, because the wrapper supplied no loosened_check_verdict: or loosened_check_patterns: lines); patterns: 0. The change loosens no check.

Verifier dropped 0 of 0 candidates.

A temporary home or a container with network access leaves credential
variables and real remotes in reach. A destructive command that writes
to a remote or uses credentials now also runs with credentials cleared
and a local fake remote, and the rule defers to the Network control:
an integration test opts in only to hosts it owns for testing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit e27b987 Nov 17, 2026
49 checks passed
@kyle-sexton
kyle-sexton deleted the feat/testing-write-isolation-rules branch November 17, 2026 22:21
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant