test(contracts): expand serde round-trip coverage to all types #20

Closed
claude-desktop wants to merge 5 commits from test/19 into main
Collaborator

Summary

  • Add serde round-trip tests for all previously-untested contracts types: Thread, Turn, Message, Checkpoint, Provider, RuntimeMode, TurnStatus, MessageRole, CommitInfo, BranchInfo, FileDiff, FileChangeStatus (all variants including Renamed and Copied), OrchestrationReadModel
  • Add KeySpec tests for Super/Alt modifiers, all-modifier round-trip, and to_string_repr with Meta
  • Add KeyScope serde round-trip covering all 4 variants
  • Test count grows from 12 → 33 (all passing, zero clippy warnings)

Test plan

  • cargo fmt --all -- --check passes
  • cargo clippy --workspace -- -D warnings passes (0 warnings)
  • cargo test passes — 33/33 tests green

Closes #19

## Summary - Add serde round-trip tests for all previously-untested contracts types: `Thread`, `Turn`, `Message`, `Checkpoint`, `Provider`, `RuntimeMode`, `TurnStatus`, `MessageRole`, `CommitInfo`, `BranchInfo`, `FileDiff`, `FileChangeStatus` (all variants including `Renamed` and `Copied`), `OrchestrationReadModel` - Add `KeySpec` tests for `Super`/`Alt` modifiers, all-modifier round-trip, and `to_string_repr` with `Meta` - Add `KeyScope` serde round-trip covering all 4 variants - Test count grows from 12 → 33 (all passing, zero clippy warnings) ## Test plan - [x] `cargo fmt --all -- --check` passes - [x] `cargo clippy --workspace -- -D warnings` passes (0 warnings) - [x] `cargo test` passes — 33/33 tests green Closes #19
feat: scaffold Cargo workspace and implement contracts crate
Some checks failed
qa / qa (push) Failing after 1m30s
qa / qa (pull_request) Failing after 1m28s
17d50f4742
Set up the 4-crate workspace (app, backend, frontend, contracts) with
centralized dependency management, inter-crate rules, justfile with
qa/ci recipes, Forgejo Actions CI pipeline, and CLAUDE.md.

Implement the contracts crate with all shared domain types: orchestration
(Project, Thread, Turn, Message, Checkpoint, ReadModel), git types
(GitStatus, FileDiff, DiffHunk), terminal status, and keybindings
(KeySpec with parse/format). Includes 12 unit tests.

Closes #1
Closes #2

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fix: use rust:1-trixie for CI (glib >= 2.80 required by gtk4-rs 0.11)
Some checks failed
qa / qa (push) Has been cancelled
qa / qa (pull_request) Successful in 12m25s
31584ff48e
Debian Bookworm ships glib 2.74 but gtk4-rs 0.11 / glib-sys 0.22
requires glib >= 2.80. Switch to Debian Trixie which has GNOME 47+.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
test(contracts): expand serde round-trip coverage to all types
All checks were successful
qa / qa (push) Successful in 11m20s
qa / qa (pull_request) Successful in 1m49s
b59e74574a
Add missing tests for Thread, Turn, Message, Checkpoint, Provider,
RuntimeMode, TurnStatus, MessageRole, CommitInfo, BranchInfo,
FileDiff, FileChangeStatus (Renamed/Copied), OrchestrationReadModel,
KeyScope, and KeySpec modifier variants (Super/Alt/all-modifiers).

Test count: 12 → 33.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Ghost left a comment

Reviewed all four test files in full. Test count (33) matches the PR claim and coverage of new types is thorough. Two issues with silent assertion gaps — see inline comments.

Reviewed all four test files in full. Test count (33) matches the PR claim and coverage of new types is thorough. Two issues with silent assertion gaps — see inline comments.

serde_round_trip_git_status constructs GitStatus { ahead: 2, untracked: vec!["new_file.rs".into()], ... } but never asserts those fields after decoding. A regression in ahead or untracked serde (e.g. a field rename) would silently pass.

Add after the existing assertions:

assert_eq!(decoded.ahead, 2);
assert_eq!(decoded.behind, 0);
assert_eq!(decoded.untracked, vec!["new_file.rs"]);
`serde_round_trip_git_status` constructs `GitStatus { ahead: 2, untracked: vec!["new_file.rs".into()], ... }` but never asserts those fields after decoding. A regression in `ahead` or `untracked` serde (e.g. a field rename) would silently pass. Add after the existing assertions: ```rust assert_eq!(decoded.ahead, 2); assert_eq!(decoded.behind, 0); assert_eq!(decoded.untracked, vec!["new_file.rs"]); ```

serde_round_trip_keybinding only checks id and scopedefault_key, current_key, and description are never asserted after decoding. KeySpec serde is covered by its own round-trip tests, but a bug specifically in how KeySpec is embedded in Keybinding (e.g. wrong field name in the JSON) would go undetected here.

Add after the existing assertions:

assert_eq!(decoded.default_key, KeySpec::parse("Ctrl+Return").unwrap());
assert_eq!(decoded.current_key, KeySpec::parse("Ctrl+Return").unwrap());
assert_eq!(decoded.description, "Send the message");
`serde_round_trip_keybinding` only checks `id` and `scope` — `default_key`, `current_key`, and `description` are never asserted after decoding. `KeySpec` serde is covered by its own round-trip tests, but a bug specifically in how `KeySpec` is embedded in `Keybinding` (e.g. wrong field name in the JSON) would go undetected here. Add after the existing assertions: ```rust assert_eq!(decoded.default_key, KeySpec::parse("Ctrl+Return").unwrap()); assert_eq!(decoded.current_key, KeySpec::parse("Ctrl+Return").unwrap()); assert_eq!(decoded.description, "Send the message"); ```
Ghost left a comment

Reviewed all four test files in full. Test count (33) matches the PR claim and coverage of new types is thorough. Two issues with silent assertion gaps — see inline comments.

Reviewed all four test files in full. Test count (33) matches the PR claim and coverage of new types is thorough. Two issues with silent assertion gaps — see inline comments.

serde_round_trip_git_status constructs GitStatus { ahead: 2, untracked: vec!["new_file.rs".into()], ... } but never asserts those fields after decoding. A regression in ahead or untracked serde (e.g. a field rename) would silently pass.

Add after the existing assertions:

assert_eq!(decoded.ahead, 2);
assert_eq!(decoded.behind, 0);
assert_eq!(decoded.untracked, vec!["new_file.rs"]);
`serde_round_trip_git_status` constructs `GitStatus { ahead: 2, untracked: vec!["new_file.rs".into()], ... }` but never asserts those fields after decoding. A regression in `ahead` or `untracked` serde (e.g. a field rename) would silently pass. Add after the existing assertions: ```rust assert_eq!(decoded.ahead, 2); assert_eq!(decoded.behind, 0); assert_eq!(decoded.untracked, vec!["new_file.rs"]); ```

serde_round_trip_keybinding only checks id and scopedefault_key, current_key, and description are never asserted after decoding. KeySpec serde is covered by its own round-trip tests, but a bug specifically in how KeySpec is embedded in Keybinding (e.g. wrong field name in the JSON) would go undetected here.

Add after the existing assertions:

assert_eq!(decoded.default_key, KeySpec::parse("Ctrl+Return").unwrap());
assert_eq!(decoded.current_key, KeySpec::parse("Ctrl+Return").unwrap());
assert_eq!(decoded.description, "Send the message");
`serde_round_trip_keybinding` only checks `id` and `scope` — `default_key`, `current_key`, and `description` are never asserted after decoding. `KeySpec` serde is covered by its own round-trip tests, but a bug specifically in how `KeySpec` is embedded in `Keybinding` (e.g. wrong field name in the JSON) would go undetected here. Add after the existing assertions: ```rust assert_eq!(decoded.default_key, KeySpec::parse("Ctrl+Return").unwrap()); assert_eq!(decoded.current_key, KeySpec::parse("Ctrl+Return").unwrap()); assert_eq!(decoded.description, "Send the message"); ```
fix: address PR review — bookworm compat and frontend isolation
Some checks failed
qa / qa (pull_request) Waiting to run
qa / qa (push) Has been cancelled
e54c614ba8
Downgrade gtk4-rs to 0.10 generation (glib 2.74 compatible) so CI
runs on rust:1-bookworm per org convention. Remove backend dep from
frontend crate to enforce the inter-crate boundary.

- gtk4 0.10, libadwaita 0.8 (v1_2), relm4 0.10 (gnome_43),
  vte4 0.9, sourceview5 0.10
- CI image: rust:1-bookworm (not trixie)
- frontend no longer depends on forge-agent-backend

Closes: PR #19 review comments

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
fix(ci): run QA only on pull requests, not on every push
All checks were successful
qa / qa (pull_request) Successful in 9m56s
3179c7ed5f
Removes the push trigger to avoid duplicate CI runs when a PR is open.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
claude-desktop closed this pull request 2026-04-16 20:04:37 +00:00
All checks were successful
qa / qa (pull_request) Successful in 9m56s
Required
Details

Pull request closed

Sign in to join this conversation.
No description provided.