Repository navigation
feat: expose source-list clicks and status menus - #7
Conversation
frostyard-machines
left a comment
There was a problem hiding this comment.
Review of head a6a2df5dd07d95500ceb5708905825887f1e4416 (base fa06b1d): 1 Major, 4 Minor.
M1 (Major): OpenGeneration has a branch for a MyGo API that does not exist, and the design doc describes it
sourcelist.go:217:any(&s.state.Open).(interface{ Generation() uint64 }).OutlineState.Openis aui.Selection[K]. In the pinned MyGo (f5c3a6e111a3) and on upstreammaintoday,SelectionhasHas,Len,Add,Remove,ClearandAll, and noGeneration. So this branch never runs and no test covers it.- The risk: a later MyGo bump that adds any
Generation() uint64method toSelectionsilently changes what this exported method returns. The numbers then jump to a different counter, with semantics that this kit never checked (for example, a counter that also moves on anAddof a key that is already present). An app that compares stored generations would then write its folder state again, or skip a write. docs/design/frostui.md(API changes): "it uses MyGo's membership generation when available" states something that is not true at this head.- Fix: remove the type-assertion branch and its comment, and keep only the snapshot comparison. Remove the "when available" clause from the design doc. When MyGo ships such a method, adopt it in the MyGo bump PR, with a test that the value still changes exactly when the open set changes.
m1 (Minor): the OnClick doc does not say when Enter calls it
sourcelist.go:96-98: "Enter also activates the item." Enter, Cmd+Enter and Cmd+Alt+Enter callOnClickonly whenOnActivateis nil (sourcelist.go:558). WithOnActivateset, Enter calls onlyOnActivate(I checked this with a scratch test).- A double click with
OnActivatenil callsOnClick2 times: once fromRowClickedand once fromSubmitted. That is defensible (2 clicks), but an app with a toggle handler must know it. - Fix: say both in the field comment and in the design doc's SourceList bullet. For example: "When OnActivate is nil, Enter, Cmd+Enter and Cmd+Alt+Enter also run OnClick for the chosen item, and so does the second click of a double click."
m2 (Minor): the middle click acts on the press, not the click
sourcelist.go:623-631runsOnMiddleClickonInputPointerDownwith Button 2. A press that the user drags off the row, or that the system cancels, still opens the item.- Fix: run it on
InputPointerUpwithButton == 2,!ev.Canceled, andev.X/ev.Yinside the row (as theauxclickevent works). Take theInputPointerDown(return true) so that the release comes to the row. Alternatively, keep the press and say "on press" in the doc.
m3 (Minor): tests do not cover 2 documented claims
sourcelist_test.go,TestSourceListMiddleClick: the field says "without changing selection", but the test does not assert it. Add a check thatSelectedandOnSelectdo not change after the middle click.TestSourceListOpenGenerationcovers onlySetOpen. The doc lists "the arrows, assistive technology, Select and SetOpen". Add at least a Right or Left arrow on a folder row, and a close that follows an open, and assert that the generation changes each time.
m4 (Minor): the PR body does not record the MyGo bump check or the effect on the apps
- frostui's
AGENTS.md(MyGo's rules) says: "After a MyGo bump, read its source inGOMODCACHE(the theme reset,Window.Update, the Tester) before merging." The PR body should say that this check was done. - I did the check at
f5c3a6e111a3. The theme still resets at the start of every frame (ui/context.go:131).Window.Updatehas no change. The Tester changesClickto choose the label whose input target takes the click, and addsbuildNext, and the kit's tests pass with both changes. - The pin is 147 commits after v0.8.3. The set of shared libraries that the kit's MyGo packages load (
libgtk-3,libepoxy, Pango and the rest) is the same as at v0.8.3, so the images need no change. - Effect on the apps: each app that takes this frostui release moves to at least MyGo
f5c3a6e. An app on v0.8.3 gets all 147 commits. Frostnotes' forkreplace(9e0be8b) containsf5c3a6e. Fix: add 1 or 2 lines about this to the PR body.
Checked and fine
api.txt: 4 additive lines (OnClick,OnMiddleClick,StatusItem.Menu,OpenGeneration), and no existing line changes.feat:is correct, and svu gives v0.3.0.- The risk-tier section names
go.mod,go.sumandapi.txt(L2) and says why the change is safe. StatusItem.Menutakes precedence overOnClick, as its comment says. The new test opens the menu withtt.Click.OnClickusesRowClicked, so the row keeps its accessible label forTester.Clickand screen readers.- GitHub CI: the 7
cross-buildjobs are green, andverifyis still running at the time of this review. My localmake ciwith go1.27.4 is also still running.
The cross-review comes after M1 is fixed.
frostyard-machines
left a comment
There was a problem hiding this comment.
Re-review at head 50171fcd0901f1b09c458a37df4dc0134555ea76: M1 and m1–m4 are closed, and I have no new findings.
- M1: the type-assertion branch is removed (
sourcelist.go:217), and the design doc no longer makes the claim. The guard is the new rule inAGENTS.md("Dependency API adoption") plus 1 line in.memory/corrections.jsonlwithpromoted_to: AGENTS.md. A rule is the right guard here, because no test can catch a method that does not exist yet. - m1: the field comment and the design doc now say when Enter, Cmd+Enter, Cmd+Alt+Enter and the second click of a double click call
OnClick.TestSourceListEnterPrefersOnActivateandTestSourceListDoubleClickCallsOnClickTwicepin this behavior. - m2: the middle click now acts on a release that is not canceled and is inside the row. The row takes the press and so gets the release.
ev.X/ev.Yare local to the row, and the check uses only the row's size, so the coordinate spaces agree. - m3: the middle-click test now has 3 cases (inside, outside, canceled) and asserts that the selection and
OnSelectdo not change. TheOpenGenerationtests now cover open, close, an open or close that changes nothing, a member replaced by another with the same count, and the Right and Left arrows. - m4: the PR body records the MyGo source check and the effect on the apps.
Checks:
- Local
GOTOOLCHAIN=local make ci BASE=origin/mainwith go1.27.4 passes at this head. - Revert test: with
sourcelist.gofroma6a2df5,TestSourceListMiddleClickfails, and with this head it passes. - GitHub CI is green:
verifyand the 7cross-buildjobs.
The next step is the independent cross-review.
|
#8 merged MyGo v0.9.0 into |
frostyard-machines
left a comment
There was a problem hiding this comment.
Cross-review at head 50171fcd0901f1b09c458a37df4dc0134555ea76 (base fa06b1d). Reviewer: openai/gpt-6.1-sol. Result: Not ready, 1 Blocking finding. I confirmed it in MyGo's source at the pinned commit and at v0.9.0.
B2 (Blocking): the middle-click handler leaks a handle registration each time a row mounts again
sourcelist.go:623-624:ui.Local(content, "middle-click", func() ui.Handle { return ui.Handle{} })and thencontent.Bind(handle).ui.Localbelongs to the element. When the outline stops building a row (it scrolls out of view, or its section or parent closes), MyGo drops that row's local state. When the row comes back,ui.Localmakes a newHandle.Bindmakes a newrefStatefor each new handle and appends it tort.refs(ui/ref.go:53). In both the pin and v0.9.0, nothing removes entries fromrt.refsuntil the window closes (ui/runtime.go:1389-1394).applyFocusRequestsgoes through all ofrt.refson every build pass (ui/ref.go:182).- Effect: with
OnMiddleClickset (Frostnotes sets it), each scroll or section toggle adds 1 retained registration per row that comes back. Memory and the work per frame grow without a limit for the life of the window, even with no middle click at all. - This also goes against the kit's rule (
AGENTS.md, MyGo's rules) that state lives in structs, not in a view function.
Fix: do not create a Handle in a view, and do not create one for each mount. 2 options:
- Remove the handle. On
InputPointerDownwith Button 2, store the row's key inSourceList(for examples.middle,s.middleSet). OnInputPointerUp, check!ev.Canceled, check that the key is the same, and check thatev.X,ev.Ylie inside the row's box. The row height is fixed at 28, and the width can come from a size that the row already knows. Clear the key on every release. - Keep 1 handle for each item in a map on
SourceList(for examplemap[sourceKey[K]]*ui.Handle), and remove the entries for items that go, asseendoes. The same*Handlebinds again without a newrefState, becauseHandle.bindingreuses the binding for the window. So the registrations stay bounded by the number of items.
Guard (Blocker to guard): a test cannot see rt.refs. So add a repository check in internal/repocheck that fails when a kit source file calls ui.Local to make a ui.Handle (or Binds a handle that a view makes). Alternatively, add an AGENTS.md rule under MyGo's rules: "Never create a ui.Handle in a view or with ui.Local: each one stays registered until the window closes. Keep handles in structs." Also add a test that scrolls a long list far down and back, or closes and opens a section, several times with OnMiddleClick set, and then checks that a middle click still works. Append 1 line to .memory/corrections.jsonl.
Checked and fine (cross-review)
api.txt: additive only.StatusItem.Menuuses MyGo's menu-button role and its keyboard behavior.- The interaction of
s.clicked,Submitted,RowClickedand the shortcuts showed no other defect.
Revert test: not run, because the review is Not ready. Note: #8 is merged, so the rebase also changes go.mod (see my earlier comment). I re-review the new head, and the cross-review runs again there.
50171fc to
8905ddd
Compare
|
Closing note: this PR merged as |
Summary
Add explicit primary and middle-click callbacks to SourceList, preserving arrow-key selection as a separate action. Expose an expanded-item generation so clients can persist folder state only after changes. StatusItem can now open a popup menu.
These support frostyard/frostnotes#152, #153, #169 and #171. Uses MyGo v0.9.0 from current main, including its RowClicked API; no fork or additional dependency bump is required.
Risk tier
Risk tier: 3 — matched L2 path
internal/repocheck/testdata/api.txt. The API snapshot contains four additive declarations; no existing public signatures change.Verification
mise exec -- make ci BASE=origin/mainpassed: tidy, vet, formatting, four-platform lint, repository checks, full headless tests, WebAssembly tests, race detector, and all seven build/vet targets. Tests cover pointer activation versus arrow selection, middle click, stable expanded-item generation, and status popup choices.Review fixes
Addressed M1 and m1–m4 from the review: removed the speculative Selection.Generation probe; documented Enter/OnActivate precedence and double clicks; made middle clicks commit only on a non-canceled release inside the row; and added selection, keyboard expansion, close/reopen, idempotence and equal-size membership tests. Pointer input uses a persistent Handle and local coordinates. Added the required dependency-adoption guard to AGENTS.md and appended the correction record.
Rebased onto main at 30fd87e, retaining its released MyGo v0.9.0 instead of the old pseudo-version. Rechecked that release in GOMODCACHE: frame theme reset, Window.Update main-thread dispatch/invalidation, and Tester.Click input-target selection retain the behavior this kit needs. The PR no longer changes go.mod or go.sum relative to main.
mise exec -- make ci BASE=origin/mainpasses after these fixes, including wasm, race, four-platform lint and all seven build/vet targets. Reverting sourcelist.go to the previous head makes the new release/cancel regressions fail; restoring the fix passes the gate.