Skip to content

[codex] Add keyed OpenCapTable v35 package#232

Closed
HardlyDifficult wants to merge 7 commits into
mainfrom
codex/open-captable-v36-contract-keys
Closed

[codex] Add keyed OpenCapTable v35 package#232
HardlyDifficult wants to merge 7 commits into
mainfrom
codex/open-captable-v36-contract-keys

Conversation

@HardlyDifficult

@HardlyDifficult HardlyDifficult commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • keep the contract-key work on OpenCapTable-v35 as version 0.0.1; v35 has not been uploaded/vetted on a network, so this is still the first v35 package shape
  • keep only the keys that provide a concrete positive lookup path: IssuerAuthorization and CapTable
  • remove the OcpFactory key because factory discovery is deployment/config driven and the key was not used by any on-ledger workflow
  • keep the key test focused on positive lookup behavior rather than negative lookup/absence assertions
  • refresh the keyed OpenCapTable-v35/0.0.1 DAR backup and dars.lock

Contract key policy for this PR

These keys are lookup helpers, not ledger-wide database constraints.

They are useful when a transaction already knows the logical object it is looking for and wants to resolve the current visible contract by a stable business identifier. They are not used here to prove global uniqueness, prove absence, enumerate contracts, or replace cap-table invariants.

In particular:

  • no production path relies on a negative lookup such as "there is no contract by this key"
  • duplicate keys would still need to be prevented or remediated by the operator workflow and off-ledger controls
  • cap-table correctness still comes from exercising choices on the authoritative CapTable contract, not from key existence

Keys kept

IssuerAuthorization

Key:

(context.system_operator, context.issuer) : (Party, Party)

Maintainer:

context.system_operator

Why this key is useful:

  • it identifies the pending authorization that a specific system operator issued for a specific issuer
  • the maintainer is the party that creates and can withdraw the authorization, so the key is maintained by the lifecycle authority
  • OcpFactory.LookupIssuerAuthorization gives a positive lookup path for that pending authorization without requiring callers to persist the authorization contract id out of band

What a more standard approach would be:

  • an off-ledger client could query active IssuerAuthorization contracts by template and filter on context.system_operator and context.issuer
  • that works for client code, but it is not available as a composable Daml transaction step and pushes every caller toward ad hoc query/filter logic

What this key does not do:

  • it does not prove there is only one authorization for an issuer
  • it does not make AuthorizeIssuer idempotent
  • it does not replace the operator's responsibility to serialize or clean up duplicated pending authorizations

CapTable

Key:

(context.system_operator, context.issuer) : (Party, Party)

Maintainer:

context.system_operator

Why this key is useful:

  • it gives the system operator a stable way to find the issuer's current authoritative cap-table aggregate after the one-time authorization contract has been consumed
  • it avoids requiring every caller to store and pass the CapTable contract id forever after setup
  • it creates a clean on-ledger lookup hook for future workflows that need to fetch the known cap table before exercising choices against it

What a more standard approach would be:

  • an off-ledger client could query active CapTable contracts by template and filter on context.system_operator and context.issuer
  • that is fine for indexing/reporting, but it is not a Daml transaction primitive and cannot be used by another choice without leaving the ledger transaction

What this key does not do:

  • it does not replace the cap table's maps or security-id indexes
  • it does not allow on-ledger enumeration of all cap tables
  • it does not by itself guarantee there can never be duplicate cap tables for the same issuer; correctness still depends on the factory/operator workflow and on consuming/updating the authoritative cap table in mutation choices

Key removed

OcpFactory

Removed key:

system_operator : Party

Why it was removed:

  • the factory contract id is already deployment/config state (generated/ocp-factory-contract-id.json)
  • scripts/create-ocp-factory.ts already reuses an existing factory through an ACS query by template and operator
  • no Daml choice in this package performs lookupByKey or fetchByKey on OcpFactory
  • the key did not enforce a meaningful invariant and would have implied more value than it actually provided

Why v35 0.0.1

OpenCapTable-v35 has not been uploaded/vetted on a network. The dars.lock entry for v35 has networks: [], so there is no deployed v35 package line to preserve upgrade compatibility with.

The earlier v36 direction came from dpm upgrade-check rejecting keys as an upgrade to an already-backed-up v35 shape. Since that v35 shape was never deployed, this PR treats keyed v35 0.0.1 as the first v35 release instead of creating an unnecessary v36 line.

Validation

  • npm run build
  • npm run check-upgrade-compat
  • npm run lint:daml
  • npm run test
  • npm run codegen
  • npm run verify-package
  • npm run verify-dars
  • npm run build:ts
  • npm run lint (passes with two existing warnings in scripts/remove-participant-dar.ts)
  • npm run format
  • git diff --check

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 23 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 98c66cd7-a809-4803-8bc2-fb69b772df7c

📥 Commits

Reviewing files that changed from the base of the PR and between 365b09f and 8eaf0a5.

⛔ Files ignored due to path filters (1)
  • dars/dars.lock is excluded by !**/*.lock
📒 Files selected for processing (14)
  • .github/workflows/publish.yml
  • .github/workflows/release.yml
  • OpenCapTable-v35/daml.yaml
  • OpenCapTable-v35/daml/Fairmint/OpenCapTable/IssuerAuthorization.daml
  • OpenCapTable-v35/daml/Fairmint/OpenCapTable/OcpFactory.daml
  • Test/daml.yaml
  • Test/daml/OpenCapTable/TestIssuer.daml
  • Test/daml/OpenCapTable/TestOcpFactory.daml
  • dars/OpenCapTable-v35/0.0.1/OpenCapTable-v35.dar
  • dars/OpenCapTable-v35/0.0.2/OpenCapTable-v35.dar
  • scripts/codegen/templates/CapTable.daml.template
  • scripts/create-ocp-factory.ts
  • scripts/parse-release-tag.ts
  • scripts/release-tag-utils.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/open-captable-v36-contract-keys

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

Comment thread scripts/codegen/templates/CapTable.daml.template

@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: 68d7d5f996

ℹ️ 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
Comment thread scripts/packages.ts Outdated
Comment thread OpenCapTable-v35/daml/Fairmint/OpenCapTable/OcpFactory.daml Outdated
Comment thread scripts/create-ocp-factory.ts
@HardlyDifficult

Copy link
Copy Markdown
Collaborator Author

-v35 has never been uploaded to a network. we should be able to use v35 0.0.1 still since there is nothing to maintain compatibility with. @codex

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create an environment for this repo.

@HardlyDifficult HardlyDifficult changed the title [codex] Add keyed OpenCapTable v36 package [codex] Add keyed OpenCapTable v35 package Jun 23, 2026

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c2a16f7. Configure here.

Comment thread .github/workflows/publish.yml
@HardlyDifficult HardlyDifficult marked this pull request as draft July 1, 2026 20:17
@HardlyDifficult HardlyDifficult deleted the codex/open-captable-v36-contract-keys branch July 6, 2026 14:51
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.

1 participant