Repository navigation
Carry upstream PRs #7243 (GitLab merge requests) and #8308 (stow before compaction) - #2
Merged
Merged
Conversation
… arm tasks-axi types a --pr link only as a GitHub or Forgejo pull request url, so a GitLab merge request url made the teardown atomic close refuse (both GitLab teardowns failed on it today). Extend the Gerrit note-rewrite precedent to GitLab: fm_backlog_pr_note_label labels any untaken forge url by its forge, and done, retain, and retained-artifact close record it as a labeled note instead of refusing. bin/fm-pr-check.sh now requires jq for a GitLab arm, names glab and jq together when either is missing, reads one JSON view of the merge request and refuses a work_in_progress draft exactly like the GitHub arm-time draft refusal, and records the MR head sha as pr_head for teardown and review consumers. fm_pr_json_draft_state takes the field name so GitLab's work_in_progress reads through the same helper. fm_pr_gitlab_read_record gains the glab-axi fallback its GitHub twin already had, with the glab implementation split out as fm_pr_gitlab_read_record_with_glab.
fm-review-diff.sh fetches the compare tip for a GitLab merge request from refs/merge-requests/<iid>/head, the ref GitLab keeps for every merge request, instead of warning down to the local branch; the one fetch helper now takes the ref pair, so the GitHub pull ref and the GitLab merge-request ref share one mechanism. fm-teardown.sh proves a recorded GitLab merge request landed the same way the GitHub path does: merged state through fm_pr_gitlab_read_record, head fetched from refs/merge-requests/<iid>/head, then the same ancestor-or-patch-id containment proof. pr_ref_for_target picks the forge ref for a bare number or either URL shape. fm-pr-merge.sh merges a merge request with --squash when the caller names no method, mirroring the GitHub default the header already documents, because the fleet's recording and teardown machinery reasons on squash merges. The forge closed set gains gitlab: fm-project-mode.sh parses and refuses it like gerrit, fm_forge_valid_for_mode accepts it for the publishing modes, a direct-PR DoD block on gitlab tells the worker to open its merge request with glab-axi and read its draft state back, fm-brief.sh names glab-axi in a gitlab ship brief's tool rule, and fm-forge-detect.sh proposes forge=gitlab from a gitlab.com origin. yolo stays available on gitlab; a base branch stays refused on gerrit publishes only, since a merge request targets any branch. docs: architecture.md, gerrit-forge-integration.md, and gitlab-merge-watch.md updated for the new behaviors, with dated arm-time head-recording and jq-refusal evidence against the public fixture. tests: arm-time head and draft, squash default, teardown MR proof and MR-url close, review-diff MR head, gitlab forge rows, detection proposals, DoD rendering, and the brief binding.
The fallback accepted the gh-twin spelling 'open' where GitLab's native open state is 'opened', so a host without plain glab read every open merge request as state unknown; it also rejected 'locked' as unreadable. Accept the native spellings, passing 'locked' through the way the plain-glab twin does, and pin the fallback with the tests it never had: the fake-glab-axi state matrix, the rendered gitlab tool rule and forge token in the ship brief, and the gitlab retain and retained-artifact labels on the captain-held cleanup paths. Findings and remedy from the adversarial review of the port (data/fm-gitlab-port-adversarial-review/report.md, F1-F4).
The merge with main replaced the gitlab port's no-mistakes draft-readback sentence with the forge-specific direct-PR wording, so a gitlab no-mistakes brief told the worker to read the pipeline's own pull request back through glab-axi. The readback is now scoped to the no-mistakes block: gh-axi for none and gitlab, main's tea sentence for forgejo, whose pipeline-opened pull request lives on the Forgejo forge. Two unit pins that predate the gitlab forge value also broke under the port: fm-brief's closed-set table and fm-project-mode's glabbed fixture both refused forge=gitlab, which the port accepts. Both now pin the binding positively, and the fm-brief forge test covers the gitlab Rule 3 line, the delivery-contract line, and the pipeline-scoped draft readback. Records the 2026-10-13 live end-to-end evidence in docs/gitlab-merge-watch.md against a real public fixture merge request: the draft-refusal arm, a fresh refs/merge-requests/<iid>/head review fetch that out-ranked a stale recorded pr_head, the guarded squash merge with a successful head pipeline, and the teardown landed-work proof after the merge.
…ebase The rebase onto main composed main's FORGE_RULE_LINE refactor (from the pr=manual feature) with the GitLab port's forge arms, but the ship heredoc still expanded the port's old $RULE3 variable, which the composed block no longer defines: every ship scaffold died on an unbound variable under set -u. Render rule 3 from FORGE_RULE_LINE, whose gitlab arm the composition keeps, so the glab-axi/tea/gh-axi rule lines reach the brief unchanged.
A GitLab landed-work proof read its merged state through the recorded URL's host, path, and number (fm_pr_gitlab_read_record) but fetched its containment head from the worktree's origin remote addressed by merge request number alone, and bin/fm-review-diff.sh fetched its fresh review head the same way. When the URL and the origin remote name different projects, a merged merge request in one project could authorize cleanup of - or review against - a same-numbered merge request of another project the origin happens to serve. Add fm_pr_gitlab_origin_matches to bin/fm-pr-lib.sh and call it at both readers: gitlab_mr_is_merged refuses on mismatch (the caller falls back to the content check, never trusting the origin-fetched head), and resolve_pr_head's GitLab arm leaves the head unresolved so the offline fallbacks apply. The check compares the raw configured origin URL - never the insteadOf-expanded transport, which only says where the same project is fetched from - after normalizing https/http/ssh/git and scp-like spellings, with a case-insensitive host, a case-sensitive project path, and a conventional trailing ".git" removed; a URL naming no host and project never matches. The merged-lands teardown test now pins both https and ssh spellings, and adversarial twins prove the refusal: a cross-project origin leaves teardown REFUSED with state retained, and a review whose origin names another project falls back to the recorded pr_head instead of the other project's fresh head. Also give test_teardown_closes_a_gitlab_task_with_its_mr_url_as_a_note its own fixture (tasks-axi-close-gitlab-mr-note): it reused the earlier close test's fixture, so make_case re-initialized an existing bare origin and cloned into a populated directory, continuing on leftover state with two Git setup errors per run.
… arm The GitLab origin-mismatch arm added in 487f4f0d guards the merge-request head fetch with fm_pr_gitlab_origin_matches, so on a mismatch the resolved local is never assigned; under set -u the function then crashed at [ -n "$resolved" ] before the recorded-pr_head fallback could run, printed 'line 185: resolved: unbound variable' to the user, and degraded the review to the local branch instead of the recorded head the commit promises. Initialize resolved empty. The cross-project unit twin now advances the local branch past the recorded pr_head, asserts the recorded head wins over the moved branch, and asserts the mismatch path leaves stderr clean; it fails on 487f4f0d and passes with this fix (proven live against gitlab.com in the evidence for this round).
bin/fm-pr-check.sh's header states that fm-pr-merge.sh records through it with FM_PR_CHECK_MERGE=1 and skips the arm-time draft refusal "because its own merge-time draft refusal is authoritative", but gitlab_verify_mergeable never read work_in_progress, so a merge request marked draft after arming reached `glab mr merge` with no firstmate-side refusal while GitHub and Forgejo both refuse theirs. Mirror those twins: read work_in_progress from the same one live view of the merge request, refuse unless it reads false, and report "the merge request is a draft" alongside every other failing condition, so the header claim is authoritative on every forge.
Add an opt-in Stop hook that tells a primary session to run the existing /stow skill when context nears compaction or the last /stow is a day old.
A Stop block in a secondmate home left the parent recording idle, and a missing python3 still asked by age after a /stow it could not see.
…equests end to end Carried from kunchenguid#7243
…o /stow before compaction Carried from kunchenguid#8308
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.
Intent
Run two open upstream pull requests on this fork before upstream merges them.
Once upstream merges them, the fork will be force-synced to upstream again, so each carried PR stays a separate
--no-ffmerge commit to keep it identifiable.Carried upstream PRs
dfeaa6a6)7d44d87d)Base: fork
mainatbc9370e8, identical to upstreammainat branch time.Conflicts
None.
Both PR heads merged into current
mainwithout conflicts, and no change was made beyond the two PRs' own content.Test results
All run on the merged branch (both PRs applied together), each under
bash:bin/fm-lint.shwith the pinned ShellCheck 0.11.0 on every changedbin/andtests/shell script: clean.bin/fm-doc-audience-check.sh: ok.mainwas needed.