Skip to content

fix(ADR-0048): rescope os lint naming/namespace-prefix to intra-package duplicates#1838

Merged
xuyushun441-sys merged 1 commit into
mainfrom
fix/lint-namespace-prefix-adr0048
Jun 14, 2026
Merged

fix(ADR-0048): rescope os lint naming/namespace-prefix to intra-package duplicates#1838
xuyushun441-sys merged 1 commit into
mainfrom
fix/lint-namespace-prefix-adr0048

Conversation

@xuyushun441-sys

Copy link
Copy Markdown
Contributor

Summary

ADR-0048 §3.4 retired the per-item cross-package metadata collision throw — two installed packages may legitimately ship the same bare name (e.g. page/home), stored under distinct composite keys and disambiguated by package-scoped resolution. The os lint naming/namespace-prefix rule was never updated to match, so it still:

  • fired on every bare-named UI/automation item (apps/pages/dashboards/flows/actions/reports/datasets) regardless of whether a duplicate existed — a normal single-package app got dozens of false positives (hotcrm: 63), and
  • claimed the package would "collide on the registry key and fail at install", which is no longer true.

What changed

packages/cli/src/commands/lint.ts — the rule now warns only on a genuine intra-package duplicate (type, name) pair within the linted config. This is the narrow authoring-time hygiene case ADR-0048 §3.4 explicitly leaves to os lint ("an author shipping two page/home in one package"). A unique bare name produces zero warnings. Detection is per-type (so page/home + flow/home don't false-trigger) and the warning points the duplicate occurrence back at the original declaration.

The message no longer claims an install failure; it explains the items shadow each other on the registry key and that distinct packages may reuse the same name freely (the namespace prefix is an optional convention, not a collision-avoidance requirement). The <ns>_-prefixed fix is offered only when a namespace is declared.

Runtime/registry behavior is unchanged — this touches only the CLI lint rule, its tests, and the message.

Tests

packages/cli/test/lint-namespace-prefix.test.ts rewritten for the new contract:

  • unique-name single-package config → 0 warnings (the hotcrm false-positive regression)
  • actual intra-package duplicate → 1 warning (points at the dup, back-references the original, suggests crm_-prefixed rename)
  • per-type independence; same name across different types is not a collision
  • no-namespace duplicate still warns (omits the fix)
  • message asserts absence of the stale "fail at install" / "Two packages" claims

Full CLI suite: 316 passed.

Real-world check

Ran the freshly-built CLI against ../hotcrm: naming/namespace-prefix warnings dropped 63 → 0 (total warnings 63 → 4; the remaining 4 are unrelated data-model rules).

Changeset added (@objectstack/cli: patch).

🤖 Generated with Claude Code

…ge duplicates

ADR-0048 §3.4 retired the per-item cross-package collision throw, but the
naming/namespace-prefix lint rule was never updated to match. It fired on every
bare-named UI/automation item (hotcrm: 63 false positives) and claimed the
package would "collide on the registry key and fail at install" — both false.

The rule now warns only on a genuine intra-package duplicate (type, name) pair
within the linted config (the authoring-hygiene case §3.4 leaves to os lint).
Unique bare names produce zero warnings. Message no longer claims an install
failure. Runtime/registry behavior unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 14, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 14, 2026 6:20am

Request Review

@github-actions github-actions Bot added documentation Improvements or additions to documentation tests tooling size/m labels Jun 14, 2026
@xuyushun441-sys
xuyushun441-sys merged commit e1df97c into main Jun 14, 2026
12 checks passed
@xuyushun441-sys
xuyushun441-sys deleted the fix/lint-namespace-prefix-adr0048 branch June 14, 2026 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants