Skip to content

E24: Code Hygiene #254

Description

@DavidCozens

Overview

Non-functional improvements to the codebase as a unit. Cross-cutting work
that protects properties of the code — how it's built, organised,
structured — rather than adding capabilities.

These items are typically too large to land as one-off chore PRs but don't
fit under any feature epic. They're rails, gates, and uniform pattern
adoption that improve quality and resilience without changing what the
library does.

In scope

  • CI gates that protect non-functional invariants (include hygiene,
    layering, language version)
  • Cross-cutting refactors that apply patterns uniformly (e.g. Nil Object
    adoption across abstractions)
  • Other code-quality work that doesn't belong under a capability-focused
    epic

Out of scope

  • Anything covered by a feature epic — stays where it is
  • One-off chore PRs that don't need a tracked story (small refactors,
    dependency bumps, formatter changes)
  • Static analysis and MISRA tooling — covered by E10
  • Documentation tooling — covered by E23

Candidate ideas

Ideas live here until commitment. Each becomes a story (added to the table
below) only when scope is clear and we're ready to do the work. New ideas
are added as comments before promotion.

  • C99 portability gate — code has drifted from being C99-capable with
    optional C11 atomics; add a CI job that builds against an old language
    standard to keep that promise honest.
  • Resource-leak detection in tests — every test group exercising a
    class that owns an external resource installs a balance counter in
    setup/teardown that asserts the resource is fully released by
    end-of-test. Drives out Open()-without-Close() leaks (symptom: S26.02: MbedTlsStream Open() unwinds inner transport and SSL state on failure #420
    / S26.02) and surfaces the wider class of missing failure-path tests.
    Balance counter lives in the fake (e.g. SocketFake.openFdCount); the
    first per-class story to touch a shared fake also retrofits the
    assertion to every other TEST_GROUP that uses it. Per-class story,
    raised when picked up. Classes to cover (no particular order):
    • share SocketFake: PosixTcpStream, PosixDatagram, GetAddrInfoResolver
    • share WinsockFake: WinsockTcpStream, WinsockDatagram, WinsockResolver
    • share FreeRTOS net fakes: FreeRtosTcpStream, FreeRtosDatagram
    • share LwIP fakes (when added): LwipTcpStream, LwipDatagram
    • TlsStream (OpenSslFake)
    • MbedTlsStream (MbedTlsFake)
    • PosixFile, WindowsFile, FatFsFile
    • PosixMessageQueueBuffer (mq_t open/close/unlink)
      Plus an integration-harness fd-balance check across N forced-failure
      cycles per platform. Closes the scope of S26.02: MbedTlsStream Open() unwinds inner transport and SSL state on failure #420 (its two specific fixes
      fall out of the TlsStream and MbedTlsStream stories).

Stories

Story Title Status
S24.01 (#255) IWYU CI gate for include hygiene Done
S24.02 (#321) Adopt CALLED_FUNCTION test macro and standardise *CallCount naming Done
S24.03 (#325) Drop AtomicOps vtable; select atomics implementation at link time Done
S24.04 (#332) Migrate Linux BDD off Example/SingleTask; remove the SingleTask binary Done
S24.05 (#333) Move BDD-target binaries from Example/ to Bdd/Targets// Done
S24.06 (#335) Retire Example/FreeRtos/HelloWorld bring-up smoke binary Done
S24.07 (#418) SolidSyslogAddress as pool-allocated handle Done
S24.08 (#423) Enforce top-down function ordering across all source files Done
S24.09 (#424) StreamSender bad-setup contract — reject NULL Resolver / Stream / Address Done
S24.10 (#449) Rename file-leaking identifiers and comments in BlockStore tests Done
S24.11 (#459) Extend tidy / cppcheck / IWYU CI to cover platform + BDD code Done
S24.12 (#461) Audit inline cppcheck-suppress and NOLINT comments tree-wide Done

Metadata

Metadata

Assignees

No one assigned

    Labels

    epicEpic issue

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions