Skip to content

test: the pinned-server prerequisites refuse a submodule checkout off the recorded commit (#469) - #473

Merged
Blind-Striker merged 1 commit into
masterfrom
fix/469-stale-submodule
Oct 18, 2026
Merged

Blind-Striker merged 1 commit into
masterfrom
fix/469-stale-submodule

Conversation

@Blind-Striker

@Blind-Striker Blind-Striker commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

What

OpenCode.Sdk.Tests' discovery guard now refuses the module when external/opencode is not checked out at the commit this repository records, and names the command that fixes it.

Fixes #469.

Why

On 2026-10-18 a gate worktree's gitlink named v2.0.32 (#465), but its submodule was still checked out at v2.0.29 (git submodule status showed +). The guard checked the checkout's presence, its install and the Bun version, but not which commit was checked out. Every pinned-server test therefore ran a 2.0.29 server, and the suite passed. The env-precedence proof (#470) was the first test that can tell the two versions apart, and it exposed this.

The change

tests/OpenCode.Sdk.Tests/Harness/PinnedServerPrerequisites.cs:

  • New inputs. FindAsync takes the recorded commit and the checked-out commit.
    • The recorded commit is the index gitlink, the second field of git ls-files -s -- external/opencode. That is the same entry git submodule status compares against, so a staged gitlink counts.
    • The checked-out commit is git -C external/opencode rev-parse HEAD.
  • Differing commits. The guard adds: "The pin's checkout at '' is , but this repository records . Run: git submodule update --init --depth 1 external/opencode".
  • Unreadable commits. If either commit cannot be read while the source is present, the guard adds a problem naming which one and the same command. The guard fails closed here.
  • Missing source. It adds only the existing missing-source problem, as before.
  • Problem order. The order of the existing problems is unchanged: an invalid OPENCODE_SDK_TESTS_BUN_MISMATCH value, then missing source with its early return. The commit problems come next, followed by the Bun and install problems.
  • One process helper. The Bun version read and the two git reads share one private helper. The Bun read's command, messages and cancellation handling are unchanged.

PinnedServerPrerequisitesTests:

  • New rows:
    • a wrong checkout plus a missing install, asserting the full ordered list;
    • each commit unreadable;
    • missing source with no commit problem;
    • a typo'd switch value plus missing source, asserting the full ordered list.
  • Existing rows reach FindAsync through a matching-commit helper, with assertions unchanged.
  • Clone baseline. tools/jscpd/tests.baseline.json only removes two entries, 482c654299e74350 and 57470feca6bbb65f. They are the duplicated arranges that the helper eliminated, and nothing is added.

CI is unaffected: a fresh checkout's submodule always matches.

Proof

Each mutant is a compiling edit to the guard, run on net10.0 and on net472 and then restored:

Mutant Effect
The commit comparison neutralized (&& string.IsNullOrEmpty(checkedOutCommit)) Only FindAsync_Should_Name_A_Wrong_Checkout_Before_A_Missing_Install is red. The && false form is rejected by S1125, a second guard.
The typo check moved after the missing-source early return Only FindAsync_Should_Name_A_Mismatch_Typo_Before_Missing_Source is red.

Checks:

  • The class: 20 of 20 on net10.0 and on net472. The guard itself accepts this matching checkout, because the module would refuse at discovery otherwise.
  • The whole OpenCode.Sdk.Tools.Tests project: 2072 of 2072.
  • verify-clones: exit 0, tests at 4.97%, 0 new.
  • Slopwatch: 0. Format: clean.
  • Local check: GATE PASS on 6d3d93eb (master df25ea59): every step including the new submodule and pinned-install steps, and 10,805 tests with 0 failed.

Provenance

Sol Fast drafted the guard and the rows, then made a fix pass. The coordinator finished the remaining items by hand, because that was cheaper than a third dispatch:

  • the restored problem order, with its red proof;
  • the two stale baseline removals;
  • two nits.

The coordinator also verified the evidence and ran the local check.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

… the recorded commit (#469)

Discovery now reads the index gitlink for external/opencode and the
submodule's checked-out HEAD, and refuses the module when they differ or
cannot be read, naming the command that fixes it. A stale checkout had let a
gate run the previous upstream while the repository recorded the new one.
The Bun version read and the two git reads share one process helper, and the
existing rows reach FindAsync through a matching-commit helper.
@Blind-Striker
Blind-Striker added this pull request to the merge queue Oct 18, 2026
Merged via the queue into master with commit 36e0c7c Oct 18, 2026
12 checks passed
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.

Pinned-server prerequisites accept a submodule checkout that differs from the recorded gitlink

1 participant