feat(sdk): complete Task 8 — mocks, simulator, inspector#5
Conversation
…point inspector Implement the three remaining Task 8 deliverables: - Capability mocks (sdk/igor/mock/): pluggable MockBackend for native testing without WASM, deterministic clock/rand, log capture. Split hostcall wrappers into build-tagged files (WASM vs native). - Local simulator (internal/simulator/): single-process WASM runner with deterministic hostcalls, per-tick replay verification, checkpoint round-trip verification. CLI flags: --simulate, --ticks, --verify, --deterministic, --seed. - Checkpoint inspector (internal/inspector/): parse and display checkpoint files with hex dump, WASM hash verification. CLI flags: --inspect-checkpoint, --inspect-wasm. Update docs: ROADMAP.md, IMPLEMENTATION_STATUS.md, README.md to reflect Task 8 completion. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 669b7abe7f
ℹ️ 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".
| func loadManifest(cfg Config) []byte { | ||
| mPath := cfg.ManifestPath | ||
| if mPath == "" && cfg.WASMPath != "" { | ||
| mPath = cfg.WASMPath[:len(cfg.WASMPath)-len(".wasm")] + ".manifest.json" |
There was a problem hiding this comment.
Validate .wasm suffix before deriving manifest path
When ManifestPath is empty, this code slices cfg.WASMPath by len(".wasm") without checking that the input is long enough or actually ends with .wasm. A simulator run with a nonstandard filename (for example agent or any short path) can panic with an out-of-range slice, and other non-.wasm names derive an incorrect manifest path, causing confusing fallback behavior instead of a normal validation error.
Useful? React with 👍 / 👎.
| if *simulate && *runAgent != "" { | ||
| runSimulator(*runAgent, *manifestPath, *budgetFlag, *simTicks, *simVerify, *simDeterministic, *simSeed) |
There was a problem hiding this comment.
Fail fast when --simulate is missing --run-agent
The simulator mode is only entered when both flags are set, so --simulate by itself is silently ignored and execution falls through to normal node startup. In CLI automation this can unexpectedly start the full daemon/P2P flow and hang instead of immediately telling the user that --run-agent is required for simulation.
Useful? React with 👍 / 👎.
Implements the remaining optimization items from IMPROVEMENTS.md: - #9 Arena-backed event log allocation to reduce GC pressure - #3 Observation-weighted snapshot retention (replaces FIFO eviction) - #5 Configurable replay divergence escalation (log/pause/intensify/migrate) - #4 Multi-tick chain replay verification (N ticks in single wazero instance) - #7 SDK checkpoint serialization helpers (Encoder/Decoder with chainable API) - #6 Adaptive tick rate with agent hint (Tick() returns bool, 10ms/1s intervals) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implements the remaining optimization items from IMPROVEMENTS.md: - #9 Arena-backed event log allocation to reduce GC pressure - #3 Observation-weighted snapshot retention (replaces FIFO eviction) - #5 Configurable replay divergence escalation (log/pause/intensify/migrate) - #4 Multi-tick chain replay verification (N ticks in single wazero instance) - #7 SDK checkpoint serialization helpers (Encoder/Decoder with chainable API) - #6 Adaptive tick rate with agent hint (Tick() returns bool, 10ms/1s intervals) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Summary
sdk/igor/mock/): pluggableMockBackendfor nativego testwithout WASM compilation, with deterministic clock/rand and log capture. Hostcall wrappers split into build-tagged files (WASM vs native).internal/simulator/): single-process WASM runner with deterministic hostcalls, per-tick replay verification, and checkpoint round-trip verification. New CLI flags:--simulate,--ticks,--verify,--deterministic,--seed.internal/inspector/): parse and display checkpoint files with hex dump and WASM hash verification. New CLI flags:--inspect-checkpoint,--inspect-wasm.This completes all Task 8 (Agent SDK & Developer Experience) deliverables.
Test plan
go test ./sdk/igor/mock/...— 12 mock tests pass (no TinyGo needed)go test ./internal/inspector/...— 8 inspector tests pass (no TinyGo needed)go test ./internal/simulator/...— 5 simulator integration tests pass (TinyGo required, skipped if absent)make check— full fmt + vet + lint + test suite passes (verified by pre-commit hook)🤖 Generated with Claude Code