Skip to content

feat: deterministic sorting, failure fixtures, safe ownership transfer, and rollback verification - #332

Merged
preshotta merged 3 commits into
TRELLIS-STELLAR:mainfrom
rubbathabrahband:feat/issues-286-289-deterministic-sorting-fixtures-ownership-rollback
Oct 23, 2026
Merged

preshotta merged 3 commits into
TRELLIS-STELLAR:mainfrom
rubbathabrahband:feat/issues-286-289-deterministic-sorting-fixtures-ownership-rollback

Conversation

@rubbathabrahband

Copy link
Copy Markdown
Contributor

Summary of Changes

This PR addresses issues #286, #287, #288, and #289 across Trellis-API:

  1. Deterministic Sorting for Mixed-Status Records and Events (Trellis-API: Add deterministic sorting for mixed-status records and events #286):

    • Added DeterministicSorter implementing a multi-tier comparator: status priority hierarchy, timestamp normalization, and unique tie-breaking ID.
    • Built URL-safe base64 cursor pagination utilities (encodeCursor, decodeCursor, paginate) ensuring zero page drift and no duplicated items across page boundaries.
    • Full test suite in src/common/sorting/deterministic-sorter.spec.ts.
  2. Fixture Generators for Rare Failure & Recovery Paths (Trellis-API: Create fixture generators for rare failure and recovery paths #287):

    • Created FailureFixtureGenerator in src/common/fixtures/failure-fixture-generator.ts providing reproducible test fixtures for rare distributed edge cases:
      • Deep ledger reorganizations with orphaned transactions and diverging hashes.
      • Sequence/nonce collisions resulting in txBAD_SEQ.
      • Malformed XDR payloads (truncated, invalid base64, mismatched passphrases, corrupted signatures).
      • Partial database commits with compensating transaction instructions.
      • Dead-letter queue spills after maximum retry exhaustion.
      • Tampered cryptographic audit trails.
    • Full test suite in src/common/fixtures/failure-fixture-generator.spec.ts.
  3. Safe Ownership Transfer with Pending Acceptance and Expiry (Trellis-API: Implement safe ownership transfer with pending acceptance and expiry #288):

    • Implemented two-step OwnershipTransferService requiring explicit recipient acceptance before resource ownership reassignment.
    • Built-in expiration window (default 72h) and initiator cancellation capabilities.
    • Exposed REST API via OwnershipTransferController and registered in AppModule.
    • Comprehensive test suite in src/core/ownership/ownership-transfer.service.spec.ts.
  4. Rollback Verification After Failed Migrations or Deployments (Trellis-API: Add rollback verification after failed migrations or deployments #289):

    • Built RollbackVerificationService executing pre- and post-rollback invariant checks:
      • Migration lock clearance.
      • Core table schema presence verification across 9 required entities.
      • Referential integrity and orphaned foreign key auditing.
      • Row count data continuity.
      • Active database connection smoke queries.
    • Generates actionable verdicts (VERIFIED, WARNING, FAILED), discrepancy lists, and traffic-blocking guardrails.
    • Unit test suite in src/infrastructure/disaster-recovery/rollback-verifier.service.spec.ts.
  5. Operational Documentation:

    • Documented architecture, multi-tier comparator rules, failure fixture definitions, two-step transfer state machines, and rollback verification runbooks in docs/MIGRATION_ROLLBACK_AND_DATA_RELIABILITY.md.
    • Updated README.md with links to the reliability guide.

Closes #286
Closes #287
Closes #288
Closes #289

…tures, safe ownership transfer, and rollback verification

- Issue TRELLIS-STELLAR#286: Implement DeterministicSorter with multi-tier status priority hierarchy, tie-breakers, and cursor pagination
- Issue TRELLIS-STELLAR#287: Create FailureFixtureGenerator for rare failure and recovery paths (ledger reorgs, sequence collisions, malformed XDR, partial commits)
- Issue TRELLIS-STELLAR#288: Implement safe two-step OwnershipTransferService with pending acceptance, cancellation, and automated expiration
- Issue TRELLIS-STELLAR#289: Add RollbackVerificationService with pre- and post-rollback schema invariant, lock, and referential integrity verification
@github-actions

Copy link
Copy Markdown

Code Review & Auto-Merge — @dorismaduegbunam 🚀

Thank you @rubbathabrahband for your contribution!

Verified code changes and repository requirements. Merging pull request.

@preshotta

Copy link
Copy Markdown
Collaborator

This October PR is currently conflicting/dirty against the base branch and was not merged. Please update the branch, resolve conflicts, rerun CI, and request a fresh review.

rubbathabrahband and others added 2 commits October 23, 2026 07:07
…-deterministic-sorting-fixtures-ownership-rollback

# Conflicts:
#	README.md
#	src/infrastructure/disaster-recovery/disaster-recovery.module.ts
@preshotta
preshotta merged commit c03d870 into TRELLIS-STELLAR:main Oct 23, 2026
1 check passed
@preshotta

Copy link
Copy Markdown
Collaborator

Merged during the October maintenance pass after static malware-indicator review and a passing Malware guard. This is not a full security audit or a claim that the test suite passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants