Skip to content

service-settings: alias the remaining three workspace deps to source in vitest.config.ts, shrinking its check-test-source-alias registry entry to empty #8104

Description

@huangyiirene

Residual from #8030 → PR #8063, filed by the domain:services PM seat on the dev's recommendation. ⛔ Not graded by me — for triage. Small and mechanical, but with one non-obvious trap that has already cost this repo a debugging round, so it is written down rather than left as folklore.

State after #8063

PR #8063 introduced this package's first real-engine test and, with it, packages/services/service-settings/vitest.config.ts. It aliases two workspace deps to source — @objectstack/objectql and @objectstack/core — because those two were what check-test-source-alias newly named. The gate's registry entry for service-settings was left byte-identical: @objectstack/platform-objects, @objectstack/spec, @objectstack/types are still listed as known-unaliased.

Those three still resolve through exports to dist in this package's tests. That is the condition the gate exists to shrink: a test that reads a build artifact reports on build state rather than on the source in the checkout, and its failure mode is a green test that proves nothing.

The ask

Alias the remaining three to source in the same config, and delete service-settings' entry from KNOWN_UNALIASED_TEST_IMPORTS in scripts/check-test-source-alias.mjs.

⚠️ The registry is audited for set equality in both directions — a stale entry for a package that no longer has unaliased imports is itself a failure. So the removal is not optional cleanup; it is half of the change.

Two traps, both measured, both cheap to walk into

  1. Array form with anchored regexes, never the object form. resolve.alias's object form matches by prefix, so a bare key whose replacement is a file also swallows every subpath and resolves it to …/index.ts/<sub>ENOTDIR, at run time, in a config that reads as correct. See test(service-storage): resolve @objectstack/core from source so a stale dist can't decide a pin (#7668) #7778, and the shape already in vitest.config.ts from fix(service-settings): repoint sys_setting.value_enc on a secret rotation, and reap the retired ciphertext (#8030) #8063: { find: /^@objectstack\/spec$/, replacement: … }. @objectstack/spec and @objectstack/platform-objects are the ones that matter here — this package imports subpaths of both (@objectstack/platform-objects/system, @objectstack/spec/system), so a prefix-matching alias will break them and an anchored one will not cover them. Whether the subpath entry points need their own alias entries is the actual work in this card.
  2. Blast radius is the whole package. This changes module resolution for all 20 test files in service-settings, not just the one that motivated it. That is exactly why it was kept off a P0 security hotfix. Expect to run the full package suite (413 passing / 20 files as of fix(service-settings): repoint sys_setting.value_enc on a secret rotation, and reap the retired ciphertext (#8030) #8063) and read the result, not just the new file's.

Acceptance

  • check-test-source-alias: OK, and service-settings absent from the registry.
  • service-settings suite still green at its full count.
  • ⛔ No source change in packages/services/service-settings/src/** — if aliasing to source turns a test red, that is a finding to report, not a thing to patch away. A test that only passed against dist was measuring the wrong artifact, and what it was hiding is the interesting half of this card.

Provenance: #8030 dev report (comment 5267935069, "Deliberately not done"), and my ACCEPT receipt on #8030 (comment 5268937227).

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions