Repository navigation
Done
Description
Goal
Identify, catalog, and document the core C++20 systems programming, architectural, testing, and tooling patterns used across milo in one or more dedicated Markdown documents under docs/ (following existing docs/01-*.md–08-*.md conventions and SPDX GPL-3.0-only headers), with concrete repo file references and authoritative web citations justifying each practice.
Proposed Documentation Scope
Create docs/09-design-patterns-and-best-practices.md (and link it from README.md / docs/reference.md if appropriate), covering:
- Freestanding C++20 Without Exceptions, RTTI, or
atexit- Value-based error handling (
Result<T, E>,Kernel::DDK::Status), placementnewover static storage (drivers/dummy/DummyDriver.cpp), and-fno-use-cxa-atexitsingleton discipline (kernel/ddk/KernelPlatformServices.cpp). - References: C++ Core Guidelines (Error handling / Freestanding), ARM/Itanium C++ ABI freestanding notes.
- Value-based error handling (
- RAII & Rule of Five for Deterministic Resource Ownership
- Move-only, non-copyable handles (
DDK::MmioRegion,DmaBuffer,IrqHandle,IrqLock,EventHandle),Sync::IrqGuard,Kernel::Log::ScopedLevel, andTestSession. - References: C++ Core Guidelines (
R.1,C.21,E.6).
- Move-only, non-copyable handles (
- Hardware Isolation, HAL, and Compiler-Enforced DDK Boundaries
- Separating arch-agnostic
kernel/fromarch/aarch64-linux-gnu/andkernel/hal/targets/qemu_virt/. - Capability injection via
Kernel::DDK::PlatformServicesand compiler-enforced-I$(MILO_DDK_DIR)/includeisolation (drivers/ddk.mk,make export-ddk). - References: Dependency Inversion Principle, Linux/WDF/Fuchsia driver-framework isolation patterns.
- Separating arch-agnostic
- Dual-Target Testing & Zero-Leak Invariants
- Host-side
snitchunit tests with ASan/UBSan +gcovrcoverage (tests/host/mocks/host_hal.cpp) alongside QEMU kernel shell (test all) and EL0 userspace (user/test_milo.c) verification. pfa_free_pages_count()baseline conservation checks andPagerefcounting (page_get/page_put) for CoW/demand-zero paging.- References: Dual-target embedded TDD, AddressSanitizer/UBSan docs, Linux
struct pagerefcounting model.
- Host-side
- Observability: Structured Forensic Logging Decoupled from Console UX
- Separating console verbosity (
Kernel::Log::set_level) fromIrqGuard-protected ring-buffer capture (logs --json,/dev/kmsg) using JSON Lines (NDJSON). - References: JSON Lines specification (
jsonlines.org), structured logging best practices.
- Separating console verbosity (
- Automated Quality Gates & Repository Hygiene
make quality(clang-format,clang-tidyviacompile_commands.json, SPDXGPL-3.0-onlyheader checks,test-host),.githooks/pre_commit, and Conventional Commits.- References: SPDX (
spdx.dev), Conventional Commits (conventionalcommits.org), Clang-Tidy C++ Core Guidelines checks.
Acceptance Criteria
- New documentation added under
docs/(with SPDXGPL-3.0-onlyheader) and cross-linked fromREADME.md/docs/reference.md. - Every documented pattern cites concrete files/symbols in the repository and includes valid, authoritative web reference links.
-
make license-checkpasses cleanly.
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
- StatusShow more project fieldsDone
Activity
[-]dev patterns docs[/-][+][ISSUE] Document Repository Engineering Patterns & Best Practices with External References[/+]docs(core): document engineering patterns and best practices (#249)
docs(core): document engineering patterns and best practices (#249)