Skip to content

fix: ignore workspace pattern matching the project root - #702

Merged
nam-hle merged 1 commit into
mainfrom
fix/699-root-matching-workspace
Jun 21, 2026
Merged

fix: ignore workspace pattern matching the project root#702
nam-hle merged 1 commit into
mainfrom
fix/699-root-matching-workspace

Conversation

@nam-hle

@nam-hle nam-hle commented Jun 20, 2026

Copy link
Copy Markdown
Member

Closes #699.

Problem

A workspace glob matching the project root (e.g. a pnpm packages: ["."], or a broad ./** that re-includes root) made @manypkg return the root as a sub-package. createProject turned it into a degenerate empty-path workspace duplicating the root, which then failed label validation with a cryptic error:

Workspace "root" has label "" which conflicts with the ID of workspace "".

This was the it.todo("single workspace in monorepo") case in workspaces-detection.test.ts. (A genuine single sub-package monorepo already worked.)

Fix

In createProject, filter out any discovered package whose absolute dir equals the root dir before mapping to workspaces. The root is already rootWorkspace, so the match is dropped and the project resolves cleanly. One .filter; no API change.

Tests

  • Implements the deferred workspaces-detection test: pnpm-workspace matching . + a real sub-package now resolves to root + the sub (snapshot confirms no empty workspace), exit 0.
  • project-resolver suite 37 pass; nadle workspace suite 53 pass; detection + alias suites pass together (12); lint + prettier clean; pre-commit nadle check passes.

Spec

spec/06-project.md Workspace Discovery gains the root-exclusion rule. Rebased on top of #698 (now merged); spec entry is 4.1.1 (PATCH — corrects detection behavior on top of #698's 4.1.0).

🤖 Generated with Claude Code

@netlify

netlify Bot commented Jun 20, 2026

Copy link
Copy Markdown

Deploy Preview for nadle ready!

Name Link
🔨 Latest commit c4c0a87
🔍 Latest deploy log https://app.netlify.com/projects/nadle/deploys/6a37846b82145500086a3bbe
😎 Deploy Preview https://deploy-preview-702--nadle.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 92
Accessibility: 97
Best Practices: 100
SEO: 100
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new

pkg-pr-new Bot commented Jun 20, 2026

Copy link
Copy Markdown

Open in StackBlitz

create-nadle

npx https://pkg.pr.new/nadlejs/nadle/create-nadle@702

eslint-plugin-nadle

npx https://pkg.pr.new/nadlejs/nadle/eslint-plugin-nadle@702

@nadle/kernel

npx https://pkg.pr.new/nadlejs/nadle/@nadle/kernel@702

@nadle/language-server

npx https://pkg.pr.new/nadlejs/nadle/@nadle/language-server@702

nadle

npx https://pkg.pr.new/nadlejs/nadle@702

@nadle/project-resolver

npx https://pkg.pr.new/nadlejs/nadle/@nadle/project-resolver@702

nadle-vscode-extension

npx https://pkg.pr.new/nadlejs/nadle/nadle-vscode-extension@702

commit: c4c0a87

A workspace glob that matches the project root directory (e.g. a pnpm
pattern of '.') made @manypkg return the root as a sub-package, which
createProject turned into a degenerate empty-path workspace duplicating
the root. That then failed label validation with a confusing 'conflicts
with the ID of workspace ""' error.

Filter packages whose dir equals the root dir before creating workspaces:
the root is already represented by rootWorkspace, so the match is dropped
and the project resolves cleanly.

Implements the deferred workspaces-detection test. Spec 06-project gains
the root-exclusion rule (4.1.0).

Closes #699

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@nam-hle
nam-hle force-pushed the fix/699-root-matching-workspace branch from 5a4748c to c4c0a87 Compare June 21, 2026 06:27
@nam-hle
nam-hle enabled auto-merge (squash) June 21, 2026 06:28
@nam-hle
nam-hle merged commit 3a6d959 into main Jun 21, 2026
29 checks passed
@nam-hle
nam-hle deleted the fix/699-root-matching-workspace branch June 21, 2026 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

decide behavior: pnpm-workspace matching exactly one package

1 participant