Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,61 @@

## Unreleased

### feat(tooling): split local verification into parallel lanes

- **Changed** the local full verifier now runs as curated parallel lanes with
isolated `CARGO_TARGET_DIR`s for clippy, tests, rustdoc, and guard checks,
which cuts local wall-clock time by avoiding one giant serialized cargo
invocation.
- **Changed** staged and reduced local Rust checks now use a narrower fast-path
target surface, keeping the heaviest all-target clippy drag in CI instead of
every local iteration loop.
- **Changed** full local verification is now scope-aware: tooling-only full
changes stay tooling-local, while critical Rust changes run local smoke lanes
and defer exhaustive proof to CI.
- **Changed** local `warp-core` smoke selection is now file-family aware:
default source edits stay on `--lib`, runtime/inbox files pull `inbox`,
playback files pull playback-smoke tests, and PRNG edits pull the golden
regression.
- **Changed** local `warp-wasm` and `echo-wasm-abi` smoke selection is now
file-family aware too: `warp-wasm/src/lib.rs` stays on plain lib smoke,
`warp_kernel.rs` pulls the engine-enabled lane, canonical ABI work pulls only
canonical/floating-point vectors, and non-Rust crate docs no longer wake Rust
lanes at all.
- **Added** `make verify-ultra-fast` as the shortest local edit-loop lane:
changed Rust crates get `cargo check`, critical runtime surfaces still pull
targeted smoke tests, tooling-only changes stay on a syntax/smoke path, and
clippy/rustdoc/guard scans stay on heavier local paths and CI.
- **Added** `make verify-full-sequential` as an explicit fallback when the lane
runner itself needs debugging.
- **Fixed** ultra-fast tooling smoke now detects actual shell tooling files by
extension or shebang, so extensionless hook entrypoints stay covered while
non-shell files like hook docs or timing logs do not false-fail under
`bash -n`.

### feat(warp-core): close Phase 4 and pivot reads to observe

- **Added** ADR-0011 documenting the explicit observation contract with
worldline, coordinate, frame, and projection semantics.
- **Changed** Phase 4 provenance/BTR work is now the documented substrate
baseline: provenance is entry-based, parent refs are stored explicitly, and
the standalone `ProvenanceService` owns authoritative worldline history.
- **Added** `ObservationService::observe(...)` as the canonical internal read
path with explicit worldline, coordinate, frame, and projection semantics.
- **Added** deterministic observation artifacts and error mapping:
`INVALID_WORLDLINE`, `INVALID_TICK`, `UNSUPPORTED_FRAME_PROJECTION`,
`UNSUPPORTED_QUERY`, and `OBSERVATION_UNAVAILABLE`.
- **Changed** `WarpKernel` and the WASM ABI now expose `observe(...)`, while
`get_head`, `snapshot_at`, and `drain_view_ops` are thin one-phase adapters
over the observation contract. `execute_query(...)` currently lowers through
observation semantics and returns deterministic `UNSUPPORTED_QUERY` until full
query support is implemented.
- **Changed** `drain_view_ops()` is now legacy adapter/debug behavior only: it
reads recorded truth through `observe(...)` and tracks only adapter-local
drain state instead of mutating runtime-owned materialization state.
- **Changed** `ttd-browser` migrated to the entry-based provenance API after
the Phase 4 hard cut removed the old provenance convenience methods.

### fix(warp-core): close final Phase 3 PR review threads

- **Fixed** `Engine::commit_with_state()` now restores both the engine-owned
Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ SHELL := /bin/bash
PORT ?= 5173
BENCH_PORT ?= 8000

.PHONY: hooks verify-fast verify-pr verify-full docs docs-build docs-ci
.PHONY: hooks verify-ultra-fast verify-fast verify-pr verify-full verify-full-sequential docs docs-build docs-ci
hooks:
@git config core.hooksPath .githooks
@chmod +x .githooks/* 2>/dev/null || true
@echo "[hooks] Installed git hooks from .githooks (core.hooksPath)"

verify-ultra-fast:
@./scripts/verify-local.sh ultra-fast

verify-fast:
@./scripts/verify-local.sh fast

Expand All @@ -22,6 +25,9 @@ verify-pr:
verify-full:
@./scripts/verify-local.sh full

verify-full-sequential:
@VERIFY_LANE_MODE=sequential ./scripts/verify-local.sh full

.PHONY: dags dags-fetch
dags:
@cargo xtask dags
Expand Down
188 changes: 186 additions & 2 deletions crates/echo-wasm-abi/src/kernel_port.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,24 @@ pub mod error_codes {
pub const INVALID_INTENT: u32 = 2;
/// An internal engine error occurred during processing.
pub const ENGINE_ERROR: u32 = 3;
/// The requested tick index is out of bounds.
pub const INVALID_TICK: u32 = 4;
/// Legacy snapshot/history tick index is out of bounds.
pub const LEGACY_INVALID_TICK: u32 = 4;
/// The requested operation is not yet supported by this kernel.
pub const NOT_SUPPORTED: u32 = 5;
/// CBOR encoding or decoding failed.
pub const CODEC_ERROR: u32 = 6;
/// The provided payload bytes were invalid or corrupted.
pub const INVALID_PAYLOAD: u32 = 7;
/// The requested worldline is not registered.
pub const INVALID_WORLDLINE: u32 = 8;
/// The requested observation tick is not available.
pub const INVALID_TICK: u32 = 9;
/// The requested frame/projection pairing is invalid.
pub const UNSUPPORTED_FRAME_PROJECTION: u32 = 10;
/// Query observation is not implemented yet.
pub const UNSUPPORTED_QUERY: u32 = 11;
/// The requested observation cannot be produced at this coordinate.
pub const OBSERVATION_UNAVAILABLE: u32 = 12;
}

// ---------------------------------------------------------------------------
Expand Down Expand Up @@ -115,6 +125,169 @@ pub struct ChannelData {
pub data: Vec<u8>,
}

/// Coordinate selector for an observation request.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct ObservationCoordinate {
/// Worldline to observe.
pub worldline_id: Vec<u8>,
/// Requested coordinate within the worldline.
pub at: ObservationAt,
}

/// Requested position within a worldline.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(tag = "kind", rename_all = "snake_case")]
pub enum ObservationAt {
/// Observe the current frontier.
Frontier,
/// Observe a specific committed historical tick.
Tick {
/// Zero-based historical tick index.
tick: u64,
},
}

/// Declared semantic frame for an observation.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum ObservationFrame {
/// Commit-boundary metadata and snapshots.
CommitBoundary,
/// Recorded truth emitted by committed history.
RecordedTruth,
/// Query-shaped observation frame.
QueryView,
}

/// Requested observation projection.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(tag = "kind", rename_all = "snake_case")]
pub enum ObservationProjection {
/// Head metadata at the resolved coordinate.
Head,
/// Snapshot metadata at the resolved coordinate.
Snapshot,
/// Recorded truth channel payloads.
TruthChannels {
/// Optional channel filter. `None` means all recorded channels.
channels: Option<Vec<Vec<u8>>>,
},
/// Query payload placeholder.
Query {
/// Stable query identifier.
query_id: u32,
/// Canonical vars payload bytes.
vars_bytes: Vec<u8>,
},
}

/// Canonical observation request DTO.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct ObservationRequest {
/// Requested worldline coordinate.
pub coordinate: ObservationCoordinate,
/// Declared read frame.
pub frame: ObservationFrame,
/// Requested projection within that frame.
pub projection: ObservationProjection,
}

/// Resolved coordinate returned with every observation artifact.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct ResolvedObservationCoordinate {
/// Observation contract version.
pub observation_version: u32,
/// Worldline actually observed.
pub worldline_id: Vec<u8>,
/// Original coordinate selector from the request.
pub requested_at: ObservationAt,
/// Concrete resolved committed tick.
pub resolved_tick: u64,
/// Canonical state root at the resolved coordinate.
pub state_root: Vec<u8>,
/// Canonical commit hash at the resolved coordinate.
pub commit_hash: Vec<u8>,
}

/// Minimal head observation payload.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct HeadObservation {
/// Current committed tick count at the observed frontier.
pub tick: u64,
/// Graph-only state hash (32 bytes).
pub state_root: Vec<u8>,
/// Canonical commit hash (32 bytes).
pub commit_id: Vec<u8>,
}

/// Minimal historical snapshot payload.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct SnapshotObservation {
/// Historical tick index being observed.
pub tick: u64,
/// Graph-only state hash (32 bytes).
pub state_root: Vec<u8>,
/// Canonical commit hash (32 bytes).
pub commit_id: Vec<u8>,
}

/// Observation payload variants returned by the kernel.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(tag = "kind", rename_all = "snake_case")]
pub enum ObservationPayload {
/// Head payload.
Head {
/// Head observation.
head: HeadObservation,
},
/// Snapshot payload.
Snapshot {
/// Snapshot observation.
snapshot: SnapshotObservation,
},
/// Recorded truth payload.
TruthChannels {
/// Recorded channel payloads.
channels: Vec<ChannelData>,
},
/// Query payload.
QueryBytes {
/// Raw query result bytes.
data: Vec<u8>,
},
}

/// Canonical hash input for an observation artifact.
///
/// This excludes `artifact_hash` itself so kernels can compute the hash over
/// the resolved coordinate, frame, projection, and canonical payload bytes.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct ObservationHashInput {
/// Resolved coordinate metadata.
pub resolved: ResolvedObservationCoordinate,
/// Declared semantic frame.
pub frame: ObservationFrame,
/// Declared projection.
pub projection: ObservationProjection,
/// Observation payload.
pub payload: ObservationPayload,
}

/// Full observation artifact returned by `observe(...)`.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct ObservationArtifact {
/// Resolved coordinate metadata.
pub resolved: ResolvedObservationCoordinate,
/// Declared semantic frame.
pub frame: ObservationFrame,
/// Declared projection.
pub projection: ObservationProjection,
/// Canonical artifact hash.
pub artifact_hash: Vec<u8>,
/// Observation payload.
pub payload: ObservationPayload,
}

/// Response from [`KernelPort::drain_view_ops`].
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct DrainResponse {
Expand Down Expand Up @@ -234,6 +407,17 @@ pub trait KernelPort {
/// after stepping. A budget of 0 is a no-op that returns the current head.
fn step(&mut self, budget: u32) -> Result<StepResponse, AbiError>;

/// Observe a worldline at an explicit coordinate and frame.
///
/// The default implementation reports that the observation contract is not
/// supported by this kernel implementation.
fn observe(&self, _request: ObservationRequest) -> Result<ObservationArtifact, AbiError> {
Err(AbiError {
code: error_codes::NOT_SUPPORTED,
message: "observe is not supported by this kernel".into(),
})
}

/// Drain materialized ViewOps channels since the last drain.
///
/// Returns finalized channel data. Calling drain twice without an
Expand Down
Loading
Loading