Skip to content

Compile only the white-box tests without access control - #92

Merged
kahrendt merged 1 commit into
mainfrom
issue-43-access-control
Oct 15, 2026
Merged

kahrendt merged 1 commit into
mainfrom
issue-43-access-control

Conversation

@kahrendt

@kahrendt kahrendt commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Only the tests that reach private members compile with -fno-access-control now. They sit in test_*_internals.cpp files beside each class's other tests, which compile with access control. The lines compiled without it fall from about 9.7k to 3.5k. The job-wrapping test helper exists once and yields between tries.

Change

  • Eleven classes are split into test_<x>.cpp and test_<x>_internals.cpp: audio_workers, dispatcher, group_audio, host_view, live_slew, noise_initiator, pairing_crypto, server_core, server_trust, session and session_driver.
    • Every test keeps its full name. ctest -N lists the same 829 tests, with the same realtime set.
    • Each flagged file's reason in tests/CMakeLists.txt names every private member it reaches, including those reached through group_job.h.
  • tests/group_job.h:
    • wrap_job() waits, yielding, until a task is neither running nor queued, then replaces its job.
    • pipelines_of() reads a group job's GroupAudio.
    • Together they replace the three copied loops and the std::function::target reach. The server_core copy waited only on !running_; it now also waits on !queued_, as the other two did.
  • Shared headers hold what a class's two files both need: host_view_fixture.h, group_pipelines.h, session_harness.h, trust_harness.h and gate.h. SessionTest is one fixture type, instantiated once in test_session.cpp.
  • Two tests now use the public API instead of moving:
    • SessionTest.BecomesActiveWhenTheActivationIsTaken uses queue_json_message().
    • test_session_driver.cpp's ActiveDriver waits until its trace's last event is written with nothing ready, rather than reading writing_/waiting_.
  • Folded in:
    • hex.h replaces the hex helpers copied across the crypto and noise tests.
    • DropsQueuedJobsWhenStopped's stop-wait yields.
    • FallsBackToDroppedFramesKeepingTheAsrc builds a float ramp block rather than share the tone helper.
    • Includes left unused by the split are removed.
  • Docs: CLAUDE.md, docs/conventions.md and the test-standards checklist state the internals-file rule. CLAUDE.md lists the new headers, and src/ORIGIN.md names both pairing-crypto files.

Tests

No new tests; the existing ones are moved.

Closes #43

Each test file that reached private members compiled whole with -fno-access-control.
The tests that need it now sit in test_*_internals.cpp files of their own, beside
the class's other tests, which compile with access control; the lines compiled
without it fall from about 9.7k to 3.5k. Each flagged file's reason in
tests/CMakeLists.txt names every private member it reaches.

The three copies of the loop that wrapped a group's next pipeline job are one
helper, group_job.h's wrap_job(), which yields between tries. Fixtures and
harnesses a class's two files share move into headers, and hex.h replaces the
hex helpers copied across the crypto tests. Two tests that reached a private
member for no essential reason now use the public API instead.
@kahrendt
kahrendt marked this pull request as ready for review October 15, 2026 20:18
Copilot AI balanced review requested due to automatic review settings October 15, 2026 20:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

Static review found no blocking issues in this test-only refactor; builds and tests were not run.

0 open findings

What changed in this PR

Narrows disabled access checks to dedicated white-box tests, addressing #43 without changing production code.

Changes:

  • Separates private-member tests into test_*_internals.cpp files.
  • Shares fixtures and helpers, including job wrapping that yields between attempts.
  • Updates compiler flags, access justifications, and testing documentation.
File Description
tests/​trust_harness.h Shares trust-test infrastructure.
tests/​test_session.cpp Uses shared harness and public queue API.
tests/​test_session_internals.cpp Isolates private buffer checks.
tests/​test_session_driver.cpp Uses public APIs and trace-based waits.
tests/​test_session_driver_internals.cpp Isolates stalled-write inspection.
tests/​test_server_trust_internals.cpp Isolates private trust-state tests.
tests/​test_server_raw_client.cpp Updates a comment's test-file reference.
tests/​test_pairing_crypto.cpp Retains public tests; shares hex helpers.
tests/​test_pairing_crypto_internals.cpp Isolates fixed-scalar tests.
tests/​test_noise_initiator.cpp Retains cipher-name tests.
tests/​test_noise_initiator_internals.cpp Isolates private-state vector tests.
tests/​test_live_slew.cpp Removes the private-state test.
tests/​test_live_slew_internals.cpp Isolates fallback checks using ramp input.
tests/​test_host_view_internals.cpp Isolates private slew and outbox checks.
tests/​test_group_audio_internals.cpp Isolates private pipeline checks.
tests/​test_dispatcher.cpp Retains public queue tests.
tests/​test_dispatcher_internals.cpp Isolates thread-token inspection.
tests/​test_crypto.cpp Reuses shared hex formatting.
tests/​test_audio_workers.cpp Retains public worker tests.
tests/​test_audio_workers_internals.cpp Isolates internal checks and yields during waits.
tests/​session_harness.h Shares session harness and fixture.
tests/​host_view_fixture.h Shares host-view fixture.
tests/​hex.h Consolidates hex conversion helpers.
tests/​group_pipelines.h Shares pipeline harness and assertions.
tests/​group_job.h Centralizes synchronized job wrapping.
tests/​gate.h Shares job synchronization helper.
tests/​CMakeLists.txt Restricts access-control flags to internals files.
src/​ORIGIN.md Updates test provenance documentation.
docs/​conventions.md Documents internals-file requirement.
CLAUDE.md Documents shared helpers and testing rule.
.claude/​skills/​test-standards/​SKILL.md Updates access-control review checklist.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@kahrendt
kahrendt merged commit 81cbc30 into main Oct 15, 2026
14 checks passed
@kahrendt
kahrendt deleted the issue-43-access-control branch October 15, 2026 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Narrow -fno-access-control and share the job-wrapping test helper

2 participants