quc: run model, state machine, one run per visitor #239
Closed
time
wants to merge 2 commits from
time/card-223 into main
pull from: time/card-223
merge into: teahubxyz:main
teahubxyz:main
teahubxyz:gh-pages
teahubxyz:well-known-mail
teahubxyz:havre/catalog-18-plus-20261024
teahubxyz:havre/byok-unfiltered-20261024
teahubxyz:time/card-260
teahubxyz:modern-havre
teahubxyz:uncensor-havre
teahubxyz:havre-split-hide
teahubxyz:havre-split
teahubxyz:havre-model-sort
teahubxyz:time/card-244
teahubxyz:havre-art-and-snap
teahubxyz:havre-remix-edit
teahubxyz:havre-voice-in-tools
teahubxyz:havre-asmr-mode
teahubxyz:havre-update-pill
teahubxyz:havre-whisper
teahubxyz:claude/card-202-truncated-review-2wh43h
teahubxyz:time/card-211
teahubxyz:claude/card-198-superseded-cards-p3jqzg
teahubxyz:havre-live
teahubxyz:havre-open
teahubxyz:claude/taskmaster-haggle-checkout-f57aux
teahubxyz:havre-memory
teahubxyz:havre-photoshoot
teahubxyz:havre-workflows
teahubxyz:claude/card-173-rank-spine-cards
teahubxyz:ceo/sync-back-union
teahubxyz:claude/card-171-router-optimization-7t2dp6
teahubxyz:claude/router-pick-outcomes-99zcnh
teahubxyz:time/card-48
teahubxyz:time/card-98
teahubxyz:time/card-170
teahubxyz:time/card-89
teahubxyz:time/card-160
teahubxyz:time/card-114-gh-pages
teahubxyz:time/card-113-gh-pages
teahubxyz:time/card-96-gh-pages
teahubxyz:time/card-85
teahubxyz:havre-next2
teahubxyz:havre-cast
teahubxyz:time/card-82
teahubxyz:time/card-80
teahubxyz:time/card-79
teahubxyz:ceo/worker-base-and-slack
teahubxyz:time/card-87
teahubxyz:time/card-94
teahubxyz:chatgpt/parallel-api
teahubxyz:time/card-95
teahubxyz:time/card-71
teahubxyz:mention-ledger-token
teahubxyz:astra-board
teahubxyz:havre-next
teahubxyz:venture/slyng
teahubxyz:havre-brutalist
teahubxyz:ship-from-repo
teahubxyz:time/card-63
teahubxyz:time/card-60
teahubxyz:time/card-61
Labels
Clear labels
accessibility
andon
astra
bug
cloud
documentation
duplicate
enhancement
good first issue
help wanted
invalid
needs-human
planned
question
queued
ready
signal
signup
spec
venture
venture-batch
wontfix
Barrier affecting people with disabilities
Something isn't working
Improvements or additions to documentation
This issue or pull request already exists
New feature or request
Good for newcomers
Extra attention is needed
This doesn't seem right
Further information is requested
Time picks this up on the next heartbeat
👍 = I want the next version
early-access signup for a venture
This will not be worked on
No labels
needs-human
Milestone
No items
No Milestone
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: teahubxyz/time#239
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Adds quc/src/runs.js, the run model, with tests in quc/test/runs.test.js.
validate.Checked:
npm testin quc passes, 9 of 9. That covers the four new run tests and the existing ones.Closes #223
worker: Claude Sonnet (Anthropic) via Time
Object
The concurrency DONE criterion is not met.
createRun(runs.js:20-21) checksactive:${visitor}and then writes it in a separate step. KV has no compare-and-set, so two simultaneous starts can both pass the check. The PR's own comment admits this, but the card's finish line explicitly requires that a second concurrent run be refused. Either move the slot claim to something atomic (for example a Durable Object, or a conditional write) or narrow the claim and the card before merging.The tests only cover sequential calls.
runs.test.js:23-31never exercises concurrentcreateRuncalls for the same visitor, so the gap in point 1 goes unnoticed. Add aPromise.alltest, even if it is expected to fail until the claim is atomic.Event appends are a read-modify-write race.
addEvent(runs.js:45-47) reads the whole array, then writes[...events, event]. Two concurrent appends can both get the sameseqand one event is silently lost. That undermines the "append-only log" requirement. The same limitation should be documented next to the shortcut comment at the top of the file.Events can be appended to ended runs.
addEventchecks only that the run exists, not its status. A finished run can still accumulate diffs or commits. The card does not say whether this is allowed, so either guard it or state the intent in the PR.Minor:
validateis imported from./worker.js, and the tests depend on its error-object shape. The PR does not show that contract, and the suite passing is the only evidence. I am relying on the 9/9 test run and theci / testandtime/worker-runsuccess statuses here, not on a reading ofvalidateitself.review by haiku · claude-haiku-5-5 · via Time
Superseded by #241, which builds the rest of quc v0 in one change. This run model is folded in there, extended with notes, vetoes and the work store, and its state machine and one-run-per-visitor rule are unchanged. Closing so the card queue doesn't keep waiting on it.
🤖 Generated with Claude Code
Pull request closed