Enforce OCF terminal transaction completeness - #281
Conversation
📝 WalkthroughWalkthroughThe change centralizes terminal-event indexing and validation in the cap-table template. DAML tests now model explicit remainder securities for partial lifecycle operations and assert failures for missing or invalid balance-security references across security types. ChangesTerminal Event Validation and Balance-Linked Tests
Estimated code review effort: 5 (Critical) | ~120 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
@copilot review exact head |
|
@codex review exact head |
|
@cursor review exact head |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit a2487c4. Configure here.
Reviewed exact head |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a2487c47c4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@copilot review exact head |
|
@codex review exact head |
|
@cursor review exact head |
Reviewed exact head |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 84716e5. Configure here.
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Preliminary OCF validation-policy auditPolicy: OCF Validation Policy Strong OCF basis
Needs verification
Proposed next step |
There was a problem hiding this comment.
Pull request overview
Enforces OCF terminal transaction semantics by retiring source security IDs and requiring explicit successor securities for partial transactions.
Changes:
- Makes stock, warrant, equity-compensation, and convertible reductions terminal.
- Validates full consumption when no balance security is provided.
- Updates fixtures, tests, package version, and DAR artifacts.
Reviewed changes
Copilot reviewed 23 out of 24 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
Test/daml/OpenCapTable/TestWarrantTransfer.daml |
Tests partial-transfer rejection. |
Test/daml/OpenCapTable/TestWarrantCancellation.daml |
Tests completeness and unknown quantities. |
Test/daml/OpenCapTable/TestVestingQuantityIntegrity.daml |
Updates successor-chain vesting tests. |
Test/daml/OpenCapTable/TestStockTransfer.daml |
Tests partial-transfer rejection. |
Test/daml/OpenCapTable/TestStockSecurityBalances.daml |
Materializes stock balance successors. |
Test/daml/OpenCapTable/TestStockRepurchase.daml |
Tests partial-repurchase rejection. |
Test/daml/OpenCapTable/TestStockPlanReservedShares.daml |
Updates stock-plan successor fixtures. |
Test/daml/OpenCapTable/TestStockConversion.daml |
Tests partial-conversion rejection. |
Test/daml/OpenCapTable/TestStockClassAuthorizedShares.daml |
Updates ceiling fixtures. |
Test/daml/OpenCapTable/TestStockCancellation.daml |
Tests partial-cancellation rejection. |
Test/daml/OpenCapTable/TestNonStockSecurityBalances.daml |
Adds explicit non-stock successor chains. |
Test/daml/OpenCapTable/TestLifecycleInvariants.daml |
Updates lifecycle chains. |
Test/daml/OpenCapTable/TestFinalReferenceValidation.daml |
Adds transfer balance reference. |
Test/daml/OpenCapTable/TestEquityCompensationTransfer.daml |
Tests partial-transfer rejection. |
Test/daml/OpenCapTable/TestEquityCompensationCancellation.daml |
Tests partial-cancellation rejection. |
Test/daml/OpenCapTable/TestConvertibleTransfer.daml |
Tests partial-transfer rejection. |
Test/daml/OpenCapTable/TestConvertibleConversion.daml |
Targets reduced convertible successors. |
Test/daml/OpenCapTable/TestConvertibleCancellation.daml |
Tests partial-cancellation rejection. |
Test/daml/OpenCapTable/TestBalanceSecurityReferences.daml |
Covers terminal transaction edits. |
Test/daml.yaml |
Uses version 0.0.19 DAR. |
scripts/codegen/templates/CapTable.daml.template |
Implements terminal-balance validation. |
OpenCapTable-v34/daml.yaml |
Bumps package to 0.0.19. |
dars/OpenCapTable-v34/0.0.19/OpenCapTable-v34.dar |
Adds versioned DAR artifact. |
dars/dars.lock |
Records DAR metadata and checksum. |
84716e5 to
bcc0707
Compare
|
@copilot review exact head |
|
@copilot review |
|
@codex review |
|
@cursor review |
Reviewed current head |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 10cec02. Configure here.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 10cec0210c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@copilot review |
|
@codex review |
|
@cursor review |
Reviewed current head |
|
@copilot review |
|
@codex review |
|
@cursor review |
Reviewed current head |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 5a24256. Configure here.
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Final exact-head replay resultTested
No database writes were performed. The implementation, CI, and exact-head reviews are clean, but the PR does not yet meet the required zero-issue dev/production replay gate because these ten data histories require correction. |
Exact-head data findings and safe repair boundary (2026-07-22)A fresh repeatable-read, read-only audit confirms this PR exposes 10 equity-compensation cancellation histories that current
For the nine deterministic histories, the proposed repair appends 9 successor issuances, 9 corrected cancellation versions, and 3 corrected exercise versions. It changes no existing quantity, date, economic term, or prior version. The live dry run found zero ID/custom-ID collisions, zero unreviewed post-cancellation references, exact conservation ( Code prerequisites before any data updateThe correct OCF data shape currently exposes two application bugs:
Status: the contract requirement remains well-supported, but this PR is not data-ready until the two code prerequisites are fixed, the nine deterministic histories are repaired with explicit approval, and the ambiguous Vortex history is resolved. |
Standalone OCF/data audit — 2026-07-23Audited exact head Supported by official OCF
Deliberate limitation / open spec inconsistency
Current data impact (fresh repeatable-read, read-only audit; rolled back)
Code/view blockers verified on current branchesBefore writing the nine deterministic repairs:
RecommendationKeep the contract requirement; do not weaken it or merge yet. First fix and regression-test the engine look-ahead and lineage-aware grant view, then apply the nine deterministic data repairs with explicit approval, resolve the ambiguous Vortex history, and require fresh exact-head dev and production replays with zero PR-specific issues. The latest exact-head runs remain dev and production. |
Summary
main, with no dependency on the discarded validation stackbalance_security_idbalance_security_idresolves, without treatingquantity_convertedas convertible principalbalance_security_id0.0.3DAR candidate; no version stack is addedDetailed successor economic-term continuity remains separate in #276; this PR does not duplicate that category.
OCF basis
OCF defines terminal transactions as retiring the source
security_id. When a balance-capable transaction affects only part of the position, the remainder is reissued underbalance_security_id.The explainer calls exercises terminal, but the current exercise primitive has no
balance_security_id. This PR therefore does not invent an unreported successor or retire a known partial exercise prematurely.Validation
Exact head:
5a24256b06d03ff9f4559d54543eb7254c9bc794npm run buildnpm run formatnpm run lint: 0 errors, 2 pre-existing warningsnpm run lint:daml: no hintsnpm run verify-packagenpm run verify-darsOpenCapTable-v34 v0.0.30.0.2 -> 0.0.3DAR SHA-256:
de46f26a1225fdcf798b1f17fa71eca57b2105b0df22bb70344233c8fb2dda6dExact-head replay status
5a24256b06d03ff9f4559d54543eb7254c9bc794: failed only inbatchafter 755.3s of data replay (20m23s job). Currentmainpasses the same dev snapshot, so this PR exposes remaining strict-balance data defects.batch,conversion, andschemaafter 298.6s of data replay (13m46s job), the same public phase set as the current-main baseline.