Skip to content

test(gateway): centralize session branch fixtures - #117625

Merged
steipete merged 1 commit into
mainfrom
codex/goal100k-control-ui-session-branch-fixture
Aug 1, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/goal100k-control-ui-session-branch-fixture

Conversation

@steipete

@steipete steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

The session branch diff suite rebuilt the same real temporary Git repository, commits, remote refs, GitHub routes, and merged-PR envelopes in every test. That made a 19-test behavior matrix 961 lines long and obscured the few history details that differ per scenario.

This change moves only repeated arrange/act mechanics into typed, file-local fixture owners. Every test remains standalone. Real Git commits, branches, heads, merge bases, remote refs, routed GitHub responses, cache eviction, and cleanup still run exactly as before.

Architectural owner and canonical fix

  • Owner: src/gateway/control-ui-session-prs-branch.test.ts test fixture boundary.
  • Canonical fixture owners: file writes/commits, repository and feature setup, remote ref tracking, revision resolution, merged-PR envelopes, and branch-state loading.
  • Removed paths: nineteen hand-expanded copies of those mechanics.
  • Production LOC delta: 0.
  • Test LOC delta: +227/-744, net -517.

Evidence

  • File size: 961 -> 444 lines; nonblank 900 -> 389; characters 33,611 -> 17,020.
  • No line packing: maximum line length remains 99; lines over 100 remain 0.
  • Strict exact-clone scan (jscpd min 5 lines / 45 tokens): 663 -> 49 duplicated lines, 40 -> 4 clones.
  • Declaration parity: all 19 test titles and order are identical. Digest ef8dd2eadef57d668869b2c13f4d00b6e3d837b9f1f8ade480cab040ad00d2ae.
  • Assertion parity: all 20 inline matcher expressions and order are byte-identical. Digest 84fd6e5fd991cc4d4462989a43d02f23d9f4e2d3f5610312c0fff497be64bead.
  • Current-main proof: clean synthetic merge with origin/main fb3d473; the owned test blob is identical in the branch and synthetic merge.
  • Full open-PR path scan found no overlapping PR for the owned file.

Tests

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: L maintainer Maintainer-authored PR labels Aug 1, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 4:44 PM ET / 20:44 UTC.

ClawSweeper review

What this changes

Centralizes repeated temporary-Git repository, remote-ref, GitHub-response, and branch-state setup inside src/gateway/control-ui-session-prs-branch.test.ts without changing the tested gateway runtime.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

This is a focused test-only refactor that keeps the existing session-branch behavior matrix while making its real-Git setup easier to maintain. Current main still has the expanded fixture setup, and the protected maintainer label requires an explicit human landing decision rather than automated cleanup.

Priority: P3
Reviewed head: 44a30a5fd914e86d1f203a41c378d0b03e2fc4f3
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused, production-neutral refactor with direct test-run and changed-gate evidence.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR body provides after-refactor Blacksmith Testbox evidence for the exact 19-case real-Git suite and a changed gate; terminal proof is appropriate for this test-only change.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body provides after-refactor Blacksmith Testbox evidence for the exact 19-case real-Git suite and a changed gate; terminal proof is appropriate for this test-only change.
Evidence reviewed 6 items Current-main test surface: Current main still contains the expanded session branch diff stats suite, so the central fixture consolidation is not already implemented on main.
Proposed fixture boundary: The PR keeps fixture helpers file-local and uses them to construct real repositories, commits, remote refs, merged pull envelopes, and loader calls; production code is untouched.
Behavior-matrix parity: Both the main and proposed file contain 19 test declarations and 20 expectation calls; the proposed cases continue to cover merged-head, rebase, merge-base, untracked-file, and unknown-default-branch outcomes.
Findings None None.
Security None None.

How this fits together

The Control UI session pull-request loader combines local Git branch facts with GitHub pull-request state to render pull-request chips and a possible Create PR row. This test suite builds temporary repositories and routed GitHub responses to verify that branch-state decisions remain correct across merged, rebased, dirty, and missing-ref scenarios.

flowchart LR
  A[Control UI session] --> B[Session PR loader]
  B --> C[Local Git branch facts]
  B --> D[GitHub pull request state]
  C --> E[Branch-state decision]
  D --> E
  E --> F[PR chips and Create PR row]
  G[Test fixtures] --> C
  G --> D
Loading

Decision needed

Question Recommendation
Should this protected maintainer-labeled test refactor be landed after its branch is refreshed against current main? Refresh and land: Rebase or refresh the exact head, confirm required checks, then merge the test-only cleanup.

Why: The patch appears correct and does not alter runtime behavior, but repository policy keeps protected maintainer items for explicit human handling.

Before merge

  • Resolve merge risk (P1) - GitHub currently reports this PR as behind main; rebase or exact-head merge validation should refresh before landing, although current-main history shows no independent rewrite of the owned test file.
Agent review details

Security

None.

PR surface

Tests -517. Total -517 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 227 744 -517
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 227 744 -517

Review metrics

None.

Stored data model

Persistent data-model change detected: serialized state: src/gateway/control-ui-session-prs-branch.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the file-local fixture refactor after an up-to-date merge check, retaining the existing real-Git scenario coverage and the unchanged production branch-resolution contract.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the file-local fixture refactor after an up-to-date merge check, retaining the existing real-Git scenario coverage and the unchanged production branch-resolution contract.

Do we have a high-confidence way to reproduce the issue?

Not applicable — this PR refactors test setup rather than reporting a runtime defect. The provided PR evidence reports the exact 19-case suite and changed gate passing after the refactor.

Is this the best way to solve the issue?

Yes. File-local helpers remove repeated arrangement mechanics while preserving the real-Git and routed-response boundary that the tests are intended to cover; moving this policy into production or shared support code would add unnecessary surface.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against fb3d473a73b0.

Labels

Label changes:

  • add P3: This is low-risk test-maintenance cleanup with no production behavior or configuration change.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-refactor Blacksmith Testbox evidence for the exact 19-case real-Git suite and a changed gate; terminal proof is appropriate for this test-only change.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body provides after-refactor Blacksmith Testbox evidence for the exact 19-case real-Git suite and a changed gate; terminal proof is appropriate for this test-only change.

Label justifications:

  • P3: This is low-risk test-maintenance cleanup with no production behavior or configuration change.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body provides after-refactor Blacksmith Testbox evidence for the exact 19-case real-Git suite and a changed gate; terminal proof is appropriate for this test-only change.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-refactor Blacksmith Testbox evidence for the exact 19-case real-Git suite and a changed gate; terminal proof is appropriate for this test-only change.

Evidence

What I checked:

Likely related people:

  • steipete: Current history shows this contributor introduced both the branch-state runtime and its 19-case real-Git test suite, and current blame attributes the relevant test and loader lines to that work. (role: feature owner and recent area contributor; confidence: high; commits: 142ad75c4336, 44a30a5fd914; files: src/gateway/control-ui-session-prs.ts, src/gateway/control-ui-session-prs-branch.test.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit b8655a7 into main Aug 1, 2026
104 of 115 checks passed
@steipete
steipete deleted the codex/goal100k-control-ui-session-branch-fixture branch August 1, 2026 21:01
@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant