Skip to content

mcpx(searchpath): List reports a name as ambiguous even when a nearer entry already resolves it — the name is both listed and warned, while Find resolves it cleanly #1704

Open

Description

@dezren39

Problem

searchpath.Resolved.List and Resolved.Find disagree about the same resolved path. When a nearer directory provides a name unambiguously and a farther (shadowed) directory holds an overlapping .ts/.js pair for the same name, Find resolves the name cleanly to the nearer file — but List returns the name in its results and reports it in its ambiguity list. Nearest-wins is List's own documented rule ("the nearer occurrence of a duplicated name winning"), so a name that was won cannot also be ambiguous.

Evidence (verified this run on main 211aa58f)

  • pkgs/mcpx/internal/searchpath/searchpath.go:191-245 (List): the per-directory stem loop checks len(hits) > 1 && !AllowOverlap (line 233) and appends an Ambiguity before the seen duplicate check (line ~240), so the ambiguity branch runs for stems a nearer entry already provided. Find (line 146) returns at the first entry with a hit and never reaches the shadowed directory.
  • Probe executed this run on the laptop (~/git/fleet/probe-2026-10-28-lanea-searchpath/, searchpath.go copied verbatim, sha256 92c048ed…; log in the goal's hidden_files/probe-2026-10-28-laneA-searchpath/probe.log):
    • Layout: near dir holds only shared.ts; far dir holds shared.ts + shared.js; extensions [.ts, .js], overlap not allowed.
    • Find("shared") → <near>/shared.ts, ambiguity nil, error nil.
    • List() → names [shared], ambiguous [{shared [<far>/shared.js <far>/shared.ts]}] — the same name is simultaneously listed and warned as ambiguous (probe test FAILs on current code).
  • The existing test TestListReportsEveryNameNearestWinning covers a duplicated name with no overlap anywhere; the shadowed-overlap shape is untested.
  • Honest scope note: List currently has no in-repo production caller (only tests call it); it is the package's exported listing API, and its two outputs contradicting each other — and contradicting Find — is the defect, at low priority.

Why it matters

A consumer rendering List's output (a scripts listing with warnings) would tell the user shared is both available and unusable-until-they-pick-one, when running it via Find works with no choice needed. The ambiguity warning exists to force a deliberate pick where the outcome is genuinely undecided; a shadowed pair decides nothing.

Acceptance criteria

  • List does not report an ambiguity for a stem already provided by a nearer entry (the seen check governs shadowed stems), matching Find's nearest-wins outcome for the same Resolved.
  • A stem whose nearest occurrence is itself an overlapping pair is still reported ambiguous and omitted from the names (existing semantics preserved).
  • Regression test: near shared.ts only + far shared.ts/shared.js → names contain shared, ambiguities do not; plus the near-ambiguous case above.
  • Existing internal/searchpath tests keep passing.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    source/creatorFiled by the new-issue-creator job
    priority/lowNice to have; do when convenient
    on Oct 28, 2026
  2. developing-today commented on Oct 28, 2026

    @developing-today
    Contributor
  3. added
    queue/queuedHas a queued task in the Supabase agent queue
    app/mcpxPackage/app: mcpx (pkgs/ or apps/ in this repo)
    effort/sSmall: expected under 2 hours of work
    on Oct 28, 2026
  4. dezren39 commented on Oct 28, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

    • Agent: new-issue-creator (new-issue-creator-code-a)
    • Session / ID: new-issue-creator-code-a cron run 2026-10-28T15:05Z
    • Found via: filed this run
    • Task: Fix internal/searchpath List so a stem already provided by a nearer entry is not also reported ambiguous for a shadowed directory's overlapping pair.
    • Expectation: effort/s; done when List and Find agree on the shadowed-overlap layout and both regression shapes (shadowed pair, nearest pair) are tested.
    • Links: probe on laptop ~/git/fleet/probe-2026-10-28-lanea-searchpath/ (log: goal hidden_files/probe-2026-10-28-laneA-searchpath/probe.log); same-package companion filed this run: mcpx(searchpath): a ~name search-path entry is silently resolved under the caller's own home — ~alice/scripts becomes $HOME/alice/scripts #1702 (different defect — ~name resolution in absolute, cross-linked there too)
  5. dezren39 commented on Oct 28, 2026

    @dezren39
    MemberAuthor

    🤖 Dispatcher binding · openchamber-dispatcher run 2026-10-28 13:45 CDT (burn-by-expiry run: Drew directive 13:44 CDT — fill free session slots, burn the Go window resetting 2:26 PM and the Meta window resetting 4:23 PM)

  6. dezren39 commented on Oct 28, 2026

    @dezren39
    MemberAuthor

    Checkpoint — fix implemented, tested, PR open. Not merged.

    Change: pkgs/mcpx/internal/searchpath/searchpath.go, List only. The seen check now runs before the overlap/ambiguity check, so the nearest occurrence of a stem decides it: a shadowed .ts/.js pair further down the path is never warned about. The stem is also marked seen before the ambiguity test, so when the nearest occurrence is an overlapping pair it stays ambiguous and omitted, and a farther plain copy cannot quietly replace it (matching Find, which returns the ambiguity rather than falling through).

    Unchanged: Find ambiguity semantics, AllowOverlap: true behaviour, the ~name defect in #1702.

    Regression tests: two new tests in searchpath_test.go — TestListDoesNotReportAShadowedOverlapAsAmbiguous (nearer single shadows farther pair) and TestListReportsAnOverlapOnlyWhereItIsNearest (nearest pair ambiguous + omitted, farther plain copy does not stand in). Both fail on main; both pass with the fix.

    Verified on laptop: cd pkgs/mcpx && go test ./internal/searchpath/ -v → all 14 tests pass; go vet ./internal/searchpath/ clean. Full go test ./... for the mcpx module is running in the background and will be reported here if it is not green.

    PR: #1776

  7. dezren39 commented on Oct 28, 2026

    @dezren39
    MemberAuthor

    CI is green on PR #1776: 15 checks pass (mcpx test, mcpx conformance clients/servers/spec parity, nix ci flake + treefmt), 1 neutral (CodeRabbit), 1 skipped (vendorHash bot job). internal/searchpath passed in CI.

    One first-attempt flake: internal/execsvc failed once on CI while internal/searchpath passed; that package has no searchpath references, passes 4× locally, and the failed job passed on rerun. Not related to this change.

  8. dezren39 commented on Oct 29, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · bound

  9. 4 remaining items

  10. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    event: done (already_done)
    task: 1924 (repo-health-code-pilot, repo-worker-code; OpenChamber scheduled lane ec118cad-0fd3-4652-91c4-27432f2f2efd)
    state: completed as already_done; no new branch, no PR, no files changed.
    fresh_evidence: the exact fix in this packet already landed on main as dda7ae7 (Refs #1704, ancestor of origin/main 9f730f1): List marks seen first so a shadowed overlap is not warned about, and a nearest pair still claims the stem. Regression tests TestListDoesNotReportAShadowedOverlapAsAmbiguous + TestListReportsAnOverlapOnlyWhereItIsNearest exist; go test ./internal/searchpath/ passes on current origin/main.
    note: dda7ae7 says Refs, not Closes — leaving #1704 OPEN for the author to close on confirmation.
    labels: removed queue/queued, status/needs-triage (task terminally complete; nothing in flight).

  11. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: triaged (coverage pass)
    Coverage pass 2026-11-03: reviewed in the fleet-wide per-issue pass (drift / overlap / already-handled / stale / blockers / ordering). Verdict: still live; queued in repo-health-code-pilot as small_fix at priority 50 (priority/low). If this is already handled at current main, the triage closes it with evidence; if it needs splitting, the triage files the split.
    Found via: coverage pass 2026-11-03

  12. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: triaged (coverage pass)
    Coverage pass 2026-11-03: reviewed in the fleet-wide per-issue pass (drift / overlap / already-handled / stale / blockers / ordering). Verdict: still live; queued in repo-health-code-pilot as small_fix at priority 50 (priority/low). If this is already handled at current main, the triage closes it with evidence; if it needs splitting, the triage files the split.
    Found via: coverage pass 2026-11-03

  13. added
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    and removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Nov 4, 2026
  14. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    event: picked_up
    task: 7713 (repo-health-code-pilot, repo-worker-code; OpenChamber scheduled lane 335a5d1f-bfc1-4831-99ea-850c8939a727)
    state: claimed; issue and linked artifacts revalidated.
    fresh_evidence: issue #1704 is open; linked PR #1776 is merged and its checks are green. No implementation or duplicate PR will be created.
    next: close the queue task as already_done, keep the issue open because the PR says Refs #1704, and remove the transient in-flight labels.
    labels: added work/assigned, queue/claimed, status/in-progress; removed queue/queued, status/needs-triage.

  15. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    event: done (already_done)
    task: 7713 (repo-health-code-pilot, repo-worker-code; OpenChamber scheduled lane 335a5d1f-bfc1-4831-99ea-850c8939a727)
    state: completed as already_done; no branch, worktree, source edits, or duplicate PR created.
    fresh_evidence: issue #1704 remains open; PR #1776 is merged (merge commit 74737b3), and current PR status reports 23/23 checks passed. The issue records the targeted searchpath tests passing (14 tests).
    note: leaving #1704 open because PR #1776 says Refs #1704 rather than closing it.
    labels: removed work/assigned, queue/claimed, status/in-progress; no transient queue/status/work labels remain.

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

Metadata

Metadata

Assignees

Labels

app/mcpxPackage/app: mcpx (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/lowNice to have; do when convenientsource/creatorFiled by the new-issue-creator jobtask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions