feat(downstream): default firstmate self-changes to local-only on downstream instances - #298
Open
rocco-zhang wants to merge 1 commit into
Open
feat(downstream): default firstmate self-changes to local-only on downstream instances#298rocco-zhang wants to merge 1 commit into
rocco-zhang wants to merge 1 commit into
Conversation
…nstream instances A firstmate instance cloned from the shared template has origin pointing at the upstream repo the user does not own, so firstmate-on-itself ship tasks and the self-ship flow open PRs against upstream by accident. - bin/fm-downstream.sh: detect owner vs downstream from live git origin owner vs authenticated gh login; unresolvable identity degrades to downstream. - fm_is_firstmate_repo (fm-tangle-lib.sh): authoritative firstmate-on-itself check via shared git common dir. - fm-project-mode.sh --firstmate-self: downstream -> local-only, owner -> no-mistakes; wired into fm-spawn.sh (git identity) and fm-brief.sh flag. - fm-pr-check.sh / fm-pr-merge.sh: hard-refuse a firstmate self-change PR when downstream unless FM_CONTRIBUTE=1 (explicit upstream-contribution opt-in). - AGENTS.md sections 1 and 12 document the downstream-user model.
This was referenced Jul 24, 2026
Open
Closed
Open
Closed
Closed
Closed
This was referenced Jul 28, 2026
Closed
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stop firstmate instances that run a clone of the shared template from accidentally pushing/PR'ing their own changes back to the upstream template.
A downstream instance has
originpointing at the upstream repo it does not own, so firstmate-on-itself changes (and the tool's own self-ship flow) open PRs against the upstream by accident — the public repo fills with instance PRs that were never meant as contributions.Approach
Detect downstream-vs-owner from live git/gh identity, and default a downstream instance's own firstmate changes to local-only (no remote, no PR). Contributing upstream stays possible but becomes a deliberate, explicit opt-in (
FM_CONTRIBUTE=1).Changes
bin/fm-downstream.sh(new): resolves origin's GitHub owner vs the authenticatedghlogin. A fork you own → owner; unresolvable identity → downstream (safe default).bin/fm-tangle-lib.sh:fm_is_firstmate_repo— authoritative firstmate-on-itself check via the shared git common dir.bin/fm-project-mode.sh:--firstmate-selfresolves tolocal-onlywhen downstream, unchangedno-mistakespipeline path when owner/maintainer.bin/fm-spawn.sh/bin/fm-brief.sh: consume the self-change mode; brief DoD becomes local-only-aware for a downstream self-change.bin/fm-pr-check.sh/bin/fm-pr-merge.sh: hard-refuse a firstmate self-change PR when downstream unlessFM_CONTRIBUTE=1(the backstop).AGENTS.md(sections 1, 12): documents the downstream-user model.Tests
shellcheckclean. Newtests/fm-downstream.test.sh(8 cases: owner/downstream/unresolvable detection, origin-URL parsing, mode resolution, brief DoD, both PR-seam refusals + opt-in). Existing fm-brief / fm-pr-merge / fm-tangle-guard / fm-spawn suites pass.Verified live: a downstream instance detects as downstream, resolves self-changes to local-only, and refuses arming a self-change merge poll without the opt-in.