182 lines
10 KiB
Markdown
182 lines
10 KiB
Markdown
---
|
|
id: LSN-0037
|
|
ticket: runtime-edge-test-plan
|
|
title: Domain Gates Must Be Owned by the Repository
|
|
created: 2026-04-21
|
|
tags: [tests, coverage, ci, governance]
|
|
---
|
|
|
|
## Context
|
|
|
|
PROMETEU moved runtime-edge coverage governance away from a single workspace-wide percentage and toward canonical domain gates. That shift mattered not only for policy, but also for how CI logic is expressed and maintained.
|
|
|
|
The initial model focused on runtime edges. It now preserves the specialized
|
|
system/asset/firmware/host owners and also covers VM, bytecode, residual
|
|
HAL/drivers/system sources, tooling and test infrastructure.
|
|
The published operational reference is
|
|
[Coverage domains](../../../docs/vm-arch/COVERAGE_DOMAINS.md).
|
|
|
|
## Key Decisions
|
|
|
|
### Domain-first coverage governance
|
|
|
|
**What:**
|
|
The authoritative CI gate is no longer a global aggregate percentage. The gate is evaluated per canonical domain, with `lines` coverage compared against the domain baseline, while scenario expectations remain the real acceptance contract.
|
|
|
|
**Why:**
|
|
A single global number can hide risk in firmware transitions, boot flow, host integration, and other sensitive edges. Domain ownership makes the gate reflect where regressions actually matter.
|
|
|
|
**Trade-offs:**
|
|
This model is more explicit and more honest, but it requires clearer mapping between code changes, domain responsibility, and test evidence.
|
|
|
|
### Repository-owned CI helpers
|
|
|
|
**What:**
|
|
Jenkins should call repository helpers such as `make ci-domains`, rather than reimplementing coverage policy inline in the pipeline file.
|
|
|
|
**Why:**
|
|
The coverage contract evolves with the repository. When CI duplicates the decision logic, policy drifts and operational changes become harder to propagate consistently.
|
|
|
|
**Trade-offs:**
|
|
The helper must remain readable and stable, because it becomes part of the repository contract rather than a local convenience script.
|
|
|
|
### Complete and exclusive source ownership
|
|
|
|
**What:**
|
|
Every crate src Rust file has exactly one domain, including sources without
|
|
executable LLVM lines. Residual crate owners exclude the existing specialized
|
|
prefixes. A shared auditor normalizes report paths and supplies the same
|
|
statistics used by evidence display and percentage gates.
|
|
|
|
**Why:**
|
|
Tests can run successfully while the implementation they exercise belongs
|
|
to no coverage gate. Moving test files does not repair that omission.
|
|
Auditing only report files also misses sources absent from instrumentation.
|
|
Separate matching implementations can disagree on absolute/relative paths
|
|
or symlink aliases while producing plausible percentages.
|
|
|
|
**Trade-offs:**
|
|
New crates require explicit ownership. Reports with missing domains, duplicate
|
|
sources or zero instrumented lines are rejected before threshold comparison.
|
|
The initial ownership extension assigned 232 files to 15 exclusive owners
|
|
without changing the original eight domain baselines. Source counts grow with
|
|
the repository; the current evidence records the measured layout.
|
|
|
|
### Exclusive ownership must also be the intended ownership
|
|
|
|
**What:**
|
|
Module entry files and their sibling directories belong to the same specialized
|
|
domain. Memcard descendants belong to system/fs; asset-driver descendants
|
|
belong to asset/bank. Both residual owners exclude the entry file and the whole
|
|
module tree. Regression tests call the production auditor's ownership function
|
|
for current and future paths, and audit independent reports containing absent
|
|
and zero-line descendants.
|
|
|
|
**Why:**
|
|
A prefix ending in `.rs` covers the entry file but not the directory created
|
|
when a module is split. A residual owner can absorb every new descendant and
|
|
still pass a generic exactly-one-owner audit. The resulting percentages look
|
|
valid but measure the wrong responsibility. Expected-owner assertions detect
|
|
this failure before instrumentation or percentage comparison.
|
|
|
|
**Trade-offs:**
|
|
Correcting ownership moves the denominator and may reduce a specialized
|
|
domain's margin. Preserve reviewed floors and investigate fresh failures with
|
|
behavioral evidence. Historical measurements remain useful only when their
|
|
original source map and fingerprints remain intact; they should not be
|
|
silently rewritten to match the repaired map.
|
|
|
|
## Patterns and Algorithms
|
|
|
|
- Keep the policy in repository files (`Makefile`, coverage scripts, domain baseline config), and keep Jenkins as a thin caller.
|
|
- Use domain-scoped baselines as a quantitative gate, but keep mandatory scenarios as the governing behavioral rule.
|
|
- Publish operationally useful coverage output that emphasizes gate status first and only exposes deeper evidence on demand.
|
|
- Let Cargo discover unit/integration/cross-layer suites in their existing
|
|
targets. Their execution contributes coverage to every implementation owner
|
|
they exercise; the physical test-file directory is not the ownership map.
|
|
- Measure new starting baselines from fresh coverage and preserve existing
|
|
ones. Keep precision/bit-level oracles complementary to line coverage.
|
|
|
|
## Pitfalls
|
|
|
|
- Treating a global coverage increase as proof that a touched domain is adequately tested.
|
|
- Encoding gate math directly in Jenkins and forcing future policy changes to update multiple authorities.
|
|
- Letting verbose evidence output bury the actual pass/fail signal in CI logs.
|
|
- Allowing an absent or zero-line report to pass a zero baseline.
|
|
- Assigning the whole VM to the system integration domain, or counting one
|
|
source in both a specialized owner and its enclosing residual crate owner.
|
|
- Treating exactly one owner as proof that a module retained its intended
|
|
owner after its implementation moved into sibling source files.
|
|
- Treating local host measurements as evidence for unexecuted platforms.
|
|
|
|
## Published Extension and Evidence
|
|
|
|
The ownership extension derives from accepted DEC-0049 and its completed local
|
|
implementation PLN-0180. It preserves the domain-first governance of the
|
|
original completed discussion. The
|
|
[measured evidence](../../../docs/vm-arch/COVERAGE_DOMAINS_EVIDENCE.json)
|
|
records the actual host/configuration, source/report fingerprints and counts.
|
|
|
|
Local macOS/aarch64 make ci-domains passed 915 tests, with nine existing ignored
|
|
tests, formatting, Clippy and all 15 coverage gates. Eight policy regression
|
|
tests exercise real repository ownership and independent invalid evidence.
|
|
Mathematics and its portable MPFR-generated fixture now exercise vm/core;
|
|
bytecode has its own gate. The standalone MPFR qualification remains separate.
|
|
This evidence does not claim Linux or Intel Mac coverage execution.
|
|
|
|
The module-tree ownership correction derives from accepted DEC-0059. Its
|
|
[current measured evidence](../../../docs/vm-arch/COVERAGE_DOMAINS_CURRENT.json)
|
|
preserves the earlier evidence records and restores system/core to 87.71%
|
|
without changing the other 14 floors. The fresh local map has 257 source files
|
|
and 15 exclusive domains. All domain gates pass: system/fs measures 78.73%,
|
|
system/core 93.69%, asset/bank 90.52% and drivers/core 89.17%.
|
|
Ten policy tests cover both generic validity and intended specialized owners.
|
|
The existing repository target passes 1,021 tests with 11 ignored; strict
|
|
workspace Clippy still reports existing VM diagnostics. Coverage qualification
|
|
must not be presented as completed strict workspace qualification.
|
|
|
|
## Takeaways
|
|
|
|
- Runtime-edge coverage is safer when CI enforces domain ownership instead of trusting a workspace aggregate.
|
|
- Scenario-first review and domain baselines complement each other; neither should replace the other.
|
|
- Coverage gates that live in repository helpers are easier to evolve, audit, and keep consistent than CI-local logic.
|
|
- Audit source ownership and evidence validity before comparing percentages.
|
|
A passing percentage is useful only when its denominator has a clear owner.
|
|
|
|
## A Shared Gate Must Share Failure Semantics Too
|
|
|
|
The strict-gate correction derives from DEC-0063. A common coverage helper did
|
|
not establish common CI policy while one pipeline only ran permissive lint/tests
|
|
and another produced domain reports. Both CI consumers now provision the declared
|
|
tools and invoke the same Makefile-owned `ci-domains` target. Strict Clippy covers
|
|
workspace targets and features with warnings denied; concrete lint fixes replace
|
|
warning suppression. The existing coverage map and floors remain unchanged.
|
|
|
|
The Makefile owns the ordered steps. A serial runner performs format, strict lint,
|
|
all-target tests, the five named debugger socket cases, fresh coverage/export and
|
|
all domain audits/gates. Serial child Make invocations avoid races between clean,
|
|
Cargo execution and report generation. A second independent gate in the same
|
|
checkout still requires operator coordination.
|
|
|
|
Failure publication is part of the contract. Before a run, old reports are
|
|
removed; every executed step receives a log, exit status, revision and source/config
|
|
identity. A later failure retains current partial reports. An early failure cannot
|
|
archive old HTML as current success. Both CI providers publish available evidence
|
|
on failure and preserve the gate's nonzero status. Regression fixtures exercise
|
|
failed execution, success and failure after partial report generation.
|
|
|
|
Ignored tests are not one qualification category. Five localhost socket tests
|
|
belong in automation, but physical audio, endurance, packaged installation and
|
|
manual timing/layout probes need their own named execution. Restricting the socket
|
|
filter prevents accidentally turning a device requirement into a CI prerequisite.
|
|
|
|
The local macOS/aarch64 strict gate passed 1,039 ordinary tests, five socket tests,
|
|
three runner regressions and all fifteen coverage gates; fresh coverage separately
|
|
replayed 1,039 tests. The ordinary phases reported thirteen ignored tests; five
|
|
of these ran in the separate socket step, while eight remained unselected. The initial sandbox
|
|
socket refusal is distinguished from the successful authorized run. Pipeline
|
|
configuration was inspected, but no remote or Linux gate was executed. Platform
|
|
equivalence concerns required commands, not identical measured coverage. See the
|
|
[published operational contract and evidence](../../../docs/vm-arch/COVERAGE_DOMAINS.md)
|
|
for prerequisites, manual commands and practical limits.
|