docs(devlog): #84 view-menu session log
CI / ci (push) Canceled after 0s

This commit is contained in:
AlexKucera committed 2026-10-08 21:31:05 +02:00
1 parent 997607b9d3
commit c25e792479
3 files changed
+53 -3

No files matched your search

@@ -0,0 +1,49 @@
# View Menu doubled (#84)
> **Date:** 2026-10-08
> **Type:** issue
> **Reference:** https://git.babylondreams.de/AlexKucera/museion/issues/84
## Goal
Kill the doubled View menu: "Toggle Reading Mode" (#68) lived in its own `CommandMenu("View")`, putting a second View menu in the menu bar beside the system one. The toggle must keep working (⌘R, `.toggleReadingMode` notification).
## What Was Done
- `Museion/MuseionApp.swift` — swapped `CommandMenu("View")` for `CommandGroup(after: .toolbar)`, so the reading toggle joins the system View menu instead of creating a duplicate. Button, shortcut, and notification post untouched.
- `MuseionTests/MuseionTests.swift` — new test `single View menu hosts the reading toggle`: hosted in the real app, inspects `NSApp.mainMenu`, asserts exactly one View-titled top-level menu and that it carries the item.
- TDD verified: test RED against the original code (two View menus — real assertion failure), GREEN with the fix. Full suite (unit + UI smoke) green; SwiftLint 0 violations on both files.
- Reviews: implement-skill review (standards: approve; spec: PASS, no findings) and finish-audit fanout (security STRIDE: 0 findings; general: 0 actionable; ponytail: 2 comment shrinks, applied — net −6 comment lines).
## Decisions & Rationale
| Decision | Rationale |
|----------|-----------|
| `CommandGroup(after: .toolbar)` over other placements | The platform way to append into the system View menu (after the Toolbar section); `CommandMenu("View")` is a *new* top-level menu by definition — that was the whole bug. |
| Discriminate on View-titled menu **count**, not contents | The system View menu's items are context-lazy (absent without a toolbar), so in the hosted test it can legitimately hold only our item. Counting View-titled menus catches the duplicate both ways. |
| Test via `NSApp.mainMenu` in the hosted suite | MuseionTests runs inside the real app process, so the live menu bar is assertable — no UI-test machinery needed for a structural claim. |
## Gotchas & Fixes
| Problem | Root Cause | Fix |
|---------|------------|-----|
| First GREEN run still failed (`items.count > 1`) | System View items are context-lazy; the merged menu held only our item in the test host. Probe (dumped menu tree to /tmp) showed one `[View]` menu — the fix itself worked, the assertion was wrong. | Assert `viewMenus.count == 1` + item present. |
| `-only-testing:MuseionTests/MuseionTests` matched 0 tests, "TEST SUCCEEDED" | Swift Testing free functions aren't class-scoped; the filter silently matched nothing — a 0-test success. | Filter at target level (`-only-testing:MuseionTests`), or grep the log for the test-case line. |
| `swiftformat .` reformatted 17 untouched files | Repo-wide format pass touches pre-existing drift in other files. | `git checkout` the collateral; lint only the two changed files. |
| Stash-RED run reported failure but no test line | The RED failure was a compile error (optional `NSApp.mainMenu` used unwrapped) — caught by reading the log, not the summary. | `try #require(NSApp.mainMenu)` in the test. |
| First review fanout dispatch failed ("670 tasks" runaway guard) | Malformed delegate_task payload from an earlier turn. | Re-dispatched cleanly; user said continue. |
## Files Changed
| File | Change Summary |
|------|---------------|
| `Museion/MuseionApp.swift` | `CommandMenu("View")` → `CommandGroup(after: .toolbar)`; comment update |
| `MuseionTests/MuseionTests.swift` | +import AppKit; new test pinning one View menu |
## Open Items & Next Steps
- None. `PRD.md` carries a pre-existing unrelated modification — left untouched on purpose.
---
*Log written by write-log skill*
+1
View File
@@ -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-10-08 | issue | [20261008-issue84-view-menu-doubled_log.md](20261008-issue84-view-menu-doubled_log.md) | #84 single View menu: CommandMenu → CommandGroup(after: .toolbar), menu-count pin test — 105 tests green |
| 2026-10-08 | issue | [20261008-issue83-save-indicator-honesty_log.md](20261008-issue83-save-indicator-honesty_log.md) | #83 honest save dot: Changed while dirty, Saving… deleted, sticky failed, vanished-disk keepLocal fix — 106 tests green |
| 2026-10-08 | issue | [20261008-issue77-editing-parity_log.md](20261008-issue77-editing-parity_log.md) | #77 editing parity: reading-mirrored presenter (30/22/19 ladder, inline traits, 66ch measure), fence-staleness audit fix — 104 tests green |
| 2026-10-06 | issue | [20261006-issue76-apex-html-reading_log.md](20261006-issue76-apex-html-reading_log.md) | #76 apex HTML reading surface: WKWebView + bundled apex, data-source-line map, TextKit reading deleted — 94 tests green, PERF-3k 20 ms |