Skip to content

feat: complete phase 8 runtime schema freeze#306

Open
flyingrobots wants to merge 19 commits intomainfrom
feat/adr-0008-0009-phase-8
Open

feat: complete phase 8 runtime schema freeze#306
flyingrobots wants to merge 19 commits intomainfrom
feat/adr-0008-0009-phase-8

Conversation

@flyingrobots
Copy link
Owner

@flyingrobots flyingrobots commented Mar 23, 2026

Summary

  • freeze the ADR-0008 runtime schema locally under schemas/runtime/ with validation and conformance docs
  • introduce echo-runtime-schema as the shared home for the frozen logical counters and core runtime ids/key
  • keep Wesley generation explicitly deferred while upstream is unstable, and close out Phase 8 on that honest boundary

Verification

  • cargo test -p echo-runtime-schema --message-format short
  • cargo test -p echo-wasm-abi --message-format short
  • cargo test -p warp-core --lib --message-format short
  • cargo test -p warp-wasm --features engine --lib --message-format short
  • cargo fmt --all --check
  • pnpm schema:runtime:check
  • npx markdownlint-cli2 docs/plans/adr-0008-and-0009.md docs/plans/phase-8-schema-freeze-inventory.md docs/plans/phase-8-runtime-schema-conformance.md docs/plans/phase-8-runtime-schema-mapping-contract.md schemas/runtime/README.md

Summary by CodeRabbit

  • New Features

    • Added a shared runtime-schema crate with typed opaque IDs, logical counters, and GraphQL runtime fragments for a frozen runtime surface.
  • Refactor

    • Replaced many raw byte identifier usages with typed opaque ID types across ABI and core codepaths to strengthen type safety and serialization.
  • Documentation

    • Phase 8 schema freeze, conformance audit, mapping contract, fragment README, and spec/guide updates added.
  • Tests

    • Runtime schema validation CLI and CI/test hooks added; CBOR/ABI tests extended.
  • Chores

    • Editor settings tracked, .gitignore adjusted, npm script and prettier added.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 23, 2026

📝 Walkthrough

Walkthrough

Adds a new crate crates/echo-runtime-schema providing opaque 32-byte IDs, logical counters, and composite keys; migrates local newtypes in warp-core and echo-wasm-abi to re-export/use those types; introduces GraphQL runtime schema fragments and a validator; updates workspace manifests, editor settings, scripts, and tests to use the typed runtime schema.

Changes

Cohort / File(s) Summary
Workspace & Editor config
\.gitignore, .vscode/settings.json, Cargo.toml, package.json
Ignore target-ra/, track .vscode/settings.json; add crates/echo-runtime-schema workspace member and workspace dependency; add schema:runtime:check npm script and Prettier dev dep.
New crate: echo-runtime-schema
crates/echo-runtime-schema/Cargo.toml, crates/echo-runtime-schema/README.md, crates/echo-runtime-schema/src/lib.rs
New crate exposing WorldlineId, HeadId (opaque 32-byte), logical counters (WorldlineTick, GlobalTick, RunId), WriterHeadKey, feature/serde gating and unit tests.
echo-wasm-abi
crates/echo-wasm-abi/Cargo.toml, crates/echo-wasm-abi/src/kernel_port.rs, crates/echo-wasm-abi/src/lib.rs, crates/echo-wasm-abi/src/codec.rs
Depend on echo-runtime-schema (workspace, serde feature); replace raw Vec<u8> ID fields with typed IDs; add canonical 32-byte opaque (de)serialization and CBOR tests; small codec change using ToOwned::to_owned.
warp-core library refactors
crates/warp-core/Cargo.toml, crates/warp-core/src/clock.rs, crates/warp-core/src/head.rs, crates/warp-core/src/worldline.rs, crates/warp-core/src/observation.rs
Remove local newtypes and re-export echo_runtime_schema types; adapt head/worldline construction to from_bytes and use WriterHeadKey.
warp-wasm changes
crates/warp-wasm/src/lib.rs, crates/warp-wasm/src/warp_kernel.rs
Tests and kernel helpers updated to use typed ABI IDs (AbiWorldlineId/AbiHeadId) and convert to WorldlineId/HeadId via infallible converters; parse helpers simplified to use typed ABI structs.
GraphQL runtime schema fragments
schemas/runtime/*.graphql, schemas/runtime/README.md
Add Phase‑8 fragments defining opaque scalars, ticks, WriterHeadKey, routing/admission, playback control, and scheduler results; README documents validation and workflow.
Schema validation tooling & tests
scripts/validate-runtime-schema-fragments.mjs, scripts/verify-local.sh, tests/hooks/test_runtime_schema_validation.sh
New validator (Prettier check, duplicate-definition and reference-resolution checks), integrated into local verify script and a test hook.
Docs & Phase‑8 planning
docs/plans/adr-0008-and-0009.md, docs/plans/phase-8-*.md
Update Phase‑8 status, mapping contract, conformance audit, and freeze inventory to reflect centralized runtime schema ownership and scope.
Dependency / DAG tooling & tests
docs/dependency-dags.md, scripts/check-append-only.js, scripts/generate-dependency-dags.js, scripts/generate-tasks-dag.js, tests/hooks/test_dependency_dags.sh
Switch default TASKS-DAG path to docs/archive/tasks/TASKS-DAG.md, adjust scripts and append-only checks, add test harness for DAG generation.
Tests & small consumers
multiple crates/* tests and crates/ttd-browser/*
Widespread test updates to construct IDs via WorldlineId::from_bytes(...) and to use as_bytes() accessors; update MBUS headers and golden vectors accordingly.
Spec & CHANGELOG & CONTRIBUTING
docs/spec/SPEC-0009-wasm-abi-v3.md, CHANGELOG.md, CONTRIBUTING.md
Spec updated to show WorldlineId/HeadId typed in wire docs (still serialized as bytes(32)); changelog and contributing notes updated to mention workspace settings and tooling.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant WasmABI as "echo-wasm-abi (ABI layer)"
  participant WarpCore as "warp-core"
  participant Schema as "echo-runtime-schema"

  Client->>WasmABI: pack ControlIntentV1{ WriterHeadKey(AbiWorldlineId, AbiHeadId) }
  WasmABI->>Schema: AbiWorldlineId -> WorldlineId (from_bytes)
  WasmABI->>Schema: AbiHeadId -> HeadId (from_bytes)
  WasmABI->>WarpCore: deliver ControlIntent{ WriterHeadKey(WorldlineId, HeadId) }
  WarpCore->>Schema: use GlobalTick/RunId/WorldlineTick types
  WarpCore-->>Client: acknowledge / process result
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

tooling

Poem

🧩 Bytes wrapped tidy, counters set to run,
Schemas frozen, fragments checked, one crate for many to shun.
Tests remade to call .from_bytes and .as_bytes true,
Packs and parses tightened — runtime types renew. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.13% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly matches the main changeset objective: completing the Phase 8 runtime schema freeze by introducing echo-runtime-schema, freezing ADR-0008 types in schemas/runtime/, and deferring Wesley generation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/adr-0008-0009-phase-8

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2af8725a51

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.gitignore:
- Line 24: Remove the .gitignore exception for .vscode/settings.json or replace
the hardcoded Unix path in that settings file (/tmp/echo-rust-analyzer-target)
with a cross-platform solution: either use a relative path (e.g.,
target/rust-analyzer) or reference an environment-variable fallback (e.g.,
${RA_TARGET_DIR}) so Windows users aren’t broken; then update CONTRIBUTING.md to
document the chosen approach and any editor setup steps and expected optional vs
committed settings so contributors know whether to commit their .vscode settings
or keep local overrides.

In @.vscode/settings.json:
- Around line 2-4: Replace the absolute /tmp path in the rust-analyzer config so
it is repository-relative and portable: update the
"rust-analyzer.cargo.extraEnv" entry to set CARGO_TARGET_DIR to a repo-local
directory name (e.g. "target-ra") instead of "/tmp/echo-rust-analyzer-target" to
avoid platform, collision and permission issues; also add the chosen directory
(e.g. target-ra/) to .gitignore near the existing target-* entries so build
artifacts are not committed.

In `@crates/echo-runtime-schema/src/lib.rs`:
- Around line 75-89: WorldlineId exposes as_bytes() but lacks a symmetric
constructor like HeadId::from_bytes, forcing callers to construct it via the
public tuple field; add a const constructor WorldlineId::from_bytes(bytes:
RuntimeIdBytes) -> Self to provide a stable API surface matching HeadId and make
construction explicit and ergonomic alongside the existing as_bytes() method.

In `@crates/echo-wasm-abi/Cargo.toml`:
- Line 21: The Cargo.toml for echo-wasm-abi is forwarding the crate feature
"std" to serde, ciborium and half but not to echo-runtime-schema, so when
building with --features std the schema crate still compiles no-std; fix this by
updating the echo-runtime-schema dependency entry in Cargo.toml to enable its
std feature (mirror how serde/ciborium/half are forwarded) — e.g. change the
echo-runtime-schema declaration to include features = ["std"] (and workspace =
true as already present) so the schema types compile with std when the crate's
std feature is enabled.

In `@schemas/runtime/artifact-b-routing-and-admission.graphql`:
- Around line 111-114: The schema's InboxPolicyBudgeted.maxPerTick field is
documented to be positive but uses plain Int, so enforce the positivity either
by introducing/using a PositiveInt custom scalar in the schema and replacing
maxPerTick: Int! with maxPerTick: PositiveInt! (and add its implementation), or
add explicit runtime validation in the resolver/input handling for the
InboxPolicyBudgeted type that throws a GraphQLError when maxPerTick <= 0;
reference the type name InboxPolicyBudgeted and the field name maxPerTick when
making the change so callers/validators are updated accordingly.

In `@scripts/generate-dependency-dags.js`:
- Around line 562-565: The fallback never runs because parseArgs sets
args.tasksDagPath to the string "TASKS-DAG.md"; update the parseArgs option for
--tasks-dag (the default value for tasksDagPath) to undefined (or remove the
default) so args.tasksDagPath is nullish when the flag is not provided, and keep
the existing tasksDagPath resolution using: const tasksDagPath =
path.resolve(process.cwd(), args.tasksDagPath ??
path.join("docs","archive","tasks","TASKS-DAG.md")); this ensures the fallback
to docs/archive/tasks/TASKS-DAG.md is used.

In `@scripts/verify-local.sh`:
- Around line 710-717: The loop variable name md_file is misleading because the
loop iterates CHANGED_FILES looking for .graphql/.mjs files; rename md_file to a
clearer identifier like changed_file or file_in_changes inside the while loop
and update all references (the case pattern matching and any uses that set
should_validate_runtime_schema) so the logic remains identical but the variable
name accurately reflects it (look for occurrences of CHANGED_FILES, md_file, and
should_validate_runtime_schema to update).
- Around line 732-735: The script calls "node
scripts/validate-runtime-schema-fragments.mjs" when the variable
should_validate_runtime_schema is set but does not verify Node is installed;
update the if-block that checks should_validate_runtime_schema to first verify
Node is available (e.g., use a command existence check against "node"), and if
missing print a clear error and exit non‑zero before attempting to run
validate-runtime-schema-fragments.mjs; reference the existing
should_validate_runtime_schema check and the node invocation so you modify that
branch only.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2cd2f967-fe13-426c-abc7-972cd5c1af2d

📥 Commits

Reviewing files that changed from the base of the PR and between 12b4cab and 2af8725.

⛔ Files ignored due to path filters (3)
  • Cargo.lock is excluded by !**/*.lock
  • docs/assets/dags/tasks-dag.dot is excluded by !**/*.dot
  • docs/assets/dags/tasks-dag.svg is excluded by !**/*.svg
📒 Files selected for processing (34)
  • .gitignore
  • .vscode/settings.json
  • Cargo.toml
  • crates/echo-runtime-schema/Cargo.toml
  • crates/echo-runtime-schema/README.md
  • crates/echo-runtime-schema/src/lib.rs
  • crates/echo-wasm-abi/Cargo.toml
  • crates/echo-wasm-abi/src/kernel_port.rs
  • crates/echo-wasm-abi/src/lib.rs
  • crates/warp-core/Cargo.toml
  • crates/warp-core/src/clock.rs
  • crates/warp-core/src/head.rs
  • crates/warp-core/src/observation.rs
  • crates/warp-core/src/worldline.rs
  • crates/warp-wasm/src/lib.rs
  • crates/warp-wasm/src/warp_kernel.rs
  • docs/dependency-dags.md
  • docs/plans/adr-0008-and-0009.md
  • docs/plans/phase-8-runtime-schema-conformance.md
  • docs/plans/phase-8-runtime-schema-mapping-contract.md
  • docs/plans/phase-8-schema-freeze-inventory.md
  • docs/spec/SPEC-0009-wasm-abi-v3.md
  • package.json
  • schemas/runtime/README.md
  • schemas/runtime/artifact-a-identifiers.graphql
  • schemas/runtime/artifact-b-routing-and-admission.graphql
  • schemas/runtime/artifact-c-playback-control.graphql
  • schemas/runtime/artifact-d-scheduler-results.graphql
  • scripts/check-append-only.js
  • scripts/generate-dependency-dags.js
  • scripts/generate-tasks-dag.js
  • scripts/validate-runtime-schema-fragments.mjs
  • scripts/verify-local.sh
  • tests/hooks/test_runtime_schema_validation.sh

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@crates/echo-runtime-schema/src/lib.rs`:
- Around line 76-89: Make WorldlineId's inner field private (remove pub from the
tuple field) and add a constructor method
WorldlineId::from_bytes(RuntimeIdBytes) -> Self (preferably const fn) that
constructs the new opaque id; keep the existing as_bytes(&self) returning
&RuntimeIdBytes. This mirrors HeadId's opacity and provides a canonical factory
to replace direct tuple construction (update tests and call sites from
WorldlineId([...]) to WorldlineId::from_bytes([...])). Ensure all references use
the new constructor and that RuntimeIdBytes remains the parameter/return type.

In `@scripts/generate-dependency-dags.js`:
- Around line 173-175: The fallback date label uses local-time formatting via
formatDateYYYYMMDD(new Date()), causing non-deterministic labels across
timezones; change this to produce a UTC-based date string instead—either update
formatDateYYYYMMDD to use getUTCFullYear/getUTCMonth/getUTCDate or call a new
UTC-aware helper (e.g., formatDateYYYYMMDDUTC) from the fallback assignment that
uses new Date() but formats with UTC methods; ensure the code referencing
generatedAt and the fallback const still returns { mode: "date", label:
<UTC-formatted-string> } so snapshot labels are consistent across environments.

In `@tests/hooks/test_dependency_dags.sh`:
- Line 92: The test's grep is brittle because it looks for the exact attribute
ordering 'i1 -> i2 \[color="red"' in tests/hooks/test_dependency_dags.sh; change
the check that uses that literal grep to a more flexible pattern that matches an
edge line for "i1 -> i2" with a bracketed attribute list that contains
color="red" anywhere (e.g., use a regex like i1 -> i2 \[[^]]*color="red"[^]]*\]
or equivalent POSIX/egrep form) so the assertion no longer depends on attribute
ordering while still verifying the color attribute is present.
- Around line 88-91: Before invoking node on scripts/generate-dependency-dags.js
in the temp workspace ($tmpdir), create a package.json that sets the module type
so Node treats files as ESM; add a step to write a package.json with
{"type":"module"} into $tmpdir (i.e., create the file in the same block that cds
into "$tmpdir" before running node scripts/generate-dependency-dags.js
>"$output_file" 2>&1) so the import-based script runs under ESM semantics.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 685201e4-296b-43db-a931-e4069b76a073

📥 Commits

Reviewing files that changed from the base of the PR and between 2af8725 and 0dc6f36.

📒 Files selected for processing (8)
  • crates/echo-runtime-schema/Cargo.toml
  • crates/echo-runtime-schema/README.md
  • crates/echo-runtime-schema/src/lib.rs
  • crates/echo-wasm-abi/Cargo.toml
  • crates/warp-core/Cargo.toml
  • docs/guide/cargo-features.md
  • scripts/generate-dependency-dags.js
  • tests/hooks/test_dependency_dags.sh

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@CONTRIBUTING.md`:
- Line 106: Replace the machine-specific absolute path
"/Users/james/git/echo/.vscode/settings.json" in the CONTRIBUTING.md sentence
with a repo-relative link to the tracked config, e.g. use
[.vscode/settings.json] (or ./ .vscode/settings.json) so the link works for all
users and does not expose a local filesystem path.

In `@crates/ttd-browser/src/lib.rs`:
- Around line 1206-1210: Update the wasm32 test accessors to match the new
WorldlineId API: replace any use of tuple-field access like wl.0 with the new
method call *wl.as_bytes(). Specifically, change occurrences in
wasm_tests::test_parse_helpers (and related wasm32 tests) that read wl.0 to use
*wl.as_bytes(), and adjust test_parse_worldline_id_inner_valid expectations to
remain consistent with that API.

In `@crates/warp-core/src/provenance_store.rs`:
- Line 2564: Multiple fork tests repeat the literal [99u8; 32] when constructing
WorldlineId via WorldlineId::from_bytes([99u8; 32]); introduce a single test
fixture (either a const like TEST_WORLDLINE_BYTES: [u8; 32] = [99u8; 32] or a
helper fn like test_worldline_id() -> WorldlineId that calls
WorldlineId::from_bytes(TEST_WORLDLINE_BYTES)) and replace each occurrence of
WorldlineId::from_bytes([99u8; 32]) (seen in the file where
WorldlineId::from_bytes is used around the fork tests) with the shared
constant/helper to avoid duplication and reduce drift risk.

In `@schemas/runtime/artifact-a-identifiers.graphql`:
- Around line 49-55: The PositiveInt scalar currently only guarantees "greater
than zero" but must be documented to map to Rust's u32 range; update the
mapping/docs for PositiveInt to explicitly state it represents the full u32
range (1–4,294,967,295) and note that cycle_limit (Option<u32>) and fields
cycleLimit / maxPerTick consume this scalar, so generators that treat GraphQL
Int as 32-bit signed need the explicit u32 upper-bound to accept values above
2,147,483,647; reference PositiveInt, cycle_limit, cycleLimit, maxPerTick and
Option<u32> in the doc update.

In `@schemas/runtime/artifact-b-routing-and-admission.graphql`:
- Around line 67-69: Unify the field name for the exact-head coordinate across
the schema by renaming ExactHeadTarget.key to match IngressTargetInput.headKey
(or vice versa) before the schema freeze; update the GraphQL type definitions
(e.g., ExactHeadTarget and IngressTargetInput) so both use the identical field
name (headKey or key), adjust any associated input/output types and usages in
the same file (including the occurrences around lines 84-89), and ensure all
references, resolvers, and generated DTO/mapper expectations are updated
accordingly so the schema is consistent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: eb4deab0-eee9-46a7-a5e6-0b13108d7c51

📥 Commits

Reviewing files that changed from the base of the PR and between 0dc6f36 and 21a683e.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (36)
  • .gitignore
  • .vscode/settings.json
  • CHANGELOG.md
  • CONTRIBUTING.md
  • crates/echo-dind-harness/tests/digest_golden_vectors.rs
  • crates/echo-runtime-schema/src/lib.rs
  • crates/echo-wasm-abi/Cargo.toml
  • crates/echo-wasm-abi/src/codec.rs
  • crates/ttd-browser/src/lib.rs
  • crates/warp-core/src/coordinator.rs
  • crates/warp-core/src/engine_impl.rs
  • crates/warp-core/src/head.rs
  • crates/warp-core/src/head_inbox.rs
  • crates/warp-core/src/observation.rs
  • crates/warp-core/src/playback.rs
  • crates/warp-core/src/provenance_store.rs
  • crates/warp-core/src/snapshot.rs
  • crates/warp-core/src/worldline.rs
  • crates/warp-core/src/worldline_registry.rs
  • crates/warp-core/src/worldline_state.rs
  • crates/warp-core/tests/checkpoint_fork_tests.rs
  • crates/warp-core/tests/common/mod.rs
  • crates/warp-core/tests/golden_vectors_phase0.rs
  • crates/warp-core/tests/inbox.rs
  • crates/warp-core/tests/invariant_property_tests.rs
  • crates/warp-core/tests/outputs_playback_tests.rs
  • crates/warp-core/tests/slice_theorem_proof.rs
  • crates/warp-wasm/src/warp_kernel.rs
  • docs/guide/cargo-features.md
  • package.json
  • schemas/runtime/artifact-a-identifiers.graphql
  • schemas/runtime/artifact-b-routing-and-admission.graphql
  • schemas/runtime/artifact-d-scheduler-results.graphql
  • scripts/generate-dependency-dags.js
  • scripts/verify-local.sh
  • tests/hooks/test_dependency_dags.sh


### Shared Workspace Settings

- The repo tracks a minimal [.vscode/settings.json](/Users/james/git/echo/.vscode/settings.json) for project-safe tooling settings only.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Replace machine-specific absolute path with a repo-relative link.

Line 106 currently points to /Users/james/git/echo/.vscode/settings.json, which is broken for everyone except one local machine and leaks local path details.

🔧 Proposed fix
-- The repo tracks a minimal [.vscode/settings.json](/Users/james/git/echo/.vscode/settings.json) for project-safe tooling settings only.
+- The repo tracks a minimal [.vscode/settings.json](.vscode/settings.json) for project-safe tooling settings only.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- The repo tracks a minimal [.vscode/settings.json](/Users/james/git/echo/.vscode/settings.json) for project-safe tooling settings only.
- The repo tracks a minimal [.vscode/settings.json](.vscode/settings.json) for project-safe tooling settings only.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@CONTRIBUTING.md` at line 106, Replace the machine-specific absolute path
"/Users/james/git/echo/.vscode/settings.json" in the CONTRIBUTING.md sentence
with a repo-relative link to the tracked config, e.g. use
[.vscode/settings.json] (or ./ .vscode/settings.json) so the link works for all
users and does not expose a local filesystem path.

Comment on lines 1206 to 1210
fn test_parse_worldline_id_inner_valid() {
let wl = parse_worldline_id_inner(&[0u8; 32]);
assert!(wl.is_ok());
assert_eq!(wl.unwrap().0, [0u8; 32]);
assert_eq!(*wl.unwrap().as_bytes(), [0u8; 32]);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Complete the wasm32 test migration.

This assertion was updated, but wasm_tests::test_parse_helpers at Line 1110 still reads wl.0. wasm32 test builds will fail until that assertion is switched to *wl.as_bytes().

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/ttd-browser/src/lib.rs` around lines 1206 - 1210, Update the wasm32
test accessors to match the new WorldlineId API: replace any use of tuple-field
access like wl.0 with the new method call *wl.as_bytes(). Specifically, change
occurrences in wasm_tests::test_parse_helpers (and related wasm32 tests) that
read wl.0 to use *wl.as_bytes(), and adjust test_parse_worldline_id_inner_valid
expectations to remain consistent with that API.

let mut store = LocalProvenanceStore::new();
let source = test_worldline_id();
let target = WorldlineId([99u8; 32]);
let target = WorldlineId::from_bytes([99u8; 32]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Reduce repeated literal worldline IDs in fork tests.

[99u8; 32] is repeated across multiple tests. A small test helper/const would reduce drift risk if this fixture value changes later.

Also applies to: 2614-2614, 2782-2782

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/warp-core/src/provenance_store.rs` at line 2564, Multiple fork tests
repeat the literal [99u8; 32] when constructing WorldlineId via
WorldlineId::from_bytes([99u8; 32]); introduce a single test fixture (either a
const like TEST_WORLDLINE_BYTES: [u8; 32] = [99u8; 32] or a helper fn like
test_worldline_id() -> WorldlineId that calls
WorldlineId::from_bytes(TEST_WORLDLINE_BYTES)) and replace each occurrence of
WorldlineId::from_bytes([99u8; 32]) (seen in the file where
WorldlineId::from_bytes is used around the fork tests) with the shared
constant/helper to avoid duplication and reduce drift risk.

Comment on lines +49 to +55
"""
Positive signed integer used where GraphQL `Int` needs an explicit positivity
contract.

Semantic rule: values must be greater than zero.
"""
scalar PositiveInt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
rg -n "PositiveInt|cycleLimit|maxPerTick|u32|2_147_483_647" \
  schemas/runtime docs/plans crates/warp-wasm/src/warp_kernel.rs crates/echo-wasm-abi/src

Repository: flyingrobots/echo

Length of output: 6998


Pin PositiveInt to explicit u32 range (1–4,294,967,295) in mapping documentation.

cycle_limit is Option<u32> and cycleLimit/maxPerTick consume it as PositiveInt. The scalar is defined as "greater than zero" with no upper bound. Without explicit documentation pinning this to u32 semantics, generators treating this as GraphQL Int will reject values above 2,147,483,647. Documentation acknowledges the mapping but labels the positive-value rule as "semantic validation"—clarify the full u32 range constraint.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@schemas/runtime/artifact-a-identifiers.graphql` around lines 49 - 55, The
PositiveInt scalar currently only guarantees "greater than zero" but must be
documented to map to Rust's u32 range; update the mapping/docs for PositiveInt
to explicitly state it represents the full u32 range (1–4,294,967,295) and note
that cycle_limit (Option<u32>) and fields cycleLimit / maxPerTick consume this
scalar, so generators that treat GraphQL Int as 32-bit signed need the explicit
u32 upper-bound to accept values above 2,147,483,647; reference PositiveInt,
cycle_limit, cycleLimit, maxPerTick and Option<u32> in the doc update.

Comment on lines +67 to +69
type ExactHeadTarget {
key: WriterHeadKey!
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Normalize key vs headKey before the schema freeze.

ExactHeadTarget.key and IngressTargetInput.headKey represent the same exact-head coordinate with two different field names. Freezing that asymmetry now will leak into every generated DTO, mapper, and doc set.

Patch
 type ExactHeadTarget {
-    key: WriterHeadKey!
+    headKey: WriterHeadKey!
 }

Also applies to: 84-89

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@schemas/runtime/artifact-b-routing-and-admission.graphql` around lines 67 -
69, Unify the field name for the exact-head coordinate across the schema by
renaming ExactHeadTarget.key to match IngressTargetInput.headKey (or vice versa)
before the schema freeze; update the GraphQL type definitions (e.g.,
ExactHeadTarget and IngressTargetInput) so both use the identical field name
(headKey or key), adjust any associated input/output types and usages in the
same file (including the occurrences around lines 84-89), and ensure all
references, resolvers, and generated DTO/mapper expectations are updated
accordingly so the schema is consistent.

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