Skip to content

resolveSpecDistInjection validates the override's exports targets but not that its own dependencies resolve, so a dep-less spec dist fails ~80s later as a rolldown "failed to resolve zod" #5391

Description

@os-project-manager

Observation, found while working #5388. Not a regression and not blocking anything — filing so triage can rank it rather than sitting on it.

What I measured

scripts/vite-objectstack-spec-dist.ts states two properties on purpose, and the first one is:

Loud, never lenient. Every way the override can be wrong — path absent, not the spec package, an exports entry naming a file the built package does not contain — throws with the offending value named.

It checks that each exports-map target file exists. It does not check that the overriding package's own runtime dependencies resolve from where the package sits. Pointing OBJECTSTACK_SPEC_DIST at a real, fully built @objectstack/spec copy that has no reachable node_modules produced no error from the helper at all. The console build ran to completion — 8592 modules transformed, ~80 seconds — and then failed with:

Error: [vite]: Rolldown failed to resolve import "zod" from
"/…/framework-spec/packages/spec/dist/index.mjs".
This is most likely unintended because it can break your application at runtime.

Symlinking the package's dependency set next to it made the same build green.

Why it is worth a line

The failure IS loud, so this is not the silent-skew class the hook exists to kill. What it costs is diagnosis: the message names zod and a rolldown resolver, not OBJECTSTACK_SPEC_DIST, and it arrives a build-length after the mistake rather than at the point the override is read. The helper's stated contract is that a wrong override names itself.

One sharp edge found alongside it, which is why the ordering matters: while #5388 was unfixed, this resolve error was completely invisible — the lazy-linter counter-probe threw in generateBundle first and aborted the build before the accumulated resolve errors were escalated. Same command, same tree, two different single-error reports depending on which failure got there first.

Scope note

scripts/build-console.sh in the framework points the override at an installed tree, where deps resolve, so this is not reachable from the path that matters today. It is reachable by hand and by any future caller that builds a spec package in isolation.

Possible shapes (not a recommendation)

  • Resolve one known dependency of the override from packageDir in findSpecPackageDir and fail with the override value named.
  • Or leave it and document the failure mode in the module header, since the build does stop either way.

Related: #4854 (the hook), #5388 (the counter-probe that masked it), objectstack-ai/objectstack#8134 (the ruling behind the injection).

Metadata

Metadata

Labels

domain:devxobjectui devx stream: fix lands on .github/, scripts/ or release pipeline — devx lane cross-repopm:dispatched

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions