Skip to content

feat(cosmic-proto): inline generated codec annotations#12650

Merged
mergify[bot] merged 6 commits into
masterfrom
mfig/codegen-proto-annotations
May 16, 2026
Merged

feat(cosmic-proto): inline generated codec annotations#12650
mergify[bot] merged 6 commits into
masterfrom
mfig/codegen-proto-annotations

Conversation

@michaelfig

Copy link
Copy Markdown
Member

refs: AGO-524

Linear: https://linear.app/agoric/issue/AGO-524/avoid-package-wide-runtime-annotation-data-in-cosmic-proto-codecs

Description

This PR changes packages/cosmic-proto annotation generation so gogoproto metadata is partitioned onto the generated codec exports that need it, instead of being emitted as package-wide runtime annotation data.

The main review points are:

  • packages/cosmic-proto/scripts/codegen.cjs now extracts field annotations and injects annotations members into generated codec exports.
  • Generated codec files statically import only the child codecs needed by their own annotations.
  • packages/cosmic-proto/src/type-url-annotations.ts recursively discovers nested annotations by walking codec-provided field references.
  • packages/cosmic-proto/src/codec-helpers.ts seeds annotation lookup from the root codec instead of relying on defaultAnnotationsFromTypeUrl.
  • packages/cosmic-proto/test/helpers.test.js covers generated gogoproto annotations for default child placeholders.

Security Considerations

This does not introduce new authority, networking, filesystem access, or trust boundaries. The change is limited to generated codec metadata and local codec-helper transformation behavior.

Scaling Considerations

This is specifically intended to improve bundle scaling for consumers whose bundler does not tree-shake. Instead of a package-wide annotation table or runtime type-url registry, each generated module imports only the child codecs needed to satisfy annotations reachable from that module's codecs.

The generated source size increases because annotations are emitted inline, but the runtime data imported by a consumer is now scoped to the codec graph they actually import.

Documentation Considerations

No user-facing protocol or application behavior changes. Downstream users do not need an upgrade step; generated codec exports now include an annotations member used by Codec and CodecHelper.

Testing Considerations

Verified locally in packages/cosmic-proto:

  • node scripts/codegen.cjs
  • yarn build
  • yarn test
  • yarn run -T tsc --noEmit --incremental
  • yarn lint
  • yarn lint:format
  • git diff --check

yarn lint exits successfully with existing warnings in the package tests/tools, and yarn lint:format exits successfully while reporting that dprint cannot write its cache under ~/Library in this sandbox.

Upgrade Considerations

No chain upgrade or state migration is required. To verify inclusion in a release, inspect generated codec exports for inline annotations members and confirm CodecHelper behavior for non-nullable child fields, especially MsgTransfer/Coin and generated swingset query params.

Co-authored-by: Codex codex@openai.com

@michaelfig michaelfig force-pushed the mfig/codegen-proto-annotations branch from e9517a4 to d8a8da9 Compare May 5, 2026 03:50
michaelfig added a commit that referenced this pull request May 5, 2026
Add explicit public type annotations for orchestration codec helpers so declaration emit does not expand private cosmic-proto annotation types through inferred exports.

Also assert the homogeneous undelegate response vow type at the watcher boundary, where executeTxProto3 cannot infer a tuple response type from a mapped runtime array.

Co-authored-by: Codex <codex@openai.com>
michaelfig added a commit that referenced this pull request May 8, 2026
Add explicit public type annotations for orchestration codec helpers so declaration emit does not expand private cosmic-proto annotation types through inferred exports.

Also assert the homogeneous undelegate response vow type at the watcher boundary, where executeTxProto3 cannot infer a tuple response type from a mapped runtime array.

Co-authored-by: Codex <codex@openai.com>
@michaelfig michaelfig force-pushed the mfig/codegen-proto-annotations branch from 624b1af to bdedd7b Compare May 8, 2026 21:38
@michaelfig michaelfig requested review from Copilot and gibson042 May 8, 2026 21:43

Copilot AI 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.

Pull request overview

This PR updates packages/cosmic-proto so gogoproto field-annotation metadata is emitted inline on the specific generated codec exports that need it (rather than maintained as a package-wide runtime table), and updates codec helper logic to discover annotations by walking the codec graph reachable from a root codec. Downstream orchestration code and tests are updated to use/validate the new behavior.

Changes:

  • Generate per-codec annotations metadata on exported codecs and add minimal imports needed to resolve annotated child field types.
  • Replace package-wide default annotation lookup with recursive annotation discovery seeded from a root codec (Codec/CodecHelper).
  • Update orchestration Any typing and add a regression test for generated gogoproto placeholder behavior.

Reviewed changes

Copilot reviewed 122 out of 123 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/orchestration/src/utils/codecs.js Tightens Any.toJSON() typing via exported AnyJson/Proto3CodecHelper types.
packages/orchestration/src/exos/cosmos-orchestration-account.js Refactors undelegate tx execution to type the vow of decoded responses explicitly.
packages/cosmic-proto/test/helpers.test.js Adds coverage asserting generated inline gogoproto annotations produce expected placeholder structure.
packages/cosmic-proto/src/type-url-annotations.ts Introduces codec-attached annotation types and recursive annotation collection utilities.
packages/cosmic-proto/src/codec-helpers.ts Seeds gogoproto transforms from the root codec’s reachable inline annotations instead of a global table.
packages/cosmic-proto/src/codegen/tendermint/types/validator.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/tendermint/types/types.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/tendermint/types/params.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/tendermint/types/evidence.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/tendermint/types/block.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/tendermint/p2p/types.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/tendermint/abci/types.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/stride/staketia/tx.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/stride/staketia/staketia.ts Generated: adds inline annotations for selected fields.
packages/cosmic-proto/src/codegen/stride/staketia/genesis.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/stride/stakeibc/validator.ts Generated: adds inline annotations for scalar/nullability fields.
packages/cosmic-proto/src/codegen/stride/stakeibc/tx.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/stride/stakeibc/trade_route.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/stride/stakeibc/query.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/stride/stakeibc/host_zone.ts Generated: adds inline annotations for scalar/nullability fields.
packages/cosmic-proto/src/codegen/stride/stakeibc/genesis.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/stride/stakeibc/callbacks.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/stride/stakeibc/address_unbonding.ts Generated: adds inline annotations for scalar/nullability fields.
packages/cosmic-proto/src/codegen/stride/stakedym/tx.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/stride/stakedym/stakedym.ts Generated: adds inline annotations for scalar/nullability fields.
packages/cosmic-proto/src/codegen/stride/stakedym/genesis.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/stride/records/records.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/stride/records/query.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/stride/records/genesis.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/stride/epochs/query.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/stride/epochs/genesis.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/noble/swap/v1/tx.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/noble/swap/v1/swap.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/noble/dollar/vaults/v1/vaults.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/noble/dollar/vaults/v1/tx.ts Generated: adds inline annotations for scalar/nullability fields.
packages/cosmic-proto/src/codegen/icq/v1/tx.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/icq/v1/genesis.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/ibc/lightclients/wasm/v1/wasm.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/ibc/lightclients/tendermint/v1/tendermint.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/ibc/lightclients/localhost/v2/localhost.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/ibc/lightclients/localhost/v1/localhost.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/ibc/core/connection/v1/tx.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/ibc/core/connection/v1/query.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/ibc/core/connection/v1/genesis.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/ibc/core/connection/v1/connection.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/ibc/core/client/v2/tx.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/ibc/core/client/v2/genesis.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/ibc/core/client/v1/tx.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/ibc/core/client/v1/query.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/ibc/core/client/v1/genesis.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/ibc/core/client/v1/client.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/ibc/core/channel/v2/tx.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/ibc/core/channel/v2/query.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/ibc/core/channel/v1/upgrade.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/ibc/core/channel/v1/tx.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/ibc/core/channel/v1/query.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/ibc/core/channel/v1/channel.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/ibc/applications/transfer/v1/tx.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/ibc/applications/transfer/v1/token.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/ibc/applications/transfer/v1/query.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/ibc/applications/transfer/v1/genesis.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/v1/account.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/host/v1/tx.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/genesis/v1/genesis.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/ibc/applications/interchain_accounts/controller/v1/tx.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/cosmos/vesting/v1beta1/vesting.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/cosmos/upgrade/v1beta1/upgrade.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/cosmos/upgrade/v1beta1/tx.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/cosmos/tx/v1beta1/tx.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/cosmos/store/v1beta1/commit_info.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/cosmos/store/snapshots/v1/snapshot.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/cosmos/staking/v1beta1/tx.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/cosmos/staking/v1beta1/staking.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/cosmos/staking/v1beta1/query.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/cosmos/staking/v1beta1/genesis.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/cosmos/protocolpool/v1/types.ts Generated: adds inline annotations for scalar/nullability fields.
packages/cosmic-proto/src/codegen/cosmos/protocolpool/v1/tx.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/cosmos/protocolpool/v1/query.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/cosmos/protocolpool/v1/genesis.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/cosmos/params/v1beta1/query.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/cosmos/mint/v1beta1/tx.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/cosmos/mint/v1beta1/query.ts Generated: adds inline annotations for scalar/nullability fields.
packages/cosmic-proto/src/codegen/cosmos/mint/v1beta1/mint.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/cosmos/mint/v1beta1/genesis.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/cosmos/group/v1/types.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/cosmos/group/v1/query.ts Generated: adds inline annotations for selected response fields.
packages/cosmic-proto/src/codegen/cosmos/group/module/v1/module.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/cosmos/gov/v1beta1/query.ts Generated: adds inline annotations for query response message fields.
packages/cosmic-proto/src/codegen/cosmos/gov/v1beta1/gov.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/cosmos/gov/v1beta1/genesis.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/cosmos/gov/v1/tx.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/cosmos/feegrant/v1beta1/feegrant.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/cosmos/epochs/v1beta1/genesis.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/cosmos/distribution/v1beta1/tx.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/cosmos/distribution/v1beta1/query.ts Generated: adds inline annotations for query response message fields.
packages/cosmic-proto/src/codegen/cosmos/distribution/v1beta1/genesis.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/cosmos/distribution/v1beta1/distribution.ts Generated: adds inline annotations for scalar/nullability fields.
packages/cosmic-proto/src/codegen/cosmos/base/v1beta1/coin.ts Generated: adds inline annotations for scalar handling (cosmos.Int/cosmos.Dec).
packages/cosmic-proto/src/codegen/cosmos/base/abci/v1beta1/abci.ts Generated: adds inline annotations for embedded/non-nullable fields.
packages/cosmic-proto/src/codegen/cosmos/bank/v1beta1/tx.ts Generated: adds inline annotations for params message field.
packages/cosmic-proto/src/codegen/cosmos/bank/v1beta1/query.ts Generated: adds inline annotations for response message fields.
packages/cosmic-proto/src/codegen/cosmos/bank/v1beta1/genesis.ts Generated: adds inline annotations for params message field.
packages/cosmic-proto/src/codegen/cosmos/authz/v1beta1/tx.ts Generated: adds inline annotations for grant message field.
packages/cosmic-proto/src/codegen/cosmos/authz/v1beta1/authz.ts Generated: adds inline annotations for timestamp field handling.
packages/cosmic-proto/src/codegen/cosmos/auth/v1beta1/tx.ts Generated: adds inline annotations for params message field.
packages/cosmic-proto/src/codegen/cosmos/auth/v1beta1/query.ts Generated: adds inline annotations for params message field.
packages/cosmic-proto/src/codegen/cosmos/auth/v1beta1/genesis.ts Generated: adds inline annotations for params message field.
packages/cosmic-proto/src/codegen/cosmos/auth/v1beta1/auth.ts Generated: adds inline annotations for embedded base account field.
packages/cosmic-proto/src/codegen/circle/cctp/v1/tx.ts Generated: adds inline annotations for scalar/nullability fields.
packages/cosmic-proto/src/codegen/circle/cctp/v1/query.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/circle/cctp/v1/per_message_burn_limit.ts Generated: adds inline annotations for scalar/nullability fields.
packages/cosmic-proto/src/codegen/circle/cctp/v1/events.ts Generated: adds inline annotations for scalar/nullability fields.
packages/cosmic-proto/src/codegen/circle/cctp/v1/burn_message.ts Generated: adds inline annotations for scalar/nullability fields.
packages/cosmic-proto/src/codegen/agoric/vibc/msgs.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/agoric/vbank/vbank.ts Generated: adds inline annotations for scalar/nullability fields.
packages/cosmic-proto/src/codegen/agoric/vbank/query.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/agoric/vbank/genesis.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/agoric/swingset/swingset.ts Generated: adds inline annotations for selected non-nullable fields.
packages/cosmic-proto/src/codegen/agoric/swingset/query.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
packages/cosmic-proto/src/codegen/agoric/swingset/genesis.ts Generated: adds inline annotations and annotation-driven child codec references/imports.
golang/cosmos/x/swingset/types/msgs.pb.go Go codegen: import ordering cleanup (no functional change).

Comment on lines +415 to +421
const codecAnnotationsFromTypeUrl = annotationsFromTypeUrlForCodec(
codec,
annotationsFromTypeUrl,
);
const cdc = Codec(codec, codecAnnotationsFromTypeUrl);
const { strippedFromDecoderOutput, packedFromGogo3 } =
makeGogo3Transformations(cdc, annotationsFromTypeUrl);
makeGogo3Transformations(cdc, codecAnnotationsFromTypeUrl);
Comment on lines +2 to 4
import type { FieldAnnotationsRecord } from '../../../type-url-annotations.js';
import { PublicKey as __annotationCodec_2ftendermint_2ecrypto_2ePublicKey } from '../crypto/keys.js';
import { PublicKey, type PublicKeySDKType } from '../crypto/keys.js';

@gibson042 gibson042 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This kind of metaprogramming is so hard to review, but I tried to be thorough and it looks good AFAICT.

Comment on lines +173 to +178
const importIdentifierFromTypeUrl = typeUrl =>
`__annotationCodec${[...typeUrl]
.map(char =>
/[A-Za-z0-9_$]/.test(char) ? char : `_${char.charCodeAt(0).toString(16)}`,
)
.join('')}`;

@gibson042 gibson042 May 15, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a pet peeve about failing to escape an escaping prefix.

Suggested change
const importIdentifierFromTypeUrl = typeUrl =>
`__annotationCodec${[...typeUrl]
.map(char =>
/[A-Za-z0-9_$]/.test(char) ? char : `_${char.charCodeAt(0).toString(16)}`,
)
.join('')}`;
const importIdentifierFromTypeUrl = typeUrl =>
`__annotationCodec${[...typeUrl]
.map(char =>
/[A-Za-z0-9$]/.test(char) ? char : `_${char.charCodeAt(0).toString(16)}`,
)
.join('')}`;

or

Suggested change
const importIdentifierFromTypeUrl = typeUrl =>
`__annotationCodec${[...typeUrl]
.map(char =>
/[A-Za-z0-9_$]/.test(char) ? char : `_${char.charCodeAt(0).toString(16)}`,
)
.join('')}`;
const importIdentifierFromTypeUrl = typeUrl =>
`__annotationCodec${[...typeUrl]
.map(char =>
/[A-Za-z0-9_]/.test(char) ? char : `$${char.charCodeAt(0).toString(16)}`,
)
.join('')}`;

michaelfig and others added 6 commits May 15, 2026 23:40
Generate annotation metadata directly onto each codec export instead of writing a package-wide typeUrlAnnotations module. Child message annotations now reference the necessary codec imports directly, allowing Codec and CodecHelper to discover nested annotations from the root codec without a runtime type-url registry.

Remove the defaultAnnotationsFromTypeUrl special case and make recursive annotation discovery follow codec-provided field references. Add coverage for generated gogoproto annotations so default child placeholders still work from the codec graph.

Co-authored-by: Codex <codex@openai.com>
Add explicit public type annotations for orchestration codec helpers so declaration emit does not expand private cosmic-proto annotation types through inferred exports.

Also assert the homogeneous undelegate response vow type at the watcher boundary, where executeTxProto3 cannot infer a tuple response type from a mapped runtime array.

Co-authored-by: Codex <codex@openai.com>
Keep the explicit exported Any helper annotation narrow enough for declaration emit while replacing only the generic toJSON signature. This avoids widening Any.toJSON results to MessageBody<unknown> during the root typecheck.

Co-authored-by: Codex <codex@openai.com>
Avoid walking the inline annotation codec graph twice when constructing CodecHelper by sharing the collected annotation map with the Codec wrapper.

Reuse existing runtime codec imports when generating annotation child references, which removes annotation-only alias imports from the generated codec modules.

Co-authored-by: Codex <codex@openai.com>
Escape underscores when deriving annotation codec import aliases from type URLs so literal underscores cannot collide with the _hex escape prefix.

Co-authored-by: Codex <codex@openai.com>
@michaelfig michaelfig force-pushed the mfig/codegen-proto-annotations branch from 3dad73a to 3630728 Compare May 16, 2026 05:40
@michaelfig michaelfig self-assigned this May 16, 2026
@michaelfig michaelfig added automerge:no-update (expert!) Automatically merge without updates agoric-cosmos labels May 16, 2026
@mergify mergify Bot merged commit 328ee75 into master May 16, 2026
120 of 131 checks passed
@mergify mergify Bot deleted the mfig/codegen-proto-annotations branch May 16, 2026 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agoric-cosmos automerge:no-update (expert!) Automatically merge without updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants