Skip to content

feat(server): schema for review round-trip loop (CRU-131) - #381

Merged
selfcontained merged 1 commit into
mainfrom
agt_b6889d895402/agent-895402
Apr 22, 2026
Merged

feat(server): schema for review round-trip loop (CRU-131)#381
selfcontained merged 1 commit into
mainfrom
agt_b6889d895402/agent-895402

Conversation

@selfcontained

Copy link
Copy Markdown
Owner

Phase 2 of the review round-trip feature (CRU-127). Pure schema readiness — no new transitions into awaiting_recheck or round-2 writes are wired up yet. Builds on Phase 1 (CRU-128 / migration 0016).

Migration 0017_persona-review-round-trip.sql

  • persona_reviews:
    • round_number INT NOT NULL DEFAULT 1
    • allow_recheck BOOLEAN NOT NULL DEFAULT false
  • agent_feedback:
    • round_number INT NOT NULL DEFAULT 1
    • responds_to_feedback_id INT REFERENCES agent_feedback(id) ON DELETE SET NULL
    • index idx_agent_feedback_responds_to on responds_to_feedback_id
  • Includes a -- Down Migration block that drops the index, FK-bearing column, and the four new columns. Phase 1 columns (resolution_reason, resolution_commit, resolved_at, last_reviewed_commit, persona_review_resolutions) are left untouched.
  • No check-constraint change needed for the new awaiting_recheck persona-review status — status is validated in app code, not Postgres. That value is not yet written anywhere in this PR.

Manager query helpers (apps/server/src/agents/manager.ts)

  • PersonaReviewRecord gains roundNumber + allowRecheck; FeedbackRecord gains roundNumber + respondsToFeedbackId.
  • All SELECT / RETURNING clauses that hydrate those record types now surface the new columns.
  • createPersonaReview accepts an optional allowRecheck param. All other writers rely on the DB defaults so existing behavior is unchanged.

Notes

  • The Phase 1 migration already created persona_review_resolutions in its final shape (no temp summary column), so the "backfill and drop" step from the ticket description is a no-op here.
  • Next migration number was chosen by checking prod pgmigrations (last applied: 0016_feedback-resolution-capture).

Test plan

  • pnpm run check — typecheck clean (backend + web).
  • pnpm run test — 372 unit tests pass.
  • pnpm run test:e2e — 138 E2E tests pass.
  • Manual verification: ran node-pg-migrate up then down against a throwaway DB. New columns/index appear with correct types + defaults, default-inserting into agent_feedback yields round_number=1 / responds_to_feedback_id=null, and a single-step rollback removes all Phase 2 artifacts while preserving Phase 1 columns.

Add round_number + allow_recheck to persona_reviews and round_number +
responds_to_feedback_id to agent_feedback so the Phase 2 recheck loop
has the columns it needs to persist round-scoped state and cross-round
references. Pure schema readiness — no transitions into awaiting_recheck
or round-2 writes are wired up yet.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@selfcontained
selfcontained marked this pull request as ready for review April 22, 2026 16:46
@selfcontained
selfcontained merged commit a25d4ac into main Apr 22, 2026
1 check passed
@selfcontained
selfcontained deleted the agt_b6889d895402/agent-895402 branch April 22, 2026 18:27
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