Skip to content

feat(autoresearch): add --frames N multi-frame capture - #2293

Merged
zackees merged 1 commit into
masterfrom
feat/autoresearch-frames
Apr 18, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/autoresearch-frames

Conversation

@zackees

@zackees zackees commented Apr 18, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Adds --frames N (1-16) to bash autoresearch for back-to-back show()/capture cycles per pattern.
  • Defaults to 2 when --spi is used, 1 otherwise — exposes second-frame degradation bugs where a driver corrupts or zeroes its DMA buffer after the first show().
  • Plumbed end-to-end: CLI → Python JSON-RPC → firmware runSingleTest → MultiRunConfig.num_runs.
  • Reports per-pattern runNumber and adds frames=N to the header when frameCount > 1.

Context: issues #2254 and #2288 — ESP32-S3 SPI "black frame between displays".

Test plan

  • uv run pytest ci/tests/test_autoresearch_phases.py
  • bash autoresearch --spi locally — confirm defaults to frames=2 and reports runNumber on failure
  • bash autoresearch --parlio --frames 1 — confirm override works
  • CI green on the branch

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added --frames command-line option to configure capture frame count (1–16) per test
    • SPI driver defaults to 2 frames; other drivers default to 1 unless explicitly set
    • Enhanced test output now displays frame count and run details for improved diagnostics

Adds back-to-back show()/capture cycles per pattern to expose second-frame
degradation bugs where a driver corrupts or zeroes its DMA buffer after
the first show() (see #2254, #2288 — ESP32-S3 SPI "black frame between
displays").

- CLI: --frames N (1-16), defaults 2 for --spi, 1 otherwise
- JSON-RPC: frameCount field in runSingleTest params (bounds-checked)
- Firmware: wires num_runs_per_pattern into MultiRunConfig.num_runs
- Reporting: per-pattern runNumber + frames=N header when frameCount>1

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Apr 18, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 204f376e-7a95-446c-a4bc-cee4aaba27c2

📥 Commits

Reviewing files that changed from the base of the PR and between 73cd62b and 1fd2ef8.

📒 Files selected for processing (7)
  • ci/autoresearch/args.py
  • ci/autoresearch/context.py
  • ci/autoresearch/phases.py
  • ci/tests/test_autoresearch_phases.py
  • examples/AutoResearch/AutoResearchRemote.cpp
  • examples/AutoResearch/AutoResearchTest.cpp
  • examples/AutoResearch/AutoResearchTest.h

📝 Walkthrough

Walkthrough

A comprehensive feature addition enabling multi-frame capture configuration in AutoResearch. Changes span CLI argument parsing for frame count (1–16), driver-dependent defaults in command building, RPC payload extensions for frame metadata, and C++ test execution support for parameterized multiple runs per pattern.

Changes

Cohort / File(s) Summary
CLI Argument Parsing
ci/autoresearch/args.py, ci/tests/test_autoresearch_phases.py
Added frames: int | None field to Args dataclass and wired --frames CLI option accepting values 1–16; test helper updated to include frames=None default in constructor.
Command Building & Display
ci/autoresearch/phases.py, ci/autoresearch/context.py
phases.py computes frameCount from args.frames with driver-dependent defaults (SPI→2, others→1) and injects it into test commands when > 1. context.py conditionally displays frameCount in headers and runNumber per pattern in output.
RPC Endpoint Implementation
examples/AutoResearch/AutoResearchRemote.cpp
Added frameCount parameter validation (1–16), threaded validated frame count through test execution calls, and extended RPC response to include frameCount and per-pattern runNumber fields.
Test Execution Backend
examples/AutoResearch/AutoResearchTest.h, examples/AutoResearch/AutoResearchTest.cpp
Updated autoResearchChipsetTiming(...) and autoResearchChipsetTimingLegacy(...) signatures to accept int num_runs_per_pattern parameter; implementation now configures multi-run execution with per-frame results tracking when frame count > 1.

Sequence Diagram

sequenceDiagram
    participant User as User/CLI
    participant Parser as Arg Parser
    participant CmdBuilder as Command Builder
    participant RPC as RPC Server
    participant TestExec as Test Executor
    participant Results as Result Aggregator

    User->>Parser: --frames N (1-16)
    Parser->>CmdBuilder: Args(frames=N)
    CmdBuilder->>CmdBuilder: Compute frameCount (driver-dependent defaults)
    CmdBuilder->>RPC: runSingleTest(..., frameCount)
    RPC->>RPC: Validate frameCount in [1, 16]
    RPC->>TestExec: Execute with num_runs_per_pattern
    TestExec->>TestExec: Run pattern N times, capture per-frame results
    TestExec->>Results: Aggregate runs with runNumber
    Results->>RPC: {frameCount, patterns[{runNumber, ...}]}
    RPC->>User: Display results with frame metadata
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

Possibly related issues

Poem

🐰 With frames now flowing from cli to cpp,
Each capture spawns its sibling's step,
One, two, or more—the rabbit hops through,
Degradation caught in frame number two! 📹✨

✨ 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/autoresearch-frames

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.

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