Skip to content

Enforce warrant conversion right references#247

Closed
HardlyDifficult wants to merge 3 commits into
codex/ocf-convertible-conversion-right-referencesfrom
codex/ocf-warrant-conversion-right-references
Closed

Enforce warrant conversion right references#247
HardlyDifficult wants to merge 3 commits into
codex/ocf-convertible-conversion-right-referencesfrom
codex/ocf-warrant-conversion-right-references

Conversation

@HardlyDifficult

@HardlyDifficult HardlyDifficult commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Validate declared OcfRightWarrant.converts_to_stock_class_id values inside WarrantIssuance.exercise_triggers against the final CapTable stock-class map.
  • Leave unset warrant conversion targets valid for future/undetermined conversion rounds.
  • Cover same-batch stock-class target creation, missing targets on create/edit, and deleting a referenced target.

OCF documentation

Validation

  • NODE_PATH=/Users/fairnick/Documents/code/fairmint/open-captable-protocol-daml/node_modules PATH="/Users/fairnick/Documents/code/fairmint/open-captable-protocol-daml/node_modules/.bin:$HOME/.dpm/bin:$PATH" npm run build
  • JAVA_HOME=/opt/homebrew/opt/openjdk@17 PATH="/opt/homebrew/opt/openjdk@17/bin:$HOME/.dpm/bin:$PATH" dpm test --show-coverage --color --coverage-ignore-choice 'splice-amulet:.*'

Note

Medium Risk
Changes which cap-table batches succeed or fail for warrant data, but mirrors existing convertible reference checks and only affects declared conversion targets.

Overview
CapTable batch updates now validate warrant exercise trigger conversion rights: when an OcfRightWarrant sets converts_to_stock_class_id, that ID must exist in the post-batch stock-class map (same optional-reference pattern as convertibles). Unset targets stay allowed.

UpdateCapTable runs the new check alongside existing stock-class and convertible conversion reference validation. Daml script tests cover same-batch target creation, missing targets on create/edit, and blocking stock-class delete when a warrant still points at it. The packaged OpenCapTable-v34 DAR and dars.lock are refreshed for the regenerated contract.

Reviewed by Cursor Bugbot for commit f937857. 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: 47 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: 8bdfeb8f-d6de-4696-ba0f-6e694abc6567

📥 Commits

Reviewing files that changed from the base of the PR and between 6841797 and f937857.

⛔ Files ignored due to path filters (1)
  • dars/dars.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • Test/daml/OpenCapTable/TestWarrantConversionRightReferences.daml
  • dars/OpenCapTable-v34/0.0.2/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-warrant-conversion-right-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:43
@HardlyDifficult
HardlyDifficult requested a review from Copilot July 8, 2026 23:43

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

This PR adds CapTable batch-time validation to ensure warrant exercise-trigger conversion targets reference an existing stock class in the post-batch stock-class map, and introduces tests covering same-batch creation, missing targets, edit-time invalid targets, and preventing deletion of a referenced stock class.

Changes:

  • Add validateWarrantConversionRightReferences to UpdateCapTable validation flow.
  • Add a new Daml Script test module covering warrant conversion-target reference scenarios.
  • Refresh the packaged DAR and dars.lock to reflect regenerated artifacts.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
Test/daml/OpenCapTable/TestWarrantConversionRightReferences.daml Adds script tests for warrant exercise-trigger conversion target reference validation.
scripts/codegen/templates/CapTable.daml.template Adds warrant conversion-target reference validation during UpdateCapTable.
dars/OpenCapTable-v34/0.0.2/OpenCapTable-v34.dar Updates DAR LFS pointer for regenerated package.
dars/dars.lock Updates locked sha/size metadata for the regenerated DAR.

Comment on lines +332 to +335
(\trigger -> case trigger.conversion_right of
OcfRightWarrant warrantRight ->
validateOptionalStockClassReference "Warrant conversion target" maps warrantRight.converts_to_stock_class_id
_ -> pure ())

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

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

Comment on lines +332 to +335
(\trigger -> case trigger.conversion_right of
OcfRightWarrant warrantRight ->
validateOptionalStockClassReference "Warrant conversion target" maps warrantRight.converts_to_stock_class_id
_ -> pure ())
@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