Skip to content

Enforce non-empty OCF arrays and quality guardrails#424

Closed
HardlyDifficult wants to merge 37 commits into
codex/canonical-schema-purityfrom
codex/schema-cardinality-guardrails
Closed

Enforce non-empty OCF arrays and quality guardrails#424
HardlyDifficult wants to merge 37 commits into
codex/canonical-schema-purityfrom
codex/schema-cardinality-guardrails

Conversation

@HardlyDifficult

@HardlyDifficult HardlyDifficult commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • model every pinned canonical minItems: 1 property with NonEmptyArray and enforce the same cardinality at runtime
  • reject a present empty vestings array while preserving omission as DAML []
  • preserve valid zero and negative-zero scalar rows instead of dropping them through truthiness checks
  • compare schema-derived cardinality against compiler-resolved source and built DTOs
  • retain the stronger schema registry and required/optional parity checks from the refreshed parent
  • remove unsafe branded-ID constructors and strengthen compiler and coverage guardrails

Validation

  • npm run test:ci — 90 suites / 5,326 tests passed
  • npm run test:declarations
  • npm run typecheck
  • npm run build
  • npm run lint
  • npm run format
  • generated schema inventories are current
  • CI and OCP QuickStart pass on exact head 9352fc7438bcdb50ee066e0e785db9c1a7b823f1

Stack

@coderabbitai

coderabbitai Bot commented Jul 10, 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: be174542-a1ef-4849-8b7c-795d124522d2

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

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/schema-cardinality-guardrails

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

@HardlyDifficult HardlyDifficult marked this pull request as ready for review July 10, 2026 18:59
@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

Current head 6e9619a is green, merge-clean, unassigned, and thread-free. Advancing to Stage 2 and queuing automated review. CodeRabbit is deferred to the org-wide cooldown and remains queued without a ping.

@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

@copilot review

@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

cursor review

@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 6e9619a. Configure here.

Copilot AI commented Jul 10, 2026

Copy link
Copy Markdown

@copilot review

Reviewed the current head commit (6e9619a) and I don’t see any additional actionable changes needed from my side right now.

@HardlyDifficult HardlyDifficult marked this pull request as draft July 10, 2026 19:20
@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

Returned to draft because upstream schema-boundary branches #417#421 have new material fixes that still need to be propagated through this stacked PR. Exact-head CI and Copilot-first bot review will be refreshed after the ordered restack.

@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

@coderabbitai pause

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews paused.

…hema-cardinality-guardrails

# Conflicts:
#	src/functions/OpenCapTable/convertibleIssuance/getConvertibleIssuanceAsOcf.ts
#	src/functions/OpenCapTable/stockIssuance/getStockIssuanceAsOcf.ts
#	src/types/native.ts
@HardlyDifficult HardlyDifficult marked this pull request as ready for review July 10, 2026 22:53
@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

Exact head e7ffd29 is merge-clean with CI and QuickStart green and no unresolved review threads.

@copilot review

Copilot AI commented Jul 10, 2026

Copy link
Copy Markdown

Exact head e7ffd29 is merge-clean with CI and QuickStart green and no unresolved review threads.

@copilot review

Reviewed the current head (e7ffd29) and I don’t see any additional actionable changes needed from my side right now.

@HardlyDifficult HardlyDifficult marked this pull request as draft July 10, 2026 22:57
@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

Material parent propagation complete at exact head 0a2c6df, incorporating #423 at 543d116. Source typecheck passed on canton-node-sdk 0.0.227, preserving this PR's schema-cardinality guardrails plus canonical exhaustive relationships and symmetric vesting-graph validation. The PR remains draft and unassigned while CI runs.

@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

Fresh cardinality-boundary audit hardening is pushed at exact head b2cdf9043988296bfb1b8f7d8c4afc45ea060a6b.

The shared array boundary now snapshots dense arrays without invoking accessors/proxy traps and supports explicit min/max/exact counts, required element parsers, exact string validation, and duplicate detection with item path/context. Schema uniqueItems is enforced on all four transfer read/write/direct/generic paths and stock consolidation; empty consolidation writes reject; canonical singular resulting_security_id is required while legacy plural input rejects. Optional vestings preserve DAML [] omission but reject malformed/accessor containers. A committed inventory pins all five canonical top-level uniqueItems arrays.

This eliminates prior cases where sparse/wrong-type/accessor arrays produced runtime-invalid NonEmptyArray<T>, duplicate security IDs round-tripped despite schema rejection, or empty consolidation arrays passed. Validation: focused 11 suites / 535 tests; full 87 suites / 4,547 tests; build; typecheck; source+built declarations; built-runtime CJS guard; exact public config; lint; format; diff check. The PR remains draft/unassigned; no parent merge or reviews were requested.

…hema-cardinality-guardrails

# Conflicts:
#	src/functions/OpenCapTable/warrantIssuance/getWarrantIssuanceAsOcf.ts
#	test/schemaAlignment/canonicalOcfObjectInventory.json
#	test/schemaAlignment/schemaConformance.test.ts
#	test/schemaAlignment/schemaConformanceRegistry.ts
@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

Corrected stack propagation is pushed at 8968c1f5f7f1e2e2435d66a50338f3b8a1748343, incorporating exact parent #423 e7411b906cf7630a23200094cbcf1b1b74e04871.

Validation on this exact head:

  • full test:ci: 88 suites / 5,268 tests, coverage passing
  • focused cardinality/canonical suite: 9 suites / 583 tests
  • clean build, typecheck, declarations, built-cardinality check, exact public config, ESLint, Prettier, and diff checks passing
  • source and built inventories agree: 55 canonical variants, 0 aliases, fingerprint 39418162cb257fc316d7a15efc24d825223fac9a9d9d4d2d5104cc53ebb444c0
  • dense/trap-safe array snapshots and non-empty, uniqueItems, and string-element validation are preserved
  • the stronger canonical TX_CONVERTIBLE_CONVERSION.resulting_security_ids non-empty contract is explicitly pinned as a narrow SDK refinement of the upstream schema omission

The PR remains draft and unassigned while fresh CI runs on this material revision. No reviewer requests were made during propagation.

@HardlyDifficult HardlyDifficult marked this pull request as ready for review July 12, 2026 07:29
@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

@copilot review

Please review exact current head 8968c1f5f7f1e2e2435d66a50338f3b8a1748343. Pre-review gate: both required checks are successful, GitHub is CLEAN/MERGEABLE, the PR is unassigned, and zero review threads are unresolved. Focus on schema-derived array cardinality, sparse/custom array handling, exact diagnostics, and regression coverage. Report every actionable current-head issue before the other reviewers.

Copilot AI commented Jul 12, 2026

Copy link
Copy Markdown

@copilot review

Please review exact current head 8968c1f5f7f1e2e2435d66a50338f3b8a1748343. Pre-review gate: both required checks are successful, GitHub is CLEAN/MERGEABLE, the PR is unassigned, and...

Reviewed exact current head 8968c1f with focus on schema-derived array cardinality, sparse/custom array handling, diagnostics, and regression coverage. I don’t see any remaining actionable issues on this head.

@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

@cursor review

Please review exact current head 8968c1f5f7f1e2e2435d66a50338f3b8a1748343. Copilot completed its required exact-head pass with no actionable findings: #424 (comment). Both required checks are green, GitHub is CLEAN/MERGEABLE, and zero review threads are unresolved. Focus on schema-derived array cardinality, sparse/custom arrays, exact diagnostics, and regression coverage.

Comment thread src/utils/arrayCardinality.ts
@HardlyDifficult HardlyDifficult marked this pull request as draft July 12, 2026 07:40
@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

Cursor’s exact-head maintainability/security finding is addressed at 1557d19b5ef42e2ec99dd8f875cb72f3fbac347c: generic and cardinality-aware array consumers now share one internal descriptor-snapshot boundary, eliminating divergent proxy/prototype/descriptor/sparse/symbol/inherited checks while preserving fresh lossless snapshots. Corrected parent #423 is also integrated exactly.

Independent audit and validation are green: targeted 8 suites / 364 tests; full test:ci 88 suites / 5,273 tests; build/declarations/exact-public/built-cardinality/package-consumer; typecheck; lint; formatting; schema inventory; ancestry and diff checks. The review thread is resolved. This PR remains draft and unassigned while fresh remote CI runs; Copilot will be requested first on the new exact head.

@HardlyDifficult HardlyDifficult marked this pull request as ready for review July 12, 2026 08:11
@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

@copilot review

Please review exact current head 1557d19b5ef42e2ec99dd8f875cb72f3fbac347c against corrected parent 474e3214038214283e533bb36d47572830d3ed6f. This revision centralizes both array consumers on one descriptor-snapshot dense-array security boundary and integrates strict legacy stakeholder rejection. Pre-review gate: both required checks green, CLEAN/MERGEABLE, unassigned, zero unresolved threads. Focus on trap-free proxy/prototype/descriptor/sparse/symbol/inherited validation, fresh snapshot semantics, cardinality/uniqueness ordering, dependency/public exports, and regression tests. Report all actionable issues before Cursor and CodeRabbit.

Copilot AI commented Jul 12, 2026

Copy link
Copy Markdown

@copilot review

Please review exact current head 1557d19b5ef42e2ec99dd8f875cb72f3fbac347c against corrected parent 474e3214038214283e533bb36d47572830d3ed6f. This revision centralizes both array c...

Reviewed exact current head 1557d19 against parent 474e321 with the requested focus areas. I don’t see any remaining actionable issues on this head.

@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

@cursor review

Please review exact current head 1557d19b5ef42e2ec99dd8f875cb72f3fbac347c. Copilot completed its required exact-head pass with no actionable findings: #424 (comment). Both required checks are green, GitHub is CLEAN/MERGEABLE, and zero threads are unresolved. Focus on the shared descriptor-snapshot dense-array boundary, trap safety, fresh snapshot semantics, cardinality/uniqueness ordering, internal dependency/public-export impact, and propagated stakeholder rejection.

@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 1557d19. Configure here.

@HardlyDifficult HardlyDifficult marked this pull request as draft July 12, 2026 08:41
@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

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.

…hema-cardinality-guardrails

# Conflicts:
#	test/declarations/publicApi.types.ts
#	test/schemaAlignment/canonicalOcfObjectInventory.json
#	test/schemaAlignment/schemaConformance.test.ts
#	test/schemaAlignment/schemaConformanceHarness.ts
#	test/schemaAlignment/schemaConformanceRegistry.ts
@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

Closing for the contract-owned validation pivot. SDK-enforced non-empty arrays, cardinality constraints, positivity checks, and similar quality guardrails duplicate invariants that DAML should execute and report. Any independently useful representation fixes, such as lossless zero/negative-zero handling, will be absorbed into a transport-focused decoder change instead. Branch retained for reference.

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