Repository navigation
fix(channels): refresh the suggesting tab when its channel is auto-approved (#232) - #238
Conversation
…suggesting tab (#232) With channelProposals.autoApprove on, the suggest poller sees `approved` but never calls onApproved, so the suggesting tab does not list the channel until the next refresh. - test-channel-proposals.js: the poller's approved path calls onApproved once; pending/rejected/error do not; the admin decision and the poller reporting the same approval refresh once; a re-approval after a revoke (same id, new reviewedAt) refreshes again. - test-channels-client-state-152.js: through the real channels.js and the real mount(), an auto-approved suggestion lists the channel with one /channels request and keeps the open PSK conversation and unread counts. - test-channel-proposals-e2e.js: the suggesting page lists the channel without a reload, keeps its PSK conversation, and refreshes once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…proved (#232) The suggest poller now calls the same onApproved path as the admin decision when a request ends `approved`. notifyApproved() runs it once per approval, keyed by proposal id and reviewedAt, so the admin path and the poller reporting the same approval cause one refresh, while a proposal re-approved after a revoke still refreshes. The set is per mount and capped at 64 entries. loadChannels() keeps client-only state across the refresh (#153), so an open PSK conversation and unread counts survive. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rapport — CS-pve-agent1 PR#238 #232 — head 8f41334Status: Ready for review as a draft. All acceptance criteria are covered by red-then-green tests, every mutant is killed, and CI passes (E2E green on attempt 2 after an unrelated timing flake in the #180 packets test). Evidence legend: [T] = test run (local or CI), [A] = analysis of code/logs, [K] = known from issue/prior PRs. Acceptance criteria
CI per job (run 37275433123)
Attempt 1 failure analysis [A]: the fixture was freshened at 07:24:39 and the #180 test ran at 07:38:05, about 13.5 min later. Packets were crossing the 15-minute default window that Clear restores between the Clear and the reload. That test and the packets page are not touched by this PR. Locally the same test passed 3/3 against this branch [T]. Only the failed job was rerun. Local verification [T]
Residuals
|
Review — CS-Minimax PR#238 autoapprove-refresh — head 8f41334Dom: APPROVE med nits Independent read-only review of the head above, rebased in scratch onto Findings
No blocking findings. Answers to the review brief1. Core: the poller's
2. Exactly one
3. Poller lifecycle. 4. No behaviour change with 5. Security / UI.
6. Rules.
CIRun 37275433123 on this head [T]:
Tests run (merged tree, Go server/ingestor/migrate built from it) [T]
The local server was stopped by its pid file and the port was verified free afterwards. Mutants (own) [T]
M7 shows that the E2E is what guards the cache invalidation; the unit and integration harnesses do not model Not verified
|
Relates to #232
Problem
With
channelProposals.autoApproveon (#196), a suggested channel is approved at once. The tab that suggested it only updated its status line ("… is already shared with everyone.") and did not list the channel until the next list refresh.onApproved, which runsloadChannels(true), was called only from the admin decision path, not from the suggest poller.Fix
public/channel-proposals.js:onApprovedpath when a request endsapproved.notifyApproved(st, fallbackName), which runsonApprovedonce per approval. The key isproposal.id + '@' + proposal.reviewedAt:reviewedAt, so it refreshes again.mount()and capped at 64 entries (cleared when full).public/channels.js: comment only.onApproveditself is unchanged. Since #153,loadChannels()keeps client-only state across the refresh, so an open PSK conversation and unread counts survive.A suggestion of a name that is already approved also ends
approved. The tab then refreshes once, which lists the channel if this tab had not seen it yet.Performance
The fix adds one
Setlookup per final poll result and at most one/api/channelsrequest per approval. That is the same request the admin path already makes, and nothing runs in a render, ingest or WS hot path.Tests
Tests were committed first (
test(...)commit), red on master, then the fix.test-channel-proposals.js(+4)approvedpath callsonApprovedonce with the name; pending/rejected/error do not; admin decision + poller reporting the same approval → one call, a different approval → another call; re-approval after a revoke (same id, newreviewedAt) → another calltest-channels-client-state-152.js(+1)channels.jsand the realChannelProposals.mount()(new harness optionrealProposals). An auto-approved suggestion lists the channel with exactly one/channelsrequest and keeps the open PSK conversation (selection, URL, My Channels) and the unread counts on a server row and on theuser:*rowtest-channel-proposals-e2e.js(+1 step, 1 extended)autoApprove. Page A opens a PSK conversation, then suggests a channel. On the same page (no reload) the channel is listed as shared, the PSK conversation stays open, exactly one/api/channelsrequest is made, and the list refreshes exactly onceThe E2E counts refreshes as well as requests because
api()coalesces identical in-flight requests. A doubledonApprovedwould still show as only one network request.Mutants (each killed):
onApproved: unit, integration and E2E fail;onApprovedcalled twice: unit, integration and E2E fail;reviewedAt: unit fails;onApproved: unit fails.Local runs:
sh test-all.sh(217 files),node test-frontend-helpers.js,test-channel-proposals-e2e.jsandtest-channels-client-state-152-decrypt-e2e.js(self-started stacks), and 19 channel E2Es against a local Go server on the CI-migratede2e-fixture.db. All green.scripts/check-xss-sinks.sh --diff origin/masteris clean, and no CSS or colors were changed.No merge, deploy or configuration change is included.
🤖 Generated with Claude Code