A planning document for lowering traditionally “impossible” browser and host
behavior into a deterministic no_std Rust core.
The usual answers are:
no_std can't do network
no_std can't do time
no_std can't do JSON
no_std can't do files
no_std can't do a browser
Those are not useful answers. The useful question is:
Where is the seam?
Every one of those has a boundary that can be moved. The goal is not to pretend the platform does not exist. The goal is to make the platform a small, explicit, inspectable input to a deterministic state machine.
| Traditionally “impossible” | Seam | What the no_std side owns | What the host owns |
|---|---|---|---|
| Wall clock | start_time + logical_tick |
Relative time, elapsed time, scheduling | Initial anchor or tick source |
| Timers | Tick-driven event queue | Event ordering, due-event dispatch | Advancing the clock |
| Network | Transport adapter | Request/response state, retries, deadlines | Sockets, DNS, TLS |
| TLS | Host termination or virtual device | Trust decisions exposed as state | Certificates, handshake, entropy |
| JSON | Host reduction or bounded parser | Typed scenario/model | Raw bytes or reduced fixture |
| Files | Byte buffer or host mount | Content state | Opened files, paths, mounts |
| Allocation | Fixed buffers or arena | Layout, capacity, overflow policy | Arena backing memory |
| DOM | Semantic text/event model | View state and text projection | DOM, CSS, layout, paint |
| Screenshots/PDF | Host projection | Snapshot descriptors and state | Browser/PDF engine |
| Browser lifecycle | JS hypervisor | Guest ABI and state | Module loading, memory, events |
Timing is an ideal “impossible” claim to attack. A no_std state machine can own
time completely if time is represented as:
initial anchor
+ logical timebase
+ tick count
+ ordered events
No Instant, no SystemTime, no hidden clock reads.
The clock rate must be configurable. The scenario may use:
1000 Hz 1 ms resolution
60 Hz frame-aligned
10 Hz coarse scenario steps
1 Hz slow state progression
The timebase is part of the scenario input and part of replay metadata.
pub struct Timebase {
pub ticks_per_second: u32,
}
pub struct Clock {
pub tick: u64,
}
Use integer arithmetic only:
elapsed_ms = tick * 1000 / ticks_per_second
elapsed_us = tick * 1_000_000 / ticks_per_second
Use u128 intermediates when multiplying. Never accumulate per-tick
milliseconds; always derive elapsed from the total tick count.
Events are scheduled in logical ticks:
pub struct ScheduledEvent {
pub at_tick: u64,
pub sequence: u32,
pub event: Event,
}
Ordering is always (at_tick, sequence). Events at the same tick are
deterministic.
advance_to(target_tick):
while next_event.at_tick <= target_tick:
clock.tick = next_event.at_tick
apply(next_event)
clock.tick = target_tick
That gives:
The same canonical event time maps differently across rates:
| Event time | 1000 Hz | 60 Hz | 10 Hz | 1 Hz |
|---|---|---|---|---|
| 0 ms | 0 | 0 | 0 | 0 |
| 500 ms | 500 | 30 | 5 | 0 or 1 |
| 1000 ms | 1000 | 60 | 10 | 1 |
| 1500 ms | 1500 | 90 | 15 | 1 or 2 |
At coarse rates, not every event time is representable. The scenario must choose and document one policy:
floor — event happens at or before the requested time
ceil — event happens at or after the requested time
round — nearest representable tick
For “no earlier than intended,” use ceil.
tick = ceil(ms * ticks_per_second / 1000)
At 1 Hz:
500 ms -> tick 1 -> displayed elapsed 1000 ms
1500 ms -> tick 2 -> displayed elapsed 2000 ms
That is not an error; it is an inspectable quantization decision.
Two valid models:
Fixed timebase per scenario
scenario declares 60 Hz
events are authored in ticks
replay is exact
Timebase changes during a run
Use epochs or a canonical elapsed-time accumulator:
epoch 0: 1000 Hz
epoch 1: 60 Hz
epoch 2: 10 Hz
or:
elapsed_us += tick_in_epoch * 1_000_000 / current_hz
current_hz = new_hz
tick_in_epoch = 0
Changing the rate without preserving elapsed time is the only real hazard. Preserve it explicitly.
(tick, sequence).initial_start_time
timebase
rate changes
event schedule
target tick
state hash
A replay is:
clock.tick = initial_tick
for event in schedule where event.at_tick <= target:
clock.tick = event.at_tick
apply(event)
clock.tick = target
render(clock, state)
Branching is just replaying a prefix and applying a different suffix.
The browser demo is the first proving ground.
Current split:
JS hypervisor: load Wasm, read memory, paint screen, drive DevTools
Rust no_std: scenario loop, view rendering, golden comparison, report
Implemented update:
1000, 60, 10, 1.ceil.The text snapshots must remain identical across clock rates. Only timing metadata changes.
1000 Hz, 60 Hz, 10 Hz, and 1 Hz all run.no_std Rust.The first implementation is in the browser demo.
Implemented:
Timebase and Clock in lodalite-web-rs/src/time.rs1000, 60, 10, and 1 HzViewStep::at_ms:
0 ms500 ms1500 ms2500 ms3500 ms4500 ms3lod_set_timebaselod_timebase_hzlod_view_scheduled_mslod_view_ticklod_view_elapsed_mslod_clock_ticklod_elapsed_mslod_elapsed_usMeasured results:
| Rate | Last tick | Last elapsed | Text result |
|---|---|---|---|
| 1000 Hz | 4500 | 4500 ms | 6/6 exact |
| 60 Hz | 270 | 4500 ms | 6/6 exact |
| 10 Hz | 45 | 4500 ms | 6/6 exact |
| 1 Hz | 5 | 5000 ms | 6/6 exact |
At 1 Hz, the 4500 ms final view quantizes to tick 5, so elapsed time is
5000 ms. That is the intended ceiling behavior.
The six rendered text snapshots are identical across all four rates. Only the timing metadata changes.
The JS hypervisor now only selects the rate, calls Rust, and reads back the
results. Timing, quantization, event placement, and report generation are all in
the no_std Rust side.
The next layer is implemented as a fixed character-cell screen.
100 × 36 cells, Unicode scalars<pre> and semantic action forwardingscreen.txt output through the ABIreport.md remains generated by RustThis moves the remaining JS presentation decisions into Rust without introducing DOM, CSS, fonts, pixels, screenshots, or PDF.
The screen state is inspectable through:
selected view
scroll offset
timebase
clock tick
elapsed time
match status
screen text
The last application-specific JS constants have moved into Rust.
Rust emits a line-oriented manifest containing:
JS now:
JS no longer contains action IDs, rate values, labels, key bindings, or download filenames.
This leaves the JS side as a platform adapter:
Wasm loading
manifest parsing
DOM control creation
event capture
linear-memory reads
text painting
DevTools buffer rendering
The browser demo now queries a Rust-owned machine contract.
lodalite-web-rs/src/contract.rs declares:
The same declarations drive:
The Wasm adapter no longer hand-writes a manifest. It serializes the contract.
The action dispatch also uses the same Action enum that populates the
contract, so numeric action IDs are not maintained in two places.
The contract now announces the execution model as well:
The machine also emits a full instruction manual from the same contract. The manual documents:
The browser ingests the manifest and can read manual.txt through the ABI.
No external document or host-side contract is required to discover the
machine’s shape.
The no_std policy module includes concrete primitives:
The machine now announces its build and source identity:
build.rs captures these at compile time. The contract fingerprint hashes only
the declared machine shape, excluding volatile build data, so a new compiler
does not look like a new interface.
The machine also emits two instruction surfaces:
help.txt short description and usage
manual.txt full contract, policy, provenance, and replay rules
Both are generated from the same Rust contract. A host can expose --help
without maintaining its own copy of the action list or usage text.
The default screen is now a text browser shell, not the help path.
100x3640..240 columns and 12..80 rows? enters the help screenq enters the closed screenset_screen_size action and
lod_set_screen_sizeThe startup shell renders its own borders, title bar, logo, address, action hints, and footer at every screen render.
Current ABI: 16.