Skip to content

Enforce equity compensation issuance references#249

Closed
HardlyDifficult wants to merge 2 commits into
codex/ocf-valuation-stock-class-referencefrom
codex/ocf-equity-compensation-issuance-references
Closed

Enforce equity compensation issuance references#249
HardlyDifficult wants to merge 2 commits into
codex/ocf-valuation-stock-class-referencefrom
codex/ocf-equity-compensation-issuance-references

Conversation

@HardlyDifficult

@HardlyDifficult HardlyDifficult commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

Enforces OCF-backed reference integrity for EquityCompensationIssuance optional references:

  • stock_class_id, when present, must reference an existing StockClass
  • stock_plan_id, when present, must reference an existing StockPlan
  • vesting_terms_id, when present, must reference existing VestingTerms
  • final cap table state is revalidated so deleting a referenced stock class, stock plan, or vesting terms cannot leave an existing equity compensation issuance dangling

OCF documentation:

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
Changes cap-table mutation rules for equity grants and shipped contract artifacts; invalid historical data or clients sending orphan optional IDs will start failing updates, but behavior matches intended OCF integrity.

Overview
Equity compensation issuances now enforce OCF-style reference integrity for optional stock_class_id, stock_plan_id, and vesting_terms_id: when set, each must point at an object on the cap table.

UpdateCapTable runs a new post-batch check over all equity compensation issuances, so edits cannot introduce bad IDs and deletes of a referenced stock class, stock plan, or vesting terms fail if any issuance still points at them. Shared validateReference / validateOptionalReference helpers back this and existing stock-class checks.

Codegen config now lists those optional fields for EquityCompensationIssuance (aligned with StockIssuance). Daml script tests were adjusted—many fixtures clear optional refs; the “optionals populated” case creates stock class, plan, and vesting terms in the same batch; TestEquityCompensationIssuanceReferences covers missing refs, same-batch success, bad edits, and blocked deletes. The OpenCapTable-v34 DAR and lockfile were refreshed.

Reviewed by Cursor Bugbot for commit b8e352c. 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: 41 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: c1d3f518-aaf1-481e-98ce-89092dfda53a

📥 Commits

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

⛔ Files ignored due to path filters (1)
  • dars/dars.lock is excluded by !**/*.lock
📒 Files selected for processing (12)
  • Test/daml/OpenCapTable/TestEquityCompensationAcceptance.daml
  • Test/daml/OpenCapTable/TestEquityCompensationCancellation.daml
  • Test/daml/OpenCapTable/TestEquityCompensationIssuance.daml
  • Test/daml/OpenCapTable/TestEquityCompensationIssuanceReferences.daml
  • Test/daml/OpenCapTable/TestEquityCompensationRetraction.daml
  • Test/daml/OpenCapTable/TestEquityCompensationTransfer.daml
  • Test/daml/OpenCapTable/TestVestingAcceleration.daml
  • Test/daml/OpenCapTable/TestVestingEvent.daml
  • Test/daml/OpenCapTable/TestVestingStart.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-equity-compensation-issuance-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:50
@HardlyDifficult
HardlyDifficult requested a review from Copilot July 8, 2026 23:50

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 pull request strengthens cap table integrity by enforcing that optional reference fields on EquityCompensationIssuance (stock class, stock plan, vesting terms) must point to existing OCF objects when present, and by revalidating the final post-batch cap table so deletes can’t leave dangling references.

Changes:

  • Added shared reference validation helpers and a post-batch validateEquityCompensationIssuanceReferences pass in UpdateCapTable.
  • Updated codegen validation config to include EquityCompensationIssuance optional reference fields.
  • Updated DAML script tests/fixtures to avoid orphan optional IDs and added a dedicated references test module covering missing refs, same-batch success, bad edits, and blocked deletes.

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Test/daml/OpenCapTable/TestVestingStart.daml Clears optional equity-comp reference IDs in fixtures so tests don’t fail under stricter reference validation.
Test/daml/OpenCapTable/TestVestingEvent.daml Clears optional equity-comp reference IDs in fixtures to avoid invalid orphan references.
Test/daml/OpenCapTable/TestVestingAcceleration.daml Clears optional equity-comp reference IDs in fixtures to align with new reference integrity rules.
Test/daml/OpenCapTable/TestEquityCompensationTransfer.daml Removes hard-coded optional refs in issuance setup to prevent dangling IDs.
Test/daml/OpenCapTable/TestEquityCompensationRetraction.daml Removes hard-coded optional refs in issuance setup to prevent dangling IDs.
Test/daml/OpenCapTable/TestEquityCompensationIssuanceReferences.daml New test coverage for equity-comp optional reference validation (missing refs, same-batch success, edit failures, delete blocking).
Test/daml/OpenCapTable/TestEquityCompensationIssuance.daml Adjusts “optionals populated” test to create referenced objects in the same batch before issuance creation.
Test/daml/OpenCapTable/TestEquityCompensationCancellation.daml Removes hard-coded optional refs in issuance setup to prevent dangling IDs.
Test/daml/OpenCapTable/TestEquityCompensationAcceptance.daml Removes hard-coded optional refs in issuance setup to prevent dangling IDs.
scripts/codegen/templates/CapTable.daml.template Adds generic reference validators and a post-batch validation pass for EquityCompensationIssuance optional references.
scripts/codegen/captable-config.yaml Adds optional reference validations for EquityCompensationIssuance in codegen config.
dars/OpenCapTable-v34/0.0.2/OpenCapTable-v34.dar Updates shipped DAR artifact (LFS pointer) to reflect new validation logic.
dars/dars.lock Updates lock entry (sha/size/timestamp) for the refreshed DAR.
Comments suppressed due to low confidence (1)

scripts/codegen/templates/CapTable.daml.template:313

  • validateOptionalStockClassReference duplicates the new generic validateOptionalReference helper. Rewriting it in terms of validateOptionalReference reduces duplication and ensures optional-reference validation stays consistent across object types.
validateOptionalStockClassReference : Text -> CapTableMaps -> Optional Text -> Update ()
validateOptionalStockClassReference label maps stockClassId = case stockClassId of
  Some id -> validateStockClassReference label maps id
  None -> 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