Model exact conversion trigger variants#421
Conversation
# Conflicts: # src/functions/OpenCapTable/convertibleIssuance/createConvertibleIssuance.ts # src/functions/OpenCapTable/convertibleIssuance/getConvertibleIssuanceAsOcf.ts # src/functions/OpenCapTable/warrantIssuance/createWarrantIssuance.ts # src/functions/OpenCapTable/warrantIssuance/getWarrantIssuanceAsOcf.ts # src/types/native.ts
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Note Reviews pausedUse the following commands to manage reviews:
Use the checkboxes below for quick actions:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
…-conversion-triggers
|
CI is green on the latest head, including the full OCP QuickStart integration suite. @copilot review |
|
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Pull request overview
Models OCF conversion triggers as six exact discriminated-union variants and centralizes validation so convertible/warrant issuance read/write boundaries reject malformed or cross-variant trigger payloads instead of silently normalizing them.
Changes:
- Introduces
ConversionTriggerFor<TRight>exact union types and applies them toConvertibleConversionTrigger/WarrantExerciseTrigger. - Adds
parseConversionTriggerFieldsand wires it into convertible + warrant issuance DAML↔OCF converters to enforce variant-specific fields. - Adds compile-time declaration contracts plus runtime round-trip / rejection tests and pinned-schema alignment coverage for all six trigger variants.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/types/conversionTriggers.types.ts | Source-level TS compile contracts for the six exact trigger variants (including negative @ts-expect-error cases). |
| test/declarations/conversionTriggers.types.ts | Built-declaration compile contracts to ensure emitted dist types preserve the exact trigger unions. |
| test/schemaAlignment/conversionTriggerShapes.test.ts | Schema-alignment tests asserting pinned OCF trigger shapes are accepted/rejected correctly via parseOcfObject. |
| test/converters/conversionTriggerVariants.test.ts | Converter round-trip and boundary-rejection tests covering all six variants across convertible + warrant issuance paths. |
| test/createOcf/falsyFieldRoundtrip.test.ts | Extends falsy/field-preservation tests to include trigger_date on DAML trigger payloads. |
| src/types/native.ts | Adds exact trigger union types (ConversionTriggerFor) and replaces prior loose trigger interfaces for convertibles/warrants. |
| src/utils/conversionTriggers.ts | New centralized trigger validator/builder (parseConversionTriggerFields) enforcing discriminator-specific timing fields and null-handling. |
| src/functions/OpenCapTable/convertibleIssuance/createConvertibleIssuance.ts | Validates and writes convertible triggers using parseConversionTriggerFields, emitting only the allowed timing fields per variant. |
| src/functions/OpenCapTable/convertibleIssuance/getConvertibleIssuanceAsOcf.ts | Reads/validates convertible triggers via parseConversionTriggerFields (with nullIsAbsent for ledger nulls). |
| src/functions/OpenCapTable/warrantIssuance/createWarrantIssuance.ts | Validates and writes warrant triggers using parseConversionTriggerFields, ensuring canonical timing field emission. |
| src/functions/OpenCapTable/warrantIssuance/getWarrantIssuanceAsOcf.ts | Reads/validates warrant triggers via parseConversionTriggerFields (with nullIsAbsent for ledger nulls). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… into codex/exact-conversion-triggers
|
Current head 5231202 is green and merge-clean. Empty required trigger strings are rejected, both issuance writers share one strict timing serializer, and all prior review threads are resolved. @copilot-pull-request-reviewer please review the latest head. |
|
cursor review |
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 5231202. Configure here.
…nisms' into codex/exact-conversion-triggers # Conflicts: # src/functions/OpenCapTable/convertibleIssuance/createConvertibleIssuance.ts
…nisms' into codex/exact-conversion-triggers
…nisms' into codex/exact-conversion-triggers # Conflicts: # src/functions/OpenCapTable/warrantIssuance/createWarrantIssuance.ts
…nisms' into codex/exact-conversion-triggers
|
cursor review |
Reviewed exact head |
|
@cursor review Copilot completed a fresh no-findings review of exact head eed32ce: #421 (comment). Exact CI and QuickStart are green, GitHub reports CLEAN/MERGEABLE, and all prior threads are resolved. Please perform a formal review of this exact head against a42473a, focusing on exact conversion-trigger variants and stock-class storage invariants. |
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 eed32ce. Configure here.
…act-conversion-triggers
|
Material parent propagation complete at exact head 4debb8a, incorporating #420 at 0f61496. Source typecheck passed on canton-node-sdk 0.0.227, preserving this PR's exact conversion-trigger architecture plus exhaustive relationship and symmetric vesting-graph validation. The PR remains draft and unassigned while CI runs. |
|
Fresh semantic audit hardening is pushed at exact head Two runtime invariants that declarations/tests previously missed are now enforced symmetrically:
The shared validators run on writer and ledger-reader paths for both parent families. Regressions cover duplicate variants, reversed reads/writes, valid/equal round trips, source+built declaration gates, and post-build runtime behavior. Accessor/proxy inputs remain trap-safe and right/mechanism discriminant mismatches remain rejected. Validation on this exact revision: focused 2 suites / 100 tests; full 83 suites / 4,454 tests; build; typecheck; declarations; exact public-config checks; lint; format; diff check; and six post-build duplicate/reversed rejection probes with structured SDK errors. The PR remains draft and unassigned; no parent merge or reviews were requested. |
…act-conversion-triggers # Conflicts: # test/client/OcpClient.test.ts # test/config/environment.test.ts
|
Propagated corrected PR #420 head Preserved every parent schema/conversion guardrail and this PR’s exact conversion-trigger invariants: non-empty unique Validation is green locally: 84 suites / 5,149 tests, build, global exact-optional typecheck, declaration and exact public-config tests, lint, Prettier, and diff checks. This PR remains draft and unassigned while the corrected stack is propagated and fresh exact-head reviews are pending. |
…act-conversion-triggers
|
Re-propagated corrected PR #420 head Preserved global exact optional-property types, unique non-empty trigger IDs, inclusive date-range validation, all parent schema/conversion invariants, and corrected full-payload PlanSecurity/Monetary behavior. Validation is green locally: 7 focused suites / 517 tests; full coverage run 84 suites / 5,163 tests; clean build; global exact-optional typecheck; declaration and exact public-config tests; lint; Prettier; and diff checks. This PR remains draft and unassigned pending downstream propagation and fresh exact-head reviews. |
|
@copilot review Please review exact current head |
Reviewed exact head |
|
@cursor review Please review exact current 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 93cbf41. Configure here.
|
Returned to draft because upstream #417 received a material exact-head corrective revision after full CodeRabbit review. This stacked PR will remain held until the audited #417 head and each intervening parent are propagated normally; fresh CI and Copilot-first reviewer gates are required afterward. |
…act-conversion-triggers
…act-conversion-triggers
|
Exact draft head |
|
Fresh GitHub validation is now complete for exact draft head |
|
Closing for the contract-owned validation pivot. The runtime trigger validator, duplicate-ID checks, elective-range ordering checks, and related semantic preflight belong in DAML. The small discriminated TypeScript trigger union and thin deterministic codec mapping remain useful and will be absorbed into the future simplified #420 scope rather than preserved as a separate PR. Branch retained for reference. |
Summary
Validation
Stack
Depends on #420 at exact head c97ddc3. This PR remains draft until the parent and its own fresh CI, QuickStart, and exact-head reviewer gates complete.