Skip to content

Testing framework refactor#983

Draft
HaoboGu wants to merge 9 commits into
feat/rynkfrom
feat/simulator
Draft

Testing framework refactor#983
HaoboGu wants to merge 9 commits into
feat/rynkfrom
feat/simulator

Conversation

@HaoboGu

@HaoboGu HaoboGu commented Jul 20, 2026

Copy link
Copy Markdown
Owner

No description provided.

HaoboGu added 9 commits July 20, 2026 21:59
The simulator commits were authored against an older rynk base; feat/rynk
has since changed several APIs. Port the rebased suite so it builds and passes:

- KeyAction::TapHold now takes a u8 profile index (was an inline MorseProfile).
  Register per-key profiles via a new SimKeyboardBuilder::morse_profiles table
  and reference them by index; combo-only keys use u8::MAX (default profile).
- The rynk HostService dispatch is now session-scoped and private. Expose
  new_session()/dispatch() as pub(crate) and give the simulator one persistent
  RynkSession, like a single host connection.
- ConsumerKey discriminants are no longer USB usage codes; use u16::from(..)
  to match the report the keyboard emits.
- bulk is folded into rynk (no standalone feature); drop the dead
  cfg(feature = "bulk") gates and size the loopback bulk fixture at 256 keys.
The struct-literal rewrite of the rynk service's test config was unrelated cleanup that drifted into the simulator branch. Restore it to the base form so this PR touches only simulator-relevant lines.
Drive Vial through the existing process_via_packet (now pub(crate)) instead of a new process_packet wrapper. ViaReport is already public, so the sim builds the report itself and run_session returns to its base form.
The simulator lived in src/ as a std-gated `pub mod sim` so it could reach pub(crate) internals, putting ~1.1k lines of test harness in the shipping crate. Move it to tests/common/sim, where it drives only rmk's public API:

- Vial/Rynk now go through the public `run_session` over in-memory pipes (the rynk_link pattern), so host/via and host/rynk revert to base — the pub(crate) seams are gone.
- A std-gated #[doc(hidden)] `rmk::test_exports` wraps the few internal signals the harness still needs (flash/connection/keycode). std is dev-only, so the firmware API is unchanged.
- src/test_support.rs regains its own block_on (src unit tests can't reach the test crate); check_sim_tests.sh skips the harness itself.

Whole feature matrix passes (scripts/test_all.sh).
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