Skip to content

Groundwork: split camera.rs - #164

Merged
nofuturekid merged 1 commit into
rebuildfrom
fix/162-groundwork-camera-split
Nov 13, 2026
Merged

nofuturekid merged 1 commit into
rebuildfrom
fix/162-groundwork-camera-split

Conversation

@nofuturekid

Copy link
Copy Markdown
Collaborator

Fixes #162

Task 6 of the groundwork plan: splits camera.rs by function. A pure move: no byte sent to the camera, no ioctl, no timing and no command-line output changes.

What changed

  • git mv state.rs to legacy/state.rs and camera.rs to models/tiny2lite/camera.rs.
  • scripts/groundwork/split-camera.py (new, committed so the split can be reproduced) copies contiguous line ranges of the 0.13 camera.rs into four files. All of its line anchors matched the file on rebuild as it is; no anchor was corrected.
    • family/exchange.rs: reply gap and attempts, pair gap, the sequence counter, struct Camera, open, short, framed, pair, query, query_to, answer.
    • legacy/full_status.rs: CAPABILITIES, Zoom, FullStatus, Limits, LIMITS, StateView, ZoneInfo, zone_info, full_status, full_status_with and the full_status_tests module.
    • legacy/current_pose.rs: PAN_ABSOLUTE, TILT_ABSOLUTE, current_pose.
    • models/tiny2lite/camera.rs: everything else, with its four test modules.
  • Only edit inside copied blocks: pub(crate) on Camera.dev, Camera.seq, short, framed, pair, query, query_to, answer, PAIR_GAP, ZOOM_ABSOLUTE, current_pose.
  • New legacy/mod.rs; lib.rs group (pub mod error; pub mod legacy; pub use legacy::state;); one mod line each in family/mod.rs and models/tiny2lite/mod.rs; the camera imports in cli.rs and daemon.rs; two paths in docs/center-parity.md.
  • Every new file carries the SPDX line and, where it receives code from camera.rs, the EUPL-1.2 Article 5 note.
  • No CHANGELOG line (no user-visible change).

Verified (no camera, nothing opened a device)

  • cargo fmt --check, cargo clippy --workspace --all-targets --locked -j 3 -- -D warnings (no output), cargo test --workspace --locked -j 3: 118 + 1 + 25 + 2 + 0 passed, 0 failed, the same five result lines as on the base. byte_guard and cli_surface pass; byte-guard.txt and cli-surface.txt are not edited.
  • Test names: scripts/groundwork/test-names.sh for base 898579c and head, comm -3 prints nothing (146 names each).
  • Move check scripts/groundwork/move-check.sh 898579c HEAD prints exactly the 21 lines the plan lists.
  • git diff -M --stat: { => legacy}/state.rs | 0 and { => models/tiny2lite}/camera.rs shown as renames.
  • Scripted split reproduced on a detached worktree of the base (git mv, committed script, rustfmt --edition 2024): the four written files equal the head's.
  • grep -rn 'static SEQ\|const REPLY_GAP\|const REPLY_ATTEMPTS\|const PAIR_GAP\|const LOCK_WAIT' crates gives exactly the five lines of the plan: REPLY_GAP 50 ms, REPLY_ATTEMPTS 20, PAIR_GAP 100 ms (pub(crate)), static SEQ (all in family/exchange.rs), LOCK_WAIT 5 s (transport/uvc.rs).
  • grep -rn 'obsbot_device::camera\|crate::camera' crates: nothing.

🤖 Generated with Claude Code

… status

The exchange with the extension unit (short and framed writes, answer polling, the sequence
counter) moves to family/exchange.rs; the Tiny 2 Lite reads and writes stay as
models/tiny2lite/camera.rs; the 0.13 status shape, its capability list and the remembered
pose move to legacy, with state.rs. Every block is copied unchanged by
scripts/groundwork/split-camera.py (anchors matched the file on rebuild as it is); items
another file now uses become pub(crate).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@nofuturekid nofuturekid added the enhancement New feature or request label Nov 13, 2026
@nofuturekid
nofuturekid merged commit e7c15de into rebuild Nov 13, 2026
20 checks passed
@nofuturekid
nofuturekid deleted the fix/162-groundwork-camera-split branch November 13, 2026 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant