-
Notifications
You must be signed in to change notification settings - Fork 1
feat: complete phase 8 runtime schema freeze #306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 14 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
7daf735
docs(phase8): add runtime schema freeze inventory
flyingrobots 219bb15
docs(phase8): define runtime schema artifact set
flyingrobots be8875c
feat(phase8): add runtime schema source fragments
flyingrobots e08a673
feat(phase8): add playback and scheduler schema fragments
flyingrobots 1ec7dee
feat(phase8): validate local runtime schema fragments
flyingrobots fb32e42
docs(phase8): add runtime schema conformance audit
flyingrobots ec4478c
refactor(phase8): align writer head key naming
flyingrobots 096f0c3
docs(phase8): add runtime schema mapping contract
flyingrobots 637c707
refactor(phase8): type ABI runtime identifiers
flyingrobots fa95989
chore(tooling): track shared workspace settings
flyingrobots 6ac3aba
fix(ci): restore tasks dag refresh inputs
flyingrobots 5254e97
refactor(phase8): add shared runtime schema crate
flyingrobots ff7dcc0
docs(phase8): narrow shared runtime schema boundary
flyingrobots 2af8725
docs(phase8): mark runtime schema freeze complete
flyingrobots 0dc6f36
fix(phase8): restore schema feature gating and DAG defaults
flyingrobots 2dfbc21
fix(phase8): harden schema freeze tooling
flyingrobots 2521150
refactor(phase8): make worldline ids opaque
flyingrobots 4cbeacb
docs(phase8): document review follow-ups
flyingrobots 21a683e
docs: note phase 8 review fixes
flyingrobots 67f57c7
docs(backlog): add review tooling follow-ups
flyingrobots 629dccd
fix(phase8): resolve schema review follow-ups
flyingrobots d560ba2
docs(phase8): align review follow-ups
flyingrobots 8a6d83c
fix(phase8): harden schema and ABI freeze contracts
flyingrobots 8476506
fix(phase8): resolve final schema review threads
flyingrobots 22f3f5b
docs(phase8): align final review follow-ups
flyingrobots 2d5fd4f
docs(backlog): queue post-merge review tooling work
flyingrobots db4f8d0
fix(phase8): tighten final tooling review fixes
flyingrobots 3e5e1f6
docs(phase8): align final review wording
flyingrobots 470c190
docs(backlog): queue pre-pr process hardening
flyingrobots File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "rust-analyzer.cargo.extraEnv": { | ||
| "CARGO_TARGET_DIR": "/tmp/echo-rust-analyzer-target" | ||
| } | ||
|
flyingrobots marked this conversation as resolved.
Outdated
|
||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # © James Ross Ω FLYING•ROBOTS <https://github.com/flyingrobots> | ||
| [package] | ||
| name = "echo-runtime-schema" | ||
| version = "0.1.0" | ||
| edition = "2024" | ||
| rust-version = "1.90.0" | ||
| description = "Shared ADR-0008 runtime schema types for Echo" | ||
| license = "Apache-2.0" | ||
| repository = "https://github.com/flyingrobots/echo" | ||
| readme = "README.md" | ||
| keywords = ["echo", "runtime", "schema", "worldline"] | ||
| categories = ["data-structures"] | ||
|
|
||
| [dependencies] | ||
| serde = { version = "1.0", default-features = false, features = ["derive"] } | ||
|
|
||
| [features] | ||
| default = ["std"] | ||
| std = ["serde/std"] | ||
|
|
||
| [lints] | ||
| workspace = true |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| <!-- SPDX-License-Identifier: Apache-2.0 OR LicenseRef-MIND-UCAL-1.0 --> | ||
| <!-- © James Ross Ω FLYING•ROBOTS <https://github.com/flyingrobots> --> | ||
|
|
||
| # echo-runtime-schema | ||
|
|
||
| Shared ADR-0008 runtime schema primitives for Echo. | ||
|
|
||
| This crate is the Echo-local shared owner for runtime-schema types that are not | ||
| inherently ABI-only: | ||
|
|
||
| - opaque runtime identifiers | ||
| - logical monotone counters | ||
| - structural runtime key types | ||
|
|
||
| `warp-core` consumes or re-exports these semantic types. `echo-wasm-abi` | ||
| converts to and from them where the host wire format differs. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,196 @@ | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| // © James Ross Ω FLYING•ROBOTS <https://github.com/flyingrobots> | ||
| //! Shared ADR-0008 runtime schema primitives. | ||
| //! | ||
| //! This crate is the Echo-local shared owner for generated-or-generation-ready | ||
| //! runtime schema types that are not inherently ABI-only: | ||
| //! | ||
| //! - opaque runtime identifiers | ||
| //! - logical monotone counters | ||
| //! - structural runtime key types | ||
| //! | ||
| //! Adapter crates such as `echo-wasm-abi` may still wrap these types when the | ||
| //! host wire format needs a different serialization contract. | ||
|
|
||
| #![cfg_attr(not(feature = "std"), no_std)] | ||
|
|
||
| use core::fmt; | ||
|
|
||
| macro_rules! logical_counter { | ||
| ($(#[$meta:meta])* $name:ident) => { | ||
| $(#[$meta])* | ||
| #[repr(transparent)] | ||
| #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Default, serde::Serialize, serde::Deserialize)] | ||
| #[serde(transparent)] | ||
| pub struct $name(pub u64); | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
|
|
||
| impl $name { | ||
| /// Zero value for this logical counter. | ||
| pub const ZERO: Self = Self(0); | ||
| /// Largest representable counter value. | ||
| pub const MAX: Self = Self(u64::MAX); | ||
|
|
||
| /// Builds the counter from its raw logical value. | ||
| #[must_use] | ||
| pub const fn from_raw(raw: u64) -> Self { | ||
| Self(raw) | ||
| } | ||
|
|
||
| /// Returns the raw logical value. | ||
| #[must_use] | ||
| pub const fn as_u64(self) -> u64 { | ||
| self.0 | ||
| } | ||
|
|
||
| /// Adds `rhs`, returning `None` on overflow. | ||
| #[must_use] | ||
| pub fn checked_add(self, rhs: u64) -> Option<Self> { | ||
| self.0.checked_add(rhs).map(Self) | ||
| } | ||
|
|
||
| /// Subtracts `rhs`, returning `None` on underflow. | ||
| #[must_use] | ||
| pub fn checked_sub(self, rhs: u64) -> Option<Self> { | ||
| self.0.checked_sub(rhs).map(Self) | ||
| } | ||
|
|
||
| /// Increments by one, returning `None` on overflow. | ||
| #[must_use] | ||
| pub fn checked_increment(self) -> Option<Self> { | ||
| self.checked_add(1) | ||
| } | ||
| } | ||
|
|
||
| impl fmt::Display for $name { | ||
| fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
| self.0.fmt(f) | ||
| } | ||
| } | ||
| }; | ||
| } | ||
|
|
||
| /// Canonical 32-byte identifier payload used by shared runtime schema ids. | ||
| pub type RuntimeIdBytes = [u8; 32]; | ||
|
|
||
| /// Opaque stable identifier for a worldline. | ||
| #[repr(transparent)] | ||
| #[derive( | ||
| Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, serde::Serialize, serde::Deserialize, | ||
| )] | ||
| #[serde(transparent)] | ||
| pub struct WorldlineId(pub RuntimeIdBytes); | ||
|
|
||
| impl WorldlineId { | ||
| /// Returns the canonical byte representation of this id. | ||
| #[must_use] | ||
| pub const fn as_bytes(&self) -> &RuntimeIdBytes { | ||
| &self.0 | ||
| } | ||
| } | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| /// Opaque stable identifier for a head. | ||
| #[repr(transparent)] | ||
| #[derive( | ||
| Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, serde::Serialize, serde::Deserialize, | ||
| )] | ||
| #[serde(transparent)] | ||
| pub struct HeadId(RuntimeIdBytes); | ||
|
|
||
| impl HeadId { | ||
| /// Inclusive minimum key used by internal `BTreeMap` range queries. | ||
| pub const MIN: Self = Self([0u8; 32]); | ||
| /// Inclusive maximum key used by internal `BTreeMap` range queries. | ||
| pub const MAX: Self = Self([0xff; 32]); | ||
|
|
||
| /// Reconstructs a head id from its canonical 32-byte representation. | ||
| #[must_use] | ||
| pub const fn from_bytes(bytes: RuntimeIdBytes) -> Self { | ||
| Self(bytes) | ||
| } | ||
|
|
||
| /// Returns the canonical byte representation of this id. | ||
| #[must_use] | ||
| pub const fn as_bytes(&self) -> &RuntimeIdBytes { | ||
| &self.0 | ||
| } | ||
| } | ||
|
|
||
| logical_counter!( | ||
| /// Per-worldline append identity for committed history. | ||
| WorldlineTick | ||
| ); | ||
|
|
||
| logical_counter!( | ||
| /// Runtime-cycle correlation stamp. No wall-clock semantics. | ||
| GlobalTick | ||
| ); | ||
|
|
||
| logical_counter!( | ||
| /// Control-plane generation token for scheduler runs. | ||
| /// | ||
| /// This value is not provenance, replay state, or hash input. | ||
| RunId | ||
| ); | ||
|
|
||
| /// Composite key identifying a writer head within its worldline. | ||
| #[derive( | ||
| Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, serde::Serialize, serde::Deserialize, | ||
| )] | ||
| pub struct WriterHeadKey { | ||
| /// The worldline this head targets. | ||
| pub worldline_id: WorldlineId, | ||
| /// The head identity within that worldline. | ||
| pub head_id: HeadId, | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| #[allow(clippy::unwrap_used)] | ||
| mod tests { | ||
| use super::{GlobalTick, HeadId, RunId, WorldlineId, WorldlineTick, WriterHeadKey}; | ||
|
|
||
| macro_rules! assert_logical_counter_boundaries { | ||
| ($ty:ty) => {{ | ||
| assert_eq!(<$ty>::ZERO.as_u64(), 0); | ||
| assert_eq!(<$ty>::MAX.as_u64(), u64::MAX); | ||
| assert_eq!(<$ty>::from_raw(41).checked_add(1).unwrap().as_u64(), 42); | ||
| assert_eq!(<$ty>::MAX.checked_add(1), None); | ||
| assert_eq!(<$ty>::from_raw(42).checked_sub(1).unwrap().as_u64(), 41); | ||
| assert_eq!(<$ty>::ZERO.checked_sub(1), None); | ||
| assert_eq!(<$ty>::from_raw(7).checked_increment().unwrap().as_u64(), 8); | ||
| assert_eq!(<$ty>::MAX.checked_increment(), None); | ||
| }}; | ||
| } | ||
|
|
||
| #[test] | ||
| fn worldline_tick_checked_arithmetic_boundaries() { | ||
| assert_logical_counter_boundaries!(WorldlineTick); | ||
| } | ||
|
|
||
| #[test] | ||
| fn global_tick_checked_arithmetic_boundaries() { | ||
| assert_logical_counter_boundaries!(GlobalTick); | ||
| } | ||
|
|
||
| #[test] | ||
| fn run_id_checked_arithmetic_boundaries() { | ||
| assert_logical_counter_boundaries!(RunId); | ||
| } | ||
|
|
||
| #[test] | ||
| fn opaque_ids_round_trip_bytes() { | ||
| let worldline = WorldlineId([3u8; 32]); | ||
| let head = HeadId::from_bytes([7u8; 32]); | ||
| assert_eq!(*worldline.as_bytes(), [3u8; 32]); | ||
| assert_eq!(*head.as_bytes(), [7u8; 32]); | ||
| } | ||
|
|
||
| #[test] | ||
| fn writer_head_key_preserves_typed_components() { | ||
| let key = WriterHeadKey { | ||
| worldline_id: WorldlineId([1u8; 32]), | ||
| head_id: HeadId::from_bytes([2u8; 32]), | ||
| }; | ||
| assert_eq!(*key.worldline_id.as_bytes(), [1u8; 32]); | ||
| assert_eq!(*key.head_id.as_bytes(), [2u8; 32]); | ||
| } | ||
| } | ||
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.