Repository navigation
Description
Second-largest remaining fold blocker after #1044, and currently untracked. Measured on main a0e7ffe9 (after #1020 shipped).
The gap
#1020 resolves cross-file identifiers through project files only — isProjectFileSpecifier in fold-import.ts skips bare package specifiers. So an identifier imported from a lexicon package still fails with unresolved identifier, even when what it names is plain static data.
Remaining unresolved identifier blockers on the corpus, by name:
| name | blocks | what it is |
|---|---|---|
config |
11 | project-file const (deeper chains #1020 doesn't reach) |
Azure |
11 | azure pseudo-parameter namespace |
GCP |
8 | gcp pseudo-parameter namespace |
process |
5 | correctly rejected — leave alone |
S3Actions |
2 | aws action constants |
CI |
2 | gitlab constants |
GCP_PROJECT_ID, shared |
2 | misc |
Why this is tractable
The lexicons already emit exactly the shape fold handles. lexicons/azure/src/pseudo.ts:63:
export const Azure = {
ResourceGroupName, ResourceGroupLocation, ResourceGroupId,
SubscriptionId, TenantId, DeploymentName,
} as const;That is a plain const object literal — structurally identical to a project-file const that folds today. AWS declares AWS the same way. This is not a code-generation problem; the generators are already producing foldable source. The blocker is purely the resolver's scope.
Scope
- Extend cross-file resolution to bare specifiers that resolve into an active lexicon package, reusing feat(core): fold — resolve identifiers across the module graph #1020's existing machinery (the per-build memo, one-instance-per-export identity guarantee, cycle detection).
- Keep the boundary tight: resolve only into packages already loaded as lexicons for this build. Do not walk arbitrary
node_modules. processand anything else environment-dependent must keep failing. That rejection is the point of the subset, not a gap.
Watch out for
- Cost. Reading lexicon source at fold time is what made feat(core): fold — resolve identifiers across the module graph #1020's first cut hang (see PR feat(fold): resolve identifiers across the module graph #1055 —
createRequire().resolve()degrading pathologically inside a vitest worker). The caching and fast-path work frombe72cb88/0112d972is already in place; reuse it rather than re-introducing the slow path. - Identity. Same invariant as feat(core): fold — resolve identifiers across the module graph #1020: one instance per resolved export per build, or
AttrRefidentity matching breaks.
Expected value
~25 corpus entries are blocked by cross-file alone, and 4 more by cross-file plus call-as-a-value. With #1044 (~45 entries), these two together take fold coverage from today's 21/98 to roughly 91/98.
Acceptance
- A lexicon-exported const (pseudo-parameter namespace, action constants) resolves and folds when referenced as a value.
-
process.envand environment-dependent references still reject, with tests. -
EXPECTED_FOLDupdated; before/after entry counts reported; no entry that folds today regresses. - No regression in suite runtime — verify with a repeat-run harness, not a single pass.
Activity
feat(core): fold registered call-form intrinsics — per-intrinsic opt-…
feat(core): fold cross-file references into active lexicon package ex…