005b T1: `affected_probes`: map a diff to a probe set nf-lbh.1 ← Beads

open priority 2 task unassigned

From 005b-golden.md's task table (design 005b). - Covers: 005 S4

Goal: a pure function (plus thin CLI) that, given a set of changed file paths, returns the probe names the change can affect.

Context. 34 probe JSONs live in tools/probes/*.json; each declares "scene": "res://games/<g>/<g>.tscn". tools/nflib/godot_build.py already has godot_inert(path) ("can the Godot build see this file?"), used by probe_gate.py's current all-or-nothing skip.

Build:

- Logic in tools/nflib/probe_select.py; CLI tools/pr/affected_probes.py that takes either --paths a b c or two shas (diff via nflib.git) and prints affected probe names, one per line, nothing else (C3/C4). A --verbose flag names the matched rule per probe (C5). - Rules, first match per path, union across paths: 1. tools/probes/<name>.json changed → that probe. 2. A harness input changed → all probes. Harness inputs are an explicit tuple: shared/VisualProbe.cs, shared/PlaytestJournal.cs, probe.py, probe_all.py, tools/pr/probe_gate.py, and the tools/nflib/ modules those three scripts import (godot.py, godot_build.py, godot_import.py, proc.py, …). Guard the tuple with a premise test that regex-scans the three scripts' import lines and fails when a new import is missing from the tuple — the SlnPremiseTest pattern in probe_gate.py. 3. godot_inert(path) and not caught above → no probes. (This is where a tools/nflib/devcli.py docstring now lands — the #847 case.) 4. Path under games/<g>/ → probes whose scene path starts res://games/<g>/. Attribute by the scene file's directory, never by a "game" concept — that is 005's S4, and it is what scales when a game grows more scenes. 5. Anything else Godot-visible (shared/, root .cs, project.godot, export_presets.cfg, …) → all probes. Fail-closed; T5 shrinks this to the smoke set later.

Tests: tools/tests/test_probe_select.py — table-driven paths→sets over all five rules, plus the harness premise test. In the PR body, show the output for the last ~40 merges on main (E5): expected shape is "most merges → 0 probes, game merges → that game's probes".

PR shape: one PR — logic, CLI and tests are one cognitive level, and nothing depends on it yet.

Done when: the five rules are unit-tested, the premise test guards the harness tuple, and the spot-check over recent merges is in the PR body.

Dependencies

Comments

No comments.

Add a comment