Skip to content

feat(finale): sync with base branch before push - #812

Merged
jflowers merged 17 commits into
unbound-force:mainfrom
jflowers:opsx/rebase-upstream-before-push
Oct 24, 2026
Merged

jflowers merged 17 commits into
unbound-force:mainfrom
jflowers:opsx/rebase-upstream-before-push

Conversation

@jflowers

Copy link
Copy Markdown
Contributor

Summary

The /uf.finale workflow now syncs with the base branch after commit
and before push, so the created PR is never immediately out of date.
A new uf_finale_base_state plugin tool resolves the remote
(upstream, falling back to origin) and base branch, fetches, and
reports aheadBy/behindBy in a machine-parseable envelope with
provenance.

When the branch is behind, new step 4 "Sync with Base Branch"
(command renumbered eight to nine steps) presents a gate: rebase
onto <remote>/<base> (recommended), continue without rebase, or
abort — with a session-resume guard, checkpoint step sync-base,
safe git_rebase_abort on conflicts, and force-with-lease push
selection after a rebase. Fetch failures soft-gate (warn and
proceed).

The tool is injectable (GitExec + cwd) with 6 unit tests, tool
enumerations updated 8 to 9, scaffold mirrors synced byte-identically
(drift tests enforce parity), docs updated (CHANGELOG, usage,
architecture), and documentation issues filed:
#810 and unbound-force/website#320.

How to Test

Quality gates (CI parity): make check (lint, race tests incl.
scaffold drift parity, build, coverage gate, plugin-test) and
bash council-review-action/test/test-pipeline.sh (91 assertions).

Acceptance scenarios: on a branch behind its base, /uf.finale
step 4 reports behindBy via uf_finale_base_state and offers rebase
onto <remote>/<base> (recommended) / continue / abort; rebase
conflicts abort via git_rebase_abort and STOP; fetch failure
soft-gates; branch-current skips the gate; push after rebase uses
force-with-lease. Unit level: 6 createUfFinaleBaseStateTool tests
in .opencode/test/uf-finale.test.ts.

How to Demo

Run /uf.finale on a feature branch whose base has moved ahead —
step 4 (Sync with Base Branch) reports behindBy and offers the
rebase / continue / abort gate.

Key Files Changed

  • .opencode/commands/uf.finale.md — nine-step command with
    sync-with-base step
  • .opencode/plugins/uf-finale/index.ts — uf_finale_base_state
    tool
  • .opencode/test/uf-finale.test.ts — 6 unit tests
  • internal/scaffold/assets/opencode/commands/uf.finale.md and
    .../plugins/uf-finale/index.ts — scaffold mirrors (drift-parity)
  • openspec/changes/rebase-upstream-before-push/ — proposal,
    design, specs, tasks
  • CHANGELOG.md, docs/usage.md, docs/architecture.md — docs
  • .uf/dewey/learnings/ — 4 workflow learnings

This PR was generated by /uf.finale (AI-assisted).

@jflowers
jflowers requested a review from a team as a code owner October 23, 2026 16:57
@jflowers jflowers self-assigned this Oct 23, 2026

@jflowers jflowers left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: The council verdict is REQUEST CHANGES. GitHub does not allow requesting changes on one's own pull request, so this review posts as a comment; the verdict below stands unchanged.

Council Review Summary

The review council (4 Divisor reviewers: adversary, architect, curator, guard) reviewed this change; all CI checks pass. Three of four runs approve; the architect run requests changes on one HIGH finding.

Findings

HIGH — seam-verification — .opencode/test/golden-output-shape.test.ts:55 (inline below)

MEDIUM — error-handling — .opencode/plugins/uf-finale/index.ts (adversary)
When git rev-list throws, createUfFinaleBaseStateTool defaults aheadBy/behindBy to 0 in empty catch blocks and returns a success envelope with behindBy 0; the command then skips the sync gate entirely. The fetch path (BASE_SYNC_FETCH) returns a failure envelope correctly — the rev-list path should follow the same pattern or propagate a warning flag distinguishing "actually zero behind" from "count unavailable" (Constitution III, Observable Quality).

MEDIUM — command-structure — .opencode/commands/uf.finale.md:160 (inline below)

MEDIUM — error-handling — .opencode/plugins/uf-finale/index.ts:269 (inline below)

MEDIUM — constitution-check — openspec/changes/rebase-upstream-before-push/proposal.md:100 (inline below)

LOW — documentation — .opencode/plugins/uf-finale/index.ts:219 (inline below)

Verdict

REQUEST CHANGES — the HIGH seam-verification finding blocks. The blocking items are mechanical: one golden site test plus census correction, a step-6 consumption instruction, a rev-list failure envelope, and constitution V/VI assessments.

This review was generated by /uf.review-pr (AI-assisted).

Comment thread .opencode/commands/uf.finale.md Resolved
Comment thread .opencode/plugins/uf-finale/index.ts Resolved
Comment thread .opencode/plugins/uf-finale/index.ts Resolved
Implement createUfFinaleBaseStateTool per the rebase-upstream-before-push
OpenSpec change (specs/finale-base-sync): resolve the PR base remote
(upstream when listed, else origin), resolve the base branch via
git symbolic-ref refs/remotes/<remote>/HEAD with a main fallback, fetch
the base branch inside the tool, and report aheadBy/behindBy counts via
git rev-list against <remote>/<baseBranch>.

Envelopes follow the existing factory pattern: fetch failure returns a
retryable BASE_SYNC_FETCH failure naming the resolved remote and base
branch (soft gate); unexpected failures return BASE_STATE_ERROR. The
tool is read-only apart from the fetch and accepts an injectable GitExec
and cwd. Registered as uf_finale_base_state in the plugin entry point;
section banners renumbered to keep tool order aligned with the nine-step
finale sequence.
- Mark rebase-upstream-before-push tasks complete in tasks.md
- Add Dewey learnings: command design, content pipeline,
  documentation, seam verification

Assisted-by: glm-5
Generated with AI assistance (glm-5)
@jflowers
jflowers force-pushed the opsx/rebase-upstream-before-push branch from 8e4c63c to ce92e2a Compare October 23, 2026 21:15
Step 4's 'Continue without rebase' option mandates a behind-base
warning in step 6, but step 6 never read the sync-base checkpoint
-- the warning survived only as in-context carry-forward and was
dropped on session resume. Step 6 now reads {behindBy, rebased}
and includes the warning in the PR body (or finale report for an
existing PR) when rebased is false and behindBy > 0, mirroring
step 5's sync-base consumption pattern. Scaffold mirror synced
byte-identically.

Addresses PR unbound-force#812 review feedback from @jflowers.

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm-5
…plugin

Two same-file convention fixes in the uf-finale plugin:

- rev-list count failures were swallowed in comment-only catch
  blocks, leaving behindBy 0 in a success envelope. behindBy 0 is
  gate-deciding -- step 4 reads it as 'current with base, proceed
  without gate' -- so a count failure silently skipped the
  MANDATORY sync gate. Count failures now return a retryable
  BASE_SYNC_COUNT failure envelope, mirroring the BASE_SYNC_FETCH
  pattern, with a unit test covering the new failure path.
- all nine tool factories carried description-only JSDoc and no
  explicit return type annotations (TS-pack DR-001/CS-005 MUSTs);
  factories now carry @param/@returns JSDoc and
  ReturnType<typeof tool> annotations.

Scaffold mirror synced byte-identically.

Addresses PR unbound-force#812 review feedback from @jflowers.

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm-5
DE-007 requires the documented-output-shape seam verified in the
same increment that creates it. Adds the registry-path golden site
test for uf_finale_base_state (mockGit remote/symbolic-ref/fetch/
rev-list asserting the documented envelope {remote, baseBranch,
baseRef, aheadBy, behindBy}) and refreshes the three coupled census
counts: uf-finale 8 -> 9 sites with the base_state entry
(uf.finale.md:132), coverage 43 of 47 -> 44 of 48, describe title
8 -> 9, with post-insertion line anchors refreshed (create_pr 262,
ci_poll 270, return_to_main 349). Includes the seam-verification
learning captured during the Tier 2 assessment.

Addresses PR unbound-force#812 review feedback from @jflowers.

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm-5
The Constitution Alignment section assessed only principles I-IV;
the active org constitution v1.4.0 (amended 2026-10-14) carries six.
Adds the V (Security by Default: git-only plumbing, no new
dependencies, no secrets, failures surfaced not swallowed) and
VI (Deterministic Execution: D2 tool extraction with injectable
GitExec and golden-envelope pinning) assessments.

Addresses PR unbound-force#812 review feedback from @jflowers.

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm-5
…suite anchors

Wire the BASE_SYNC_COUNT failure envelope into /uf.finale step 4
as a soft gate alongside BASE_SYNC_FETCH (skip the sync-base
checkpoint, proceed to push), instruct step 5 to read the
sync-base checkpoint for push-mode selection, add the matching
count-failure scenario to the finale-base-sync spec delta, and
correct the golden-suite registry: section banner 8 -> 9
documented sites and the three test-title anchors shifted by
the step-renumbering (create_pr 262, ci_poll 270,
return_to_main 349). Council review learnings included.

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm-5
…ate issues

Amend design D8 with the review-phase repo-wide cross-reference
audit (six sibling unarchived changes and the uf-workflow-checkpoint
sequence table carry historical step numbers per the D9
disposition; the golden-suite anchors were the one live surface,
refreshed in this change), align the Risks mitigation wording,
relabel the proposal Capabilities section to the actual
finale-base-sync delta (no invented base-sync-check/gate or
finale-push/finale-command-sequence capabilities), and pin the
docs-gate issues (unbound-force#810, website#320) in task 4.3.

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm-5
…sync docs record

Council iteration 2 advisories: add the missing uf_finale_base_state
terminal-write hygiene test (ninth tool in the Requirement 1 suite),
record the DE-007 layer-3 round-trip N/A on task 3.2, correct the D8
cross-reference enumeration to twelve sibling changes (grep widened to
pre-rename `/finale` spellings and step-count phrasings), state the
absent-sync-base-checkpoint fallback in step 4, and sync the
user-facing record (usage.md, CHANGELOG, gate issues unbound-force#810/unbound-force#320) to the
both-codes base-state soft gate.

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm-5
The frontmatter description (command-picker text) and ## Description
enumeration still listed the pre-change activity order (commit, push,
create PR, ...) and omitted the step-4 sync with the base branch that
every secondary surface already documents. Extend both enumerations
line-count-stably so the golden census anchors (51/72/83/132/172/204/
262/270/349) and the 391-line count are unchanged; sync the scaffold
mirror byte-identically.

Council iteration 3 (0b845f2f) flagged this as the one remaining
MEDIUM finding: number-scoped cross-reference audits never touch
numberless prose, so the command's own self-description went stale.

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm-5
Store the two lesson proposals from council iteration 4
(APPROVE WITH ADVISORIES, 3 LOW advisories):

- seam-verification: a failure envelope's documented value
  invariants must be validated against every path that
  produces the value (exec throw, parse, coercion, default),
  not only the exec-throw path.
- documentation-gate: a docs-gate issue with per-surface
  dispositions functions as the change's documentation
  blast-radius manifest for reviewers and feed-backs.

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm-5
@jflowers
jflowers merged commit b20a1a5 into unbound-force:main Oct 24, 2026
17 checks passed
jflowers added a commit that referenced this pull request Oct 24, 2026
Step 4's 'Continue without rebase' option mandates a behind-base
warning in step 6, but step 6 never read the sync-base checkpoint
-- the warning survived only as in-context carry-forward and was
dropped on session resume. Step 6 now reads {behindBy, rebased}
and includes the warning in the PR body (or finale report for an
existing PR) when rebased is false and behindBy > 0, mirroring
step 5's sync-base consumption pattern. Scaffold mirror synced
byte-identically.

Addresses PR #812 review feedback from @jflowers.

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm-5
jflowers added a commit that referenced this pull request Oct 24, 2026
…plugin

Two same-file convention fixes in the uf-finale plugin:

- rev-list count failures were swallowed in comment-only catch
  blocks, leaving behindBy 0 in a success envelope. behindBy 0 is
  gate-deciding -- step 4 reads it as 'current with base, proceed
  without gate' -- so a count failure silently skipped the
  MANDATORY sync gate. Count failures now return a retryable
  BASE_SYNC_COUNT failure envelope, mirroring the BASE_SYNC_FETCH
  pattern, with a unit test covering the new failure path.
- all nine tool factories carried description-only JSDoc and no
  explicit return type annotations (TS-pack DR-001/CS-005 MUSTs);
  factories now carry @param/@returns JSDoc and
  ReturnType<typeof tool> annotations.

Scaffold mirror synced byte-identically.

Addresses PR #812 review feedback from @jflowers.

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm-5
jflowers added a commit that referenced this pull request Oct 24, 2026
DE-007 requires the documented-output-shape seam verified in the
same increment that creates it. Adds the registry-path golden site
test for uf_finale_base_state (mockGit remote/symbolic-ref/fetch/
rev-list asserting the documented envelope {remote, baseBranch,
baseRef, aheadBy, behindBy}) and refreshes the three coupled census
counts: uf-finale 8 -> 9 sites with the base_state entry
(uf.finale.md:132), coverage 43 of 47 -> 44 of 48, describe title
8 -> 9, with post-insertion line anchors refreshed (create_pr 262,
ci_poll 270, return_to_main 349). Includes the seam-verification
learning captured during the Tier 2 assessment.

Addresses PR #812 review feedback from @jflowers.

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm-5
jflowers added a commit that referenced this pull request Oct 24, 2026
The Constitution Alignment section assessed only principles I-IV;
the active org constitution v1.4.0 (amended 2026-10-14) carries six.
Adds the V (Security by Default: git-only plumbing, no new
dependencies, no secrets, failures surfaced not swallowed) and
VI (Deterministic Execution: D2 tool extraction with injectable
GitExec and golden-envelope pinning) assessments.

Addresses PR #812 review feedback from @jflowers.

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm-5
@jflowers
jflowers deleted the opsx/rebase-upstream-before-push branch November 15, 2026 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant