T0: launch: type-safe PhaseEnd sort key via natural_key (Phase3_5 crash); upstream report filed

This commit is contained in:
Drew T
2026-09-29 19:30:09 -06:00
parent 1be63ffb6a
commit 303c045edf
4 changed files with 23 additions and 5 deletions
+14
View File
@@ -0,0 +1,14 @@
# D1 — - (2026-09-29, session router)
Status: executed
## Decisions
- (one line each)
## Plan edits
- (plan_edit.py commands; executed: yes/no)
## Open
- (unresolved items)
## Deferred
- deferred: <what> → <phase>
+1
View File
@@ -1 +1,2 @@
<!-- Discussion records for one phase. One line per record, written by tools/discussion.py off --new-record: D<n> | <topic> | <date> | discussions/D<n>.md -->
D1 | - | 2026-09-29 | executed | phase-ends/current/discussions/D1.md
+5
View File
@@ -0,0 +1,5 @@
# T0.c1 — launch.py PhaseEnd sort key
- Change: tools/launch.py `_audit_flag_line`: local `_sort_key` (int/str mixed list → TypeError on id `3_5`) replaced by `phaseend_index.natural_key(item[1])` (tuple-typed parts, splits on `._-`).
- Verified: `python3 tools/launch.py --seed-only` → exit 0, `mode=router`, 0 `refused:` lines (.run/logs/launch_seed.log).
- Verified: scratch sort over phase-ends/ (39 PhaseEnds) → newest `PhaseEnd_Phase37.5.md` (id 37.5).
- Note: launch.py now diverges from upstream PA3; expect an upgrade conflict until upstream fixes it. No PhaseEnd renamed.
+3 -5
View File
@@ -347,11 +347,9 @@ def _audit_flag_line(root):
pe_files.append((os.path.join(sub, name), m.group(1)))
if not pe_files:
return None
# natural sort: split phase id into numeric parts
def _sort_key(item):
parts = re.split(r"[.\-]", item[1])
return [int(p) if p.isdigit() else p for p in parts]
pe_files.sort(key=_sort_key)
# natural sort by phase id (type-safe: ids like 3_5 mix digits and words)
from phaseend_index import natural_key
pe_files.sort(key=lambda item: natural_key(item[1]))
newest_rel, newest_phase = pe_files[-1]
newest_path = os.path.join(pe_dir, newest_rel)
# count '- flag:' lines under '## Audit'