feat(state): pass entity props through describeResources() (#39)#44
Merged
Merged
Conversation
Extends LexiconPlugin.describeResources options with:
entities: Map<string, { entityType, props }>
so plugins can map cloud-side identifiers back to chant entity names.
Existing entityNames is preserved as a convenience for the simple case;
the AWS lexicon (CloudFormation logical IDs already match chant entity
names) continues unchanged.
Temporal lexicon now uses entity props for round-trip mapping:
- Namespace: props.name -> entity name
- SearchAttribute: <ns>/<props.name> -> entity name
- Schedule: <ns>/<props.scheduleId> -> entity name
Server-side resources without a matching declaration still surface as
orphan keys (namespace/<name>, etc.) so chant state diff --live can
report them as 'orphan' (in cloud, not declared) instead of forcing a
synthetic mapping.
Callers updated:
- state/snapshot.ts: takeSnapshot() builds the entities map per lexicon
- cli/handlers/state.ts: runStateDiffLive does the same
Tests:
- 4 new round-trip cases in describe-resources.test.ts:
namespace mapping by props.name
search-attribute mapping by props.name + props.namespace
schedule mapping by props.scheduleId
search-attribute namespace fallback to first declared
- existing 5 cases updated to pass entities: new Map() (no behavior
change since they don't declare any entities)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #39. Extends
LexiconPlugin.describeResources()withentities: Map<string, { entityType, props }>so plugins can map cloud-side identifiers back to chant entity names. Solves the round-trip problem identified during #27 where the Temporal lexicon was forced to use server-side keys (namespace/prod) instead of chant entity names.entityNamespreserved for the simple case. AWS lexicon (CloudFormation logical IDs == chant entity names) continues unchanged.Temporal mapping
prodentityType: "Temporal::Namespace"andprops.name === "prod"prod/ProjectentityType: "Temporal::SearchAttribute"andprops.name === "Project"+props.namespace === "prod"(or default-fallback to first declared namespace)prod/daily-reportentityType: "Temporal::Schedule"andprops.scheduleId === "daily-report"Server-side resources without a matching declaration still surface as orphan keys (
namespace/<name>, etc.) sochant state diff --livecorrectly reports them as orphan (in cloud, not declared) rather than forcing a synthetic mapping.Tests
4 new cases in
describe-resources.test.ts:props.nameprops.name + props.namespaceprops.scheduleIdPlus the 5 existing cases updated to pass
entities: new Map()(no behavior change since they don't declare entities).Verification
just buildcleannpx vitest run→ 1639/1639 passTest plan
describeResourcesrollout)