Skip to content

feat(drain): preview replies with --post --dry-run (STA-444) - #180

Merged
SutuSebastian merged 2 commits into
mainfrom
agent/sta-444-drain-dry-run
Nov 17, 2026
Merged

SutuSebastian merged 2 commits into
mainfrom
agent/sta-444-drain-dry-run

Conversation

@SutuSebastian

Copy link
Copy Markdown
Contributor

Summary

STA-444: verdict drain <repo> <pr> --post --dry-run previews exactly what --post would write, with zero host writes. This closes north star amendment A4 ("every host write has an explicit verb or flag, a dry-run, and a receipt"), where drain was the only outlier.

 drain --post
+drain --post --dry-run
+  local preflight → drafts → secret scan (still refuses post-secret-shaped)
+  live refresh into a temp scratch bundle (real threads.json untouched) + self login
+  stale / answered / resolved skips → mention neutralization → final marker
+  writers swapped for refusing stubs (Reply, Resolve, ledger Append, SaveFeed)
+  → <bundle>/drain.dryrun.json {planned[], skipped[]}; next = the same command without --dry-run
  • Flag rules: --dry-run without --post → exit 2. It composes with --agent: plan → draft → preview.
  • Schema: a new closed schemas/drain-dryrun.schema.json. It is separate from drain.json, so a preview can never be mistaken for a receipt. TS types are regenerated.
  • Discovery: usage synopsis and shell completion both offer --dry-run, and the completion guard covers it.

Evidence

  • Unit:
    • with a stub host that fails on any write argv: 0 writes, and replies.json, drain.json and threads.json stay byte-identical;
    • a secret-shaped draft refuses with 0 writes;
    • --dry-run without --post exits 2.
  • Eval drain-post: D1 is the dry run reporting both marked bodies. D5 shows "the real post sent exactly the bodies the dry run planned", with the stub refusing unregistered argv across all runs.
  • Mutations (6): dropping planned population, the early return, the usage check, the secret gate, the body, or the write guards each fails a test.
  • Ladder at 770b32f7e: all green.
    • make test-race, make vet, GOOS=windows go vet, make deadcode, make cross, doc-coverage, make schemas-check, make ts-types-check, make clients-ts and make size pass.
    • make evals: 142 passed.
    • golangci-lint (host and windows): 0 issues.

Merge Danger

Door: two-way

This is a new opt-in flag. Existing drain behavior is unchanged.

Blast Radius: small

The binary grows by about 10–20 KB per target; five size budgets rose to the next 10 KB, with measurements in the commit body.

Run the real post gates and live reads, then write drain.dryrun.json with the final marked bodies instead of posting or mutating the receipt. The preview schema ships under schemas/ with the new-style $id.

Size baselines raised to the next 10 kB: darwin/amd64 17617712, darwin/arm64 16017138, linux/amd64 17309856, windows/amd64 17705472, windows/arm64 15787008.
@changeset-bot

changeset-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4c820a2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@stainless-code/verdict Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 13 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e33ccb4f-c7e6-4ed1-8e79-53a8bf63991c
Commits

Reviewing files that changed from the base of the PR and between ef7318d and 4c820a2.

Files selected for processing: 22

  • .changeset/sta-444-drain-dry-run.md
  • cmd/verdict/usage.go
  • docs/manual.md
  • docs/troubleshooting.md
  • evals/README.md
  • evals/cases/drain-post.sh
  • internal/core/drain/dryrun.go
  • internal/core/drain/post.go
  • internal/drain/post.go
  • internal/drain/post_dryrun_test.go
  • internal/drain/post_test.go
  • internal/drain/verb.go
  • internal/schemagen/build.go
  • internal/schemagen/build_test.go
  • internal/schemagen/drain_schema_test.go
  • internal/schemagen/model.go
  • internal/schemagen/overlay.json
  • internal/schemagen/semantics_test.go
  • internal/schemagen/testdata/baseline/drain-dryrun.schema.json
  • schemas/drain-dryrun.schema.json
  • scripts/size-baseline.txt
  • scripts/verdict-complete.sh
  • 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

@SutuSebastian
SutuSebastian merged commit a4f33c2 into main Nov 17, 2026
21 checks passed
@SutuSebastian
SutuSebastian deleted the agent/sta-444-drain-dry-run branch November 17, 2026 23:31
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