Skip to content

test(verify): add a project verify skill and document it in AGENTS.md - #273

Merged
Hazzng merged 4 commits into
mainfrom
chore/verify-skill
Oct 17, 2026
Merged

Hazzng merged 4 commits into
mainfrom
chore/verify-skill

Conversation

@Hazzng

@Hazzng Hazzng commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Summary

Until now an agent could only prove a change with pnpm verify:local, which runs everything in one go. This PR adds a project skill at .claude/skills/verify/ so agents can work and verify on their own:

  • Change-to-gate map. SKILL.md lists, for each source area, the checks to run while iterating and the gate that counts as completion evidence.
  • scripts/stack.sh. It keeps a disposable Postgres/Redis/API stack running between calls. It reuses infra/docker-compose.verify.yml with a unique Compose project, random loopback ports, a clean env -i, and migrations on startup. Subcommands:
    • up, restart, down: start, rebuild, and stop the stack. down stops only the PID it started and keeps the evidence.
    • doctor: checks service health, PID and port ownership, readiness, and token auth. It fails when dist/ is older than src/ or when node_modules doesn't match pnpm-lock.yaml.
    • api, mcp, psql: send an authenticated request, call one MCP tool, or inspect the database.
    • suite <name>: runs any scripts/verify/*.mjs suite, or integration [filter], against the stack.
  • Feature map. features/*.md covers auth, sandboxes, exec, files, ingest, and MCP. scripts/journeys.sh runs those journeys with 41 assertions in about 8 seconds.
  • Redacted evidence. scripts/verify/.run/stack-<id>/transcript.jsonl masks the stack secret, JWTs, and token, secret, password, and authorization keys.
  • AGENTS.md (and CLAUDE.md, which links to it) gets a new "Verify while you work" section with the commands and a table of the scripts/verify suites. Agents without Claude Code can run the scripts directly.

No product code changes; nothing in src/ is touched. The one CI-gate edit: scripts/verify-local.sh now calls scripts/verify/assert-integration-report.mjs instead of an inline heredoc. It runs the same three assertions with the same messages, and stack.sh suite integration calls the same file. Node tests cover empty, failed, and skipped reports.

Test plan

Run in this worktree on top of e9cf495:

  • pnpm check passes: 2334 unit tests and 154 TypeScript SDK tests.
  • Fresh up, then doctor (all ok), all 6 journeys (41/41), then down. No containers, volumes, listeners, or server process remain, and the evidence directory survives.
  • Each scripts/verify suite passes through stack.sh suite: contracts, output-cap, shutdown, sdk-clients, worker-failures, sse-finalization, input-budgets, tenants, ingest-admission, and integration (265 tests, 0 skipped). large-files was not run because it needs a cgroup v2 host.
  • Negative control: changing a read-only error code in src/api/routes/exec.ts made doctor report the stale build and journeys.sh exec fail with the expected and actual values. Reverting the change made it pass again.
  • Failure paths:
    • a failed launch prints the server log tail, blocks a second up, and down still cleans up;
    • dependency drift fails doctor;
    • an integration report with skipped tests fails the gate.
  • Redaction: the bootstrap call's X-Auth-Secret and the returned token are recorded as [REDACTED]. A scan found no JWTs or secrets in the transcript.
  • pnpm verify:architecture passed while a stack was up, so the two coexist.
  • With the shared integration check: pnpm check:scripts (including the new tests), pnpm lint, and pnpm verify:local all pass (265 integration tests, 0 skipped). On the stack, suite integration passes on a real report and fails on the same report with one skipped test.

Follow-ups (not in this PR)

  • MCP bash_exec reports denial as {"exitCode":1,"stderr":"forbidden"}, and file and sandbox tools report it as {"ok":false}. Both use isError:false. Setting isError:true (in src/api/mcp/tool-errors.ts) would match the MCP spec, but it is a contract change.
  • stack.sh repeats about 15 lines of compose and env setup from verify-local.sh.

🤖 Generated with Claude Code


Summary by cubic

Adds a verify project skill so agents can prove changes against a live, disposable Postgres/Redis/API stack instead of only running the full pnpm verify:local gate.

New Features

  • scripts/stack.sh keeps a disposable Postgres/Redis/API stack running between calls, with up, restart, doctor, api, mcp, psql, suite, and down subcommands.
  • SKILL.md maps each source area to the checks to run while iterating and the gate that counts as completion evidence.
  • features/*.md and scripts/journeys.sh drive client-visible journeys for auth, sandboxes, exec, files, ingest, and MCP with about 40 assertions in roughly 10 seconds.
  • API/MCP calls are recorded to transcript.jsonl; bodies are capped at 4 KiB and the stack secret, JWTs, and sensitive keys and header values (including inside JSON) are redacted.
  • AGENTS.md documents the workflow; no product code changes, and existing gates like verify:local can run alongside the stack.
  • The integration report gate, extracted from verify-local.sh, is now shared as scripts/verify/assert-integration-report.mjs with node tests.

Written for commit 2b4408d. Summary will update on new commits.

View guided diff Turn on auto-fix

Agents could only prove a change with the all-or-nothing verify:local run.
The skill keeps a disposable Postgres/Redis/API stack up for iteration,
maps each kind of change to its required gates, and records redacted
evidence. journeys.sh asserts the feature map's client journeys against it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 86142851-af46-48b3-b6c0-3f4d95111511

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…erify skill scripts

Name the shapes those comments explained: exec_in_stack_env runs in a
subshell so the server's PID is $!, SERVER_ENV is split into an array,
register_for_teardown records the stack before anything can fail, and
isToolFailure detects {"ok":false} MCP replies.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 13 files

You’re at about 92% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread .claude/skills/verify/features/auth.md Outdated
Comment thread .claude/skills/verify/SKILL.md Outdated
Comment thread .claude/skills/verify/scripts/record.mjs Outdated
Comment thread .claude/skills/verify/features/exec.md Outdated
Comment thread .claude/skills/verify/scripts/stack.sh Outdated
Comment thread .claude/skills/verify/scripts/record.mjs Outdated
Comment thread .claude/skills/verify/scripts/mcp.mjs Outdated
Comment thread AGENTS.md Outdated
Comment thread AGENTS.md Outdated
Comment thread .claude/skills/verify/features/auth.md Outdated

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed

You’re at about 92% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread .claude/skills/verify/scripts/record.mjs Outdated
Comment thread .claude/skills/verify/scripts/stack.sh Outdated
Comment thread .claude/skills/verify/scripts/record.mjs Outdated
Comment thread AGENTS.md
Comment thread .claude/skills/verify/features/exec.md Outdated
Comment thread .claude/skills/verify/scripts/stack.sh Outdated
Comment thread .claude/skills/verify/features/sandboxes.md Outdated
Comment thread .claude/skills/verify/features/sandboxes.md Outdated
Comment thread .claude/skills/verify/SKILL.md Outdated
Comment thread .claude/skills/verify/scripts/journeys.sh
…and the verify skill

Both checked that an integration run executed tests with none failed or
skipped, in two copies. assert-integration-report.mjs is now the single
check, with node tests for empty, failed and skipped reports.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Hazzng

Hazzng commented Oct 17, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 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-17T05:14:03.605077Z 77fc44d Manual request
ℹ️ 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.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 5 files (changes from recent commits).

You’re at about 94% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread scripts/verify/assert-integration-report.test.mjs
@Hazzng

Hazzng commented Oct 17, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@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: 77fc44ddfe

ℹ️ 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 .claude/skills/verify/scripts/stack.sh
Comment thread .claude/skills/verify/scripts/record.mjs Outdated
Comment thread .claude/skills/verify/scripts/mcp.mjs
Redact sensitive keys inside JSON-looking strings and sensitive headers,
cap every recorded body at 4 KiB, keep SERVER_ENV values out of logs and
doctor output, write state.env shell-safely and owner-only, record the
server PID before readiness polling, keep doctor running when the server
is down, restore the default server env when a journey fails, accept only
suite entry points in `suite`, and correct the auth, exec, sandbox and
prerequisite docs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Hazzng
Hazzng merged commit b0662b8 into main Oct 17, 2026
16 checks passed
@Hazzng
Hazzng deleted the chore/verify-skill branch October 17, 2026 06:46
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.

1 participant