feat(harness): value grounding -- multi-column LSH + value_grounded (D14a)

Ports search/__init__.py (combined_search/RRF/aggregate) renamed psdwp3->nsp.

New aggregate_lsh_multi (the D14a deviation): groups LSH hits by table keeping
EVERY column where a value appears -- NOT collapsed to a single best column.
The old _aggregate_lsh hid alternative groundings (e.g. 'ablazione' matching both
a boolean flag and a free-text patologia field). aggregate_lsh_multi exposes all
columns so the value-grounding widget lets the reviewer choose the anchor(s).
Within one (table, column) the best-scored value is kept; columns ordered by score.

value_grounded added to DecisionType (records the reviewer's anchor choice).

L1: test_value_grounding (6 tests) -- multi-column exposure, grouping, within-column
best-value, ordering, empty, and the value_grounded decision-type existence.

Deferred: lshindex/ (needs vendor/thoth_lsh) and the L0 test_rrf.py land with the
nsp lsh build command + index-building path; not needed for the pure L1 core here.
This commit is contained in:
2026-06-26 23:02:11 +02:00
parent 9fa1e3e498
commit c0285e55a0
3 changed files with 205 additions and 0 deletions
+4
View File
@@ -35,6 +35,10 @@ DecisionType = Literal[
# D15: marker di ritrazione. subject = "phase:N", retracts = decision_seq ritirata.
# Resta nel log di audit (append-only); effective_decisions() la esclude dalla vista.
"decision_retracted",
# D14a: valore citato nella domanda ancorato a una o piu' colonne. subject =
# "phase:4", detail = il valore (es. "ablazione"), rationale = la/e colonna/e scelta/e
# dal reviewer (aggregate_lsh_multi le espone tutte senza collassare al miglior match).
"value_grounded",
]