Files
RedBear-OS/local/sources
vasilito 38ebecabb6 phase 6.5: add --selftest mode to verify-patch-content + pre-push wiring
Adds --selftest mode that runs 5 regression test cases against a
temp directory. The temp dir is created OUTSIDE the parent git
working tree (e.g. via /tmp/.tmp-redbear-selftest-/) so that the
test's 'git log' commands don't pick up the parent repo's 100+
commits.

Test cases:
  1. patch with sig in fork target         preserved
  2. patch without sig in fork target       orphan
  3. no-target patch (no +++ b/ header)    orphan (no-target)
  4. patch with content-integrated target   orphan (classification)
  5. verify --report action produces per-orphan decision

Bug fixed during dev: passing fork_dir to git log WITHOUT
isolating it from the parent repo's git tree caused 50 'case2'
keyword matches to leak in from the RedBear-OS parent repo's
commit log, making case2 falsely classified as INTEGRATED. Fixed
by using tempfile.mkdtemp(dir=os.path.dirname(REPO_ROOT)) to put
the test fork dir OUTSIDE the parent git tree.

Also fixed: audit_component now accepts an optional patches_dir
arg (so selftest can pass a non-default patches path without
modifying the main code path).

Also fixed: 'if not target_path or target_path == \'?\'' check
in suggest_action_for_orphan to handle the literal '?' sentinel
that audit_component uses for no-target orphans.

Wired into pre-push-checks.sh as check #3b (verify-patch-content-selftest).
Total: 7 pre-push checks now run before any push.
2026-07-12 11:02:27 +03:00
..