Skip to content

Model canonical OCF conditional shapes#414

Open
HardlyDifficult wants to merge 125 commits into
mainfrom
codex/schema-shaped-core-types
Open

Model canonical OCF conditional shapes#414
HardlyDifficult wants to merge 125 commits into
mainfrom
codex/schema-shaped-core-types

Conversation

@HardlyDifficult

@HardlyDifficult HardlyDifficult commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add reusable non-empty, exactly-one, at-least-one, and at-most-one type utilities
  • require exactly one Document location: path or uri
  • make StockPlan use a non-empty canonical stock_class_ids collection
  • prevent conflicting issuer subdivision code/name values
  • require actual contact details, relationship changes, and exactly one vesting amount form
  • require the canonical stock-class conversion-ratio mechanism
  • update readers, writers, fixtures, guards, and validators to construct only schema-valid states
  • keep typed SDK paths canonical; deprecated source aliases are normalized only at the raw schema-ingestion boundary

Breaking changes

  • canonical typed DTOs no longer accept deprecated singular StockPlan class IDs
  • impossible neither/both conditional-property states no longer compile
  • deprecated DAML-only ratio and relationship fields are removed from canonical typed inputs

Validation

  • source and built-declaration positive/negative type matrices
  • runtime parser matrix for every neither/both/empty branch
  • 66 unit suites / 3,439 tests passing on the merged core slice
  • lint, formatting, and diff checks
  • coverage: 82.73% statements / 71.85% branches / 80.81% functions / 82.79% lines

Stack


Note

High Risk
Large, cross-cutting changes to cap-table read/write and breaking removal of deprecated input shapes and DAML field fallbacks; incorrect validation could block valid ledger data or alter converted OCF output.

Overview
This PR tightens canonical OCF modeling and safe conversion boundaries across the SDK: typed inputs must match schema-valid conditional shapes, and reads/writes reject unsafe or ambiguous payloads before conversion runs.

Error reporting is bounded and JSON-safe via new diagnostic sanitization on OcpError and subclasses (toSafeDiagnosticValue, mergeDiagnosticContext, toJSON), so logs/telemetry cannot trigger getters, proxies, or unbounded payloads while handling a prior failure.

Write paths call assertSafeOcfJson and stricter field checks before DAML encoding—batch createOperation/editOperation/deleteOperation and buildUpdateCapTableCommand validate exact operation envelopes; entities like document (exactly one of path/uri), stock plan (non-empty stock_class_ids, numeric initial_shares_reserved), issuer (IssuerDataInput is canonical OcfIssuer), stakeholder relationship events (canonical relationship_started/relationship_ended, no legacy new_relationships), stock-class conversion ratio (full new_ratio_conversion_mechanism only), and vesting terms (graph + portion/quantity exclusivity) drop deprecated aliases and defaults.

Read paths use generatedDamlValidation and extractGeneratedCreateArgumentData on ledger JSON; singleContractRead scans contract events for unsafe JSON and rejects proxy createArguments. Registry removes dataFieldFallbacks in favor of single canonical DAML data fields (event_data, vesting_data, etc.), so older alternate create-argument field names are no longer accepted at the dispatcher.

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

Summary by CodeRabbit

  • New Features

    • Added stricter, JSON-safe validation across OCF inputs and generated-DAML payloads, including required-field checks, canonical numeric(10) handling, supported enums, and validation of document path/URI, MD5, stock plans, relationship events, ratios, and vesting graphs.
    • Introduced bounded, immutable, JSON-serializable diagnostic error details to safely handle oversized, cyclic, proxy/unsafe, and other adversarial data.
  • Bug Fixes

    • Corrected document location rules, relationship/conversion mappings, and consistent selection of canonical generated-data fields.
    • Rejected deprecated/legacy and ambiguous input shapes consistently, with more precise error paths/messages.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Note

Reviews paused

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR adds bounded diagnostic sanitization, safe JSON and generated-DAML validation, stricter OCF schema types, canonical numeric handling, hardened entity converters, vesting graph validation, and extensive boundary, type-contract, converter, and integration tests.

Changes

Validation foundations

Layer / File(s) Summary
Bounded diagnostics
src/errors/*
Error messages, contexts, causes, and serialized output are sanitized, bounded, and made safer to enumerate.
Safe JSON and generated-DAML boundaries
src/utils/safeJson.ts, src/utils/generatedDamlValidation.ts, src/utils/ocfJsonValidation.ts, src/utils/ocfZodSchemas.ts
Unsafe JSON, proxies, accessors, unknown fields, malformed wrappers, and lossy generated-DAML decoding are rejected.
Numeric helpers and native contracts
src/utils/numeric10.ts, src/functions/OpenCapTable/vestingTerms/*, src/types/native.ts
Numeric canonicalization and cardinality types enforce canonical Numeric 10 values and OCF conditional shapes.

Entity converter hardening

Layer / File(s) Summary
Core entity converters
src/functions/OpenCapTable/{document,issuer,stakeholder}/*
Document, issuer, stakeholder, and relationship conversions use strict validation and generated-DAML decoding.
Stock plan and ratio adjustment converters
src/functions/OpenCapTable/{stockPlan,stockClassConversionRatioAdjustment}/*
Stock plans require canonical non-empty class IDs; ratio adjustments require validated conversion mechanisms and wrappers.
Vesting conversion and graph validation
src/functions/OpenCapTable/vestingTerms/*
Vesting quantities, periods, triggers, condition cardinality, graph references, and cycles are validated on both conversion paths.
Dispatch and routing
src/OcpClient.ts, src/functions/OpenCapTable/capTable/*, src/functions/OpenCapTable/shared/singleContractRead.ts
Object-type routing, batch operations, generated operation decoding, and contract reads apply safe input and wrapper validation.

Verification coverage

Layer / File(s) Summary
Converter and validation tests
test/{batch,client,converters,utils,validation}/*
Tests cover canonical fields, strict errors, numeric boundaries, generated readers, writer validation, and vesting graph behavior.
Schema, type, and integration contracts
test/{declarations,types,schemaAlignment,integration}/*
Compile-time contracts, schema alignment, fixture factories, and integration validations reflect the updated OCF shapes.
Generated boundary tests
test/validation/generatedDamlBoundary.test.ts
Boundary tests cover exact wrappers, proxy/accessor safety, sparse containers, trap-free writers, and bounded diagnostics.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 36.94% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the PR’s main focus on enforcing canonical OCF conditional shapes across models and validators.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/schema-shaped-core-types

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

@HardlyDifficult HardlyDifficult marked this pull request as ready for review July 10, 2026 04:53
@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

CI is green on the latest head, including the full OCP QuickStart integration suite.

@copilot review
@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

@HardlyDifficult I'll review the changes now.

✅ 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.

Comment thread src/functions/OpenCapTable/document/createDocument.ts
@HardlyDifficult HardlyDifficult requested a review from Copilot July 10, 2026 05:01

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

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 746ae52. Configure here.

@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

Please perform a substantive exact-head review of corrected current head 746ae52fd8d14575efe139d6ec5429785d77f124, covering the full schema-shaped core-types delta, the propagated parent fixes, and the enum-validator correction. All old-head and instant/rate-limited results are superseded and must not count. Copilot completed an explicit exact-head no-findings review: #414 (comment). Cursor completed an exact-head no-findings formal review: #414 (review). Both required CI checks are green, the PR is CLEAN/MERGEABLE, non-draft, unassigned, and has zero unresolved review threads. Please execute and publish the real analysis, feedback, and review-result phases.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

@HardlyDifficult I'll perform a fresh review of exact head 746ae52fd8d14575efe139d6ec5429785d77f124 now, covering the schema-shaped core-types delta, the propagated parent fixes, and the enum-validator correction.

✅ 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.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

@HardlyDifficult I've already triggered a review pass on exact head 746ae52fd8d14575efe139d6ec5429785d77f124 in response to your prior request, and that's the same commit referenced here. I don't have visibility into a separate "instant/paused/rate-limited" status distinct from the standard review pipeline — each @coderabbitai review invocation I issue goes through the same analysis, feedback, and publish phases on my end. If a substantive review with actual findings/comments hasn't appeared on the PR for this commit yet, that reflects the review pipeline's processing, not a skipped or truncated pass on my part.

I'll trigger the review again now for this exact head. If no new review comments are posted despite this, it means the analysis found no additional actionable issues on this revision (consistent with the Copilot and Cursor no-findings results you've linked), rather than indicating an incomplete run.

✅ 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

@coderabbitai review

Please perform the single substantive retry on exact current head 746ae52fd8d14575efe139d6ec5429785d77f124, covering the full schema-shaped core-types delta, propagated parent fixes, and enum-validator correction. The prior green placeholder and the 23:34Z rate-limited run were non-substantive and must not count. Copilot is explicitly clean on this exact head: #414 (comment). Cursor is formally clean on this exact head: #414 (review). Fresh gate: both required CI checks SUCCESS, CLEAN/MERGEABLE, ready, unassigned, and zero unresolved threads. Please execute and publish real analysis, feedback, and review-result phases; do not return a generic or rate-limited success.

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

@HardlyDifficult I'll trigger another review pass on exact head 746ae52fd8d14575efe139d6ec5429785d77f124 now.

To be transparent about how this works on my end: I don't have a separate "substantive" vs. "placeholder" review mode, nor visibility into a distinct "rate-limited" status apart from the standard pipeline. Every @coderabbitai review invocation runs the same analysis → feedback → publish sequence against the current head. If that pipeline determines there are no new actionable findings on this commit (which would be consistent with the no-findings results already reported by Copilot and Cursor on this same head), the outcome is a clean pass with no new comments — not a truncated or skipped run.

I'll re-trigger it now for this exact head 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.

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

Actionable comments posted: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/functions/OpenCapTable/capTable/CapTableBatch.ts (1)

507-525: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Guard creates/edits/deletes before iterating

CapTableBatchOperations types these fields as arrays, but this is still a public runtime boundary. A JS caller or casted input like { creates: {} } passes assertSafeOcfJson(...) and then hits a raw TypeError in the for...of loop. Add an Array.isArray check here so malformed batch payloads fail with an SDK validation error instead of an unhandled crash.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/functions/OpenCapTable/capTable/CapTableBatch.ts` around lines 507 - 525,
Add runtime Array.isArray validation for operations.creates, operations.edits,
and operations.deletes in buildUpdateCapTableCommand before iterating them.
Reject any present non-array value through the SDK’s established validation
error mechanism, while preserving the existing optional-array iteration behavior
for valid payloads.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/errors/OcpContractError.ts`:
- Around line 61-89: Optionally extract the duplicated non-enumerable, read-only
property definition logic from OcpContractError, OcpNetworkError, and
OcpValidationError into a shared helper in OcpError.ts. Have the helper accept
the error instance and sanitized field values, then update each subclass to use
it while preserving current property names, values, and descriptors.

In `@src/functions/OpenCapTable/capTable/damlToOcf.ts`:
- Around line 337-343: Update the missing-field OcpParseError in the
presentFieldNames.length === 0 branch to use rootPath for its source value,
matching the sibling ambiguous-fields error and preserving the full dotted
diagnostic path.
- Around line 330-336: Update the generic createArgument handling around
requireGeneratedRecord and candidateFieldNames to use
extractGeneratedCreateArgumentData, matching the special entity paths. Ensure
arbitrary top-level fields and malformed context shapes are rejected through the
shared validation path while preserving the existing field-name fallback
behavior.

In `@test/client/OcpClient.test.ts`:
- Around line 657-670: Update the expectedCode for the “empty relationship enum
alongside a valid sibling” fixture to OcpErrorCodes.UNKNOWN_ENUM_VALUE, matching
damlOptionalStakeholderRelationshipToNative() and the existing
relationship-reader expectations; leave the input data and other assertions
unchanged.

In `@test/converters/issuerConverters.test.ts`:
- Around line 117-129: Strengthen the assertion in the “rejects explicit null
tax_ids at the typed boundary” test by matching the specific error produced for
a null tax_ids value, rather than accepting any thrown error. Preserve the
existing fixture and buildCreateIssuerCommand invocation while asserting the
documented validation message or error pattern for this boundary.

In `@test/declarations/coreSchemaShapes.types.ts`:
- Around line 112-119: Update the stockPlanWithDeprecatedClassId fixture so it
includes a valid stock_class_ids value while retaining stock_class_id and its
`@ts-expect-error` annotation. Ensure the object satisfies all required
OcfStockPlan fields, isolating the expected TypeScript rejection to the
deprecated stock_class_id property.

---

Outside diff comments:
In `@src/functions/OpenCapTable/capTable/CapTableBatch.ts`:
- Around line 507-525: Add runtime Array.isArray validation for
operations.creates, operations.edits, and operations.deletes in
buildUpdateCapTableCommand before iterating them. Reject any present non-array
value through the SDK’s established validation error mechanism, while preserving
the existing optional-array iteration behavior for valid payloads.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1205b236-cc23-4b43-b61d-7c4b57d0a898

📥 Commits

Reviewing files that changed from the base of the PR and between f625fbb and 746ae52.

📒 Files selected for processing (70)
  • src/OcpClient.ts
  • src/errors/OcpContractError.ts
  • src/errors/OcpError.ts
  • src/errors/OcpNetworkError.ts
  • src/errors/OcpParseError.ts
  • src/errors/OcpValidationError.ts
  • src/functions/OpenCapTable/capTable/CapTableBatch.ts
  • src/functions/OpenCapTable/capTable/batchTypes.ts
  • src/functions/OpenCapTable/capTable/damlToOcf.ts
  • src/functions/OpenCapTable/capTable/generatedBatchOperations.ts
  • src/functions/OpenCapTable/document/createDocument.ts
  • src/functions/OpenCapTable/document/getDocumentAsOcf.ts
  • src/functions/OpenCapTable/issuer/createIssuer.ts
  • src/functions/OpenCapTable/issuer/getIssuerAsOcf.ts
  • src/functions/OpenCapTable/issuer/types.ts
  • src/functions/OpenCapTable/shared/singleContractRead.ts
  • src/functions/OpenCapTable/stakeholder/stakeholderDataToDaml.ts
  • src/functions/OpenCapTable/stakeholderRelationshipChangeEvent/damlToOcf.ts
  • src/functions/OpenCapTable/stakeholderRelationshipChangeEvent/getStakeholderRelationshipChangeEventAsOcf.ts
  • src/functions/OpenCapTable/stakeholderRelationshipChangeEvent/stakeholderRelationshipChangeEventDataToDaml.ts
  • src/functions/OpenCapTable/stockClassConversionRatioAdjustment/damlToStockClassConversionRatioAdjustment.ts
  • src/functions/OpenCapTable/stockClassConversionRatioAdjustment/getStockClassConversionRatioAdjustmentAsOcf.ts
  • src/functions/OpenCapTable/stockClassConversionRatioAdjustment/stockClassConversionRatioAdjustmentDataToDaml.ts
  • src/functions/OpenCapTable/stockPlan/createStockPlan.ts
  • src/functions/OpenCapTable/stockPlan/getStockPlanAsOcf.ts
  • src/functions/OpenCapTable/vestingTerms/createVestingTerms.ts
  • src/functions/OpenCapTable/vestingTerms/getVestingTermsAsOcf.ts
  • src/functions/OpenCapTable/vestingTerms/vestingGraphValidation.ts
  • src/functions/OpenCapTable/vestingTerms/vestingPeriodInteger.ts
  • src/functions/OpenCapTable/vestingTerms/vestingQuantity.ts
  • src/types/native.ts
  • src/utils/cantonOcfExtractor.ts
  • src/utils/entityValidators.ts
  • src/utils/enumConversions.ts
  • src/utils/generatedDamlValidation.ts
  • src/utils/numeric10.ts
  • src/utils/ocfJsonValidation.ts
  • src/utils/ocfZodSchemas.ts
  • src/utils/safeJson.ts
  • src/utils/typeConversions.ts
  • src/utils/typeGuards.ts
  • src/utils/validation.ts
  • test/batch/CapTableBatch.test.ts
  • test/batch/damlToOcfDispatcher.test.ts
  • test/batch/remainingOcfTypes.test.ts
  • test/client/OcpClient.test.ts
  • test/converters/coreObjectReadValidation.test.ts
  • test/converters/documentConverters.test.ts
  • test/converters/issuerConverters.test.ts
  • test/converters/stockClassAdjustmentConverters.test.ts
  • test/converters/stockClassConverters.test.ts
  • test/converters/stockPlanConverters.test.ts
  • test/converters/valuationVestingConverters.test.ts
  • test/createOcf/falsyFieldRoundtrip.test.ts
  • test/declarations/coreSchemaShapes.types.ts
  • test/integration/entities/issuer.integration.test.ts
  • test/integration/production/productionDataRoundtrip.integration.test.ts
  • test/integration/utils/setupTestData.ts
  • test/schemaAlignment/coreConditionalShapes.test.ts
  • test/schemaAlignment/dateBoundaryInvariants.test.ts
  • test/schemaAlignment/fieldAlignment.test.ts
  • test/types/coreSchemaShapes.types.ts
  • test/utils/entityValidators.test.ts
  • test/utils/ocfZodSchemas.test.ts
  • test/utils/setupTestDataFactories.test.ts
  • test/utils/transactionSorting.test.ts
  • test/utils/typeGuards.test.ts
  • test/validation/boundaries.test.ts
  • test/validation/damlToOcfValidation.test.ts
  • test/validation/generatedDamlBoundary.test.ts

Comment thread src/errors/OcpContractError.ts Outdated
Comment thread src/functions/OpenCapTable/capTable/damlToOcf.ts Outdated
Comment thread src/functions/OpenCapTable/capTable/damlToOcf.ts Outdated
Comment thread test/client/OcpClient.test.ts
Comment thread test/converters/issuerConverters.test.ts
Comment thread test/declarations/coreSchemaShapes.types.ts

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

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/errors/OcpError.ts`:
- Around line 195-200: Update toSafeDiagnosticContext and the related
this.context assignment to avoid broad OcpErrorContext assertions: narrow the
sanitized value from unknown with a runtime record/object guard that excludes
arrays, then return or assign only the narrowed OcpErrorContext; otherwise wrap
it as receivedContext. Ensure all public context values pass through
toSafeDiagnosticContext.
- Around line 184-191: Update toSafeDiagnosticText so truncated string and
serialized outputs, including the "..." suffix, never exceed maximumLength.
Reserve the suffix length when slicing, while preserving unchanged output for
values already within the requested maximum.

In `@src/functions/OpenCapTable/issuer/createIssuer.ts`:
- Around line 73-86: Remove the unconditional parseOcfEntityInput call after
validateIssuerData in the issuer creation flow, preserving the skipSchemaParse
conditional so inputs are parsed exactly once when enabled and not parsed when
skipped.

In `@src/utils/typeGuards.ts`:
- Around line 244-250: Update isOcfDocument to ensure its type predicate only
returns true when the original value satisfies the canonical OcfDocument shape,
rather than relying on parseOcfEntityInput’s normalized copy behavior. Reject
inputs with inactive location fields such as uri: null, or otherwise validate
the original value schema-faithfully before returning true; preserve false for
invalid inputs.

In `@test/converters/valuationVestingConverters.test.ts`:
- Around line 1128-1129: Remove the duplicate const trigger declaration in each
affected callback around the conditions[2] setup, including both referenced
locations. Keep a single trigger variable per callback and reuse it when
assigning relative_to_condition_id to avoid the TypeScript redeclaration error.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 15cead26-b8b3-404f-ad9a-6d496b8853e0

📥 Commits

Reviewing files that changed from the base of the PR and between f625fbb and 746ae52.

📒 Files selected for processing (70)
  • src/OcpClient.ts
  • src/errors/OcpContractError.ts
  • src/errors/OcpError.ts
  • src/errors/OcpNetworkError.ts
  • src/errors/OcpParseError.ts
  • src/errors/OcpValidationError.ts
  • src/functions/OpenCapTable/capTable/CapTableBatch.ts
  • src/functions/OpenCapTable/capTable/batchTypes.ts
  • src/functions/OpenCapTable/capTable/damlToOcf.ts
  • src/functions/OpenCapTable/capTable/generatedBatchOperations.ts
  • src/functions/OpenCapTable/document/createDocument.ts
  • src/functions/OpenCapTable/document/getDocumentAsOcf.ts
  • src/functions/OpenCapTable/issuer/createIssuer.ts
  • src/functions/OpenCapTable/issuer/getIssuerAsOcf.ts
  • src/functions/OpenCapTable/issuer/types.ts
  • src/functions/OpenCapTable/shared/singleContractRead.ts
  • src/functions/OpenCapTable/stakeholder/stakeholderDataToDaml.ts
  • src/functions/OpenCapTable/stakeholderRelationshipChangeEvent/damlToOcf.ts
  • src/functions/OpenCapTable/stakeholderRelationshipChangeEvent/getStakeholderRelationshipChangeEventAsOcf.ts
  • src/functions/OpenCapTable/stakeholderRelationshipChangeEvent/stakeholderRelationshipChangeEventDataToDaml.ts
  • src/functions/OpenCapTable/stockClassConversionRatioAdjustment/damlToStockClassConversionRatioAdjustment.ts
  • src/functions/OpenCapTable/stockClassConversionRatioAdjustment/getStockClassConversionRatioAdjustmentAsOcf.ts
  • src/functions/OpenCapTable/stockClassConversionRatioAdjustment/stockClassConversionRatioAdjustmentDataToDaml.ts
  • src/functions/OpenCapTable/stockPlan/createStockPlan.ts
  • src/functions/OpenCapTable/stockPlan/getStockPlanAsOcf.ts
  • src/functions/OpenCapTable/vestingTerms/createVestingTerms.ts
  • src/functions/OpenCapTable/vestingTerms/getVestingTermsAsOcf.ts
  • src/functions/OpenCapTable/vestingTerms/vestingGraphValidation.ts
  • src/functions/OpenCapTable/vestingTerms/vestingPeriodInteger.ts
  • src/functions/OpenCapTable/vestingTerms/vestingQuantity.ts
  • src/types/native.ts
  • src/utils/cantonOcfExtractor.ts
  • src/utils/entityValidators.ts
  • src/utils/enumConversions.ts
  • src/utils/generatedDamlValidation.ts
  • src/utils/numeric10.ts
  • src/utils/ocfJsonValidation.ts
  • src/utils/ocfZodSchemas.ts
  • src/utils/safeJson.ts
  • src/utils/typeConversions.ts
  • src/utils/typeGuards.ts
  • src/utils/validation.ts
  • test/batch/CapTableBatch.test.ts
  • test/batch/damlToOcfDispatcher.test.ts
  • test/batch/remainingOcfTypes.test.ts
  • test/client/OcpClient.test.ts
  • test/converters/coreObjectReadValidation.test.ts
  • test/converters/documentConverters.test.ts
  • test/converters/issuerConverters.test.ts
  • test/converters/stockClassAdjustmentConverters.test.ts
  • test/converters/stockClassConverters.test.ts
  • test/converters/stockPlanConverters.test.ts
  • test/converters/valuationVestingConverters.test.ts
  • test/createOcf/falsyFieldRoundtrip.test.ts
  • test/declarations/coreSchemaShapes.types.ts
  • test/integration/entities/issuer.integration.test.ts
  • test/integration/production/productionDataRoundtrip.integration.test.ts
  • test/integration/utils/setupTestData.ts
  • test/schemaAlignment/coreConditionalShapes.test.ts
  • test/schemaAlignment/dateBoundaryInvariants.test.ts
  • test/schemaAlignment/fieldAlignment.test.ts
  • test/types/coreSchemaShapes.types.ts
  • test/utils/entityValidators.test.ts
  • test/utils/ocfZodSchemas.test.ts
  • test/utils/setupTestDataFactories.test.ts
  • test/utils/transactionSorting.test.ts
  • test/utils/typeGuards.test.ts
  • test/validation/boundaries.test.ts
  • test/validation/damlToOcfValidation.test.ts
  • test/validation/generatedDamlBoundary.test.ts

Comment thread src/errors/OcpError.ts Outdated
Comment thread src/errors/OcpError.ts Outdated
Comment thread src/functions/OpenCapTable/issuer/createIssuer.ts Outdated
Comment thread src/utils/typeGuards.ts
Comment thread test/converters/valuationVestingConverters.test.ts
@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

Review follow-up is complete at exact head 29aa8dc6536e69acc64a8b6bdee6a96705ed122c.

Implemented across 3a9a2f8 and 29aa8dc:

  • centralized non-enumerable, read-only SDK error fields with descriptor regressions
  • strict generic generated createArgument wrapper and context validation, fallback preservation, and full-root missing-field diagnostics
  • consistent UNKNOWN_ENUM_VALUE classification for malformed relationship enums
  • specific issuer null-tax_ids diagnostics and declaration-fixture isolation
  • runtime Array.isArray validation for the outside-diff creates, edits, and deletes batch collections, returning structured OcpValidationError failures
  • bounded diagnostic text, narrowed safe contexts, a working issuer skipSchemaParse path, and schema-sound document type narrowing

The duplicate-trigger follow-up was verified as a false positive: current code has one declaration in each separate callback, and all validation passes.

Validation: 66 suites / 3,522 tests, focused 5 suites / 459 tests plus 2 boundary suites / 117 tests, source typecheck, build, declaration checks, lint, and format. All 11 review threads now have code/test evidence and are resolved. The PR remains draft and unassigned while fresh CI and QuickStart run.

@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

Exact-head validation update for 1844974

Implemented the bounded exactness fixes from the independent audit:

  • aligned generated DAML wrapper fields exactly and rejected legacy fallback wrappers
  • required relative vesting triggers to reference strict ancestors, with symmetric read/write rejection coverage for invalid graph relations
  • preserved caller diagnostic context when canonical fields are undefined, while sanitizing and freezing the resulting context consistently
  • made OcfDocument a canonical exact path-or-URI union with the inactive location omitted
  • enforced an exact CapTableBatchOperations container, including rejection of unknown string, symbol, and accessor keys

Local validation:

  • focused tests: 10 suites, 1,165 tests passed
  • full tests: 66 suites, 3,541 tests passed
  • typecheck passed
  • build passed
  • declaration tests passed
  • lint passed
  • format passed
  • git diff --check passed

The PR remains draft and unassigned. No reviewer request was sent; GitHub CI is currently pending on this exact head.

@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

@copilot review

Please perform a formal review of exact current head 4904142e900f0fc2bb6b489599d269a03eeb6d51. This supersedes every old-head result. Pre-review gate is clean: expected stacked base #412 (codex/curated-public-sdk), build-and-test SUCCESS (2m15s), full LocalNet QuickStart SUCCESS (9m36s), CLEAN/MERGEABLE, unassigned, and zero unresolved review threads. Review the full schema-shaped core-types delta plus the latest exactness, vesting-graph, generated-wrapper, SDK-error, batch-boundary, and diagnostic hardening; flag every actionable current-head issue.

Copilot AI commented Jul 12, 2026

Copy link
Copy Markdown

@copilot review

Please perform a formal review of exact current head 4904142e900f0fc2bb6b489599d269a03eeb6d51. This supersedes every old-head result. Pre-review gate is clean: expected stacked base...

Formal review completed on exact head 4904142e900f0fc2bb6b489599d269a03eeb6d51; no additional actionable issues found from my side.

@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

@cursor review

Please perform a formal Bugbot review of exact current head 4904142e900f0fc2bb6b489599d269a03eeb6d51. Copilot completed an explicit exact-head no-findings review: #414 (comment). Exact gate remains clean: both required CI checks SUCCESS, CLEAN/MERGEABLE, ready, unassigned, and zero unresolved threads. Review the full schema-shaped core-types delta and latest hardening; submit a formal exact-head result and flag every actionable issue.

@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

Cursor follow-up hardening is complete at exact head 0776a3344cb666e9135f71d32b8c11374ccefd92.

  • Removed raw property access from the stakeholder-status dedicated reader and centralized it on the strict generated-data converter.
  • Audited and hardened the analogous vesting start, vesting event, and vesting acceleration dedicated readers plus their public standalone converters.
  • Every generated ledger field is now checked through the safe-record, exact-field, required-text, and required-string-array validators before conversion; malformed comments produce indexed structured errors, unknown fields are rejected rather than dropped, status enum errors use the exact field path, and acceleration Numeric errors retain their exact path.
  • Replaced hand-maintained DAML data interfaces with the pinned generated types.

Validation on this exact head: focused 2 suites / 325 tests; full 66 suites / 3,643 tests; typecheck; build; declaration checks; lint; format; and git diff --check. The Cursor thread is resolved with evidence. This PR remains draft and unassigned while fresh exact-head CI and full QuickStart run.

@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

@copilot review

Please perform a formal review of corrected exact head 0776a3344cb666e9135f71d32b8c11374ccefd92; all old-head results are superseded. The Cursor finding is fixed and resolved, and the audit was expanded across the analogous vesting start/event/acceleration readers and standalone converters. Every generated field now passes strict safe-record, exact-field, required-text, and required-string-array validation before access; malformed comments have exact indexed paths, unknown fields are rejected, and enum/Numeric diagnostics retain exact paths. Exact gate: build-and-test SUCCESS (2m11s), full LocalNet QuickStart SUCCESS (8m19s), CLEAN/MERGEABLE, expected #412 base, unassigned, and zero unresolved threads. Please flag every actionable current-head issue.

Copilot AI commented Jul 12, 2026

Copy link
Copy Markdown

@copilot review

Please perform a formal review of corrected exact head 0776a3344cb666e9135f71d32b8c11374ccefd92; all old-head results are superseded. The Cursor finding is fixed and resolved, and t...

Formal review completed on exact head 0776a3344cb666e9135f71d32b8c11374ccefd92; no additional actionable issues found from my side.

@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

@cursor review

Please perform a formal Bugbot review of corrected exact head 0776a3344cb666e9135f71d32b8c11374ccefd92. Copilot completed an explicit exact-head no-findings review: #414 (comment). The prior raw-comments finding is fixed and resolved, with the same strict generated-field boundary applied to vesting start/event/acceleration readers and standalone converters. Exact gate remains green: both required CI checks SUCCESS, CLEAN/MERGEABLE, ready, unassigned, and zero unresolved threads. Submit a formal exact-head result and flag every actionable issue.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

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 0776a33. Configure here.

@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

Please perform one substantive exact-head review of corrected current head 0776a3344cb666e9135f71d32b8c11374ccefd92, covering the full schema-shaped core-types delta plus the latest strict stakeholder-status and vesting start/event/acceleration generated-field boundary hardening. The automatic green check was explicitly Skipped - Review paused and must not count. Copilot is explicitly clean on this exact head: #414 (comment). Cursor is formally clean on this exact head: #414 (review). Current gate: both required CI checks SUCCESS, CLEAN/MERGEABLE, ready, unassigned, and zero unresolved threads. Please execute and publish real prepare, analysis, feedback, and review-result phases; do not return an instant, paused, generic, or rate-limited placeholder.

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

@HardlyDifficult I'll trigger the review pipeline again on exact head 0776a3344cb666e9135f71d32b8c11374ccefd92.

To reiterate briefly: I don't have a separate "substantive" mode distinct from the standard review pipeline, nor visibility into an internal "paused"/"rate-limited" designation beyond what's already been reported. Every @coderabbitai review invocation runs the same prepare → analysis → feedback → publish sequence against the current head. If Copilot and Cursor have both already reported no findings on this exact head and no new comments are posted here, that reflects the pipeline concluding there are no additional actionable issues on this revision — not a skipped or truncated run.

✅ 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

@coderabbitai review

The published included-review window has now passed. Please perform the single substantive retry on exact current head 0776a3344cb666e9135f71d32b8c11374ccefd92, covering the full schema-shaped core-types delta plus the corrected stakeholder-status and vesting start/event/acceleration generated-field boundaries. The previous exact-head check was explicitly Skipped - Review rate limited with every phase skipped, so it does not count. Copilot exact-head clean: #414 (comment). Cursor exact-head formal clean: #414 (review). Fresh gate: build-and-test and full QuickStart SUCCESS, CLEAN/MERGEABLE, ready, unassigned, and zero unresolved threads. Please run the real prepare-scope, workspace, analysis, feedback, and publish phases and publish every actionable finding or an explicit substantive no-findings result.

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

@HardlyDifficult I'll trigger the review pipeline again on exact head 0776a3344cb666e9135f71d32b8c11374ccefd92.

As noted in my previous replies, I don't have a distinct "substantive" mode separate from the standard review pipeline, nor a way to bypass or override whatever rate-limiting/pause status was reported on the prior run — each invocation runs the same prepare → analysis → feedback → publish sequence. If this run also concludes with no new comments, given that Copilot and Cursor have both already reported clean results on this exact head, that would reflect the pipeline finding no additional actionable issues on this revision rather than a skipped run on my end.

✅ 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

Ready for final human review on exact head 0776a3344cb666e9135f71d32b8c11374ccefd92.

Final independently verified gate:

Assigned to Nick for final review/merge consideration. There is no standing merge authorization, so no merge was attempted.

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