You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4c1e0ed
Browse filesBrowse the repository at this point in the historyBrowse files
Kimi audit P1.4 refactor: src/nl_sql/agent/nodes/_support.py 483 lines split
into three focused modules without changing public API or behavior:
- _support.py (184 lines) — public surface only: parse_generate_sql_output,
render_m_schema, render_schema_block, render_fewshot_block. Imports
internal helpers from the two siblings below.
- _text_utils.py (53 lines, new) — JSON-fence stripping, safe-loads,
NaN-safe float coerce, best-effort SELECT extraction. Used only by
parse_generate_sql_output.
- _hints.py (302 lines, new) — schema-block appendices: M-Schema regexes
(_M_COL_RE, _M_FK_RE), join-hints, 10 P3.F schema-link if-blocks
(one per landed BIRD-quirk rescue), extended-samples appendix.
All 7 external import sites preserved (generate_sql.py, repair_once.py,
plan_query.py, eval/runner.py, scripts/wider_sc_poc.py,
tests/test_agent_support.py, tests/agent/nodes/test_schema_link_hints.py).
No circular imports — _support → _hints/_text_utils, nothing flows back.
355 pytest pass unchanged; ruff check + format clean; mypy strict 0 issues.
Codex P2 backlog reachability audit (housekeeping, no code change):
triggered by a mis-attempt at P2 #9 (cache key omits json_mode) which
turned out to be a false-positive — groq.py:44 force-sets json_mode=True
on every Groq call via req.model_copy, Mistral codestral ignores the
field, so per (provider, model) the value is constant and collision is
impossible to trigger. Diff reverted after independent Codex + Kimi
review. Then verified remaining P2 items have 0 production impact on the
current state:
- #7 (rescore_arcwise transition buckets stale): 0/200 stale-vs-fresh
disagreements in eval/reports/2026-05-24/v29-arcwise-rescored.json.
- #8 (_hashable float bucketing): 0 set-mismatch records in v22-v30
baselines (200 each); 8 in demo runs 2026-05-11, all honest
column-count diff, not float-bucket.
- #9 closed false-positive.
- #10 (cache miss/fill race): latent, current eval pipeline serial per
qid; fires only with parallel workers (not currently used).
Per-item findings recorded in docs/NEXT_SESSION.md Open Audit Items
table. Lesson: before touching audit findings, grep call-sites +
reachability-check eval reports first.
docs/SESSION_HANDOFF.md additionally received stale `_support.py::*`
reference cleanups (now pointing at `_hints.py::*` after the split).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Triggered by mis-attempt at "small safe item" Codex P2 #9 (json_mode cache key) — landed fix + regression test, then independent Codex + Kimi review verdict = busywork (collision impossible per `groq.py:44` force-set). Diff reverted, HEAD `3c82e37` unchanged.
9
+
10
+
Verified remaining P2 items have **0 production impact** on current state:
11
+
-#7 (rescore_arcwise transition buckets): `0/200` stale-vs-fresh disagreements в `v29-arcwise-rescored.json`. Transitions output unchanged if fixed.
12
+
-#8 (`_hashable` float bucketing): `0` set-mismatch records в v22-v30 baselines (8 в demo runs 2026-05-11, all honest column-diff, not float-bucket).
13
+
-#9 (json_mode cache key): false positive, closed (see counterfactual в backlog table).
14
+
-#10 (cache miss/fill race): latent — текущий eval pipeline serial per qid; fires only при parallel workers (not currently used).
15
+
16
+
**Lesson:** before touching any backlog item, grep call-sites + reachability-check eval reports first. Codex audits may flag patterns без verifying they fire in actual runtime paths. Memory `feedback_no_shipping_blind_ci` extends to "verify P2 audit findings reachable before fixing".
1.**Verify uniqueness** in n=200: `python -c "import json; r=json.load(open('eval/reports/2026-05-24/v29-v28-plus-p3f-q1275-merged.json',encoding='utf-8')); print([(x['question_id'], x['db_id']) for x in r['records'] if 'YOUR_PHRASE' in x['question'].lower()])"`. Phrase должна возвращать ТОЛЬКО target qid.
100
-
2.**Add hint** в `src/nl_sql/agent/nodes/_support.py::_render_schema_link_hints_appendix`. Триггер = db_id + phrase(s) + table set. По шаблону существующих 8 if-блоков.
112
+
2.**Add hint** в `src/nl_sql/agent/nodes/_hints.py::_render_schema_link_hints_appendix`. Триггер = db_id + phrase(s) + table set. По шаблону существующих 8 if-блоков.
101
113
3.**Add target** в `scripts/p3f_acceptance.py::TARGETS` — required_columns + forbidden_columns (опционально).
102
114
4.**Probe**`uv run python scripts/eval_baseline.py --config C --only-qids <NEW>,1275,408,894,1251,1531,902,1404,207 --report-suffix p3f-<new>-v1`. Все 8 prior targets должны PASS + новый match=True.
103
115
5.**Merge** — inline Python (см. commit `99bae66` или `v28`/`v29` для шаблона; примерно 30 строк). Load baseline, swap pred_sql + match=True для new qid'ов, recompute summary + per_difficulty, write `v<N+1>-v<N>-plus-p3f-q<X>-merged.json`.
@@ -114,7 +126,7 @@ voted_by tag и delta, inline Python даёт control + audit trail. Не вын
| Kimi P1.6 | P1 | API coverage 58% → DI для `_make_singletons` + mock provider в API tests | 1.5h |
167
-
| Codex #7| P2 |`scripts/rescore_arcwise.py:82` transition buckets используют stale `rec["match"]` вместо recomputed match | 30min |
168
-
| Codex #8| P2 |`execution_accuracy.py:206` unordered float comparison через hash-bucket — два tolerant-equivalent rows могут попасть в разные buckets, set-mode EA false-negative| 1h (replace hash-bucket с tolerance-aware row matching)|
169
-
| Codex #9|P2 |`cache.py:77` cache key omits `GenerateRequest.json_mode` — JSON-mode call может replay non-JSON cached response | 30min (bump cache version key + include json_mode + other provider-affecting params)|
170
-
| Codex #10| P2 |`cache.py:88` cache miss/fill не locked — parallel eval workers могут race, duplicate paid calls, last-writer-wins| 1h (per-key diskcache lock или atomic memoization)|
179
+
| Codex #7| P2 latent |`scripts/rescore_arcwise.py:82` transition buckets используют stale `rec["match"]` вместо recomputed `out_entry["original_match"]` (line 141 overwrite). **Reachability verified 2026-05-26: 0/200 stale-vs-fresh disagreements в `eval/reports/2026-05-24/v29-arcwise-rescored.json`** — bug latent, transitions counts (7 gained / 91 lost) honest. Fix = 1-line swap, no observable change в output. | 30min, deferred|
180
+
| Codex #8| P2 latent |`execution_accuracy.py:209-221``_hashable` bucketing через `round(v / 1e-6)` может развести два tolerance-equivalent rows (diff ~9e-7, banker's rounding edge) в разные buckets → set-mode falsenegative. **Reachability verified 2026-05-26: 0 set-mismatch records в v22-v30 baselines (200 records each); 8 set-mismatch в demo runs 2026-05-11, все honest column-count diff не float-bucket.** Fix = replace `_hashable` с pair-wise tolerance match (O(n²)). | 1h, deferred|
181
+
|~~Codex #9~~|**false positive 2026-05-26**|`cache.py:77` cache key omits `req.json_mode`. **Не достижимо в текущем коде:**`src/nl_sql/llm/providers/groq.py:44` force-set'ит `json_mode=True` через `req.model_copy` на каждом Groq call; Mistral codestral игнорирует поле (`base.py:21` docstring). Per (provider, model) пара `json_mode` имеет константное значение → collision impossible. Не трогать (попытка fix landed 2026-05-26, reverted после Codex+Kimi independent review). | closed|
182
+
| Codex #10| P2 latent |`cache.py:88` cache miss/fill race без lock — parallel eval workers могут race, duplicate paid calls, last-writer-wins. **Reachability: текущий eval pipeline serial per qid (см. `runner.py::_run_one`). Latent до момента запуска parallel workers.** Fix = per-key diskcache lock или atomic memoization (`Cache.add` semantic). | 1h, deferred|
171
183
172
184
2.**HF Spaces redeploy** — на EOD-3 был synced на 92.5%, ничего не сдвинулось. Если юзер захочет регрес-проверить — `D:/NL_SQL/.deploy_hf.py` (gitignored, локальный).
0 commit comments