test(session): finish-audit closeout for #184
CI / ci (push) Canceled after 0s
CI / ci (pull_request) Canceled after 0s
CI / ci (push) Canceled after 0s
CI / ci (pull_request) Canceled after 0s
Three-reviewer fanout over PR #184's deferred nil-scope fix: - pin the titled drain's APPLY half (unpinned suite-wide) over a new hangOnPromptLoad rig mode (prompt parks, load answers); flip-verified against a nil-only drain guard - cut the dead Equatable on PendingScope (converged finding) - name the same-turn pendingRestart ceiling on the drain: respawn's .starting window drops the consumed scope; consume-at-apply is the upgrade path (follow-up ticket) - changelog + devlog for the PR; AGENTS.md rails refreshed Suite 654 executed / 0 failed; swiftformat clean; swiftlint unchanged (both warnings pre-exist on main).
This commit is contained in:
1 parent
836da5833d
commit
3193714a61
8 files changed
+127
-12
No files matched your search
@@ -0,0 +1,56 @@
|
||||
# PR #184 finish-audit — deferred nil scope drains as an explicit clear
|
||||
|
||||
> **Date:** 2026-11-10
|
||||
> **Type:** issue
|
||||
> **Reference:** PR #184 `fix/deferred-empty-piece-scope-lost` (finding class #176)
|
||||
|
||||
## Goal
|
||||
|
||||
Run the finish-audit reviewer fanout (ponytail / security / general) over PR #184 — `fix(session): drain a deferred nil scope as an explicit clear`, 2 commits ahead of `origin/main` touching `Museion/MentorSessionModel.swift` and `MuseionTests/SessionScopeTests.swift` — then fix what the reviewers flagged.
|
||||
|
||||
## What Was Done
|
||||
|
||||
- Resolved the audit scope mechanically: branch `fix/deferred-empty-piece-scope-lost`, commits 836da58 (fix) + 8531d79 (pin), clean tree, no untracked files. Baseline gates before dispatch: `build-for-testing` green, full unit suite 653/653 (xcresult executed count), swiftformat clean, swiftlint warnings at `MentorSessionModel.swift:158/:192` verified pre-existing on main.
|
||||
- Dispatched the three reviewers in one parallel batch with resolved facts + exclusion list (enum shape settled, pendingRestart sibling pattern, poll-loop conventions, pre-existing lint warnings).
|
||||
- Applied audit fixes on the PR branch (working tree, uncommitted):
|
||||
- Cut the dead `: Equatable` conformance from `PendingScope` (converged finding — ponytail + general independently; only `guard case let` reads, no `==` anywhere).
|
||||
- Ceiling comment on `firePendingScopeIfRequested` naming the restart race and its consume-at-apply upgrade path (see Decisions).
|
||||
- New pin `deferred titled scope during a stream applies at turn end` — the drain's APPLY half for a NON-nil target was unpinned suite-wide (the replay-deferral pin never releases its hold; the nil pins activate nothing).
|
||||
- New rig mode `hangOnPromptLoad` in `ScriptedEngine` (prompt parks + `session/load` answers) — required by the pin: titled apply rides `resumeSession`, and no existing mode parked a prompt while answering a load.
|
||||
- Flip-verified the new pin: weakened the drain guard to `title == nil` → exactly the titled pin failed (5.4 s poll timeout), both nil pins passed; restored, re-ran green.
|
||||
- Final gate after all fixes: swiftformat clean, lint exit 0 (same two pre-existing warnings), full unit suite **654 executed / 0 failed**.
|
||||
|
||||
## Decisions & Rationale
|
||||
|
||||
| Decision | Rationale |
|
||||
|----------|-----------|
|
||||
| Restart race DEFERRED with a ceiling comment, not fixed in-audit | General reviewer's MEDIUM verified real: a same-turn `pendingRestart` + `pendingScope` makes both turn-end defers spawn sibling Tasks; `respawn()` sets `phase = .starting` before its `await startChat()` suspension, the scope Task then no-ops on the `isReady` guard with the pending already consumed → scope lost, respawn's rail re-activates the old entry. But the reviewer's sketched remediation (re-fire at respawn completion) is provably a no-op — `pendingScope = .none` runs before the drop. A correct fix needs consume-at-apply semantics, which changes the documented "not-ready direct call is a no-op" contract (a not-ready call would arm a stale pending that fires at the next drain). Design change with its own hazard → follow-up ticket, not an audit patch. |
|
||||
| Rig extension (`hangOnPromptLoad`) over test contortion | The alternative was a two-hold release dance in `loadReplayHold` (release, wait, release again) — brittle and unreadable. One mode string, three one-line branch widenings, existing modes byte-identical (`hasPrefix` keeps `hangOnPrompt` semantics unchanged). |
|
||||
| Security INFO-1/INFO-2: no action | Both display-only, both pre-existing shapes (owner ruling 2026-11-07 semantics; replay-slot design #137/#178). The PR strictly improves both (the nil clear was lost permanently pre-fix). |
|
||||
| Reviewer call-site count corrected | 4 drain call sites (:538, :573, :827, :978) + the definition — the dispatch's "five" phrasing miscounted; the general reviewer's grep is right. |
|
||||
|
||||
## Gotchas & Fixes
|
||||
|
||||
| Problem | Root Cause | Fix |
|
||||
|---------|------------|-----|
|
||||
| New titled pin failed its first green run ("Expectation failed: applied", 5.4 s) | The rig's `load` parks `session/load` forever in every mode except `loadReplay*` ("the zsh never answers") — the drain's `resumeSession(B)` never returned within the poll. Diagnosed by pulling `failureText` from the xcresult, not re-running. | Added the `hangOnPromptLoad` rig mode. |
|
||||
| Reviewer's proposed remediation didn't survive scrutiny | The re-fire sketch ignores that `pendingScope = .none` (:1117) precedes the Task creation (:1118) — consumption happens before the not-ready drop. | Timeline analysis in the parent; deferred the real fix rather than landing a plausible-looking no-op. |
|
||||
|
||||
## Files Changed
|
||||
|
||||
| File | Change Summary |
|
||||
|------|---------------|
|
||||
| `Museion/MentorSessionModel.swift` | Cut dead `Equatable` on `PendingScope`; ceiling comment on `firePendingScopeIfRequested` (restart race, consume-at-apply upgrade path) |
|
||||
| `MuseionTests/ScriptedEngine.swift` | New `hangOnPromptLoad` mode — prompt parks (cancel releases), load answers with the replay shape |
|
||||
| `MuseionTests/SessionScopeTests.swift` | New pin: deferred titled scope applies at turn end |
|
||||
| `MuseionTests/AGENTS.md` | Mode-string list gains `hangOnPromptLoad` |
|
||||
|
||||
## Open Items & Next Steps
|
||||
|
||||
- [ ] Follow-up ticket: same-turn `pendingRestart` + `pendingScope` loses the scope at the restart window (titled and nil alike; consume-at-apply is the upgrade path). Ceiling comment already in code.
|
||||
- [ ] Titled-defer APPLY behind the REPLAY drain (:538) is still unpinned (stream drain :827 now is).
|
||||
- [ ] Working-tree fixes are uncommitted — PR #184 needs the audit diff committed and pushed (owner authorization required).
|
||||
|
||||
---
|
||||
|
||||
*Log written by write-log skill*
|
||||
@@ -5,6 +5,7 @@ Complete history of session logs in this directory, newest first. One-line summa
|
||||
<!-- write-log: full-index -->
|
||||
| Date | Type | File | Summary |
|
||||
|------|------|------|---------|
|
||||
| 2026-11-10 | issue | [20261110-pr184-deferred-empty-piece-scope-lost-audit_log.md](20261110-pr184-deferred-empty-piece-scope-lost-audit_log.md) | PR #184 finish-audit: dead Equatable cut, restart-race ceiling named, titled-apply pin + hangOnPromptLoad rig mode |
|
||||
| 2026-11-09 | issue | [20261109-issue178-extract-engine-host-transport-seam_log.md](20261109-issue178-extract-engine-host-transport-seam_log.md) | Engine lifecycle → EngineHost behind the EngineTransport seam; scripted in-process tests, one real smoke per surface |
|
||||
| 2026-11-09 | issue | [20261109-issue177-type-transcript-rail-shared-tool-payload-decoder_log.md](20261109-issue177-type-transcript-rail-shared-tool-payload-decoder_log.md) | SessionRow text rows typed (speaker+notice), kick-off sniffed at append seam, one ToolPayloads decoder both rails read |
|
||||
| 2026-11-09 | issue | [20261109-issue183-shrink-agentsmd_log.md](20261109-issue183-shrink-agentsmd_log.md) | AGENTS.md rails shrunk 206 KB → 36 KB — contracts and rulings kept, per-issue diaries cut; serif payload untouched (#183) |
|
||||
|
||||
Reference in new issue
Block a user