Skip to content

fix(cli): guard console resolution against stale out-of-workspace installs - #1778

Merged
xuyushun441-sys merged 2 commits into
mainfrom
fix/cli-console-resolve-version-guard
Jun 12, 2026
Merged

fix(cli): guard console resolution against stale out-of-workspace installs#1778
xuyushun441-sys merged 2 commits into
mainfrom
fix/cli-console-resolve-version-guard

Conversation

@xuyushun441-sys

Copy link
Copy Markdown
Contributor

Problem

resolveConsolePath() in packages/cli/src/utils/console.ts resolves @objectstack/console/package.json via createRequire from the consumer cwd. Node module resolution climbs node_modules directories all the way up the filesystem — past the workspace root. A stray install higher up (real incident: a leftover ~/node_modules/@objectstack/console@7.8.0 from an old npm experiment) won over the version-locked bundle, so serve --dev silently served a stale Console and the browser failed with OBJUI-001 Unknown component type: marketplace:installed-list.

Fix

The vendored @objectstack/console is version-locked to the framework release, so a healthy install always shares the CLI's major version:

  • New guard isConsoleVersionCompatible(): candidates from node resolution (strategy 1) and the cwd/node_modules direct check (strategy 2) are skipped with a warning when their major version differs from the CLI's own. The warning names the path and both versions so the stray install is discoverable.
  • The sibling-repo ../objectui dev fallback is exempt — it versions independently and is an explicit dev opt-in.
  • The CLI's own version is read by walking up from the module to the nearest package.json; if unreadable, the guard fails open rather than breaking resolution.
  • resolveConsolePath() gains optional { cwd, cliVersion, warn } for testability; the serve.ts call site is unchanged.

Also adds a Post-Task Checklist item to AGENTS.md: passing work must land via branch + PR, not sit in the working tree.

Tests

New packages/cli/test/console-resolve.test.ts reproduces the incident shape in a tmpdir sandbox (stale @7.8.0 in a simulated $HOME, project as cwd) and pins: stale install skipped + warned, same-major accepted, matching local install preferred, missing-version rejected. Full packages/cli suite: 275 passed. tsc --noEmit clean.

🤖 Generated with Claude Code

os-zhuangand others added 2 commits June 12, 2026 15:15
fix(app-shell): NavigationSyncEffect baseline race — readiness gate, sys_ filter, ADR-0010 lock filter (#1668)
objectui@e95cc25b2c0d2fa680e232151721e71c19630659
…talls
resolveConsolePath() resolves @objectstack/console via createRequire from
the consumer cwd, and Node module resolution climbs node_modules
directories past the workspace root. A stray install higher up the
filesystem (e.g. a leftover ~/node_modules/@objectstack/console@7.8.0
from an npm experiment) won over the version-locked bundle, so
`serve --dev` served a stale Console (browser-side OBJUI-001
"Unknown component type: marketplace:installed-list").
The vendored console package is version-locked to the framework release,
so a healthy install always shares the CLI's major version. Skip any
candidate from node resolution or the cwd/node_modules direct check
whose major differs from the CLI's own, and warn with the path and both
versions so the stray install is discoverable. The sibling-repo objectui
dev fallback is exempt (independent versioning, explicit opt-in). If the
CLI's own version can't be read the guard fails open.
resolveConsolePath() now takes optional { cwd, cliVersion, warn } for
testability; the serve.ts call site is unchanged. Also documents in
AGENTS.md that passing work must land via branch + PR, not sit in the
working tree.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercelBot commented Jun 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
specReadyReadyPreview, CommentJun 12, 2026 10:42am

Request Review

@github-actionsgithub-actionsBot added size/m documentation Improvements or additions to documentation tests labels Jun 12, 2026
@xuyushun441-sys
xuyushun441-sys merged commit 748e3eb into mainJun 12, 2026
12 checks passed
@xuyushun441-sys
xuyushun441-sys deleted the fix/cli-console-resolve-version-guard branch June 12, 2026 10:44
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/mtests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@xuyushun441-sys@os-zhuang