Repository navigation
feat(notifications): a click on a Juno banner goes where the banner says (LAC-8588) - #1042
Conversation
|
Review of #1042: a click on a Juno banner now goes where the banner says. I read the diff and confirmed the helpers it calls exist ( What works well
Suggestions (none blocking)
No bugs found that I would block on. Nice, tightly scoped change. |
…d (LAC-8588) Review of #1042 found `ClickAction` reachable from the `send_notification` payload: it derived `Deserialize` and rode on `NotificationData`, so a webview could name a destination. Every variant is a fixed target compiled into the app, so nothing was exploitable today, but it is the wrong side of Juno's boundary and the first variant carrying a path or a URL would make it a real surface. The derives are gone and the field is `#[serde(skip)]`. A Rust caller sets it; a payload asking for one reads as the default, which is also what the frontend has always sent. A test pins both halves. Also from the review: - a test asserts the separator cannot appear in the unique part of an identifier, which is the claim the unambiguous split rests on - the round trip now includes a session id containing the separator, since `AgentSessionId` is a `From<String>` newtype and UUID shape is convention - the delegate's unset-handle arm says why it is unreachable (`install` sets the handle before the delegate, and the object takes no message until it is the delegate), so it is not later "fixed" with a replay latch no click can reach
|
Thanks. Two taken, three declined with reasons. Fixes are in 1. Frontend-supplied actions. Taken, and further than suggested. You are 2. Identifier charset. Taken as a test, not an assertion. The invariant the 3. Emit an event so the UI selects that conversation. Declined: that event 4. Cold-launch clicks. Declined: that arm is unreachable, including for a Worth noting the related path that is real and is handled: with no delegate 5. Dead-code attributes. Declined, with the tradeoff stated. The file |
|
Review of #1042: click-to-action for Juno notifications. Verdict: the design is sound and I found no blocking issues. What works well
Minor suggestions (non-blocking)
I only read the diff. I have not run or built anything. 🤖 Generated with Claude Code |
|
Review of #1042 (click on a Juno banner goes where it says) Overall: a well-shaped fix. Putting the action on the request identifier after a What I like
Suggestions (non-blocking)
No security concerns: the identifier is only parsed, never executed, and unknown input degrades to bringing Juno forward. No new I would merge once CI (fmt, clippy, tests) is green. A manual click test on a built app for the three paths would still be worth doing, since the delegate method only runs on macOS. |
|
#1041 is merged (17:23:01Z, squash All 12 checks passed on its final head before merge, including both macOS Rust jobs. Three claude-review passes were answered in full; the one substantive fix was a latent bug worth knowing about if you are touching Rebase on Two things from my side that are relevant to your review:
|
…ays (LAC-8588) The presenter delegate implemented one method, `willPresentNotification`, which is what makes a banner appear while Juno is frontmost. With no `didReceiveNotificationResponse` macOS had nowhere to deliver a click, so every notification Juno posts was a dead end: a finished timer, a new automation, the scheduler, a finished turn, and LAC-8231's "Juno has no voice to speak with", whose whole body is an instruction to open a System Settings pane. One table, not a callback per caller. A click hands the delegate the identifier of the notification and nothing else, so the action rides on the identifier after a `#`, and `action_from_identifier` is the single place that reads it back. It is total: no separator, an unknown slug, an empty session id, or a string Juno never posted all read as "bring Juno forward". No click is answered with silence, and none can panic. Wired: - the no-voice notice opens Accessibility > Read & Speak, through the same `READ_AND_SPEAK_URLS` the Voice picker's own link uses - a background session that finished, failed, or is waiting on input brings its conversation forward and focuses that session in the registry `notify(app, title, body)` and `deliver` keep their signatures, so the six callers with nowhere to go are untouched; `notify_action` and `deliver_action` are the siblings that carry one. Only the default action is routed. A dismissal closes the handler and does nothing else, so the day a category asks for dismiss responses one does not open System Settings.
…d (LAC-8588) Review of #1042 found `ClickAction` reachable from the `send_notification` payload: it derived `Deserialize` and rode on `NotificationData`, so a webview could name a destination. Every variant is a fixed target compiled into the app, so nothing was exploitable today, but it is the wrong side of Juno's boundary and the first variant carrying a path or a URL would make it a real surface. The derives are gone and the field is `#[serde(skip)]`. A Rust caller sets it; a payload asking for one reads as the default, which is also what the frontend has always sent. A test pins both halves. Also from the review: - a test asserts the separator cannot appear in the unique part of an identifier, which is the claim the unambiguous split rests on - the round trip now includes a session id containing the separator, since `AgentSessionId` is a `From<String>` newtype and UUID shape is convention - the delegate's unset-handle arm says why it is unreachable (`install` sets the handle before the delegate, and the object takes no message until it is the delegate), so it is not later "fixed" with a replay latch no click can reach
…t the slug (LAC-8588) The comment claimed neither half of an identifier could contain the separator. The unique part cannot, by construction, and a test now says so. A session id can: `AgentSessionId` is a `From<String>` newtype, so UUID shape is convention. The parse was already right either way, because the first separator ends the unique part and every later one belongs to the slug, and a round-trip case covers it. Only the comment was wrong.
eba31be to
9da447b
Compare
|
Review: notification click routing (LAC-8588) Overall this is a clean, well-reasoned change. I did not run anything locally (CI owns Rust builds), so this is a read-through of the diff. What works well
Minor points and suggestions
No blocking issues found. Nice work. |
CI's test step failed on one of this PR's own tests:
assertion `left == right` failed: '#read-and-speak' should bring Juno forward
The test was wrong and the code was right, but the doc comment was wrong too,
which is why the test got written that way. `action_from_identifier` reads
only the slug after the separator; the comment claimed that "a string Juno
never posted" brings Juno forward, and `#read-and-speak` is such a string
while plainly naming a known action.
Keeping the behaviour, because validating the unique part would buy nothing
and cost something:
- there is no channel for a forged identifier. Only Juno's own bundle can have
a response delivered to Juno's delegate, so everything arriving here was
written by some build of Juno
- tying routing to `request_identifier`'s format would mean a later change to
that format silently stopped routing the notifications already sitting in
Notification Center. The unique part is macOS's dedup key and nothing else
So the comment now states the real rule, `#read-and-speak` moves out of the
unknown-action list (it is a known action with a degenerate prefix), and a new
test pins invariance across the prefix: the same slug behind what Juno posts,
behind nothing, and behind a prefix Juno would never write.
fmt and clippy were clean, and 2237 of 2238 tests passed, so this was the only
disagreement in the change.
Review: click routing for Juno notifications (LAC-8588)Overall this is a well-built change. I have no blocking findings. I read the diff and checked that the callees exist with the signatures used ( What I like
Suggestions (non-blocking)
The Cargo feature addition ( |
|
CI's first real verdict on this PR (the earlier red was a starved macOS runner, see the body): fmt clean, clippy clean, 2237 of 2238 tests passed. The one failure was one of this PR's own tests, and it was pointing at something real.
The reason the test said otherwise is the actual defect: the function's doc comment promised that "a string Juno never posted" reads as I kept the behaviour and fixed the documentation, because validating the unique part buys nothing and costs something:
|
Two review passes independently asked whether `open_main_window`, which runs after `focus_agent_session` in the `ShowSession` arm, could reset the session that was just focused. Neither could tell from the diff. Checked instead of assumed: - `AgentSessionRegistry::set_focused` has exactly one caller in the app, `focus_agent_session`. Nothing on `open_main_window`'s path (`show_bar`, `emit_ladder`, `create_or_show_window`, `announce_main_window`) writes focus - every frontend `focusSession` call is an `onFocus` prop on a session row, so it fires on a click and never on mount. Showing the window mounts nothing that re-focuses The order is therefore correct as written. That reasoning now sits in the arm, along with what to do if the premise ever stops holding, so the next person to add a focus writer sees which order depends on them.
|
Answering the two review passes at 20:15Z and 22:05Z together, since they overlap. The one point worth real work: does showing the window reset the focus?Both passes asked this and both said they could not tell from the diff. It is the right question, so I checked rather than asserted. The order is correct, and here is the evidence.
I did not add a source-scanning test pinning "one focus writer". That invariant belongs to the session registry, not to notification routing, and asserting another module's invariant from this PR is the wrong home for it. One factual correction
There is already only one path. The rest, declined with reasonsLogging the identifier at
The seven
|
|
Review of #1042 (notification click routing) I read the diff only. I did not build it or run CI, per the repo rules. Overall: this looks good to merge once CI is green. The design is small and easy to check. The action is encoded on the request identifier, one total parse function reads it back, and every unknown input falls through to "bring Juno forward". What I checked
Minor suggestions (non-blocking)
Security: no new attack surface. Destinations are fixed and compiled in, and the identifier is only ever written by Juno. The doc comment warning against variants that carry a path, URL or shell word is a useful guardrail. Nice work. |
|
Closing out the two earlier passes (17:18Z, 17:21Z). Most of their points are covered by the reply above or by the commits since; two are new. A seam (trait or fn pointer) so a test can assert
Already handled rather than declined:
No unanswered comments remain on my side. |
… on (LAC-8588)
A sixth review pass made the point the previous five had not quite landed:
The comment justifies the order by saying `set_focused` has one caller.
That invariant is only in prose.
Correct, and prose is the weakest kind of guard. I had declined the expensive
half of the suggestion (a trait seam so a test could observe call order) and
dropped the cheap half with it, which was the wrong call: the invariant is
checkable without any seam at all.
`ShowSession` focuses the session and then calls `open_main_window`. That
order is safe only while nothing on the window-opening path writes focus.
The new test walks `src-tauri/src` and asserts the set of files containing a
focus write is exactly two: the registry that defines the setter, and the
command module whose job is focusing a session. A write appearing anywhere
else, `window_management.rs` above all, fails with a message naming this
ordering and what to do about it.
Two traps the repo has been bitten by before, both handled:
- it would match its own marker and report this file, so the marker is
assembled from pieces (`format!("set_{}(", "focused")`) and never appears
contiguously on a code line here
- a scan that walked the wrong tree, or stopped matching, finds nothing and
passes while proving nothing. So the allowed files are asserted present
*before* the unexpected set is checked. Both halves have to hold
Comment lines are skipped in all three forms, following
`agents_holds_no_executor`, which is the house pattern for this.
|
Sixth review pass, and it landed the point the previous five had circled:
You are right, and prose is the weakest kind of guard. I had declined the expensive half of this suggestion (a trait seam so a test could observe the call order) and dropped the cheap half along with it. That was the wrong call: the invariant is checkable with no seam at all.
That is better than the Two traps this kind of test has fallen into in this repo before, both handled:
Comment lines are skipped in all three forms, following Points 2, 3 and 4 of your review are answered in the two replies above (the |
|
Review: notification click routing (LAC-8588) Overall this is a well-reasoned change. I read the diff but did not build or run it, since CI owns the Rust compile. What I like
Suggestions (non-blocking)
Test coverage: good for the pure parsing and routing table. The macOS delegate path cannot run in CI, so a manual click-through on a built branch app is worth recording for the three actions (timer or turn finished, no-voice notice, waiting session). Per CLAUDE.md, a visible behaviour change also needs QA media under No blocking issues found. 🤖 Generated with Claude Code |
|
Seventh pass. Nothing blocking, no code changes needed. Two of your points are factually answered by the source, and one contradicts the sixth review, so I am making a call rather than ping-ponging. Two corrections5. "On a click that launches a cold Juno, 4. " Your point 2 is right for a better reason than I gaveYou suggested bringing the window forward first and focusing second. I checked, and focus-first is actively the better order, not just the safe one:
I have added that to the thread rather than to the comment, since the comment already names the invariant and what breaks it, and the test now enforces it. Point 1 contradicts the sixth review, and I am keeping the testYou call
I agree with the sixth, and I am not removing enforcement because a later pass prefers prose. Specifically:
3. A Coverage and media. Unchanged and stated in the body rather than papered over: the delegate path is AppKit-bound and cannot run in CI, and a click can only be shot from an installed build with notification permission, because a dev build posts under Terminal so the delegate is never installed. That needs the recording Mac. All seven passes are now answered. |
Paperclip: LAC-8588 (child of LAC-8231)
The seam
commands::notifications::presenterimplemented exactly oneUNUserNotificationCenterDelegatemethod,willPresentNotification, which iswhat makes a banner appear while Juno is frontmost. There was no
didReceiveNotificationResponse, so macOS had nowhere to deliver a clickand every notification Juno posts was a dead end: a finished timer, a new
automation, the scheduler, a finished turn, and LAC-8231's "Juno has no voice
to speak with", whose entire body is an instruction to open a System Settings
pane.
The shape of the fix
A click hands the delegate the identifier of the notification and nothing
else. So the action rides on the identifier, appended after a
#, andaction_from_identifieris the single place that reads it back. One table, nota callback per caller.
The table is total. No separator, a slug this build does not know, an empty
session id, or a string Juno never posted all read as "bring Juno forward".
There is no path through it that does nothing, and none that can panic.
The unique part stays in front of the separator, untouched, so two
notifications carrying the same action still do not replace each other in
Notification Center.
Two actions wired
tts/no_voice.rs(LAC-8231's notice)READ_AND_SPEAK_URLSthe Voice picker's own link usesanthropic.rs(background turn finished / failed),agent_runner.rs(needs input)Read & Speak deliberately does not also bring Juno forward: the person is
being sent to System Settings, and fighting it for the foreground would land
them back where they started.
The session focus is best effort and in that order. A session that has already
finished is gone from the registry, so focusing it fails for the most ordinary
click there is, the one on "finished". The conversation is still what the
person asked for, so the window comes forward either way.
open_main_windowmakes that call, since it is the one place that decides which surface holds the
full chat.
Only the default action is routed
macOS calls the same method for a dismissal where a category asks for one. Juno
registers no category today, so only the default action arrives, but a
dismissal that opened System Settings would be a real bug the day one is
registered. A dismissal closes the completion handler and does nothing else.
Six callers untouched
notify(app, title, body)anddeliver(app, title, body)keep theirsignatures.
notify_action/deliver_actionare the siblings that carry anaction, and
NotificationDatagained a#[serde(default)]field, so thefrontend payload (which has never carried one) still deserializes.
Acceptance criteria
didReceiveNotificationResponseon the existing presenter delegate; a click reaches Rustnotify(app, title, body)works untouched for the callers with nowhere to goTesting
Six unit tests in
commands::notifications::tests:an_identifier_says_where_its_click_goes— the table, all three armsan_unknown_action_brings_juno_forward— 7 inputs: a slug from a later build, a bare separator, an empty session id,sessionwithout its=, no unique part, the empty string, a string Juno never postedevery_action_survives_the_round_trip— post and click are two halves of one encodingan_action_does_not_make_two_notifications_collide— the action must not cost the identifier its uniquenessa_payload_with_no_action_brings_juno_forward— the serde defaultRust compiles in CI, not locally, per
CLAUDE.md.Two notes for the reviewer
Rebased onto
mainnow that #1041 has merged (61060a59), so this PR's diffis its own three commits and nothing else.
It was opened against the
LAC-8231-tts-no-voice-noticebranch first, becausethe ticket names LAC-8231's notice as the caller for the Read & Speak action
and that notice existed only there. That does not work in this repo:
ci.ymlis
pull_request: branches: [main], so against any other base no Rust jobruns at all. One check reported instead of twelve was the tell. It was
retargeted to
mainand has carried #1041's commits until now.#1041 was squash-merged, so its commits were never ancestors of
mainand aplain rebase would have replayed content already there. Repaired with
git rebase --onto origin/main 48de4c28, after confirminggit diff 48de4c28 61060a59was empty, which proves the squash isbyte-identical to what was dropped.
Ignore the earlier failed
Rust (fmt + clippy + test)oneba31be8. Thatjob is a 2-second reporter: the macOS Rust job under it sat in the hosted queue
from 17:20:30Z to 17:43:07Z with
steps: [], never got a runner, and wascancelled, so the gate reported failure. Nothing was compiled and nothing
failed.
Rust (x86_64 check)passed on the same head, which is a realcargo checkof the workspace. The rebase above is also the fix for this: apull_requestre-run replays against its original merge ref, andmainhadmoved to v0.8.297, so
gh run rerunwould have reproduced it.src/types/notifications.tsis deliberately not updated. ItsNotificationDatais hand-written, has already drifted from the Rust struct(it carries
actionsandicon, which Rust has never had), and nothing insrc/invokessend_notification. Adding a field to dead code is not a fix;it is out of scope here.
Feature media
Not attached, and it needs a human: a notification click can only be shot from
an installed build (a dev build posts under Terminal, not Juno) with
notification permission granted, on the recording Mac. What to shoot, per
docs/media/CAPTURE.md:no-voice-click-opens-read-and-speak.mp4— the no-voice banner, clicked, System Settings opening on Accessibility > Read & Speakfinished-turn-click-opens-conversation.mp4— a background session finishing, its banner clicked, that conversation coming forwardBoth are under 10 seconds. I can take this on a session with the recording Mac
if that is the right next step.