Files
gbrain/test
46055629aa feat(takes): review-first take proposal list/accept/reject over MCP + CLI (#2269)
Takeover of PR #2418. Exposes the take_proposals review queue as three
contract-first operations — takes_propose_list (scope: read),
takes_propose_accept / takes_propose_reject (scope: write) — plus the
matching `gbrain takes propose list|accept|reject` CLI subcommands, so
server-side/no-TTY deployments can drain the proposal queue natively in
chat. Preserves the D17 no-auto-accept posture: accept is the only path
from queue to canonical fence, and it stays an explicit reviewed action.

Repairs over the original PR:
- Source isolation routes through sourceScopeOpts(ctx) (federated
  allowedSources array > scalar ctx.sourceId > nothing) instead of the
  fail-open `ctx.remote ? ctx.sourceId : undefined`, which ignored
  federated grants and treated an unset remote flag as trusted.
- D4 holder privacy: all three ops thread ctx.takesHoldersAllowList so
  an allow-listed MCP token can neither see nor act on proposals for
  holders outside its grant (empty list matches nothing, fail-closed).
- Containment guard on the accept path: a proposal's page_slug can never
  resolve a markdown write outside the brain directory.
- Invalid status values error instead of silently returning nothing.
- Rebased onto master (takes.ts source-scope refactor).

Tests run against a real in-memory PGLite engine (not a hand-rolled SQL
fake), covering scope isolation, holder allow-list, promote + markdown
mirror + idempotency, rollback on DB failure, and reject lifecycle.

Co-authored-by: Mr-B-1 <Mr-B-1@users.noreply.github.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-21 15:01:18 -07:00
..