Enforce OCF adjustment state integrity#280
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 58 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 (8)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
This PR enforces OCF adjustment-state integrity by treating OCF transaction times as calendar dates (no intra-day ordering), rejecting conflicting same-date absolute states, and validating conversion-ratio adjustment eligibility and final-state consistency.
Changes:
- Normalize adjustment precedence/effectiveness to OCF calendar dates (ignore intra-day timestamps) and apply adjustments for the entire OCF date in “as-of” lookups.
- Add final-state integrity validation to reject conflicting same-date adjustment states (while allowing identical re-declarations) and validate conversion-ratio adjustment eligibility.
- Expand DAML script coverage for conflicting/identical same-date adjustments and same-date effectiveness; bump OpenCapTable-v34 to 0.0.18 and update DAR artifacts/locks.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| scripts/codegen/templates/CapTable.daml.template | Implements OCF-date normalization, same-date conflict detection, and final-state validation hook. |
| Test/daml/OpenCapTable/TestIssuerAuthorizedShares.daml | Updates tests for same-OCF-date conflict/identity rules and full-day effectiveness. |
| Test/daml/OpenCapTable/TestStockClassAuthorizedShares.daml | Updates tests for stock-class auth + conversion-ratio adjustments under OCF-date semantics. |
| Test/daml/OpenCapTable/TestStockPlanReservedShares.daml | Updates stock-plan pool adjustment tests for same-OCF-date conflict/identity and full-day effectiveness. |
| Test/daml/OpenCapTable/TestStockClassConversionRatioAdjustment.daml | Adds tests for ratio-right requirement, final-state validation behavior, and full-mechanism comparisons. |
| Test/daml.yaml | Bumps test package data-dependency DAR to 0.0.18. |
| OpenCapTable-v34/daml.yaml | Bumps package version to 0.0.18. |
| dars/OpenCapTable-v34/0.0.18/OpenCapTable-v34.dar | Adds the 0.0.18 DAR (Git LFS pointer). |
| dars/dars.lock | Registers the new DAR hash/metadata for 0.0.18. |
|
@copilot review exact head |
|
@codex review exact head |
|
@cursor review exact head |
There was a problem hiding this comment.
✅ 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 6aec384. Configure here.
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@copilot review exact head |
Reviewed exact head |
Summary
Enforce one OCF adjustment-state integrity category across issuer authorization, stock-class authorization, stock-plan pools, and stock-class conversion ratios:
This removes the previous implementation-specific same-timestamp tie breakers. OCF provides only a date and declares the new absolute state, so two different states for one target on one date cannot be ordered consistently.
OCF requirement references
Validated against Open Cap Format commit
dd84bdb6bafb63681c77166f315cea5a2078a4c8:The same-date conflict rule is the consistency invariant implied by those definitions: each transaction supplies an absolute state, but the OCF date type supplies no sub-day ordering with which to choose between conflicting values.
Coverage
Behavioral coverage includes:
Validation
Exact head:
6aec384921802ee526f07d411e083e74c6009716npm test(770 DAML scripts)npm run buildnpm run formatnpm run lint(0 errors; 2 pre-existing warnings)npm run lint:daml(no hints)npm run check:schema-gaps -- --ocf-schema-dir /tmp/ocf-audit.v3uqeD/schema(55/55 clean; 1 intentional helper skip)npm run verify-packagenpm run verify-dars(18 DARs)npm run check-upgrade-compat(0.0.17 -> 0.0.18)Package
Bumps OpenCapTable-v34 to
0.0.18.DAR SHA-256:
f73752ab485c0926f61bd0d4c5b1be9b4a7aff35902d170189238c2424650805(3,449,292 bytes).Stack
Targets
codex/ocf-vesting-quantity-integrityso this PR contains only adjustment-state integrity. Retarget tomainafter the base PR lands.Note
High Risk
Changes core cap-table authorization, pool, and conversion-ratio validation used on every UpdateCapTable; incorrect semantics could reject valid cap tables or accept ambiguous histories.
Overview
Bumps OpenCapTable-v34 to
0.0.18and ships the updated DAR; Test depends on the new package.Cap table logic now treats OCF transaction dates as calendar dates (
ocfDate/ocfDateOnOrBefore), so intra-day DAML timestamps no longer pick winners among adjustments on the same day. Same-day precedence tie-breakers (e.g. lower authorized shares or “higher ratio”) are removed; only later OCF dates win.recordAdjustmentStateandvalidateAdjustmentStateIntegrityrun onUpdateCapTablefinal state: conflicting absolute adjustment values for the same target on one OCF date fail; identical repeats are allowed. This covers issuer authorized shares, stock-class authorized shares, stock-plan pool adjustments, and conversion-ratio adjustments (fullnew_ratio_conversion_mechanismequality). Ratio adjustments must target a class with a ratio conversion right.DAML scripts replace old “same date lower wins” scenarios with tests for conflicts, identical same-date success, whole-day effectiveness, final-state edit/delete paths, ratio-target eligibility, and full-mechanism same-date conflicts.
Reviewed by Cursor Bugbot for commit 6aec384. Bugbot is set up for automated code reviews on this repo. Configure here.