Skip to content

Enforce transaction lifecycle dates#274

Draft
HardlyDifficult wants to merge 35 commits into
codex/ocf-vesting-graph-integrityfrom
codex/ocf-transaction-lifecycle-dates
Draft

Enforce transaction lifecycle dates#274
HardlyDifficult wants to merge 35 commits into
codex/ocf-vesting-graph-integrityfrom
codex/ocf-transaction-lifecycle-dates

Conversation

@HardlyDifficult

@HardlyDifficult HardlyDifficult commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Stacked on #254.

This adds contract-level lifecycle date validation for security transactions. UpdateCapTable now rejects final cap-table states where:

  • an acceptance, cancellation, transfer, conversion, exercise, release, repricing, reissuance, consolidation, or retraction is dated before the issuance that created the referenced source security_id
  • a terminal transaction's resulting_security_ids point to output issuances whose issuance date does not match the transaction that created them
  • a terminal transaction's balance_security_id points to a remainder issuance whose issuance date does not match the transaction that created it
  • an output security ID exists under the wrong issuance type, preventing lifecycle checks from being skipped by type confusion
  • an equity-compensation release settles before the release transaction date
  • a vesting start, event, or acceleration predates the stock, warrant, or equity-compensation issuance it acts on

The validation runs as a final-state pass, so it applies after creates, edits, and deletes and catches invalid historical sequences even when the bad state is created across multiple batches.

OCF requirement references

Source checked against Open-Cap-Format-OCF at dd84bdb6bafb63681c77166f315cea5a2078a4c8.

Stack/version

  • Base: #254 (codex/ocf-vesting-graph-integrity)
  • OpenCapTable-v34 package version: 0.0.14
  • Includes regenerated DAR backup and dars.lock entry for this lifecycle category.

Validation

Exact head: 4d90aa722a7209eaabf0d9d3d74a309e276a16c8

  • npm run build
  • focused lifecycle suite (17 lifecycle scripts passed)
  • npm test (all 625 behavioral test scripts plus 2 setup scripts passed)
  • npm run lint (0 errors; 2 pre-existing warnings)
  • npm run lint:daml (no hints)
  • npm run format
  • npm run check:schema-gaps -- --ocf-schema-dir /tmp/open-cap-format-ocf-schema-check/schema (55/55 clean)
  • npm run verify-dars (14 verified; 0.0.14 SHA-256 099c610b1248e1ef312cb15b0715e791088671c70ac13f44e7e103b22a20d88c, 3,235,156 bytes)
  • npm run codegen and npm run verify-package
  • npm run check-upgrade-compat (0.0.13 -> 0.0.14)
  • git diff --check

Note

Medium Risk
Tightens cap-table mutation rules in core ledger logic; previously accepted out-of-order or mis-typed successor securities may now fail UpdateCapTable, though behavior is covered by new tests and a minor package upgrade.

Overview
UpdateCapTable now runs a final-state validateTransactionLifecycleDates pass (wired from the CapTable codegen template) so invalid dated security histories are rejected after creates, edits, and deletes.

The new rules enforce that downstream transactions are not dated before their source issuance; terminal resulting_security_ids and balance_security_id issuances align with the creating transaction’s date (with convertible outputs required to match exactly); output IDs cannot be the wrong issuance type; equity-compensation releases cannot settle before the release date; and vesting transactions cannot predate the issuance they reference.

OpenCapTable-v34 is bumped to 0.0.14 with an updated DAR backup and dars.lock. Test depends on the new DAR and adds TestTransactionLifecycleDates.daml with 17 Daml Script cases covering the failure modes above.

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

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 008166a0-a22b-48b3-a9b4-ce93e31a1295

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/ocf-transaction-lifecycle-dates

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

@HardlyDifficult HardlyDifficult marked this pull request as ready for review July 9, 2026 19:15
@HardlyDifficult HardlyDifficult requested a review from Copilot July 9, 2026 19:15
@HardlyDifficult HardlyDifficult marked this pull request as draft July 9, 2026 19:16

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

Adds contract-level validation to enforce OCF-aligned transaction lifecycle date ordering for security transactions during UpdateCapTable, preventing final cap-table states with chronologically inconsistent transaction/issuance sequences.

Changes:

  • Add final-state lifecycle date validation helpers and per-transaction-type checks in the CapTable codegen template.
  • Add DAML Script tests for representative failure cases (acceptances before issuance; transfers whose output issuance predates the transfer).
  • Bump OpenCapTable-v34 package version to 0.0.15 and update Test DAR dependency and dars.lock.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Test/daml/OpenCapTable/TestTransactionLifecycleDates.daml Adds new DAML Script tests asserting invalid lifecycle date orderings fail.
Test/daml.yaml Updates Test package data-dependency to OpenCapTable-v34 0.0.15 DAR.
scripts/codegen/templates/CapTable.daml.template Introduces lifecycle date validation helpers and wires them into post-batch validation.
OpenCapTable-v34/daml.yaml Bumps package version from 0.0.14 to 0.0.15.
dars/OpenCapTable-v34/0.0.15/OpenCapTable-v34.dar Adds the regenerated DAR (Git LFS pointer).
dars/dars.lock Registers the new DAR artifact (sha/size/sdkVersion/uploadedAt).

Comment thread scripts/codegen/templates/CapTable.daml.template
@HardlyDifficult HardlyDifficult marked this pull request as ready for review July 9, 2026 20:14

Copy link
Copy Markdown
Collaborator Author

@copilot review

Copy link
Copy Markdown
Collaborator Author

@codex review
@coderabbitai review

@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

@copilot review exact head 1a042c5087b417c0602e6075b8afbdbd554fe97d. Retrying once because the prior exact-head request produced no acknowledgement or review. CI is green, merge state is clean, and all review threads are resolved.

Copilot AI commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

@copilot review exact head 1a042c5087b417c0602e6075b8afbdbd554fe97d. Retrying once because the prior exact-head request produced no acknowledgement or review. CI is green, merge state is clean, and ...

Reviewed exact head 1a042c5087b417c0602e6075b8afbdbd554fe97d. I don’t see additional issues to address in this PR at this time.

@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

@codex review exact head 1a042c5087b417c0602e6075b8afbdbd554fe97d. Copilot completed this exact revision with no findings. Please focus on lifecycle-date ordering, successor output dates, release settlement ordering, and vesting dates.

@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

@cursor review Please review exact head 1a042c5087b417c0602e6075b8afbdbd554fe97d, focusing on lifecycle-date ordering and successor output dates after the parent restack. Copilot completed this exact revision with no findings.

@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review exact head 1a042c5087b417c0602e6075b8afbdbd554fe97d. Copilot completed this revision with no findings. Please perform the canonical exact-head review.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

@HardlyDifficult Understood — kicking off the review for exact head 1a042c5087b417c0602e6075b8afbdbd554fe97d. Note that this commit was already reviewed in my earlier pass (following your resume request), so if no new commits have landed since then, this will be a no-op since CodeRabbit doesn't re-review a commit it has already reviewed. If you've pushed anything since then, this will pick it up.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cursor cursor 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.

✅ 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 1a042c5. Configure here.

@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: 1a042c5087

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

Comment thread scripts/codegen/templates/CapTable.daml.template Outdated
@HardlyDifficult HardlyDifficult marked this pull request as draft July 11, 2026 16:25
@HardlyDifficult HardlyDifficult marked this pull request as ready for review July 11, 2026 16:38
@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

@copilot review exact head 4d90aa722a7209eaabf0d9d3d74a309e276a16c8. Please re-review the convertible successor exact-date fix added from Codex feedback. CI is green, the branch is merge-clean, all 627 DAML scripts pass locally, and every review thread is resolved.

Copilot AI commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

@copilot review exact head 4d90aa722a7209eaabf0d9d3d74a309e276a16c8. Please re-review the convertible successor exact-date fix added from Codex feedback. CI is green, the branch is merge-clean, all ...

Reviewed exact head 4d90aa722a7209eaabf0d9d3d74a309e276a16c8 with focus on lifecycle-date ordering, successor output dates, release settlement ordering, and vesting dates. I don’t see additional issues to address in this PR at this time.

@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

@codex review exact head 4d90aa722a7209eaabf0d9d3d74a309e276a16c8. Copilot completed this exact revision with no findings. Please verify the exact convertible successor-date enforcement and lifecycle ordering.

@cursor review Please review exact head 4d90aa722a7209eaabf0d9d3d74a309e276a16c8, focusing on the Codex-requested exact-date fix and its regression.

@coderabbitai review exact head 4d90aa722a7209eaabf0d9d3d74a309e276a16c8. Copilot completed this revision with no findings; please perform the canonical exact-head review.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

@HardlyDifficult Got it — kicking off a review of exact head 4d90aa722a7209eaabf0d9d3d74a309e276a16c8, focusing on the convertible successor-date enforcement and lifecycle ordering as requested.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

@cursor review Please review exact head 4d90aa722a7209eaabf0d9d3d74a309e276a16c8, focusing on the exact convertible successor-date fix and its regression. Retrying once in a dedicated comment because the combined request received no Cursor acknowledgement; Copilot is clean and CI is green.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 4d90aa722a

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

@cursor cursor 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.

✅ 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 4d90aa7. Configure here.

@HardlyDifficult HardlyDifficult marked this pull request as draft July 13, 2026 18:18

Copy link
Copy Markdown
Collaborator Author

Feature/test follow-up is complete at exact commit a0306fa316d5ffb1f6372bfdf4833960880e4886.

This completes approval-date consistency for every dated transaction family that exposes board or stockholder approval dates. Each optional approval date must be on or before the transaction date, or the valuation effective_date, for convertible issuances, equity-compensation issuances, issuer authorized-share adjustments, stock-class authorized-share adjustments, stock issuances, stock-plan pool adjustments, valuations, and warrant issuances. StockClass and StockPlan approval metadata were deliberately left without invented ordering because those objects have no independent transaction/effective date.

Coverage exercises all eight dated families, alternates both approval fields, proves same-day approval is valid, and verifies edit-time revalidation.

Local validation on this feature commit passed: npm run build, the full npm test Daml script suite, npm run lint:daml, and git diff --check.

No package version, DAR backup, dependency, workflow-policy, or release-policy files changed in this follow-up. The PR intentionally remains draft and unassigned until stack normalization is complete and the resulting exact head passes CI and refreshed automated review gates.

Copy link
Copy Markdown
Collaborator Author

Preliminary OCF validation-policy audit

Policy: OCF Validation Policy

Appears supported

  • A later transaction acting on a security cannot predate the issuance that created its security_id.
  • Settlement or effective dates should obey ordering explicitly defined by the relevant OCF fields.
  • Source/result chronology required by documented event-stack semantics.

Needs line-by-line evidence or narrowing

  • Exact successor-issuance dates where OCF only establishes ordering.
  • Approval-date ordering and same-date behavior unless the official source explicitly defines it.
  • Global uniqueness rules that are not part of this date category.

Proposed next step
Split the date rules by transaction family and cite the exact ordering semantics for each. No merge recommendation yet.

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.

3 participants