fix(bin): make a task's git branch prefix configurable per project - #4384
JoeyRichter wants to merge 1 commit into
Conversation
|
Speaking as Kun's firstmate: First look on main What I inspected (diff vs main)
contract-class: opt-in — default Attestation: MATCH (body head_sha == tip). Checks: first-time fork workflows approved this pass — CI VISION.md (each rule)
Security FYI (tip only, not waiting-captain): none material — no workflows, no secrets, validated prefix shapes. Surface overlaps open #2648 (same configurable-prefix theme); this tip is the JoeyRichter fork attestation MATCH path. Merge-eligible N. Waiting-ci. Do not merge. No Firstmate flag (not otherwise-ready / not a security|default-behavior gate). |
Firstmate named every task branch fm/<id> in six places that each re-derived the pattern, so a project whose repository enforces its own branch-naming convention (e.g. a Conventional-Commits check that only exempts prefixes such as chore/, docs/, ci/, build/) had no way to ship a compliant branch, and every firstmate-opened non-ticket PR there tripped that check. Add bin/fm-branch-lib.sh as the single owner of a task's branch name: a per-project prefix read from the data/projects.md registry's optional branch=<prefix> token (default fm/, so unconfigured projects are unchanged), and the reverse PR-head-to-task-id mapping the bearings board needs. The reverse map is prefix-shape based and leftmost, so a task id that itself begins with fm- is never over-stripped. A shared fm_registry_posture_tokens helper tokenizes the posture bracket once for both fm-branch-lib.sh and fm-project-mode.sh, and a configured prefix of an unsupported shape (including one whose leading segment is fm) fails closed. Route every consumer through it: fm-brief.sh, fm-dod-lib.sh, fm-merge-local.sh, fm-review-diff.sh, fm-promote.sh, and fm-bearings-snapshot.sh. The bearings PR-head link is gated on a known task id for the configured-prefix shape only, so a repository's own human branches are never claimed as tasks while the default fm/ shape keeps its prior behavior. Registry-format docs note the new token, and the stock-Bash CI bearings-count assertion is updated for the added test.
d106f18 to
e6aa3ce
Compare
|
Note: this PR was briefly closed and reopened while fixing up the commit history (rewritten for correct authorship and to remove some leftover data that shouldn't have been in a test fixture). A separate attempt to also rename the branch turned out to close cross-fork PRs irreversibly on GitHub, so that was reverted and the original branch name restored. No functional changes to the actual diff. |
|
Closing without merging: PR #2648 already covers this exact ask (per-project branch= opt-in in data/projects.md, default fm/ unchanged, resolved through the brief/spawn/merge-local/promote/review-diff/bearings chain) and is further along with existing maintainer engagement on the tracking issue (#1887). Rather than maintain a competing duplicate implementation, deferring to #2648 - happy to help review it if useful. |
Intent
Firstmate named every task branch
fm/<task-id>in several places that each re-derived the pattern. A project whose repository enforces its own branch-naming convention (for example a Conventional-Commits-style check that only exempts prefixes such aschore/,docs/,ci/,build/) had no way to ship a compliant branch, so every firstmate-opened non-ticket PR there tripped that check.Change
bin/fm-branch-lib.shis the single owner of a task's branch name: a per-project prefix read from thedata/projects.mdregistry's optionalbranch=<prefix>token (defaultfm/, so unconfigured projects are unchanged), plus the reverse PR-head-to-task-id mapping the bearings board needs.fm_registry_posture_tokenshelper tokenizes the posture bracket once for bothfm-branch-lib.shandfm-project-mode.sh. A configured prefix of an unsupported shape fails closed.fm-brief.sh,fm-dod-lib.sh,fm-merge-local.sh,fm-review-diff.sh,fm-promote.sh, andfm-bearings-snapshot.sh.fm/shape keeps its prior behavior.fm-), name-or-path input, and fail-closed handling; registry-format docs note the new token.