Skip to content

feat(core): fold — opt-in build path with run-fallback for composites #1022

Closed

Description

@lex00

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

Context

With leaf folding working, make it a real (opt-in) build path without regressing composites. The folder handles leaves; anything it can't fold (notably composite factory calls) falls back to the existing run path. This hybrid is what lets the migration ship incrementally with zero behavior change.

Scope

  • Add chant build --fold (and/or a chant.config flag). When on, discovery folds leaf export const … = new T(...) declarations statically and only runs modules that contain unfoldable constructs (composite calls).
  • Fallback must be per-module (or per-declaration) and logged, so it's visible what still runs.
  • Default remains the current run path until Op composite + build pipeline integration #7's differential gate is green across the example corpus.

Acceptance criteria

  • chant build --fold produces specs for leaf-only modules with no module execution (assert via a run-would-throw sentinel).
  • Modules containing composites transparently fall back to run; output unchanged.
  • A log line reports each module resolved by fold vs run.
  • Flag documented in docs/.../concepts/typescript-as-data.mdx (add a "Folded vs run" note).
  • No default-path behavior change (flag is opt-in).

Epic: #1019

Activity

  1. added
    enhancement
    on Jul 24, 2026
  2. changed the title [-]feat(core): fold — symbolic cross-resource refs + intrinsic tagged templates[/-] [+]feat(core): fold — opt-in build path with run-fallback for composites[/+] on Jul 24, 2026
  3. 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