test(service-settings): alias the remaining three workspace deps to source, emptying its check-test-source-alias entry (#8104) - #8190
Conversation
…ource, emptying its check-test-source-alias entry (#8104) #8063 aliased two workspace deps to source in this package's first `vitest.config.ts`. The other three — `@objectstack/spec`, `@objectstack/platform-objects`, `@objectstack/types` — stayed on their `KNOWN_UNALIASED_TEST_IMPORTS` entry and kept resolving through `exports` to `dist/`. They are now aliased to source and the registry entry is deleted. 17 of this package's 20 test files were really reading the artifact: with the three `dist/` trees removed and the pre-#8104 config in place, 17 files fail to load and only 58 of 413 cases run. With the aliases, the same tree with no `spec`/`platform-objects`/`types` build output passes 413/413. The subpath entry points were the actual work. This package imports no bare `@objectstack/spec` and no bare `@objectstack/platform-objects` at run time — every reachable specifier for those two is a subpath (`spec/api`, `spec/contracts`, `spec/data`, `spec/system`, `platform-objects/system`, plus `spec/security` reached transitively through `types`). The object alias form would swallow them into `…/index.ts/<sub>` (`ENOTDIR`, #7778); the anchored bare form #8063 established does not swallow them but does not cover them either, so copying that shape would have left every one of them on `dist` with the registry entry undeletable. So `spec` takes the one-rule-for-all-namespaces capture form, its export map being uniform, while `platform-objects` takes an explicit `/system` entry because its map is not (`./plugin` is `src/plugin.ts`, a file, so a `([a-z-]+)` rule would invent `src/plugin/index.ts`). `plugin-audit` writes its `platform-objects/audit` entry the same way. The registry deletion is half the change: the entry is audited for set equality in both directions, so aliases-complete-with-entry-present and entry-deleted-with-aliases-incomplete each fail the gate. It reads OK at 61 registered packages, down from 62. 413 passed / 20 files, unchanged from baseline. No change under `src/`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SMN7p2W62YzA3bY7BaFv3r
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
📓 Docs Drift CheckThis PR changes 1 package(s): 5 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
⛔ 2 release-owned page(s) also reference the affected code. These are read-only:
|
Closes #8104.
#8063 gave
service-settingsits firstvitest.config.tsand aliased two workspace deps to source. The other three —@objectstack/spec,@objectstack/platform-objects,@objectstack/types— stayed on the package'sKNOWN_UNALIASED_TEST_IMPORTSentry and kept resolving throughexportstodist/. They are now aliased to source, and the registry entry is deleted.How much was actually reading the artifact: 17 of 20 files
Measured, not inferred. With the three
dist/trees physically removed from the checkout:Cannot find package '@objectstack/spec/system'So the artifact is off the resolution path, not merely shadowed by a fresh copy of it.
The subpath entry points were the job, and the obvious shape does not do it
This package imports no bare
@objectstack/specand no bare@objectstack/platform-objectsat run time. Every specifier its tests can reach for those two is a subpath:plus
@objectstack/spec/security, reached transitively through@objectstack/types([ADR-0105 D1] tenancy posture) once types itself resolves to source.Both shapes that suggest themselves fail, in opposite directions:
…/index.ts/system,ENOTDIRat run time in a config that reads as correct (test(service-storage): resolve@objectstack/corefrom source so a stale dist can't decide a pin (#7668) #7778);/^@objectstack\/spec$/, what fix(service-settings): repoint sys_setting.value_enc on a secret rotation, and reap the retired ciphertext (#8030) #8063 left behind) does not swallow them, but does not cover them either → all six stay ondistand the registry entry cannot come off.What covers them is a subpath rule, and the right rule differs per package because their export maps differ:
specis uniform (src/<ns>/index.tsthroughout) → the one-rule-for-all-namespaces capture form/^@objectstack\/spec\/([a-z-]+)$/, which cannot go stale when a new namespace import arrives.platform-objectsis not uniform —./pluginissrc/plugin.ts, a file → an explicit/systementry. A([a-z-]+)rule would sendplatform-objects/plugintosrc/plugin/index.ts, a path nobody wrote, failing on whoever next adds that import.plugin-auditwrites itsplatform-objects/auditentry the same way for the same reason.The two halves constrain each other
KNOWN_UNALIASED_TEST_IMPORTSis audited for set equality in both directions, so neither half is green alone:check-test-source-aliasdist/with no source alias"--self-testOK.Scope
distwas built from the same commit, which is exactly the condition under which the old setup looked fine.packages/services/service-settings/src/**.vitest.config.ts, the registry entry inscripts/check-test-source-alias.mjs, and a changeset.content/docs/releases/**,docs/adr/**,.claude/skills/**,skills/**untouched.One finding, not fixed here
When the gate names an unaliased dep it prints a remediation hint that is the anchored bare form:
For a package whose only reachable specifiers are subpaths — this one — following that hint verbatim leaves the gate red with no further guidance, since the suggested alias covers nothing it just named. The hint is correct for bare importers and misleading for subpath-only ones. Fixing it means teaching the diagnostic to print the specifiers it measured rather than a generic template; that is a change to the gate's own surface and belongs in its own card, not riding on this one.
Generated by Claude Code