Skip to content

mcpx(affected-tests): untracked new files are counted as changed but their contents never reach the diff-text analysis — T2 name matching, T1b and harness detection silently skip them pre-commit #3320

Closed

Description

@dezren39

mcpx(affected-tests): untracked new files are listed as changed but their contents never reach the diff-text analysis — T2 name matching and T1b silently skip them pre-commit

Summary

pkgs/mcpx/scripts/affected-tests.py promises in its header (lines 26–29):

The diff is the working tree against the base (committed + uncommitted +
untracked), so the selector works before anything is committed:
git diff --name-only <base> + git ls-files --others

The changed-file list honours that (line 336–339: git diff --name-only ∪
git ls-files --others), so an untracked new file counts as changed, its
package gets T0/T1, and its registry area fires T3 guards. But the diff text
the rest of the analysis reads is built with a plain
git diff <base> -- <paths> (lines 396–400), which emits nothing for
untracked files
. Everything derived from that text silently treats a new
untracked file as empty:

  • T2 name matching (names = diff_names(diff_text), line 448): quoted
    names (setting paths, op names, flag/command names) that exist only in a
    new untracked registry file are never extracted, so e2e tests mentioning
    them are not selected.
  • T1b (exported = changed_exported_idents(diff_text), line 403):
    exported declarations in a new untracked file are never seen, so importer
    packages are not added.
  • Harness detection (the e2e diff at line ~466): newEnv defined in a
    new untracked e2e helper file is missed, so the rule-4 sample is not
    selected.

Verified (laptop probe, script sha256 2b908c49… = current main a1aa07d)

Fixture repo with the real script; base commit contains a test-first e2e
test TestBrandNewSettingFlows mentioning "pool.brandnewsetting". The
change is one new file internal/settings/newreg.go defining that setting:

  • Untracked (git status: ?? newreg.go; git diff origin/main -- newreg.go is empty): selector reports "1 changed file(s)", selects T1
    for internal/settings and the T3 settings guards, but T2 selects only
    the generic guard TestEveryDeclaredRouteAnswersOverTheSocket —
    TestBrandNewSettingFlows is not selected.
  • Same file staged (git add): T2 selects
    TestEveryDeclaredRouteAnswersOverTheSocket|TestBrandNewSettingFlows.

Probe: laptop ~/git/fleet/probe-2026-10-31-laneB-affected/probe2.sh.

Why it matters

The selector's whole purpose (#1966 / TESTING.md tiers) is choosing the
right tests before committing. Test-first work — a committed failing test
waiting on a brand-new implementation/registry file that is still
untracked — is exactly the shape this fleet produces, and in exactly that
moment the selector under-selects: the waiting e2e test does not run, and
nothing in the output says the file's contents were skipped (the header
count even claims the file was considered). CI still runs the full suite,
so this is a local-feedback correctness bug, not a merge-safety hole.

Acceptance criteria

  • For an untracked new file under pkgs/mcpx, its contents feed the same
    diff-text analysis as a tracked change (e.g. via git diff --no-index /dev/null <path> or by intent-to-add), so:
    • T2 selects e2e tests mentioning names introduced only in an untracked
      registry file (the staged/untracked outputs match for the fixture
      above);
    • exported declarations in an untracked file drive T1b importer
      selection;
    • newEnv in an untracked e2e file triggers the rule-4 harness sample.
  • A regression test/fixture covers the untracked case (the staged and
    untracked runs of the probe fixture select the same T2 set).
  • Tracked/staged behaviour is unchanged; deleted-file handling (paths that
    no longer exist are excluded from reads) still works.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    priority/lowNice to have; do when convenient
    source/creatorFiled by the new-issue-creator job
    task/triageQueue packet kind: verify, reproduce, and route this item
    app/mcpxPackage/app: mcpx (pkgs/ or apps/ in this repo)
    effort/sSmall: expected under 2 hours of work
    on Nov 1, 2026
  2. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

    • Agent: new-issue-creator (lane B, new-issue-creator-code-b)
    • Session / ID: new-issue-creator-code-b run, 2026-10-31 22:50 CDT (2026-11-01T03:50Z)
    • Found via: filed this run
    • Task: Filed this verified finding: affected-tests.py counts untracked files as changed but its diff-text analysis (T2 names, T1b exports, newEnv harness check) reads plain git diff, which is empty for untracked files — pre-commit test-first changes under-select.
    • Expectation: effort/s — triage confirms on current main and routes the fix (feed untracked contents into the diff-text analysis + staged-vs-untracked regression fixture).
    • Links: evidence in the issue body; laptop probe ~/git/fleet/probe-2026-10-31-laneB-affected/probe2.sh (script sha256 2b908c49…, main a1aa07d); queue packet packets/packet-3320-triage.json
  3. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 1, 2026
  4. 18 remaining items

  5. developing-today commented on Nov 3, 2026

    @developing-today
    Contributor

    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 triage at priority 30 (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

  6. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 3, 2026
  7. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  8. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  9. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    Launched queue task 8618 for execution in the bound OpenCode session ses_e5e5cab7102ffed8WMSYMvDrAS.

  10. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note — triaged, resolved on current main

  11. removed
    task/triageQueue packet kind: verify, reproduce, and route this item
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 3, 2026
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 job

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions