Repository navigation
PREWAVE-BE-007 — Publish Dispute, Appeal, and Settlement Read Models - #773
Merged
Merged
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linked task
Closes: #602
Summary
I have successfully implemented PREWAVE-BE-007 — Publish Dispute, Appeal, and Settlement Read Models. Here's a summary of what was delivered:
Implementation Summary
Core Components Created
Read Model Types (dispute-read-model.types.ts)
Versioned contract: dispute-read-model/v1
Phase-separated outcomes (provisional never serialized as final)
Release provenance binding (chainId, releaseId, deploymentBlock, artifactChecksum)
Freshness tracking (indexedBlock, safeBlock, finalizedBlock, staleness)
Appeal availability reasons (contract-derived)
Bond disposition (locked, refunded, slashed, unknown)
Settlement data structure
Fail-closed error envelopes
Service Layer
dispute-read-model.service.ts - Main service with fail-closed gates
dispute-read-model-provenance.service.ts - Release binding resolver
dispute-read-model-freshness.service.ts - Freshness from checkpoints
dispute-read-model-view.ts - View function with phase separation
API Layer
dispute-read-model.controller.ts - Read-only GET endpoints
DTOs with Swagger documentation
Cursor pagination support
Module Integration
dispute-read-models.module.ts - Registered in app.module.ts
No new migrations (uses existing projections)
Fixtures & Tests
Fixtures (dispute-read-model.fixtures.ts)
Empty register
Provisional, appealable, and finalized states
Tie/refund-only paths
Unavailable paths (no deadline, max round)
Fail-closed error states
Tests (dispute-read-model.spec.ts)
Schema drift detection
Provisional/final separation validation
Appeal availability is contract-derived
Bond disposition is exact
Economic values preserve integer units
Security constraints (no secrets, release binding)
Service Unit Tests (dispute-read-model.service.spec.ts)
List and detail retrieval
Pagination with cursor
Status filtering
Fail-closed gates (stale, wrong chain/release, not found)
Phase separation enforcement
Key Features
✅ No provisional decision is serialized as final - Phase-separated outcomes guarantee this
✅ Appeal availability is contract-derived - Based on deadline, max round, and terminal status
✅ Economic values preserve exact integer units - String representation, never floats
✅ Batch 4 screens can render without invented states - All fixtures cover approved UI states
✅ Fail-closed on missing/ambiguous data - Stale, wrong release, unavailable → error response
✅ Security constraints enforced - No secrets logged, release binding enforced
Endpoints
GET /api/v2/dispute-read-models - Versioned dispute register (cursor-paginated)
GET /api/v2/dispute-read-models/:disputeId - Versioned dispute detail
Both endpoints carry readModel, readModelVersion, provenance, and freshness in every response.
The implementation follows the same patterns as PREWAVE-BE-005 (claim read models) and is ready for integration testing once the environment allows.
Scope and assignment
Stellar Wavelabel.Architecture and security
Validation