From 5a1128df16cf45d3ebafd2aac216619006f27df8 Mon Sep 17 00:00:00 2001 From: Daniel Petty Date: Thu, 22 Oct 2026 23:55:17 +0000 Subject: [PATCH] chore(settings): allow the devops, openspec and tuicr commands, and drop the read denies The person wants agents to do project and cluster work without a prompt for the `devops`, `openspec` and `tuicr` commands. The person also wants agents to read all files of the project folder and the kubeconfig. On 2026-10-22 the person chose the entries below. The allow list of `.claude/settings.json` becomes `Bash(uv run devops *)`, `Bash(openspec *)` and `Bash(tuicr *)`. The deny list goes. The three `Read` denies go with it, and so does `tests/test_claude_code_settings.py`, which pinned them. So the settings now block nothing. An agent can read `~/.kube/**`, `~/.claude/settings.json` and `.claude/settings.local.json` with the Read tool. It can run every `openspec` and `tuicr` command, including `openspec archive`, `openspec init` and the interface of `tuicr`. The task files of #1844, #1846, #1882 and #1884 and ADR 0010 now say what the settings allow and what they do not enforce. The task file of #1154 says that the deny rules and their test are gone. Part of #1844 --- .claude/settings.json | 9 +-- ...c-is-the-spec-and-change-proposal-layer.md | 6 +- .../task-1154-agent-session-prerequisites.md | 1 + .../task-1844-openspec-scaffold-and-gate.md | 63 +------------------ ...e-openspec-gate-drops-the-cut-only-code.md | 8 +-- .../task-1882-pin-gh-dash-and-ship-config.md | 2 +- .../task-1884-pin-tuicr-and-ship-config.md | 31 ++------- tests/test_claude_code_settings.py | 28 --------- 8 files changed, 19 insertions(+), 129 deletions(-) delete mode 100644 tests/test_claude_code_settings.py diff --git a/.claude/settings.json b/.claude/settings.json index 1b61e09714..bc623e58ca 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -14,12 +14,9 @@ }, "permissions": { "allow": [ - "Bash(uv run devops *)" - ], - "deny": [ - "Read(//**/.claude/settings.local.json)", - "Read(~/.claude/settings.json)", - "Read(~/.kube/**)" + "Bash(uv run devops *)", + "Bash(openspec *)", + "Bash(tuicr *)" ] } } diff --git a/docs/adr/0010-openspec-is-the-spec-and-change-proposal-layer.md b/docs/adr/0010-openspec-is-the-spec-and-change-proposal-layer.md index 140108caf8..dbbfc517b7 100644 --- a/docs/adr/0010-openspec-is-the-spec-and-change-proposal-layer.md +++ b/docs/adr/0010-openspec-is-the-spec-and-change-proposal-layer.md @@ -60,7 +60,7 @@ git merge # two archived changes to one capability: CONFLICT; two unarchived, - **Delivery.** `tools.lock` gains an `npm` kind. `[npm.openspec]` pins 1.14.3 beside `src/devops_cli/tools_lock/openspec/package.json` (the exact version) and `package-lock.json` (57 packages, all sha512, all on `registry.npmjs.org`, none with an install script), and `tools_lock_digest()` covers both. `devops install-tools` stages beside the version directory, copies the two files and two empty npmrc files, runs `npm ci --ignore-scripts --no-audit --no-fund --engine-strict --replace-registry-host=never` in the sanitized environment plus an explicit `npm_config_cache`, `npm_config_userconfig` and `npm_config_globalconfig` (npm refuses user and global config that are one file, and a configured registry would otherwise rewrite the lock's URLs), renames into `/tools/openspec/1.14.3` and links `node_modules/.bin/openspec` into `~/.local/bin`. `devops devcontainer post-create` (the devcontainer's `postCreateCommand`) already installs every lock tool, and the prototype took 4.9 s cold. It reports a failed bootstrap, a missing `npm` or a failed `npm ci`, as a warning, so the hard failure is `devops install-tools`, which fails early with `require_binary("npm", ...)` since the installer provisions no runtime, Python's included, and the gate row. `.node-version` holds `24`, the devcontainer's `node` feature is pinned to `24`, a contract test keeps the two equal, and CI's `static` job runs `actions/setup-node` pinned to v7.1.0 (`949feb2413d6458794dcd2491c4babbbce0c15c1`, resolved with `devops gh api`) and `uv run devops install-tools --tool openspec --only-missing` before the gate. The `audit` row of `devops ci` gains `npm audit --package-lock-only --json --prefix src/devops_cli/tools_lock/openspec` beside `uv audit` (tried against the pin: no vulnerabilities, no install needed), so a vulnerable pin fails the gate; nothing signals a stale one. npm exits 1 for a finding and for an audit that could not run, such as an unreachable registry, so each command is read by its own signal: uv by its exit status (1 against 2), npm by its JSON report (`metadata.vulnerabilities` counts against an `error` object). The bump runbook in the `tools.lock` header: set the version in `tools.lock` and `package.json`; run `npm install --package-lock-only --ignore-scripts`; run `uv run devops openspec regenerate` and commit the skills; run the gate; run `npm audit signatures` and `osv-scanner scan source --lockfile package-lock.json`; run the lock and installer tests; run `devops install-tools --check`. The pin never goes below 1.14.3, which fixes `validate --all` hanging under pre-commit (from its release notes; not reproduced). The `Dockerfile` service stage gains a digest-pinned Node stage and `npm ci --ignore-scripts` from the same lockfile (step 6), because the refine job of step 8 runs `openspec instructions` there when the roadmap Service runs (#1562 suspends it). - **Where the binary comes from.** The devcontainer gets it from post-create and CI's `static` job from its install step. The Copilot cloud agent gets it from `copilot-setup-steps.yml`, which GitHub runs only from the default branch: until the release that carries the file merges to `main`, that agent finds the committed skills and no binary. Claude Code in the cloud and a Gemini CLI host shell get it from `uv run devops install-tools --tool openspec --only-missing`, which needs Node 24, and AGENTS.md says so. Every generated skill starts with `openspec list --json` and has no branch for a missing binary, so AGENTS.md also tells an agent that cannot install it to write the artifacts by hand from `openspec/config.yaml`, and CI validates them. - **Telemetry and regeneration.** Telemetry is off in every environment. The gate and hook module sets `DO_NOT_TRACK=1`, `OPENSPEC_TELEMETRY=0`, `OPENSPEC_NO_UPDATE_CHECK=1`, `OPEN_SPEC_INTERACTIVE=0` and `XDG_CONFIG_HOME` in the child's environment (the `env` argument of `run_subprocess`, not `extra_allowed_env`, which only keeps a variable the parent already has), because the sanitized child environment of `devops` (the allowlist in `src/devops_cli/core/process.py`) keeps `HOME` and `CI` but none of these, and without `XDG_CONFIG_HOME` the tool would read the developer's real `~/.config/openspec`. The devcontainer sets `OPENSPEC_TELEMETRY=0` and `OPENSPEC_NO_UPDATE_CHECK=1` beside its `DO_NOT_TRACK=1`, and its template and test follow. CI sets `DO_NOT_TRACK: "1"` at the top of the workflow, though the runner's `CI=true` already suffices. The committed `.claude/settings.json` gains an `env` block with the same variables. A host shell or another agent's cloud environment runs `OPENSPEC_TELEMETRY=0 openspec config set telemetry.enabled false` once, a person step, with the prefix, since the command sends an event first. The skills are regenerated only against an isolated config: `uv run devops openspec regenerate` makes a temporary `XDG_CONFIG_HOME`, sets `telemetry.enabled false`, `delivery skills`, `profile custom` and the four workflows in it, and runs `openspec update --force` in the tree (which changed no file on a second machine; the same command under the `core` profile would also add the archive and sync skills); a bare `openspec update` is forbidden because it takes the user's global profile. -- **Agent files and `openspec/config.yaml`.** The generated skills are committed: a cloud agent or fresh clone never runs an install but reads the checkout. `.gitignore` re-includes only `.claude/skills/openspec-*/` (`!.claude/skills/` then `.claude/skills/*` then `!.claude/skills/openspec-*/`, tried: other skills, `settings.local.json` and `worktrees` stay ignored). A hermetic test requires `metadata.generatedBy` in all eight `SKILL.md` to equal the pin, and the two trees to be identical. The `.claude/settings.json` allowlist gains the verbs the four skills call (`openspec status`, `list`, `instructions`, `context`, `show`, `schemas`, `validate` and `new change`), and no bare `Bash(openspec *)`. It also gains `permissions.deny` entries for `openspec init`, `update`, `archive`, `config` and `completion`: every generated skill carries `allowed-tools: Bash(openspec:*)`, which grants the whole verb set during the turn and which the project never hand-edits, and Claude Code evaluates deny rules before allow rules, so a deny entry holds where a narrow allowlist would not (documentation read on 2026-10-22; a Bash deny rule is not a security boundary around the program, so readiness stays the backstop). `GEMINI.md` is added as a third pointer stub (`@./AGENTS.md`, the form the Gemini CLI documentation shows) through the existing generator, since Gemini CLI loads `GEMINI.md` by default and `AGENTS.md` only through `context.fileName`. `.github/workflows/copilot-setup-steps.yml` is written by hand, with SHA-pinned actions, the pinned install and the opt-outs; `--copilot-cloud` is not used, because its generated workflow runs an unpinned `actions/checkout@v4` and `npm install -g @fission-ai/openspec`. `devops ai agents` generates no OpenSpec file. The default `spec-driven` schema is kept: a fork copies 16 KB of upstream instructions and four templates that change weekly, and the project needs no structural change. Rules are advisory prompts, so what must hold keeps a mechanical check: the gate, readiness and `tests/test_change_folders.py` (every active folder is named `-`; `proposal.md` and `tasks.md` exist and `tasks.md` holds at least one `## .` group with a task-list item, since a folder of only `.openspec.yaml` and a delta passes `openspec validate --strict` and the readiness path rule (tried); `proposal.md` has `## Feasibility` and `## Existing Tool Considered` headings found with the markdown parser already a dependency; and no `PR`, `Status`, `Milestone` or `Priority` line). AGENTS.md states only what binds an agent that never runs `openspec` (where the folder lives, who archives, the entry points and the no-binary fallback) and points to `config.yaml` for every artifact convention; the one fact in both, the folder name, is enforced by readiness and that test, so no test has to keep the two documents in agreement. The file below was rendered through `openspec instructions` for the proposal, specs, design, tasks and apply operations with an empty stderr. The folded scalars (`- >-`) are not decoration: a plain scalar containing ` #` is silently cut at the comment and an unknown top-level key is silently ignored, so a hermetic test parses the file with `yaml.compose`, allows only the keys `schema`, `context`, `rules` and `operations` and only folded or literal scalars as rule items. The other defects print a warning with exit 0 (a plain scalar containing `: ` becomes a mapping and the guidance is dropped, a rule under an unknown artifact id is ignored, and a context over 50 KB is ignored), which the gate fails on. +- **Agent files and `openspec/config.yaml`.** The generated skills are committed: a cloud agent or fresh clone never runs an install but reads the checkout. `.gitignore` re-includes only `.claude/skills/openspec-*/` (`!.claude/skills/` then `.claude/skills/*` then `!.claude/skills/openspec-*/`, tried: other skills, `settings.local.json` and `worktrees` stay ignored). A hermetic test requires `metadata.generatedBy` in all eight `SKILL.md` to equal the pin, and the two trees to be identical. The `.claude/settings.json` allowlist gains `Bash(openspec *)` and `Bash(tuicr *)`, and the file holds no deny list. A person decided so on 2026-10-22. The first plan allowed the verbs the four skills call by name and denied `openspec init`, `update`, `archive`, `config` and `completion`. Every generated skill carries `allowed-tools: Bash(openspec:*)`, which grants the whole verb set during the turn and which the project never hand-edits. So no entry of the settings blocks an OpenSpec verb, and readiness stays the backstop. `GEMINI.md` is added as a third pointer stub (`@./AGENTS.md`, the form the Gemini CLI documentation shows) through the existing generator, since Gemini CLI loads `GEMINI.md` by default and `AGENTS.md` only through `context.fileName`. `.github/workflows/copilot-setup-steps.yml` is written by hand, with SHA-pinned actions, the pinned install and the opt-outs; `--copilot-cloud` is not used, because its generated workflow runs an unpinned `actions/checkout@v4` and `npm install -g @fission-ai/openspec`. `devops ai agents` generates no OpenSpec file. The default `spec-driven` schema is kept: a fork copies 16 KB of upstream instructions and four templates that change weekly, and the project needs no structural change. Rules are advisory prompts, so what must hold keeps a mechanical check: the gate, readiness and `tests/test_change_folders.py` (every active folder is named `-`; `proposal.md` and `tasks.md` exist and `tasks.md` holds at least one `## .` group with a task-list item, since a folder of only `.openspec.yaml` and a delta passes `openspec validate --strict` and the readiness path rule (tried); `proposal.md` has `## Feasibility` and `## Existing Tool Considered` headings found with the markdown parser already a dependency; and no `PR`, `Status`, `Milestone` or `Priority` line). AGENTS.md states only what binds an agent that never runs `openspec` (where the folder lives, who archives, the entry points and the no-binary fallback) and points to `config.yaml` for every artifact convention; the one fact in both, the folder name, is enforced by readiness and that test, so no test has to keep the two documents in agreement. The file below was rendered through `openspec instructions` for the proposal, specs, design, tasks and apply operations with an empty stderr. The folded scalars (`- >-`) are not decoration: a plain scalar containing ` #` is silently cut at the comment and an unknown top-level key is silently ignored, so a hermetic test parses the file with `yaml.compose`, allows only the keys `schema`, `context`, `rules` and `operations` and only folded or literal scalars as rule items. The other defects print a warning with exit 0 (a plain scalar containing `: ` becomes a mapping and the guidance is dropped, a rule under an unknown artifact id is ignored, and a context over 50 KB is ignored), which the gate fails on. ```yaml schema: spec-driven @@ -120,7 +120,7 @@ operations: Each step is its own item, delivered by one pull request, filed after this ADR merges. #1833 already delivered the AGENTS.md rule and the feature request field (Open Tools Before Internal Code), so the sequence starts at the pin. AGENTS.md names task files until the switch, so a folder planned earlier is a second record that review refuses; from step 2 the gate at least keeps such a folder valid and named `-`. Nothing reads both systems after the switch. 1. **Pin, install, telemetry (M).** The `npm` kind, the lock and installer, `.node-version`, the Node pin, the opt-out environment and its tests, the `npm audit` command in the `audit` row, the Renovate setting and the AGENTS.md telemetry list. -2. **Scaffold and gate (M).** The `openspec init` output under the isolated `custom` profile, `openspec/config.yaml`, `.gitignore`, the inventory classes and routing, `devops openspec check` and `regenerate`, `tests/test_change_folders.py` (folder names and structure), the `devops ci` row and hook, the `static` job's Node step, `copilot-setup-steps.yml`, the settings allowlist and deny entries and the hermetic tests. The gate passes on an empty tree. +2. **Scaffold and gate (M).** The `openspec init` output under the isolated `custom` profile, `openspec/config.yaml`, `.gitignore`, the inventory classes and routing, `devops openspec check` and `regenerate`, `tests/test_change_folders.py` (folder names and structure), the `devops ci` row and hook, the `static` job's Node step, `copilot-setup-steps.yml`, the settings allowlist and the hermetic tests. The gate passes on an empty tree. 3. **`GEMINI.md` pointer stub (S).** The generator, `DEFAULT_AGENT_FILES` and the byte-for-byte stub test. 4. **Archive in the closing pull request (M).** The gate holds no code that archives or orders changes. Readiness requires a `Closes` pull request to hold its folder under `openspec/changes/archive/`, and lets a pull request write `openspec/specs/**` only when it closes a change. It extends the folder reader of step 5, so it merges after step 5. 5. **The switch (L).** Readiness (the folder path, the unticked-task check for a closing pull request and the retargeted base probe), the closing comment, review routing, the pull request template, CONTEXT.md, `docs/SDLC.md`, `RELEASE_CYCLE.md`, `docs/ROUTINE_TASKS.md`, `docs/SELF_IMPROVEMENT.md`, `docs/TESTING.md`, `docs/agent/README.md`, `docs/_config.yml` (its comment on task files), the two knowledge-base guides, `instruction_generator.py`, the help text of `close` in `lang/en/help.py`, the docstrings in `review/targets.py` and `roadmap/store.py`, AGENTS.md and the eleven test files that name a task file are rewritten; the decommission test is added; `docs/agent/tasks/`, `tests/test_agent_task_files.py` and its baseline are deleted; and the generated documents are regenerated. It carries its own change folder, whose deltas create the capabilities `pr-grounding` and `issue-closure`, each with a Purpose. It stays one pull request because the no-shim rule forbids a state where the readiness check, the closing comment and their tests disagree. @@ -160,7 +160,7 @@ The other edits are small, and these are all of them. The canonical-source note ## Consequences - **Deleted.** In `src/`: `_writes_task_file` and `_changes_its_task_file` in `commands/pr.py`; `CONST_AGENT_TASKS_DIR` and `CONST_AGENT_TASK_FILE_RE` in `config/constants.py`; `acceptance_criteria`, `task_files` and `_criteria` in `roadmap/close.py` and the task read in `roadmap/request_plan.py` (one GitHub request per closing); `grounding_task_file_missing`, `close_criteria_heading`, `close_comment_task`, `close_comment_no_criteria`, `close_comment_no_task` and the `task_file` plan condition in `lang/en/messages.py`; and the task-file lines in `ai/instruction_generator.py` and the two knowledge-base guides. In `tests/`: `test_agent_task_files.py` (127 lines, five tests and one case per task file) and `fixtures/task_files_baseline.txt` (488 lines). Documents: the 584 task files, this ADR's own among them (about 25,700 lines, 3.6 MB apparent size), the task template, and the task-tracking text in `docs/agent/README.md`. -- **Added.** The `npm` kind and its installer branch, the pinned lock, `.node-version`, the `npm audit` command in the `audit` row, `devops openspec check` and `regenerate` (the validate, regeneration and instructions calls and the overlap check), the readiness predicates (the folder, the archived folder and the writes of a closing pull request, and an unticked task for a closing pull request), the closing comment's change-folder and "No change folder." lines, `tests/test_change_folders.py`, the configuration and `generatedBy` tests, the decommission test, `OpenSpecFake`, the generated skills and `openspec/config.yaml`, `.github/workflows/copilot-setup-steps.yml`, the settings deny entries and `GEMINI.md`. +- **Added.** The `npm` kind and its installer branch, the pinned lock, `.node-version`, the `npm audit` command in the `audit` row, `devops openspec check` and `regenerate` (the validate, regeneration and instructions calls and the overlap check), the readiness predicates (the folder, the archived folder and the writes of a closing pull request, and an unticked task for a closing pull request), the closing comment's change-folder and "No change folder." lines, `tests/test_change_folders.py`, the configuration and `generatedBy` tests, the decommission test, `OpenSpecFake`, the generated skills and `openspec/config.yaml`, `.github/workflows/copilot-setup-steps.yml`, the settings allowlist and `GEMINI.md`. - **AGENTS.md** ends at 39,984 of 40,000 characters (+65). A later rule is paid for by removal. - Node 24 and the 57-package tree become a requirement of `devops ci` and of the pull request that archives a change; `devops` itself, the roadmap jobs' readiness and close, and the tests need neither. On a machine without `openspec` the row fails early with an install hint. - The living spec changes in the pull request that closes a change, so it matches the merged code. A planner reads `openspec/specs//spec.md` and the active deltas. diff --git a/docs/agent/tasks/task-1154-agent-session-prerequisites.md b/docs/agent/tasks/task-1154-agent-session-prerequisites.md index ad281a0013..2f92e9f2c5 100644 --- a/docs/agent/tasks/task-1154-agent-session-prerequisites.md +++ b/docs/agent/tasks/task-1154-agent-session-prerequisites.md @@ -22,6 +22,7 @@ Agent sessions require secure configuration, isolated credentials, and read-only - [x] With `DEVOPS_CLI_AGENT_GRANT` set, a gateway 401 names the grant ID and says a person issues a new grant; without it, the hint is unchanged. Long grant IDs are capped at 256 characters. - [x] `.claude/settings.json` denies `Read(//**/.claude/settings.local.json)`, `Read(~/.claude/settings.json)`, and `Read(~/.kube/**)`. - [x] Unit and integration tests verify environment overrides, grant 401 hints, and settings file deny rules. +- Removed on 2026-10-22 by the person: the three `Read` deny rules and the test module that pinned them. The person wants agents to read the project folder and the kubeconfig. See the pull request that deletes `tests/test_claude_code_settings.py`. - [x] `uv run devops docs check` passes with all generated documentation up to date. - [x] `k8s/agents/` holds ServiceAccount `devops-agent` (automount off) and ClusterRoleBinding `devops-agent-view` to the built-in `view`. - [x] Namespace `agents` is `restricted` and carries `Prune=false,Delete=false`. diff --git a/docs/agent/tasks/task-1844-openspec-scaffold-and-gate.md b/docs/agent/tasks/task-1844-openspec-scaffold-and-gate.md index ed6652a93e..277c05bb03 100644 --- a/docs/agent/tasks/task-1844-openspec-scaffold-and-gate.md +++ b/docs/agent/tasks/task-1844-openspec-scaffold-and-gate.md @@ -26,7 +26,9 @@ The repository has somewhere to plan into and a gate that keeps a plan valid. Op - [x] The inventory classifies every new Markdown file and `devops docs check` passes. - [x] The pre-commit hook and the `static` job run the row, `copilot-setup-steps.yml` exists, and AGENTS.md is within its 40,000-character cap (39,953). `devops ci --dry-run` lists the row, and `tests/test_openspec_scaffold.py` checks the hook and `tests/test_workflow_contracts.py` both workflows and that every remote action is pinned. - [x] The tests that replay the tool hold the record to the pin and to the gate's commands: `tests/test_openspec_contract.py` fails when the record is not of the locked version, when a scenario is not recorded, and when the record holds a run the gate no longer starts. -- Not done: the `permissions` entries in `.claude/settings.json` and the test that reads them. They are the last part of #1844. An agent's session may not edit that file, so a person applies the JSON kept below, and the last part adds the test. +- [x] The `permissions` entries are in `.claude/settings.json`. A person applied them, because an agent may not edit that file. On 2026-10-22 the person set the allow list to `Bash(uv run devops *)`, `Bash(openspec *)` and `Bash(tuicr *)`, and removed the deny list. The same change deletes `tests/test_claude_code_settings.py`. The last part of #1844 adds no settings test. +- Not done: the wrapper `devops openspec archive` and its tests. ADR 0012 plans the wrapper, and it is the last part of #1844. The settings allow the direct tool `openspec archive`, so the wrapper is a convention and no entry of the settings enforces it. +- Pending a person: edit the text of #1844 and #1846. They say that the last part adds a settings test and that the deny list holds `archive`. Both statements conflict with the settings of 2026-10-22. - Pending a person: after the release that carries `.github/workflows/copilot-setup-steps.yml` merges to `main`, run the workflow once from the Actions tab and confirm that a Copilot cloud agent session finds `openspec` on its PATH. GitHub runs the file only from the default branch, so until then that agent finds the committed skills and no binary. - Pending a person: with a devcontainer rebuilt after #1842, run `uv run devops ci` and expect every row, the `openspec` row included, to pass with `openspec` on PATH. @@ -39,62 +41,3 @@ The repository has somewhere to plan into and a gate that keeps a plan valid. Op - The changelog fragment `changelog.d/1844.md`: the last part of #1844 adds it, because a part adds none. - `GEMINI.md` and its generator: #1845. - The archive in the pull request that closes a change, and the readiness rule that checks it: #1846. - -## Permission Entries Kept for the Last Part - -A person applies this change to `.claude/settings.json` and leaves its `env` block as it is. The last part of #1844 then adds the test below to `tests/test_openspec_scaffold.py` and removes this section. Every generated skill carries `allowed-tools: Bash(openspec:*)`, and Claude Code evaluates deny rules before allow rules. A deny entry therefore holds where a narrow allowlist would not. No bare `Bash(openspec *)` is allowed. The deny list holds no `archive` entry, because the pull request that closes a change runs `openspec archive --yes` as its last commit (#1846). - -```json -"permissions": { - "allow": [ - "Bash(uv run devops *)", - "Bash(openspec status *)", - "Bash(openspec list *)", - "Bash(openspec instructions *)", - "Bash(openspec context *)", - "Bash(openspec show *)", - "Bash(openspec schemas *)", - "Bash(openspec validate *)", - "Bash(openspec new change *)" - ], - "deny": [ - "Read(//**/.claude/settings.local.json)", - "Read(~/.claude/settings.json)", - "Read(~/.kube/**)", - "Bash(openspec init *)", - "Bash(openspec update *)", - "Bash(openspec config *)", - "Bash(openspec completion *)" - ] -} -``` - -```python -ALLOWED_OPENSPEC_VERBS = ( - "status", - "list", - "instructions", - "context", - "show", - "schemas", - "validate", - "new change", -) -DENIED_OPENSPEC_VERBS = ("init", "update", "config", "completion") - - -def test_the_settings_allow_the_verbs_the_skills_call_and_deny_the_ones_that_write() -> None: - """Every generated skill carries `allowed-tools: Bash(openspec:*)`, which grants the whole verb - set during the turn, and Claude Code evaluates deny rules before allow rules, so a deny entry - holds where a narrow allowlist would not. No bare `Bash(openspec *)` is allowed.""" - settings = json.loads((REPO_ROOT / ".claude/settings.json").read_text(encoding="utf-8")) - permissions = settings["permissions"] - - def openspec_rules(kind: str) -> list[str]: - return [rule for rule in permissions[kind] if rule.startswith("Bash(openspec")] - - assert (openspec_rules("allow"), openspec_rules("deny")) == ( - [f"Bash(openspec {verb} *)" for verb in ALLOWED_OPENSPEC_VERBS], - [f"Bash(openspec {verb} *)" for verb in DENIED_OPENSPEC_VERBS], - ) -``` diff --git a/docs/agent/tasks/task-1846-the-openspec-gate-drops-the-cut-only-code.md b/docs/agent/tasks/task-1846-the-openspec-gate-drops-the-cut-only-code.md index ae187cebf7..aa8e487bd0 100644 --- a/docs/agent/tasks/task-1846-the-openspec-gate-drops-the-cut-only-code.md +++ b/docs/agent/tasks/task-1846-the-openspec-gate-drops-the-cut-only-code.md @@ -26,7 +26,7 @@ The first plan archived changes at the release cut. The owner replaced that plan - **Tests.** `tests/test_openspec_archive.py` is deleted. `tests/test_openspec_gate.py`, `test_openspec_tool.py` and `test_openspec_command.py` lose the rehearsal, order, symlink and archive-failure cases. The scenarios `merged-out-of-issue-order`, `missing-purpose`, `modified-spec-absent` and `duplicate-added` are gone. The `merged` field and the commits that `build_scenario` made are gone too. A scenario tree holds a `git init` and no commit, so a gate that reads git history fails every gate test. - **New tests.** `test_the_gate_passes_changes_and_archives_none_of_them` runs the scenarios `pair` and `skip-specs-change`. It asserts no finding and no `archive` run. `test_the_static_job_installs_the_pinned_node_and_openspec_before_the_gate` now asserts that the checkout step has no `fetch-depth`. - **Recorded runs.** I deleted four scenarios from `tests/fixtures/openspec_runs/recorded_runs.json`. I also deleted every `archive` run and every `validate --specs --strict` run. I edited no recorded text. `tests/test_openspec_contract.py` proves that the record holds only runs that the gate starts. -- **Other task text.** `docs/agent/tasks/task-1844-openspec-scaffold-and-gate.md` loses the archive-function bullet and the rehearsal. Its criterion for a change that would not archive now names the overlap check. Its kept settings text denies no `archive`. `docs/agent/tasks/task-1753-openspec-adoption.md` and `changelog.d/1753.md` no longer say that the cut archives. +- **Other task text.** `docs/agent/tasks/task-1844-openspec-scaffold-and-gate.md` loses the archive-function bullet and the rehearsal. Its criterion for a change that would not archive now names the overlap check. `docs/agent/tasks/task-1753-openspec-adoption.md` and `changelog.d/1753.md` no longer say that the cut archives. ## Acceptance Criteria @@ -35,13 +35,13 @@ The first plan archived changes at the release cut. The owner replaced that plan - [x] ADR 0010 holds no passage that archives at the cut. It names the release cut only to say that the cut does not archive. - [x] `openspec/config.yaml` tells an agent to archive its own change in the commit that closes it. It also tells the agent not to run `sync`. The copy in ADR 0010 equals the file. - [x] The help text, the docstrings and the documents name no archive at the cut. -- [x] The kept settings text in the task file of #1844 holds no `archive` deny entry. +- [x] The settings hold no `archive` deny entry. `Bash(openspec *)` allows the direct tool `openspec archive`, so nothing in the settings blocks it. ADR 0012 still plans the wrapper `devops openspec archive`, which the last part of #1844 builds. The wrapper is not built yet. - [x] ADR 0012 no longer calls the overlap check cut-time code that #1846 removes. The two passages that named it now say that it stays, and one dated line records the correction. - [x] The gate tests pass with the recorded runs that remain. A gate that archives a change, or reads git history, fails them. - [x] `uv run devops openspec check` passes on the tree with the real tool. - Not done: readiness refuses a `Closes` pull request whose folder is not under `openspec/changes/archive/`. It also allows a write to `openspec/specs/**` only in a `Closes` pull request for its own change (the last Part of #1846, after #1847). -- Pending a person: apply the `permissions` entries kept in `docs/agent/tasks/task-1844-openspec-scaffold-and-gate.md` to `.claude/settings.json` after this pull request merges. That text no longer denies `openspec archive`, so an agent can run `openspec archive --yes` in the closing commit. To let an agent run it without a prompt, also add `"Bash(openspec archive *)"` to the allow list. Add `archive` to `ALLOWED_OPENSPEC_VERBS` in the kept test as well. -- Pending a person: decide the form of the archive command. ADR 0010 and `openspec/config.yaml` say `openspec archive --yes`. Line 185 of ADR 0012 plans a wrapper, `devops openspec archive `. Settle the form before Part B. +- [x] The `permissions` entries are in `.claude/settings.json`. A person applied them on 2026-10-22: `Bash(uv run devops *)`, `Bash(openspec *)` and `Bash(tuicr *)` allow, and no deny list. An agent runs `openspec archive --yes` in the closing commit without a prompt. +- Pending a person: decide the form of the archive command. ADR 0010 and `openspec/config.yaml` say `openspec archive --yes`, and the settings allow it. Line 186 of ADR 0012 plans a wrapper, `devops openspec archive `, which the last part of #1844 builds. The wrapper is not built yet. The settings enforce neither form. Settle the form before Part B. - Pending a person: edit the text of #1847. It says that the cut owns the writes to `openspec/specs/**` and `openspec/changes/archive/**`. It says that the cut lists a change which is not `complete`. Both statements conflict with the decision of 2026-10-22. ## Deliverables diff --git a/docs/agent/tasks/task-1882-pin-gh-dash-and-ship-config.md b/docs/agent/tasks/task-1882-pin-gh-dash-and-ship-config.md index 07d845f9b4..e2cccdb725 100644 --- a/docs/agent/tasks/task-1882-pin-gh-dash-and-ship-config.md +++ b/docs/agent/tasks/task-1882-pin-gh-dash-and-ship-config.md @@ -43,7 +43,7 @@ The source, the study and one measurement give these numbers: - [x] `tests/test_gh_dash_config.py` and `tests/test_tools_lock.py` pass. They run offline and never start gh-dash. `devops ci` passes in the pre-push hook before the push. - [x] `changelog.d/1882.md` records the change. `CHANGELOG.md` and `docs/ROADMAP.md` are not edited. - [x] The docs say how to start gh-dash: `docs/DEVCONTAINER_USAGE.md`. -- Not done: the permission entries that stop an agent from starting gh-dash. The sentence "Agents never start `gh-dash`." is in `docs/DEVCONTAINER_USAGE.md`. The entries that enforce it are a person-run change to `.claude/settings.json`. They come with [#1884](https://github.com/dan-petty/devops-cli/issues/1884), which pins tuicr. Its second part is the human review round. +- Not done: the permission entry that stops an agent from starting gh-dash. A person decided on 2026-10-22 to add no deny entry to `.claude/settings.json`, here and in [#1884](https://github.com/dan-petty/devops-cli/issues/1884). No entry covers `gh-dash`, so an agent run of it prompts like any other command that no entry covers. The sentence "Agents never start `gh-dash`." stays in `docs/DEVCONTAINER_USAGE.md` as a rule of the docs. The settings do not enforce it. - Pending a person: run `devops install-tools --tool gh-dash`, then `devops install-tools --check`. The check prints that every tool is linked at its locked version and exits 0. - Pending a person: at the root of the clone, run `gh-dash --config .gh-dash.yml` with your own token. Check that four pull request tabs, three issue tabs and one notification tab show. Check that Queue lists the oldest pull request first. Check that `w`, `T`, `D` and `d` run the devops commands and return to gh-dash. Check how the terminal shows the icons in the preview pane, the notification rows and the column headers. - Pending a person: measure the GraphQL cost of gh-dash again. The steps are in [#1918](https://github.com/dan-petty/devops-cli/issues/1918): count the lines of `debug.log`, and do not read the quota counters. The computed cost is 7 points at start, with 2 more points for each row you select with the preview open. diff --git a/docs/agent/tasks/task-1884-pin-tuicr-and-ship-config.md b/docs/agent/tasks/task-1884-pin-tuicr-and-ship-config.md index 7dfb08b0e7..f781ef5620 100644 --- a/docs/agent/tasks/task-1884-pin-tuicr-and-ship-config.md +++ b/docs/agent/tasks/task-1884-pin-tuicr-and-ship-config.md @@ -46,36 +46,13 @@ The upkeep of a bump is one version, four URLs and four hashes. tuicr is below 1 - [x] `tests/test_tuicr_config.py` and `tests/test_tools_lock.py` pass. They run offline and never start tuicr. `devops ci` passes in the pre-push hook before the push. - [x] `docs/SDLC.md` Phase 6 describes the human review round, `docs/VISION.md` item 15 describes the open-tool canvas, and `docs/DEVCONTAINER_USAGE.md` says how to start tuicr. - [x] `changelog.d/1884.md` records the change. `CHANGELOG.md` and `docs/ROADMAP.md` are not edited. -- Pending a person: merge these permission entries into `.claude/settings.json`. An agent must not edit its own permission file. The same entries close the gh-dash part of [#1882](https://github.com/dan-petty/devops-cli/issues/1882). The `gh-dash` deny entry and the `tuicr` deny entries are one settings change. First compare the file with the settings entries of the GitHub request budget design. The file must hold one set and no duplicate. - - ```json - { - "permissions": { - "allow": [ - "Bash(tuicr review list *)", - "Bash(tuicr review comments *)" - ], - "deny": [ - "Bash(tuicr review clear *)", - "Bash(tuicr review clearc *)", - "Bash(tuicr review delete *)", - "Bash(tuicr review add *)", - "Bash(tuicr update*)", - "Bash(tuicr pr *)", - "Bash(tuicr)", - "Bash(tuicr -*)", - "Bash(tuicr tui*)", - "Bash(gh-dash*)" - ] - } - } - ``` - -- Pending a person: check the three start patterns of the deny list. `Bash(tuicr)`, `Bash(tuicr -*)` and `Bash(tuicr tui*)` must block a start of the interface. They must not match `tuicr review list` or `tuicr review comments`. They also block `tuicr --help`, which is acceptable. The Gemini and Copilot equivalents are not verified. +- [x] The entry `Bash(tuicr *)` is in `.claude/settings.json`. A person applied it, because an agent must not edit its own permission file. It allows every `tuicr` command without a prompt. +- Not done: the deny entries for the start and write forms of `tuicr` and for `gh-dash`. A person decided on 2026-10-22 to add no deny entry. The settings allow the interface, `tuicr review clear`, `clearc`, `delete` and `add`, `tuicr update` and `tuicr pr`. No entry covers `gh-dash`, so an agent run of it prompts like any other command that no entry covers. The rule that an agent never starts `tuicr` or `gh-dash` stays in `docs/DEVCONTAINER_USAGE.md` and in `docs/SDLC.md` Phase 6. The settings do not enforce it. +- Pending a person: when the GitHub request budget design merges, compare its settings entries with `.claude/settings.json`. The file must hold one set and no duplicate. - Pending a person: run `devops install-tools --tool tuicr`, then `devops install-tools --check`. The check exits 0 when every tool has its locked version. - Pending a person: copy the template with `mkdir -p ~/.config/tuicr && cp .devops/tuicr.config.toml ~/.config/tuicr/config.toml`. If that file exists, copy it first to `~/.config/tuicr/config.toml.bak-`. - Pending a person: run one real review. In a worktree of an agent, run `tuicr -r ..HEAD`, add a comment, press `y` and check the export. In another terminal, run `tuicr review list --repo ` and `tuicr review comments --repo --session `. Check the JSON fields `id`, `location`, `path`, `start_line`, `end_line`, `side`, `comment_type`, `author`, `lifecycle_state`, `created_at` and `content`. Judge the VS Code terminal. The clipboard (OSC 52) and Shift-Enter are not verified (issue 782 of the tuicr repository). -- Pending a person: run one agent round. Ask an agent to address the comments of that review, with the "Human Review Round" bullet of `docs/SDLC.md`. Keep tuicr open during the round, or give the agent the session slug, because `"active"` is true only while tuicr is open. Check that the allow entries stop the permission prompt for the two read commands. Check that a deny entry blocks `tuicr review clear` and a start of `tuicr`. Report what failed. +- Pending a person: run one agent round. Ask an agent to address the comments of that review, with the "Human Review Round" bullet of `docs/SDLC.md`. Keep tuicr open during the round, or give the agent the session slug, because `"active"` is true only while tuicr is open. Check that the entry `Bash(tuicr *)` stops the permission prompt for the `tuicr review` commands. Report what failed. ## Deliverables diff --git a/tests/test_claude_code_settings.py b/tests/test_claude_code_settings.py deleted file mode 100644 index 372b811418..0000000000 --- a/tests/test_claude_code_settings.py +++ /dev/null @@ -1,28 +0,0 @@ -"""Tests for repository .claude/settings.json invariants.""" - -from __future__ import annotations - -import json - -from tests.support.paths import REPO_ROOT - -_EXPECTED_DENY_RULES = ( - "Read(//**/.claude/settings.local.json)", - "Read(~/.claude/settings.json)", - "Read(~/.kube/**)", -) - - -def test_claude_code_settings_parses_and_enforces_deny_rules() -> None: - """Verify .claude/settings.json is valid JSON and permissions.deny holds required rules.""" - settings_path = REPO_ROOT / ".claude" / "settings.json" - assert settings_path.is_file(), f"Missing {settings_path}" - - data = json.loads(settings_path.read_text(encoding="utf-8")) - permissions = data.get("permissions", {}) - deny_rules = permissions.get("deny", []) - - assert ( - isinstance(deny_rules, list), - all(rule in deny_rules for rule in _EXPECTED_DENY_RULES), - ) == (True, True)