Skip to content

test: gate software SPI changes on exhaustive production-path and mutation evidence #5031

Closed

Description

@zackees

Context

Two investigation rounds at 94dab9c for #5024. Source inventory and tests were read; no tests/builds were run in this discovery task. tests/platforms/shared/spi_bitbang/bitbang_pin.cpp:8-64 exercises writeBitSetClear and phase arithmetic only. Repository-wide rg -n 'GenericSoftwareSPI|SoftwareSPIOutput|BitbangPin' tests finds no production SPI template caller. Existing hardware/channel tests are not evidence that generic per-bit/bulk software branches execute correctly. Root dispatch lives in src/platforms/{fastpin.h,spi_output_template.h} and src/fastspi.h; the generic implementation is src/platforms/shared/spi_bitbang/generic_software_spi.h.

Proposal

Land this first as the shared prerequisite for the platform children: behavioral tests invoking actual production software SPI templates plus an exhaustive, fail-closed backend coverage gate. The discovery universe must start from all git-tracked src/platforms source files plus root src/fastspi and src/fastpin**, not the filenames returned by an SPI keyword query. Generate semantic candidates from declarations, stores/MMIO access, loops, GPIO toggles, templates and transitive dispatch/include edges; retain explicit dispositions for every source entry (candidate, hardware-only, clockless, alias/wrapper, unrelated, unknown). Preserve paths and symbols/implementation identity in an auditable ledger.

Acceptance criteria

  • RED -> GREEN tests call production GenericSoftwareSPIOutput, SoftwareSPIOutput and each independent software implementation, not a copied writer. Trace real GPIO write hooks: all 256 byte values/all bit indices, scalar/bulk/repeated values/pixels, adjustment callbacks, start bits, empty/one-byte/consecutive transfers, first/last edges, clock idle, distinct/same port and separate banks, GPIO16/other exceptions, unrelated GPIO interference and timing boundary/slow rates.
  • Inventory generation discovers every tracked platform source independent of search matches. A new or renamed backend, dispatch branch, pin family, register implementation or helper must cause an unknown/unclassified failure until source evidence and behavioral/configuration coverage are supplied. Remove a search token, rename writeBit or move a loop to a helper as negative mutations: denominator cannot shrink and gate cannot silently turn green. Wrapper aliases point at the canonical implementation and verify dispatch; hardware-only and clockless exclusions include code evidence.
  • Each optimization child supplies a focused failing pre-change signal; after GREEN, restoring its actual old implementation must make its own test/code-generation assertion fail, then GREEN after restoration. Mutation records include exact commit, production symbol and command/result. Changing kAtomicWrite/kTwoWriteStream, manually marking covered, removing a ledger row, selecting an unused backend, or editing regexes alone must fail validation. Derive execution coverage from actual traces and generated code, not self-reported flags.
  • Real board/configuration compilation is independently recorded for the selected implementation, including pin/bank maps, force-software modes, architecture/clock variants and error cases; native fake-MMIO traces cannot stand in for vendor core builds or physical timing. Include disassembly where branch elimination, MMIO count or tiny-delay inlining is claimed. Any physical speedup needs measured board evidence with interrupt/timing constraints recorded.
  • No new workflow file is needed; integrate into an existing repository validation entry point and report the exact gate command. Save generated inventory, classification evidence, production trace results and mutation outcomes as artifacts tied to the audited SHA. Test the gate with a synthetic new backend and with a newly routed existing backend; both must fail before classification/evidence is added.

Decisions

Open questions

Choose the lightest code-generation/AST tooling compatible with repository test infrastructure. Semantic discovery is not assumed perfect: cross-check all tracked-source/dispatch changes against the evidence ledger and require unknown disposition rather than treating a query miss as absence. Next step is the RED production-template coverage test and failing new-backend fixture.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    sanitized

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions