Skip to content

Enforce warrant issuance vesting references#250

Closed
HardlyDifficult wants to merge 2 commits into
codex/ocf-equity-compensation-issuance-referencesfrom
codex/ocf-warrant-issuance-vesting-references
Closed

Enforce warrant issuance vesting references#250
HardlyDifficult wants to merge 2 commits into
codex/ocf-equity-compensation-issuance-referencesfrom
codex/ocf-warrant-issuance-vesting-references

Conversation

@HardlyDifficult

@HardlyDifficult HardlyDifficult commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

Enforce the OCF WarrantIssuance.vesting_terms_id relationship inside the contract by validating that any populated warrant vesting terms reference resolves to an existing VestingTerms record after each cap table update batch.

This closes the dangling-reference path for creates, edits, and deletes: a warrant can still omit vesting_terms_id, but if it declares one, the target vesting terms must exist in the resulting cap table state.

OCF requirement

Changes

  • Adds WarrantIssuance optional reference validation for vesting_terms_id?:vesting_terms.
  • Adds a post-batch validateWarrantIssuanceReferences invariant so deleting referenced vesting terms is rejected.
  • Updates the existing warrant issuance optional-fields happy path to create the referenced vesting terms.
  • Adds focused tests for missing create reference, same-batch reference creation, edit to missing reference, and deleting referenced vesting terms.
  • Regenerates the v34 DAR backup and lock hash.

Validation

  • npm run build
  • dpm test --show-coverage --color --coverage-ignore-choice 'splice-amulet:.*'
  • npm run lint:daml
  • npm run verify-dars -- --update
  • npm run check-upgrade-compat
  • npm run codegen
  • npm run verify-package

Note

Medium Risk
Tightens cap-table invariants on warrant updates; batches that previously accepted invalid or orphan vesting references will now fail at exercise time.

Overview
Warrant issuances now must resolve optional vesting_terms_id to an existing VestingTerms record, matching OCF and the pattern already used for stock and equity comp issuances.

Codegen adds vesting_terms_id?:vesting_terms on create and a post-batch validateWarrantIssuanceReferences pass so dangling IDs fail on create, edit, and when deleting vesting terms still referenced by a warrant. The optional-fields warrant test creates VestingTerms in the same batch; TestWarrantIssuanceReferences covers missing reference, same-batch success, bad edit, and blocked delete. The v34 DAR backup and dars.lock hash are refreshed.

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

@coderabbitai

coderabbitai Bot commented Jul 8, 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: 34 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: 1bd2502f-9026-4e59-bce5-d2c2d38d482c

📥 Commits

Reviewing files that changed from the base of the PR and between b8e352c and 256903e.

⛔ Files ignored due to path filters (1)
  • dars/dars.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • Test/daml/OpenCapTable/TestWarrantIssuance.daml
  • Test/daml/OpenCapTable/TestWarrantIssuanceReferences.daml
  • dars/OpenCapTable-v34/0.0.2/OpenCapTable-v34.dar
  • scripts/codegen/captable-config.yaml
  • scripts/codegen/templates/CapTable.daml.template
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/ocf-warrant-issuance-vesting-references

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

@HardlyDifficult HardlyDifficult marked this pull request as ready for review July 8, 2026 23:56
@HardlyDifficult HardlyDifficult requested a review from Copilot July 8, 2026 23:56

Copilot AI 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.

Pull request overview

Tightens cap-table invariants so WarrantIssuance.vesting_terms_id (when present) must resolve to an existing VestingTerms record after each UpdateCapTable batch, preventing dangling vesting-term references created via create/edit or via deleting referenced vesting terms.

Changes:

  • Adds optional-reference validation for WarrantIssuance.vesting_terms_id in codegen configuration.
  • Adds a post-batch invariant (validateWarrantIssuanceReferences) to reject any resulting cap table state with orphaned warrant vesting-term references.
  • Updates and adds DAML script tests covering missing references, same-batch creation, bad edits, and blocked deletes.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Test/daml/OpenCapTable/TestWarrantIssuanceReferences.daml New focused tests for warrant vesting-terms reference validity across create/edit/delete.
Test/daml/OpenCapTable/TestWarrantIssuance.daml Updates existing “optionals” test to create referenced VestingTerms in the same batch.
scripts/codegen/templates/CapTable.daml.template Adds post-batch validateWarrantIssuanceReferences invariant and wires it into UpdateCapTable.
scripts/codegen/captable-config.yaml Adds vesting_terms_id?:vesting_terms validation for WarrantIssuance (and reformats one existing list).
dars/OpenCapTable-v34/0.0.2/OpenCapTable-v34.dar Regenerated DAR (Git LFS pointer updated).
dars/dars.lock Updates DAR hash/size metadata to match regenerated artifact.

@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: 256903ec0f

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

[stakeholder_id, 'stock_class_id?:stock_classes', 'stock_plan_id?:stock_plans', 'vesting_terms_id?:vesting_terms']
ConvertibleIssuance: [stakeholder_id]
WarrantIssuance: [stakeholder_id]
WarrantIssuance: [stakeholder_id, 'vesting_terms_id?:vesting_terms']

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Allow edits to reference same-batch vesting terms

When an existing warrant is edited to set vesting_terms_id to a VestingTerms created in the same UpdateCapTable call, this new validation makes the generated edit branch assert against the maps before creates are applied. Regular edits are folded before creates in scripts/codegen/templates/CapTable.daml.template lines 472-505, so the new post-batch validateWarrantIssuanceReferences would accept the final state but this early edit validation rejects it. Consider relying on the final invariant for this reference or otherwise validating warrant edits after same-batch creates are present.

Useful? React with 👍 / 👎.

Comment thread dars/dars.lock
Comment on lines +15 to +16
"sha256": "c89b11662c56c40d0ff7e8bfc03e9f4b863e84ad7b5711a338070a30ed84c08d",
"size": 2510816,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve the existing 0.0.2 DAR backup

This changes the recorded bytes for the already-backed-up OpenCapTable-v34/0.0.2 DAR while OpenCapTable-v34/daml.yaml still declares version 0.0.2. The repo's backup flow treats existing lock keys as immutable (backup-dar refuses to overwrite them), so consumers or upgrade checks that refer to the previous 0.0.2 package can no longer reproduce that exact archive from dars/; for this contract change, bump the package patch and add a new backup instead of replacing the existing 0.0.2 entry.

Useful? React with 👍 / 👎.

@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

Superseded by #251, which consolidates the reference-integrity work into one PR. Before closing this stack PR, I rechecked the live review comments and folded the actionable improvements into #251: StockPlan create-tier ordering, document related-object error messages, stock-class conversion source IDs, warrant conversion validation across all OcfAnyConversionRight variants, WarrantIssuance same-batch vesting-term edits, and immutable DAR backup versioning.

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