test: prove delegation ledger end-to-end flow#317
Conversation
Add a CI-enforced integration spec proving the actual agent handoff path: formal contract creation, delegate acceptance, task assignment/discovery, completion, Lattice validation attachment, Receipt attachment, task trust report aggregation, agent trust report aggregation, and cross-account isolation. Also add non-colliding formal routes under /v1/delegation/contracts and /v1/delegation/tasks because the legacy /v1/delegation-contracts route is shared with identity contracts. Include contract lifecycle events in task trust reports so the report shows the full assignment chain, not only task-bound events.
|
Warning Review limit reached
Next review available in: 59 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
✅ Recall Benchmark ResultsFull outputCommit: cc85bd4 |
Make shutdown flush best-effort when Redis has already been closed by another provider or teardown path. This prevents unrelated Nest app shutdown from failing delegation integration tests after assertions have passed. Adds regression coverage for already-ended Redis and keys() failure during shutdown.
Summary
Adds the missing end-to-end proof for PR #314's delegation ledger infrastructure.
This is not just unit coverage. The new integration spec boots the Nest app and exercises the HTTP/API path an agent orchestration layer would use.
What the proof covers
StateContract+ validation result is attachedFollow-up fixes discovered by the e2e
The test exposed two real integration gaps:
POST /v1/delegation-contractsis ambiguous because both formal delegation and identity contracts register that route. This PR keeps the legacy routes but adds non-colliding formal routes:/v1/delegation/contracts/v1/delegation/tasksValidation
Against a disposable local Postgres DB
engram_delegation_e2ewith migrations applied:pnpm exec jest src/delegation --runInBand --forceExitdelegation-ledger.integration.spec.tspnpm buildNote
This PR answers the question: yes, with this follow-up proof in place, we can confirm agents can delegate, discover delegated tasks, complete them, attach validation/receipt evidence, and track resulting trust reports through Engram.