Repository navigation
Description
Surfaced by verifying #1064 against loomster. The build-time parameter work did exactly what it targeted, and the fold count still did not move — because what blocks loomster now is chant's own API surface, not user code.
Measured, before and after the loomster migration
Both runs use the #1064 chant build against the real app:
| fold | run-fallback | process blockers |
|
|---|---|---|---|
loomster main |
13 | 42 | 15 |
| loomster migrated (loomster#156) | 13 | 44 | 0 |
#1064 eliminated its root cause completely. The count did not move because the files it unblocked are gated by something else.
What blocks loomster now
7 function call as a value is not foldable: phase(...)
7 exported function declaration X is not foldable
5 unsupported expression: ArrowFunction
5 resource constructor argument must be an object literal
4 folding independently would create a duplicate, non-identical instance
3 function call as a value is not foldable: output(...)
phase() and output() are chant's own exported helpers — packages/core/src/components/component.ts:142 and packages/core/src/lexicon-output.ts:145. They are the documented way to author components and outputs. Ten of the blocks are calls to them.
The resource constructor argument must be an object literal group is new Parameter("String", {...}): the AWS deploy-time Parameter takes (type, props), and foldResource requires the first constructor argument to be an object literal. So no new Parameter(...) anywhere can fold, regardless of what surrounds it.
Why this matters
#1044 decided registered lexicon intrinsics may fold, per-intrinsic and opt-in. This is the same argument one level up: chant's own authoring API is call-shaped, so any application using components, outputs, or CloudFormation parameters hits a ceiling no amount of user-side rewriting can lift.
This is not a user authoring problem. phase("Apply", [...]) is the API chant documents. An application cannot avoid it and still use components.
Scope
- Extend feat(core): fold registered plain-call intrinsics (per-intrinsic opt-in) — DECIDED: yes #1044's registered-foldable concept to chant's own helpers.
phase,output, and peers are pure functions of their arguments producing plain data — the same category as a registered intrinsic. They should be declarable as foldable and reduce to their result. - Fix
foldResource's object-literal assumption so a constructor whose first argument is not the props object (new Parameter("String", {...})) can still fold. This is a narrow signature assumption, not a subset question. - Audit the rest of chant's exported authoring surface for the same shape before deciding what opts in.
Out of scope: exported function declaration and ArrowFunction blockers. Those are user code and correctly never fold — composites are the intended answer, and worth confirming separately for loomster's helpers.
Acceptance
- A component authored with
phase(...)folds. -
new Parameter("String", {...})folds. - loomster's fold ratio improves measurably from 13/57, reported as the headline result.
- Corpus coverage does not regress from 21/98.
- Nothing arbitrary becomes foldable — the allowlist stays closed and declared, same as feat(core): fold registered plain-call intrinsics (per-intrinsic opt-in) — DECIDED: yes #1044.
Activity
feat(core): registered foldable authoring helpers — phase/output fold…
fix(fold): interpret a composite the host registered (#2442)
fix(fold): interpret a composite the host registered (#2442) (#2443)