Enforce equity compensation issuance references#249
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 41 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (12)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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
validateEquityCompensationIssuanceReferencespass inUpdateCapTable. - Updated codegen validation config to include
EquityCompensationIssuanceoptional 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
validateOptionalStockClassReferenceduplicates the new genericvalidateOptionalReferencehelper. Rewriting it in terms ofvalidateOptionalReferencereduces 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 ()
|
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. |
Summary
Enforces OCF-backed reference integrity for
EquityCompensationIssuanceoptional references:stock_class_id, when present, must reference an existingStockClassstock_plan_id, when present, must reference an existingStockPlanvesting_terms_id, when present, must reference existingVestingTermsOCF documentation:
EquityCompensationIssuance.stock_class_id,stock_plan_id, andvesting_terms_id: https://raw.githubusercontent.com/Open-Cap-Table-Coalition/Open-Cap-Format-OCF/main/schema/objects/transactions/issuance/EquityCompensationIssuance.schema.jsonStockClass: https://raw.githubusercontent.com/Open-Cap-Table-Coalition/Open-Cap-Format-OCF/main/schema/objects/StockClass.schema.jsonStockPlan: https://raw.githubusercontent.com/Open-Cap-Table-Coalition/Open-Cap-Format-OCF/main/schema/objects/StockPlan.schema.jsonVestingTerms: https://raw.githubusercontent.com/Open-Cap-Table-Coalition/Open-Cap-Format-OCF/main/schema/objects/VestingTerms.schema.jsonValidation
npm run builddpm test --show-coverage --color --coverage-ignore-choice 'splice-amulet:.*'npm run lint:damlnpm run verify-dars -- --updatenpm run check-upgrade-compatnpm run codegennpm run verify-packageNote
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, andvesting_terms_id: when set, each must point at an object on the cap table.UpdateCapTableruns 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. SharedvalidateReference/validateOptionalReferencehelpers back this and existing stock-class checks.Codegen config now lists those optional fields for
EquityCompensationIssuance(aligned withStockIssuance). 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;TestEquityCompensationIssuanceReferencescovers 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.