fix(cli): classify doctor field origin via shared computeOriginFromField - #537
Open
MarioCadenas wants to merge 1 commit into
Open
fix(cli): classify doctor field origin via shared computeOriginFromField#537MarioCadenas wants to merge 1 commit into
MarioCadenas wants to merge 1 commit into
Conversation
doctor's resolve-targets.isUserSuppliedEnv hand-rolled the field-origin cascade and never handled the cli origin, so a resolve-based (cli-origin) field — whether stamped or derived from the field shape — was misreported as a missing user-supplied env var. Derive the effective origin via the shared computeOriginFromField (trusting a stamped `origin`, else the field shape) and treat a field as user-supplied only when that origin is "user". Stacked on feat/registry-cli, which introduces computeOriginFromField. Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
MarioCadenas
requested review from
atilafassina
and removed request for
a team
August 14, 2026 13:13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #462 (
feat/registry-cli) — please review/merge that first; this PR targetsfeat/registry-cli, notmain.Problem
doctor'sresolve-targets.isUserSuppliedEnvhand-rolled the field-origin cascade and never handled thecliorigin. In a syncedappkit.plugins.json(whereplugin syncstampsorigin), acli-origin field — one resolved by the CLI viaresolve— was classified as user-supplied, soappkit doctorwrongly reported it as a MISSING user env var.Fix
Reuse the canonical classifier instead of re-implementing the cascade:
Import
computeOriginFromFieldfromschemas/manifest(the single sourceplugin syncuses).Add
resolve?: stringto the localManifestFieldso cli-origin fields in authored manifests (no stampedorigin) classify correctly.A field is user-supplied iff its effective origin is
"user"— trust a stampedfield.originfirst, else derive it from the field shape:This mirrors the
fieldOriginhelper inregistry/requirements.ts, importing the shared classifier directly.Tests
cli-origin field is excluded fromenvVars, covering both a stampedorigin: "cli"field and an unstamped field withresolveset."excludes value-default and platform-injected fields"case: it previously asserted the cli-originLAKEBASE_ENDPOINTwas included (that assertion encoded the bug). It now includes a genuine user field and asserts only that survives, so it discriminates cli/platform/static (excluded) from user (kept).Verify
pnpm --filter=shared typecheck— cleannpx vitest run packages/shared/src/cli/commands/doctor— 129 passednpx biome checkon both changed files — clean