Skip to content

Consolidate repeated crate-local test setup fixtures #486

Description

@forkwright

Finding

Akroasis's test surface repeatedly reconstructs the same setup values inside files that were split primarily to satisfy file-length limits. These are not independent protocol vectors or hardcoded expected values whose duplication catches production drift; they are fixture constructors expected to behave identically.

A normalized exact-function-body scan on the verified revision found repeated setup families across Kerykeion, Semaino, Kryphos, Tekmerion, Syntonia, and the Akroasis caller/CLI tests.

Verified against main c8e671845adca3e5b57a205d08aca31eadbc6000.

Evidence

Representative exact copies include:

  • crates/kerykeion/src/collector_tests.rs:8-15 and collector_tests_attribution.rs:8-15: identical make_config.
  • crates/kerykeion/src/processor_tests.rs:8-13 and processor_tests_attribution.rs:11-16: identical make_processor. The files are explicitly split because the primary test files reached the 800-line threshold.
  • crates/semaino/src/aggregator.rs:279-291 and pipeline.rs:350-362: identical rf_signal builders.
  • crates/kryphos/tests/tamper_log_signing.rs:202-211 and crates/kryphos/src/storage_tests.rs:761-770: identical code for removing installation-identity fields from a vault header.
  • crates/tekmerion/src/tamper_log_tests.rs:9-11,32-38 and tamper_log_codec_tests.rs:7-18: identical test_key and config_kind fixtures.
  • crates/syntonia/tests/workflow_concurrency_fitness.rs:34-46 and gate_feature_coverage.rs:21-33: identical workspace-root and file-read helpers.
  • crates/akroasis/tests/caller_contract.rs:270-290, caller_receipt_wire.rs:124-134, and sibling caller tests repeat fixed timestamp and policy/schema epoch constructors.
  • crates/akroasis/src/mesh/mod.rs, radio/mod.rs, and vault/mod.rs each define the same Clap test parser wrapper over TestCli::parse_from.

The exact-body scan also found intentionally independent expected values and trivial trait mocks; those are excluded from this finding.

Why this matters

The purpose of splitting a test file is readability and lint compliance, not creating a second owner for setup policy. As fixtures evolve, one split file can run with a different local-node identity, baseline signal shape, legacy-header mutation, workspace-root assumption, or caller epoch than its sibling.

The duplication also obscures the actual assertion. A test reader must verify repeated setup before reaching the behavior under test, and a correction to setup requires a repository-wide search rather than one fixture edit.

Desired correction

Create narrow #[cfg(test)] support modules inside the owning crate or parent module:

  • Kerykeion collector/processor fixtures shared by their split test modules;
  • Semaino signal builders;
  • Kryphos legacy-header mutation helpers;
  • Tekmerion tamper-log fixtures;
  • Syntonia fitness-test filesystem helpers; and
  • Akroasis caller/CLI test constructors.

Do not create a fleet-wide generic test framework. Keep cryptographic vectors, wire-format bytes, independently calculated expected values, and adversarial fixtures local where their independence is load-bearing.

Done when:

  • each listed setup family has one implementation in its owning crate;
  • split test files import fixtures rather than copy them;
  • fixture defaults and knobs are explicit;
  • expected-value vectors intended to detect production drift remain independent; and
  • an exact-body scan no longer reports these setup constructors as duplicate families.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions