Skip to content

feat(core): fold — symbolic cross-resource refs + intrinsic tagged templates #1021

Closed

Description

@lex00

Part of the fold epic. Cold-handoff. Depends on #1.

Context

Two value kinds need special folding so the serializer sees exactly what it does today:

  1. Cross-resource references — otherResource.arn must fold to chant's existing symbolic reference representation (the same shape the run path produces and the serializer/graph consume), not a runtime value.
  2. Intrinsic tagged templates — e.g. Intrinsic\${Params.StackName}-x``. These are lexicon-registered tagged templates that must fold to the intrinsic node form, never be evaluated to a string.

Scope

  • Property access whose base resolves to a resource → emit the canonical reference object the run path emits (confirm the exact shape in the serializer / attribute registry; do not invent {__ref,attr} if the codebase uses another shape).
  • Recognize registered intrinsic tagged-template tags (from the lexicon registry) and fold Tag\...`` to the intrinsic representation, folding only the interpolated sub-expressions.
  • Unknown/unregistered tagged templates → FoldError.

Acceptance criteria

  • a.arn folds to the same reference object the run path yields (add a differential test vs run for one example).
  • Intrinsic\${Params.StackName}-data`folds to the intrinsic node, withParams.StackName` preserved symbolically, not stringified.
  • An unregistered tagged template is rejected with a located error.
  • Attribute resolution uses the existing lexicon attribute registry.

Epic: #1019

Activity

  1. added
    enhancement
    on Jul 24, 2026
  2. changed the title [-]feat(core): fold — resolve identifiers across the module graph[/-] [+]feat(core): fold — symbolic cross-resource refs + intrinsic tagged templates[/+] on Jul 24, 2026
  3. lex00 commented on Jul 25, 2026

    @lex00
    ContributorAuthor

    Scope addition (from #1026 review): #1026 ported the reference reducer exactly, which omitted ElementAccessExpression. Add it here — obj["key"] with a string/numeric literal key only (reject dynamic keys, matching EVL003): fold the object, then index by the literal key. This is the one item from the epic's stated subset not yet in fold().

  4. lex00 commented on Jul 26, 2026

    @lex00
    ContributorAuthor

    Shipped in a6c2cffb ("epic: fold TypeScript-as-Data instead of running it — #1026,#1021,#1022,#1024,#1025 + #1032"). The squash message listed the children without closing keywords, so none of them auto-closed and they stayed open after the epic #1019 was closed. Closing as bookkeeping — the work is on main and verified: fold coverage 15/98 at that commit, drift 0 across the 98-entry differential.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions