feat(examples): counter-cli — the define-once proof (O2)#5
Merged
Conversation
Makes docs/ARCHITECTURE.md non-vapor. One Counter ViewState, projected three ways in a single process with zero transport and zero substrate: - two renderers, deliberately maximally different — LineRenderer (Output=String) and GaugeRenderer (Output=Vec<String>). Different associated Output types is the outlier-validation: if the Renderer trait fits both extremes without forcing, it fits a DOM tree / ratatui frame in the middle. - one Observer (an AI persona) that perceives the SAME Counter a human sees and, on threshold, acts through the identical command vocabulary by emitting a CommandEnvelope tagged CommandSource::Observer — the fourth projection of the identical state, not a bespoke integration. Standalone workspace member consuming positron-core as an external crate (the "consumable by anyone" proof). Two tests with `// what this catches:`: renderer purity (same &state, no mutation, byte-identical re-render) and perceive→act identity carry (observer_id() == CommandSource provenance). README status refreshed to v0.1.x + roadmap pointer; positron-ts → positron-lit for single-name consistency with the O1 nit fix. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…ent unwrap, clamp idiom Review (APPROVE WITH NITS) touch-ups: - ThresholdObserver doc now says "while at/over its threshold" and states it's level-triggered (emits on every at/over-threshold perception, not only the crossing) — matches the code, which fires 3× for 8/10/12. - print state.revision directly instead of state.revision().unwrap() (the field is owned; no reason to round-trip through the Option-returning trait method). - GaugeRenderer caption uses .clamp(0, width) to match the idiom one line up. No behavior change. cargo test -p counter-cli → 2 pass; clippy clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
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.
O2 — makes the separation contract non-vapor
Second unit of the positron build-out (roadmap in
docs/ARCHITECTURE.md, O1 landed in #4). Proves the whole "define once, project many" thesis in one process, zero transport, zero substrate — before any wire or ContinuumHost is involved.What it demonstrates
CounterViewState(semantic content only: value + revision; no colors/widths/layout, exactly as ARCHITECTURE.md Q#4 pins).LineRenderer(Output = String) andGaugeRenderer(Output = Vec<String>). Different associatedOutputtypes is the outlier-validation discipline: fit both extremes without forcing → the middle (DOM tree, ratatui frame) is guaranteed.Countera human sees (Session-tierbudget_hz) and, on threshold, acts through the identical command vocabulary by emitting aCommandEnvelopetaggedCommandSource::Observer. Perception identity is carried onto action provenance (observer_id() == source.observer_id). No separate "AI view."Shape
examples/counter-cli) consumingpositron-coreas an external crate — the honest "consumable by anyone" proof, not an in-crate test.Arc<Mutex<Vec<CommandEnvelope>>>(notmpsc::Sender, which is!Syncand would break theObserver: Syncbound).Verification
cargo test -p counter-cli→ 2 pass. Two tests, each with// what this catches:— renderer purity (same&state, no mutation, byte-identical re-render) and perceive→act identity carry.cargo run -p counter-cli→ renders the counter through both surfaces per revision and prints the 3 commands the observer emitted through the shared vocabulary.cargo check -p counter-cliclean (pre-existing ts-rs serde-attr warning in positron-core is unrelated).Docs
positron-ts→positron-litfor single-name consistency with the O1 nit fix.🤖 Generated with Claude Code