test: add Thalamic → corpus-ipc → Brainstem CPU smoke harness - #56
Conversation
LIM-1135 / GH#43. Load an explicit JSON checkpoint, decode published IpcMessage::Stimuli frames (valid_mask included), reject schema incompatibility, and keep the Thalamic fixture healthy when Brainstem is unavailable. Pin corpus-ipc 0.1.0 and MSRV 1.98.1. Co-authored-by: Raul Cardenas Montoya <montoyaraul34@gmail.com>
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Essentials Run ID: 📒 Files selected for processing (13)
✨ Finishing Touches📝 Generate docstrings
✨ Simplify code
Comment |
🤖 CodeAnt AI — Review Status
|
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
This PR successfully adds a CPU-only integration smoke test harness proving that telemetry frames can cross the published corpus-ipc contract into Brainstem runtime without Thalamic owning an SNN. The implementation is comprehensive and well-tested.
Key changes reviewed:
- ✅ New checkpoint loading with explicit validation (schema version, dimensions, finite parameters, non-blank weights)
- ✅ Typed ingress validation for
corpus-ipcmessages with proper width, freshness, and schema checks - ✅ Runtime stats tracking for bounded tick runs in test harnesses
- ✅ Comprehensive test coverage including round-trip validation, error handling, and edge cases
Security & Quality:
- ✅ No hardcoded credentials or sensitive data
- ✅ Proper input validation throughout
- ✅ Error handling follows fail-fast principles
- ✅ Test coverage validates all acceptance criteria
No blocking defects found. The code is production-ready and well-architected.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| Rust | Sep 17, 2026 9:39p.m. | Review ↗ | |
| Secrets | Sep 17, 2026 9:39p.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 106 |
| Duplication | 12 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 22ad7e2099
ℹ️ 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".
There was a problem hiding this comment.
All reported issues were addressed across 18 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
Bugbot Autofix prepared fixes for both issues found in the latest run.
- ✅ Fixed: Rejected frames skip network ticks
- Typed ingress rejects now return skip-ingress Ok(None) instead of Err, so run_tick still advances the network on zeroed stimuli.
- ✅ Fixed: Idle ticks drop held modulators
- EAGAIN and rejected-frame ticks now return the last neuromodulator snapshot so idle steps keep dopamine/cortisol/acetylcholine/tempo.
You can send follow-ups to the cloud agent here.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 22ad7e2. Configure here.
Protocol validation failures (Ping, stale, width, other IpcMessage variants) now skip ingress with Ok(None) instead of Err, so run_tick still advances the SNN. Idle EAGAIN ticks return the last neuromodulator snapshot so dopamine/cortisol/acetylcholine/tempo no longer reset.
There was a problem hiding this comment.
All reported issues were addressed across 1 file (changes from recent commits).
Requires human review: Auto-approval blocked because this review re-detected 1 unresolved issue already reported by Cubic.
Re-trigger cubic
Bring the Thalamic smoke onto current main: Distill sidecar restore (#52/#59), crates.io corpus-ipc 0.1 / neuromod 0.6 (#58), and bounded ingress queues (#51). Keep typed JSON IpcMessage ingress and run_for_ticks. Review fixes: reject future timestamps, count skipped-invalid frames, drain modulator-only ZMQ frames, shutdown the source after a failed flush, try_exists on live checkpoints, preserve session_id/valid_mask, and RAII temp dirs in the smoke harness. Co-authored-by: Raul Cardenas Montoya <montoyaraul34@gmail.com>
Co-authored-by: Raul Cardenas Montoya <montoyaraul34@gmail.com>
…ingress Implement ThalamicProducer::default with explicit healthy fields and have new() call Default so RS-A1008 does not treat default() as a recursive Self constructor. Reuse last_modulators via clone_from in skip_ingress. Co-authored-by: Raul Cardenas Montoya <montoyaraul34@gmail.com>
Split stimulus schema and freshness checks out of accept_stimulus_batch so the function stays under the 50-line limit. Write smoke fixtures under CARGO_TARGET_TMPDIR (or crate target/) instead of the shared system temp dir. Co-authored-by: Raul Cardenas Montoya <montoyaraul34@gmail.com>
Bring in #53 liveness/readiness/degraded health. Keep typed ingress, run_for_ticks/RuntimeStats, valid_mask decoding, and the Codacy fixture temp-dir plus accept_stimulus_batch split. run_tick now reports both health events and smoke counters; run_for_ticks initializes the source the same way as run so ZMQ is not double-connected from the binary. Co-authored-by: Raul Cardenas Montoya <montoyaraul34@gmail.com>
DeepSource RS antipattern: replace map + unwrap_or_else with map_or_else. Co-authored-by: Raul Cardenas Montoya <montoyaraul34@gmail.com>
Co-authored-by: Raul Cardenas Montoya <montoyaraul34@gmail.com>
run_tick would exceed clippy::too-many-arguments after merging #53 health reporting with RuntimeStats. Bundle those observers in TickReport. Co-authored-by: Raul Cardenas Montoya <montoyaraul34@gmail.com>
run and run_for_ticks both connect the stimulus source then validate the restored network. Extract boot_network so health events stay in lockstep and Codacy duplication from the merge stays down. Co-authored-by: Raul Cardenas Montoya <montoyaraul34@gmail.com>
Extract drive_ticks and finish_bounded_run so the bounded smoke entry stays under 50 lines without changing shutdown-on-flush-error behavior. Co-authored-by: Raul Cardenas Montoya <montoyaraul34@gmail.com>

User description
User description
Closes #43 (LIM-1135).
Adds a CPU-only integration smoke that proves a representative telemetry frame can cross the published
corpus-ipc0.1 contract into a loaded Brainstem runtime without Thalamic owning an SNN.Merged onto current
mainafter #53 (liveness / readiness / degraded health). Distill sidecar restore, neuromod 0.6, crates.iocorpus-ipc0.1, bounded ingress queues, the deterministic restart/fault-injection harness, and the health reporter from #53 are kept from main. This PR adds typed JSONIpcMessageingress,run_for_ticks/RuntimeStats, and the Thalamic fixture.What landed
tests/thalamic_brainstem_smoke.rsplustests/fixtures/thalamic_producer.rs(noneuromod/SpikingNetwork).src/ingress/corpus.rs,--features corpus-ipc) overIpcMessage::Stimuli(StimulusBatch): width, freshness, future timestamps,valid_mask,session_id, schema tokencorpus-ipc.stimulus.v1.IpcMessageframes; modulator-only frames are drained in the same tick; rejected frames still advance the network and incrementrejected_batches.BrainstemDaemon::run_for_ticksfor bounded, signal-free ticks (always shuts down the source, even if sink flush fails). It callsStimulusSource::initializethe same wayrundoes after feat(runtime): separate liveness, readiness, and degraded health #53.restore_network); the smoke writes a sidecar fixture rather than a neuromod serde envelope.Review follow-up
Addressed CodeAnt, Codex, cubic, Cursor Bugbot, DeepSource, and Codacy findings: future timestamps, zero-width
new(), safety_healthy clobber, try_exists, clone_from/reuse of modulator buffers, ephemeral ZMQ bind viaget_last_endpoint, RAII temp dirs underCARGO_TARGET_TMPDIR,DefaultforThalamicProducer(explicit healthy fields;new()callsDefault), rejected-frame tick accounting, idle-tick modulator hold, splitting schema/freshness checks out ofaccept_stimulus_batch, andOption::map_or_elsefor the smoke fixture scratch root.How to test
Linear Issue: LIM-1135
Summary by cubic
Closes #43 (LIM-1135). Adds a CPU-only smoke harness where a Thalamic fixture with no spiking network publishes a typed
IpcMessage::Stimuli(StimulusBatch)frame through thecorpus-ipccontract into a loaded Brainstem runtime, gated behind--features corpus-ipcso default stub builds don't needlibzmq. The runtime loadsmodel_pathas a JSON checkpoint instead of silently building a blank network, and ZMQ ingress decodes and validates typed JSON frames instead of the legacy binary readout packet. The smoke runs throughBrainstemDaemon::run_for_ticks.Bug Fixes
IpcMessagevariants; rejected frames are counted but the tick loop still advances the network.try_existserrors fail loudly.session_idandvalid_masksurvive the wire, and modulator-only frames are drained within the same tick.runandrun_for_ticksshare source initialization and checkpoint boot throughboot_network, so a ZMQ source is not double-connected and health events stay in lockstep.Dependencies
corpus-ipc0.1.0 from crates.io with itsIpcMessage/StimulusBatchtypes; the ZMQ SUB source connects viaCORPUS_IPC_ZMQ_READOUT_IPC.corpus-ipc0.1.0 compiles.Written for commit 25f22e4. Summary will update on new commits.
CodeAnt-AI Description
Validate typed stimulus ingress and run bounded Thalamic-to-Brainstem CPU smoke tests
What Changed
corpus-ipcJSON stimulus batches with schema, channel width, timestamp freshness, future-time, and payload validation.Impact
✅ Fewer tick-loop interruptions from invalid IPC frames✅ Clearer rejection of stale, incompatible, or malformed stimuli✅ Preserved missing-channel and neuromodulator state across idle ticks💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.