Commit graph

11 commits

Author SHA1 Message Date
Jason Monk
ad628ae545
Fix #347: Client-subject notification copy + deep-link taps + Manage action (#362)
* Fix #347: Client-subject notification copy + deep-link taps + Manage action

Rewrite per-tool-call and session-summary notification copy per the locked
#342 design, wire up notification tap deep-links, and add a Manage action
button.

Per-tool-call notifications now read "${clientLabel} used ${humanized(toolName)}"
with the integration display name as body and the call timestamp rendered
natively via setWhen(). Session-summary notifications partition by client
label and emit one notification per client titled "${clientLabel} used
${count} ${tool|tools}" with up to 3 unique humanized tool names in the
body (Oxford comma, "and N more" past the cap).

Tap deep-links route to the audit-history screen — scrolled to the
specific call (per-tool-call) or filtered to the session time window
(summary) — and a single Manage action button points at the integration
manage page (or home, when a summary's calls span multiple integrations).

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* Update integration tests for per-client summary notification ids

#347 changed SessionSummaryNotifier from a single-id summary to one
notification per client, keyed by the clientLabel hash. The existing
:app:integrationTest fixtures still asserted against the legacy
SessionSummaryNotifier.NOTIFICATION_ID constant, so they failed in CI.

Updated each affected test to compute the expected id via
SessionSummaryNotifier.idForClient(<clientLabel>) and dropped the
now-unused NOTIFICATION_ID companion constant. The InMemoryTokenStore
resolves clientName=null to the clientId, so for tests that pass
clientName=null the expected label is their clientId string (e.g.
"race-test", "multi-test", "runtime-mode-switch"). ToolCallHappyPathTest
passes clientName = "Test Client" explicitly.

Also retargeted the MultiToolSessionTest title-string assertion from the
old "{count} calls across {N} integrations" copy to the new
"{clientLabel} used {count} tools" title shape.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* Move summary notification id bucket below per-call range

The previous summary id bucket (6000..15999) overlapped with
PerToolCallNotifier.BASE_ID = 7000, so any clientLabel whose hash
.mod(10000) landed in 1000..9999 produced an id that collided with
per-call notifications. RuntimeNotificationModeSwitchTest failed in CI
because its clientLabel "runtime-mode-switch" hashes to
idForClient(...) = 7465, which the test's "id >= PerToolCallNotifier.BASE_ID"
probe flagged as a per-call notification during phase 1 (SUMMARY mode).

Narrow the bucket to 4000..4999 so summary ids stay clear of the per-call
range. Collisions inside the 1000-entry bucket remain acceptable for the
expected <100-clients-on-a-device cardinality.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4 (1M context) <noreply@anthropic.com>
2026-04-22 03:11:08 -04:00
Jason Monk
fcf9dc3a12
Fix #337: Add copy-branch variants to notification catalog (#338)
Covers the notifier branches that were not previously exercised:

- SessionSummaryNotifier: adds "1 tool call" (singular, 1 call / 1
  integration) and "3 tool calls" (plural, N calls / 1 integration)
  alongside the existing multi-integration variant, so all three
  buildSummaryTitle() shapes appear in the catalog.
- PerToolCallNotifier: long tool name (to show title wrapping) and a
  different integration id (to exercise display-name substitution).
- AndroidSecurityCheckNotifier: CT log Alert with multiple unexpected
  issuers (list formatting) and a CT log Warning via postInfo() -- the
  entry point SecurityCheckWorker hits after the 3-run debounce trips.
- LaunchRequestNotifier: long caller name + long URL to show wrapping
  on the open-link path.
- AuthRequestNotifier: only one shape exists; documented inline.

Each new case drives the real notifier with realistic inputs and reads
the posted Notification back via Robolectric's shadow
NotificationManager, exactly like the existing cases. docs/notifications/
index.html is regenerated from the CapturedNotifications snapshot by
the existing ClassRule writer.

Co-authored-by: Claude Opus 4 (1M context) <noreply@anthropic.com>
2026-04-21 16:12:05 -04:00
Jason Monk
e34b0e70e8
Fix #335: Auto-generate docs/notifications/index.html from real notifier output (#336)
The QA notification catalog at `docs/notifications/index.html` previously
mixed hand-coded HTML mockups (with hand-typed titles like "Session
Complete" that never existed in production) alongside Roborazzi PNGs
captured from real notifiers. The two sources had drifted, so users
lost trust in the catalog.

Every title, body, sub-text, channel ID, and `<img>` reference in the
page is now emitted by `NotificationScreenshotTest` itself: each test
case records its notifier's posted `Notification.extras` into a
class-scoped collector, and a JUnit `@ClassRule` writes the HTML to
`../docs/notifications/index.html` after the suite finishes. Output is
sorted by screenshot base name so runs are idempotent.

Hand-coded mockups and the CSS icon-chip PNG palette they used
(`icon*.png` in `docs/notifications/`) are removed; the only way this
file changes now is by running the test.

Co-authored-by: Claude Opus 4 (1M context) <noreply@anthropic.com>
2026-04-21 13:35:41 -04:00
Jason Monk
5e49fded97
Fix #332: Drive notification screenshot catalog from real notifiers (#333)
Refactors NotificationScreenshotTest to invoke the production notifiers
directly (ForegroundNotifier, AuthRequestNotifier, PerToolCallNotifier,
SessionSummaryNotifier, LaunchRequestNotifier, FgsLimitNotifier,
AndroidSecurityCheckNotifier) and capture the posted Notification via
Robolectric's ShadowNotificationManager instead of hand-rolled builders.
Any future copy or behavior change in a notifier now either intentionally
updates the catalog or breaks the screenshot diff.

Adds FgsLimitNotifier coverage (the gap called out in the issue) and
prunes stale cases (session warning/info, error variants, outreach) that
no longer map to a real producer. Renumbers docs/notifications/index.html
to match the new notifier-centric section layout.

Co-authored-by: Claude Opus 4 (1M context) <noreply@anthropic.com>
2026-04-21 12:11:46 -04:00
Jason Monk
d9bf8c4ab7 Fix #79: Remove stale NotificationModel references from docs
Follow-up to #78 cleanup. The code for NotificationModel was deleted
but implementation-specific references remained in other docs:

- docs/design/overall.md: rename section heading from
  "NotificationModel + audit" to "notification behavior + audit"
- docs/test-coverage-audit.md: drop NotificationModelTest row and
  update file count from 7 to 6
- docs/notifications/index.html: remove "/ NotificationModel.kt"
  from source references (hand-written HTML, not generated)

Historical planning references in docs/workflow.md describing the
original T-7 plan are left intact.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 13:02:21 -04:00
Jason Monk
238949e6a0 Add Roborazzi notification screenshot tests for all notification variants
Builds real Android Notification objects from production code and renders
them via a test-only NotificationCard composable that mimics the system
notification shade. Captures light and dark variants of all 18 notification
types across foreground, auth, session, error, security, and outreach
channels. Adds Compose and Roborazzi test dependencies to the notifications
module and integrates screenshots into the existing HTML notification catalog.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 12:02:07 -04:00
Jason Monk
aa87229d24 Fix notification icons: transparent bg, circular shape
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 11:30:20 -04:00
Jason Monk
ed2bb43278 Tint notification dashboard icons per channel color
Navy background preserved, foreground sun pattern tinted:
gray (idle), green (connected), blue (active/session), red (auth/error),
orange (security), purple (outreach).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 11:28:44 -04:00
Jason Monk
c652fc2a64 Fix notification dashboard icon: use PNG instead of broken SVG data URI
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 11:26:06 -04:00
Jason Monk
c3aabad9fb Use app icon in notification dashboard instead of RC placeholder
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 11:20:40 -04:00
Jason Monk
ca9cee2a0c Add notification preview dashboard: all 6 channels with state variations
HTML catalog styled as Android notification cards showing every
notification the app sends: foreground service (6 states), auth
requests, session activity, errors, security alerts, AI outreach.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 11:14:40 -04:00