ka-promote: auto-normalise git format-patch trailers (closes #31) #32

Merged
marfrit merged 1 commits from noether/ka-promote-normalise-trailers into main 2026-05-19 04:33:04 +00:00
Owner

Closes #31.

Source patches in patches// can now be in either shape (with or without git format-patch trailer); write_cumulative() strips per-input trailers and emits a single canonical separator between, but not after, concatenated patches. Removes the trailer-flip-flop tax exposed during PR #28 (commits 84734ba ↔ ceec602).

Changes

  • bin/ka-promote: add strip_trailer() + position-aware separator in write_cumulative()
  • tests/ka-promote/run-tests.sh: new unit test for trailer normalisation + cumulative shape; FRESNEL_EXPECTED_B2SUM re-recorded (4d9d93c... → 9c21751c...)

Test plan

  • tests/ka-promote/run-tests.sh — 6/6 pass
  • ka-promote on ohm produces a cumulative.patch with N-1 separators and a bare last patch (verified via grep -nE '^From [0-9a-f]{40}\|^-- $')
  • No orphan trailer at EOF (unit test asserts not body.rstrip(b'\n').endswith(b'2.40.1'))
  • --validate-against <clean v7.0 checkout> on ohm — manual verification deferred (no v7.0 checkout in scratch worktree)
Closes #31. Source patches in patches/<scope>/ can now be in either shape (with or without git format-patch trailer); write_cumulative() strips per-input trailers and emits a single canonical separator between, but not after, concatenated patches. Removes the trailer-flip-flop tax exposed during PR #28 (commits 84734ba ↔ ceec602). ## Changes - `bin/ka-promote`: add `strip_trailer()` + position-aware separator in `write_cumulative()` - `tests/ka-promote/run-tests.sh`: new unit test for trailer normalisation + cumulative shape; FRESNEL_EXPECTED_B2SUM re-recorded (4d9d93c... → 9c21751c...) ## Test plan - [x] `tests/ka-promote/run-tests.sh` — 6/6 pass - [x] ka-promote on ohm produces a cumulative.patch with N-1 separators and a bare last patch (verified via `grep -nE '^From [0-9a-f]{40}\|^-- $'`) - [x] No orphan trailer at EOF (unit test asserts `not body.rstrip(b'\n').endswith(b'2.40.1')`) - [ ] `--validate-against <clean v7.0 checkout>` on ohm — manual verification deferred (no v7.0 checkout in scratch worktree)
marfrit added 1 commit 2026-05-19 04:31:00 +00:00
write_cumulative() now strips any "-- \n<MAJOR>.<MINOR>(.<PATCH>)?\n" sentinel
from each input patch and emits a single canonical separator between, but not
after, concatenated patches. Source patches in patches/<scope>/ can therefore
keep their original git format-patch shape regardless of their position in
fleet/<host>.yaml — the brittle "trailer flip-flop on include reorder" mode
from PR #28 (commits 84734ba ↔ ceec602) is gone.

Tests:
- new unit covers strip_trailer + write_cumulative shape with mixed
  trailer states + asserts no orphan trailer leaks at EOF
- fresnel parity b2sum re-recorded after the shape change
  (4d9d93c6... -> 9c21751c...) — the cumulative is byte-identical
  modulo per-patch trailer normalisation; git apply --check on the
  v7.0 baseline still passes
- existing series-dir, bad-include, missing-patch, duplicate-include
  rejections unchanged
marfrit merged commit 443f5e992e into main 2026-05-19 04:33:04 +00:00
marfrit deleted branch noether/ka-promote-normalise-trailers 2026-05-19 04:33:04 +00:00
Sign in to join this conversation.