Context
After the branch-delete per-leg conversion (PR #1102, v4.4.54), push-to-main is the last operation class whose arm bodies are functionally duplicated between DANGEROUS_PATTERNS and detect_command_operation_type (declared inline at both sites, byte-equivalent regexes maintained by hand).
Why this is NOT urgent
The push-to-main arms are adjacency-bounded — the regex requires git push … main/master contiguity and contains no .* that can span a leg operator. The cross-leg over-block failure mode that forced the four per-leg conversions (#1082 force-push, #1086 API, #1087 close, #1094 branch-delete) is therefore structurally absent for this class. The duplication is an anti-drift hygiene concern only.
Proposed shape (when next touched)
Mirror the established SSOT idiom without changing gating semantics — the arms stay whole-command in the bank; only the declaration is shared:
# Shared constant (module top, beside the per-leg tuples):
_PUSH_TO_MAIN_ARM_BODIES: tuple[re.Pattern, ...] = (...) # moved verbatim
# Bank entry built from it:
DANGEROUS_PATTERNS = [..., *_PUSH_TO_MAIN_ARM_BODIES, ...]
# detect arm iterates the same constant:
for pattern in _PUSH_TO_MAIN_ARM_BODIES: ...
Certification obligations if/when done: byte-fidelity of the moved bodies (compiled .pattern/.flags identity), no behavioral delta base-vs-HEAD on gated + benign push forms, full suite with explicit 0-errors scan.
Scope discipline
Do NOT convert push-to-main to per-leg matching — adjacency-bounding is load-bearing there; per-leg conversion is neither needed nor wanted. Declaration-sharing only.
Surfaced by the review-architect during the PR #1102 peer review (F2 finding).
Context
After the branch-delete per-leg conversion (PR #1102, v4.4.54), push-to-main is the last operation class whose arm bodies are functionally duplicated between
DANGEROUS_PATTERNSanddetect_command_operation_type(declared inline at both sites, byte-equivalent regexes maintained by hand).Why this is NOT urgent
The push-to-main arms are adjacency-bounded — the regex requires
git push … main/mastercontiguity and contains no.*that can span a leg operator. The cross-leg over-block failure mode that forced the four per-leg conversions (#1082 force-push, #1086 API, #1087 close, #1094 branch-delete) is therefore structurally absent for this class. The duplication is an anti-drift hygiene concern only.Proposed shape (when next touched)
Mirror the established SSOT idiom without changing gating semantics — the arms stay whole-command in the bank; only the declaration is shared:
Certification obligations if/when done: byte-fidelity of the moved bodies (compiled
.pattern/.flagsidentity), no behavioral delta base-vs-HEAD on gated + benign push forms, full suite with explicit 0-errors scan.Scope discipline
Do NOT convert push-to-main to per-leg matching — adjacency-bounding is load-bearing there; per-leg conversion is neither needed nor wanted. Declaration-sharing only.
Surfaced by the review-architect during the PR #1102 peer review (F2 finding).