panel: migrate scanner check-in polling to atomic POST /scan/consume - #80
Merged
Conversation
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…atomic consumeLastScan
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThe change defines and adopts an atomic ChangesAtomic scan consumption
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant useScanInput
participant agentClient
participant Agent
useScanInput->>agentClient: consumeLastScan()
agentClient->>Agent: POST /scan/consume
Agent-->>agentClient: ScanData or empty sentinel
agentClient-->>useScanInput: Normalized scan data
useScanInput-->>useScanInput: Emit code when present
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Jul 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
agentClient.getLastScan()+clearLastScan()(the racyGET /scan/last+POST /scan/clearpair) with a singleagentClient.consumeLastScan()calling the agent's atomicPOST /scan/consume— closes the CodeRabbit-flagged race from panel PR Panel P4.1: check-in loop — idempotent check-in, station UI, launch ceremony #77, where a fast second physical scan arriving between a read and its later clear call was silently erased.useScanInput.ts's scanner-mode poll: since the agent now clears atomically server-side, every non-empty poll response is guaranteed to be a scan the client has never seen before. Deletes the now-dead{code, time}dedup ref and the separate retry-the-clear-on-failure ref entirely — no client-side workaround needed anymore.agent/(already shipped and merged tomainseparately — seedocs/superpowers/plans/2026-07-18-agent-atomic-scan-consume.md) or to any consumer ofuseScanInput(StationPage.tsx,useCheckinFlow.tsuntouched). Wedge and manual scan-input modes are unaffected.Built via subagent-driven-development (3 tasks, each with an independent implementer + reviewer, plus a final whole-branch review — "Ready to merge: Yes", zero Critical/Important findings). One note from the review: the branch's commit list includes a "docs: agent atomic scan-consume implementation plan" housekeeping commit whose content is identical to what's already on
mainunder a different hash (from earlier plan bookkeeping) — it's a no-op in the actual file diff below, not part of this change's real scope.Test plan
npm test -- --run— 1128/1128 panel tests passingnpm run typecheck(tsc -b— the correct command for this project's solution-styletsconfig.json) — cleannpx eslint . --max-warnings=0— cleannpm run build— succeedsgetLastScan/clearLastScan//scan/last//scan/clearremain inpanel/src(only historical migration-note comments)POST /scan/consumeatomicity by readingagent/scan_buffer.go'sConsume()directly, and confirmed the new MSW test mock genuinely self-clears after serving a response (mirroring the real agent) rather than passing "no double-emit" tests for the wrong reason🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes