Skip to content

feat(live): InflightLiveCard selecting queue via /api/live - #442

Merged
caigee-cmd merged 1 commit into
mainfrom
feat/live-selecting-queue
Oct 29, 2026
Merged

caigee-cmd merged 1 commit into
mainfrom
feat/live-selecting-queue

Conversation

@caigee-cmd

Copy link
Copy Markdown
Owner

Summary

Wire Overview InflightLiveCard waiting rail to real selecting (选号) requests through /api/live only — no parallel /api/inflight*. Reuses the existing RequestRecorder / request_logs lifecycle; does not invent a new state machine.

Also: worker rail sort busy → available → cooldown; formatRemain shows hours (Nh Nm) like Overview formatRemaining.

Existing lifecycle states (inventory — mapped, not extended)

accounts.RequestStatus* (internal/accounts/request_logs.go):

Status Role
started Prepare / Logs.Start — selecting while AccountID empty
streaming Non-terminal mid-flight Finish (does not clear open map)
ok / incomplete / error / canceled Terminal Finish → clearOpen + recent_completions

accounts.AttemptStatus*: started / ok / error / failover — unchanged (AttemptHook only).

Pool: Acquire / Release + InFlight / InFlightSince — running occupancy already on LiveSnapshot.workers.

UI MockJobStatus: queued | running | done | failed — projection only:

  • selecting (started + empty AccountID) → queue[] → UI queued
  • pool-bound workers → UI running
  • drained recent_completions → Done/Failed fly-outs

Architecture fit

Checkpoint Hook
Prepare → Logs.Start RequestRecorder.noteOpen
Pool.Acquire OnInFlightAcquire → BindAccount
Pool.Release (incl. body Close / failover) OnInFlightRelease → UnbindAccount
Terminal Finish clearOpen
/api/live SelectingRequests() → LiveSnapshot.queue
FE applyLiveProjection maps queue → MockJobStatus queued

Same telemetry plane as recent_completions (RequestRecorder). No second control plane.

Test plan

  • go test ./internal/logs/ ./internal/console/ ./internal/executor/
  • npx tsx frontend/scripts/mockInflight.test.ts (queue → queued + liveHasSignal)
  • Manual: expand InflightLiveCard under load — waiting pills track Prepare→Acquire handoff; busy slots stay on worker rail

Notes

  • No merge / no SGP3 deploy from this PR.
  • Tip: see commit on branch after push.

Reuse RequestRecorder + existing RequestStatus* (started/streaming/ok/
incomplete/error/canceled): Prepare Start opens, Acquire BindAccount,
Release UnbindAccount, terminal Finish clears. No new state machine or
/api/inflight*. Also sort worker rail busy→available→cooldown and format
rate-limit remain with hours.
@caigee-cmd
caigee-cmd merged commit d87778c into main Oct 29, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant