Skip to content

vcli-runtime: deterministic 10 fps scheduler (plan 3) - #9

Merged
blaksmatic merged 33 commits into
masterfrom
implement/plan-3-vcli-runtime
Apr 19, 2026
Merged

blaksmatic merged 33 commits into
masterfrom
implement/plan-3-vcli-runtime

Conversation

@blaksmatic

Copy link
Copy Markdown
Owner

Summary

Implements the 32-task plan at docs/superpowers/plans/2026-04-17-vcli-runtime.md: a deterministic 10 fps sync scheduler that wires Capture → Perception → Arbiter → Input for vcli programs.

  • 17 library tasks: crate scaffolding, RuntimeError/ErrorCode, SchedulerCommand, RuntimeClock (standalone trait; not a Clock supertrait due to MSRV 1.75), EventEmitter, RunningProgram + WatchRuntime, triggers (OnSubmit/Manual/OnPredicate), expression resolver (\$pred.match.{center,bbox}), watch lifetime decisions, priority-based arbiter, body step-at-a-time executor, full tick_once pipeline (capture → perception clear → trigger waiting → evaluate watches → arbiter → dispatch + body step).
  • 13 scenario tests covering every watch lifetime (OneShot, Persistent, UntilPredicate, TimeoutMs), body control-flow (WaitFor timeout Fail, Assert Fail), arbitration conflicts, cross-program predicate dedup, ElapsedMsSinceTrue, and daemon ResumeRunning.
  • Task 32 gate clean: `cargo fmt --all --check`, `cargo clippy --workspace --all-targets -- -D warnings`, `cargo test --workspace --locked` all pass. v0.1-unused scaffolding (budget/confirm/merged_graph/transitions) deferred to v0.2 rather than carried as dead code.

Test plan

  • `cargo fmt --all -- --check`
  • `cargo clippy --workspace --all-targets -- -D warnings`
  • `cargo test --workspace --locked` (all 13 scenario tests + library unit tests green on macOS)

🤖 Generated with Claude Code

blaksmatic and others added 30 commits April 18, 2026 21:34
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Handles Manual as never-auto-fires — scheduler Start command promotes
those to Running directly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Tiebreak picks lexicographically larger ProgramId. Plan had reversed
comparator that contradicted its own test expectations — use a.cmp(&b)
so lex-max wins as the tests require.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Placeholder tick_once() body; Task 17 fleshes it out with capture →
perception → watches → arbiter → body. Ships a build.rs that repeats
vcli-capture's macOS rpath tweak so vcli-runtime's own test binary
can load libswift_Concurrency via the transitive screencapturekit dep.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Wires the full pipeline: capture → cache-clear → waiting-triggers →
running-watches → arbiter → body-step. Scenario tests in Tasks 19-31
drive the edge cases.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds dispatch_action helper in body.rs so watch steps actually reach the
input sink; tick_once now applies WatchRuntime updates (after_fire,
last_truthy edges, TimeoutMs retirement) and skips body step on watch
dispatch failure.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Evaluates UntilPredicate.terminator before decide(); truthy → retire this
tick without firing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…s arbiter

Watches whose steps list is empty now emit watch.fired directly instead of
going through the arbiter — there's no action to conflict on, so multiple
programs can fire a no-op watch in the same tick. Enables the upcoming
predicate_dedup scenario.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
blaksmatic and others added 3 commits April 18, 2026 22:08
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Final pass:
- Remove v0.1-unused scaffolding (budget, confirm, merged_graph,
  transitions) plus the watches::on_until_predicate_truthy helper — none
  are wired by the scheduler or exercised by any scenario. v0.2 can
  re-introduce with real integration.
- Drop RunningProgram.id (scheduler keys programs by ProgramId in the
  HashMap value). Use arbiter::Decision.program_id directly instead of
  smuggling it through the payload tuple, which removes the complex
  type warning and the unread field.
- Factor PerProgEval + WatchFirePayload type aliases at module scope.
- Fix style lints: bool simplification in watches::decide, Panics docs
  on ManualClock mutators, backticks in command.rs doc comment.
- Apply cargo fmt across the crate.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@blaksmatic
blaksmatic merged commit c673af2 into master Apr 19, 2026
3 of 4 checks passed
@blaksmatic
blaksmatic deleted the implement/plan-3-vcli-runtime branch April 19, 2026 05:26
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