Skip to content

Enforce OCF terminal transaction completeness#281

Draft
HardlyDifficult wants to merge 2 commits into
codex/ocf-adjustment-state-integrityfrom
codex/ocf-terminal-transaction-completeness
Draft

Enforce OCF terminal transaction completeness#281
HardlyDifficult wants to merge 2 commits into
codex/ocf-adjustment-state-integrityfrom
codex/ocf-terminal-transaction-completeness

Conversation

@HardlyDifficult

@HardlyDifficult HardlyDifficult commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • treat every balance-capable cancellation, transfer, stock repurchase, and stock conversion as an OCF terminal transaction that retires the original security_id
  • require a transaction without balance_security_id to consume the full known source quantity or principal; partial transactions must materialize the exact remainder under a new security ID
  • retire unknown-quantity warrants after a terminal event even when an exact remainder cannot be computed
  • normalize existing lifecycle, stock-plan, ceiling, and vesting fixtures into explicit successor chains
  • bump OpenCapTable-v34 to 0.0.19 and commit the versioned DAR

OCF requirement

OCF defines cancellations, conversions, stock repurchases, and transfers as terminal transactions. A partial transaction is still terminal: the original security_id becomes inactive and the remaining securities must be issued under balance_security_id.

The pinned schemas expose the required remainder link for the enforced families:

ConvertibleConversion already retires its source. Its OCF payload reports resulting units rather than converted principal, so this PR does not infer an unreported monetary remainder.

Validation

  • npm test: 782 scripts passed
  • npm run build
  • npm run format
  • npm run lint: 0 errors, 2 pre-existing warnings in scripts/remove-participant-dar.ts
  • npm run lint:daml: no hints
  • schema parity: 55/55 clean, 1 intentional helper skip
  • npm run verify-package
  • npm run verify-dars: 19 DARs
  • npm run check-upgrade-compat: 0.0.18 -> 0.0.19

DAR SHA-256: 1a1a8a0183b1ffef5aa873fea309468efc3f240d3560e0c54d2bfcb2d5f30edb


Note

High Risk
Changes core cap-table validation for all major security lifecycle transactions; incorrect rules would reject valid OCF batches or break upgrade paths from 0.0.18.

Overview
OpenCapTable-v34 is bumped to 0.0.19 with cap-table logic that treats balance-capable cancellations, transfers, repurchases, conversions, and related non-stock reductions as OCF terminal events: the source security_id is always retired, and any remainder must appear on a new balance_security_id.

CapTable.daml.template no longer leaves partial reductions on the original ID when balance_security_id is absent. Reduction events are modeled as terminal deltas; validateStockTerminalBalanceSuccessor, convertible monetary reduction, and warrant/equity terminal validators now fail unless a no-balance transaction consumes the full live quantity/principal (or, for unknown-quantity warrants, the source is retired after a terminal event). Convertible transfer/cancellation events always use terminal priority.

Tests are aligned to explicit successor chains (partial flows materialize balance issuances; post-reduction convertibles target the reduced security). New submitMustFail scripts cover partial stock/convertible/warrant/equity transfers and cancellations without balance, editing a full cancellation into a partial without balance, and warrant unknown-quantity retirement. Test depends on the 0.0.19 DAR; the versioned DAR and dars.lock are updated.

Reviewed by Cursor Bugbot for commit 84716e5. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 32 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 809bd8cf-45b7-4971-946c-7ab3438cf78b

📥 Commits

Reviewing files that changed from the base of the PR and between 6aec384 and 84716e5.

⛔ Files ignored due to path filters (1)
  • dars/dars.lock is excluded by !**/*.lock
📒 Files selected for processing (23)
  • OpenCapTable-v34/daml.yaml
  • Test/daml.yaml
  • Test/daml/OpenCapTable/TestBalanceSecurityReferences.daml
  • Test/daml/OpenCapTable/TestConvertibleCancellation.daml
  • Test/daml/OpenCapTable/TestConvertibleConversion.daml
  • Test/daml/OpenCapTable/TestConvertibleTransfer.daml
  • Test/daml/OpenCapTable/TestEquityCompensationCancellation.daml
  • Test/daml/OpenCapTable/TestEquityCompensationTransfer.daml
  • Test/daml/OpenCapTable/TestFinalReferenceValidation.daml
  • Test/daml/OpenCapTable/TestLifecycleInvariants.daml
  • Test/daml/OpenCapTable/TestNonStockSecurityBalances.daml
  • Test/daml/OpenCapTable/TestStockCancellation.daml
  • Test/daml/OpenCapTable/TestStockClassAuthorizedShares.daml
  • Test/daml/OpenCapTable/TestStockConversion.daml
  • Test/daml/OpenCapTable/TestStockPlanReservedShares.daml
  • Test/daml/OpenCapTable/TestStockRepurchase.daml
  • Test/daml/OpenCapTable/TestStockSecurityBalances.daml
  • Test/daml/OpenCapTable/TestStockTransfer.daml
  • Test/daml/OpenCapTable/TestVestingQuantityIntegrity.daml
  • Test/daml/OpenCapTable/TestWarrantCancellation.daml
  • Test/daml/OpenCapTable/TestWarrantTransfer.daml
  • dars/OpenCapTable-v34/0.0.19/OpenCapTable-v34.dar
  • scripts/codegen/templates/CapTable.daml.template
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/ocf-terminal-transaction-completeness

Comment @coderabbitai help to get the list of available commands.

@HardlyDifficult HardlyDifficult marked this pull request as ready for review July 12, 2026 02:47

Copy link
Copy Markdown
Collaborator Author

@copilot review exact head a2487c47c4889fbbb44b605fa6f106787922e42c. Please review OCF terminal transaction completeness across stock, warrant, equity-compensation, and convertible reductions, including exact remainder checks, source retirement for unknown-quantity warrants, same-day event ordering, and final-state edit behavior. Exact-head CI and all 782 local DAML scripts are green.

Copy link
Copy Markdown
Collaborator Author

@codex review exact head a2487c47c4889fbbb44b605fa6f106787922e42c. Focus on whether every directly measurable balance_security_id family rejects omitted partial remainders, whether terminal event ordering prevents source reuse, and whether the successor-chain fixture updates preserve aggregate and vesting semantics. Copilot was requested first; CI and 782 scripts are green.

Copy link
Copy Markdown
Collaborator Author

@cursor review exact head a2487c47c4889fbbb44b605fa6f106787922e42c. Please inspect terminal source retirement, exact remainder calculations after splits or prior reductions, convertible principal handling, and the new negative/edit-path tests. Copilot was requested first; exact-head CI and all 782 DAML scripts are green.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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.

Copilot AI commented Jul 12, 2026

Copy link
Copy Markdown

@copilot review exact head a2487c47c4889fbbb44b605fa6f106787922e42c. Please review OCF terminal transaction completeness across stock, warrant, equity-compensation, and convertible reductions, inclu...

Reviewed exact head a2487c4 across the requested areas. The implementation already enforces terminal source retirement and exact remainder handling for stock, warrant, equity-comp, and convertible reductions, including unknown-quantity warrant retirement without a balance successor. The updated lifecycle/final-reference tests also cover same-day successor chains and edit-time final-state behavior. No additional code changes are needed.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread scripts/codegen/templates/CapTable.daml.template
@HardlyDifficult HardlyDifficult marked this pull request as draft July 12, 2026 03:14
@HardlyDifficult HardlyDifficult marked this pull request as ready for review July 12, 2026 03:31
@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

@copilot review exact head 84716e5efc19bf8da68c53c2d35fa3dc2b5798d4. Please review the terminal-transaction completeness category after the same-day vesting-predecessor ordering fix. In particular, verify that every source reduction now uses terminal priority (eventDate, 2, 1), same-day priority-1 release/exercise events are folded before successor vesting state is seeded, and the new 60-release/40-transfer regression proves the corrected behavior. Exact-head CI, the full local DAML suite, DAR integrity, schema parity, and upgrade compatibility are green.

@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

@codex review exact head 84716e5efc19bf8da68c53c2d35fa3dc2b5798d4. Re-review the terminal-transaction category after the addressed finding. Focus on terminal sort-key consistency, same-day release/exercise ordering, vesting predecessor fractions, and the refreshed 0.0.19 DAR. Copilot was requested first; exact-head CI and the full suite are green.

@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

@cursor review exact head 84716e5efc19bf8da68c53c2d35fa3dc2b5798d4. Please inspect the addressed same-day terminal ordering issue, the vesting predecessor regression, and the refreshed versioned DAR. Copilot was requested first; exact-head CI and the full local validation set are green.

Copilot AI commented Jul 12, 2026

Copy link
Copy Markdown

@copilot review exact head 84716e5efc19bf8da68c53c2d35fa3dc2b5798d4. Please review the terminal-transaction completeness category after the same-day vesting-predecessor ordering fix. In particular, ...

Reviewed exact head 84716e5. The ordering fix is consistent with the requested behavior: source reductions now resolve with terminal sort key (eventDate, 2, 1), same-day priority-1 release/exercise events are included before successor predecessor seeding, and the new testVestingQuantityIntegrity_SameDayReleaseBeforeNoBalanceTransferUsesLiveSource regression exercises the 60-release/40-transfer path and passes under this ordering. No additional code changes are needed from my side.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 84716e5efc

ℹ️ 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".

@HardlyDifficult HardlyDifficult marked this pull request as draft July 13, 2026 19:06
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.

2 participants