phase 5.5: polish COLLISION-DETECTION-STATUS for Phases 5.1+5.4

Updates the doc to reflect the 2 follow-on improvements to
collision detection:

- Phase 5.1 added 'recipe files' source (handles the 39 recipes
  with [[package]].files dict). Out-of-scope #1 in this doc
  marked as DONE.

- Phase 5.4 added --selftest mode with 8 regression cases wired
  into the pre-push hook. Future-work item #4 added for property-
  based fuzzing (e.g. hypothesis).
This commit is contained in:
2026-07-12 10:19:49 +03:00
parent 8d4818b94b
commit 23b7722ab6
+27 -6
View File
@@ -1,4 +1,4 @@
# Collision Detection — Status (Updated 2026-07-12, Phase 4.2)
# Collision Detection — Status (Updated 2026-07-12, Phase 5.5)
## History
@@ -13,15 +13,29 @@
collision detection at pre-flight time. Located at
`local/scripts/verify-collision-detection.py`. Wired into
`local/scripts/build-preflight.sh` with `REDBEAR_SKIP_COLLISION_CHECK=1`
bypass env var. **The runtime collision-detection promise in AGENTS.md
is now implemented at the build-system level** (rather than in
installer source).
bypass env var.
- **2026-07-12 (Phase 5.1)**: Extended collision detection to also parse
`[[package]].files` (the TOML inline table of install paths used by
39 recipes including the Round 3 system drivers like redbear-power,
redbear-acmd, evdevd). The forward coverage ensures future recipes
using this pattern are caught.
- **2026-07-12 (Phase 5.4)**: Added `--selftest` mode with 8 regression
test cases that exercise the algorithm's edge cases (exact match,
parent-dir prefix, /etc/init.d override, /etc/environment.d override,
non-overlapping, parent-of-subpath, two siblings, different base
names). The selftest is wired into `pre-push-checks.sh` so future
algorithm changes must keep these cases passing or the pre-push
hook fails.
## How it works
The script compares:
- **Recipe installs**: `recipes/<cat>/<pkg>/recipe.toml` `[[package]].installs`
fields — files the package WILL install at build time
fields (canonical list) — files the package WILL install at build time
- **Recipe files**: `recipes/<cat>/<pkg>/recipe.toml` `[[package]].files`
dict (path → source mapping) — also checked (Phase 5.1)
- **Config [[files]]**: `config/redbear-*.toml` `[[files]]` entries —
files the config writes before package staging
@@ -54,7 +68,8 @@ historical) is not present in the active build.
`[[package]].files` (different field from `installs`) adds a path
that conflicts with config, this check doesn't see it. Future work:
extend `verify-collision-detection.py` to also read
`[[package]].files` paths.
`[[package]].files` paths. **DONE in Phase 5.1: now reads
`[[package]].files` as well as `[[package]].installs`.**
2. **Patch-induced collision** — if a Red Bear patch adds a file to a
package's install manifest at fork-build time, the pre-flight check
@@ -65,6 +80,12 @@ historical) is not present in the active build.
creates files at build time that aren't in `recipe.toml`. Those are
not checked. Future work: trace installer source for generated paths.
4. **In-file test cases** — the `--selftest` mode (Phase 5.4) tests
the algorithm against 8 hard-coded cases. A more comprehensive
fuzzing test (random paths, deeper prefix trees) would catch more
edge cases. Future work: add property-based test using
hypothesis or similar.
## Toggle modes
- Default: report-only (warn if collisions found, build proceeds)