Skip to content

"pnpm lock importers list a non-root member" is written twice and drifted on comment lines: keep formats::pnpm::workspace, delete the utils::pnpm_workspace copy #1952

Closed

Description

[agent] Filed by the scheduled architecture audit (audit-core). Register: #1830 (comment).

Kind: refactor (drifted duplicate). Register ID: A67 (related to A08, ecosystem code in utils/).

Problem. Two copies answer one question:

  • formats/pnpm/workspace.rs L155-L169 lock_has_member_importers, plus its caller wrapper at hosted/engine.rs L2993-L3000.
  • utils/pnpm_workspace.rs L269-L293 root_lock_lists_members.

Executed (a scratch test on cbbbdb9). For the lock importers:\n\n .:\n dependencies: {}\n\n # sub:\n:

workspace::lock_has_member_importers       -> true   (parse_key_line reads the comment as a key)
pnpm_workspace::root_lock_lists_members    -> false

So hosted and the vendored/workspace path can disagree about whether a root lock already lists workspace members.

Proposed change.

  1. Keep one predicate in formats::pnpm::workspace that skips comment lines and applies grammar::main_document.
  2. Delete the utils copy and route its callers to the kept predicate.
  3. Inline the engine wrapper.

Size. 3 files, about −35/+10 lines.

Acceptance criteria.

  • Existing pnpm workspace tests pass.
  • A new test with a commented-out importer key asserts false, and a second one asserts the env-document importers are ignored.

Activity

  1. added
    arch-auditFiled by a scheduled architecture audit routine (see the architecture review discussion)
    refactorStructural change: duplicated code or logic, missing abstraction, layering, dead code
    on Nov 1, 2026
  2. mikolalysenko commented on Nov 1, 2026

    @mikolalysenko
    CollaboratorAuthor

    [agent] Triage: priority:p1 (pnpm). Confirmed on main: formats::pnpm::workspace::lock_has_member_importers reads a # sub: comment through parse_key_line, while utils::pnpm_workspace::root_lock_lists_members skips it. No open PR covers it. Related but separate: #1949.


    Generated by Claude Code

  3. mikolalysenko commented on Nov 1, 2026

    @mikolalysenko
    CollaboratorAuthor

    [agent] Shares root cause with #1949: pnpm lock readers scan the whole lock text with their own line rules instead of the main document through the formats::pnpm grammar, so the pnpm 11 env document and comment lines read differently per caller. Will be fixed together.

    [agent] Claiming this issue (with #1949; shared root cause: pnpm lock readers bypass grammar::main_document and the shared key-line grammar). Branch: agent/fix-pnpm-lock-main-document. Claim-ID: 2026-11-01T22:21:15Z-216d13


    Generated by Claude Code

  4. mikolalysenko commented on Nov 1, 2026

    @mikolalysenko
    CollaboratorAuthor

    [agent] Draft PR: #1960


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent:triagedarch-auditFiled by a scheduled architecture audit routine (see the architecture review discussion)priority:p1refactorStructural change: duplicated code or logic, missing abstraction, layering, dead code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions