Files
PaperClipAI/server
DottaandClaude Opus 5.5 4285366e79 test(antigravity): prove positive run-start cases reach the coordinator claim with a strict DB fake (#22947)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - Agents can run on the Google Antigravity harness, and run start has
a release gate for it
> - #22943 added run-start tests for that gate
> - Two positive cases only checked that the error was not the gate
error, so an unrelated early failure also passed
> - The fixture database returned itself for every method and an empty
result for every query, so the tests accepted any database access
> - This pull request makes each positive case prove that the run
reached the step after admission, and makes the fake database strict
> - The benefit is that a regression before the coordinator claim, or an
unexpected database call, now fails the tests

## Linked Issues or Issue Description

Refs #22943

**What happened?**
Two positive run-start cases in `antigravity-run-start.test.ts` passed
when the run failed for any reason other than the gate. The fixture
database in `antigravity.test-fixture.ts` silently accepted any call.

**What did you expect to happen?**
Each positive case proves that the run got past admission to a known
later step. The fake database rejects calls that the tests do not use.

**Steps to reproduce**
Add a temporary `throw` in `executePaperclipNativeSessionAttempt` just
before the coordinator claim. The old tests still pass (6 of 6).

## What Changed

- The granted Core sandbox case and the released plugin Runner-task case
now require the exact `native_finalization_coordinator_missing` error.
This error comes from the coordinator claim, which is after admission.
- Both cases also check the exact database reads: the coordinator lookup
and its locked re-read. The plugin case also checks the plugin lease
lookup before them.
- The older-profile case now checks that it is refused before any
database read.
- `emptyDb()` is now a typed fake. It supports only `select`, `from`,
`innerJoin`, `where`, `limit`, `for("update")`, `then`, and
`transaction`. It records each table read and throws a clear error for
any other method or lock mode.

## Verification

- `cd server && npx vitest run
src/services/native-runtime/antigravity-run-start.test.ts
src/services/native-runtime/antigravity-release.test.ts`: 16 of 16 pass.
- Red/green: with a temporary `throw` just before the coordinator claim,
the new tests fail in the two positive cases ("got
'fixture_break_before_coordinator_claim'"). The old tests pass with the
same break (6 of 6). The temporary change is not part of this PR.
- `cd server && npx tsc --noEmit -p .`: clean.

## Risks

- Low risk. This is a test-only change. No product code changes.
- If run start adds or reorders database reads, these tests fail and
need an update. That is intended.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, in Claude Code with
tool use (shell, file edits).

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 09:48:56 -06:00
..