Repository navigation
test(live): static helpers stop doing console and file work themselves - #880
Merged
Merged
Conversation
Closes #852 (the mixed option). testing-style.md gains one sentence: for the statics rule, a seam a test helper receives as an argument counts as an injected seam (category C; those helpers stay as they are). Category A, the static helpers that wrote the console, now return what they used to print, and the calling test method writes the same line: PersistentPtyLiveTests' AssertSessionRemovalAsync, AssertSubmitHasNoTerminalAsync, AssertSubmittedLineRunsAsync, AssertDaemonAbsentArmsAsync and AssertRoundTripAsync (through the row delegates and WithTerminalAsync); RpcClientLiveTests.WriteError and SessionPermissionLiveTests.WriteEvidence (formatters returning the line); the two CleanupAsync helpers in SessionMetadataLiveTests and SessionPermissionRulesLiveTests (they return the observed exception name or null). Category B, the static helpers that did file work through a static RealFileSystem, become instance members over an instance RealFileSystem field: SystemConfigurationIsolationLiveTests.SeedSystemDocumentAsync, OpenCodeServerStopLiveTests.Seed, and OpenCodeServerEnsureLiveTests' SeedAsync and ReadRegistrationAsync. The field is typed RealFileSystem: CA1859 refuses IFileSystem for a field that only holds that type. Console lines, files, assertions and expected values are unchanged. Two duplicates the baseline held were re-tokened and map to their old fingerprints (quality-gates.md): 41876d574ec48db9 <- c045ab0efa440e92 PersistentPtyLiveTests 162-168 / 244-250 -> 160-166 / 240-246 c3451242882eaa5c <- 7943699770a884f4 SessionMetadataLiveTests 108-119 / SessionPermissionRulesLiveTests 88-99 -> 111-128 / 91-108
From the review of the #852 change: the two PTY helpers' <returns> docs name the evidence line they now return; WriteError and WriteEvidence, which no longer write, become ErrorLine and EvidenceLine; the three new instance file-system fields follow the tests' _fileSystem convention. Renames only; no behaviour change.
Blind-Striker
force-pushed
the
tests/852-static-live-helpers
branch
from
November 15, 2026 02:07
7328235 to
e359590
Compare
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.
📝 Description
What does this PR do?
#852, the mixed option the maintainer chose. Background:
coding-style.mdsays statics never perform outside-world work, andtesting-style.mdapplies that to test code.testing-style.mdgains one sentence: for the statics rule, a client, session, terminal or other seam that a test helper receives as an argument counts as an injected seam. The rule for direct console, file, clock, environment and process work is unchanged.RealFileSystem) are fixed in code. The re-check on the base found the issue's sites plus one more B:PersistentPtyLiveTests:AssertSessionRemovalAsync,AssertSubmitHasNoTerminalAsync,AssertSubmittedLineRunsAsync,AssertDaemonAbsentArmsAsync,AssertRoundTripAsyncWithTerminalAsync; the three test methods print itRpcClientLiveTests.WriteError→ErrorLineSessionPermissionLiveTests.WriteEvidence→EvidenceLineSessionMetadataLiveTests.CleanupAsync,SessionPermissionRulesLiveTests.CleanupAsyncnull; the instancefinallyprints itSystemConfigurationIsolationLiveTests.SeedSystemDocumentAsyncRealFileSystem _fileSystem(both#if NETarms kept)OpenCodeServerStopLiveTests.Seed_fileSystemOpenCodeServerEnsureLiveTests.SeedAsync,ReadRegistrationAsync(the 4th B site, found on the base)_fileSystemThe A sites take the second shape the decision names (a pure helper, with the caller keeping the I/O). The test classes have no injected console, and the analyzer wall (
CA1822) refuses an instance member that touches no instance state. The B fields are typedRealFileSystembecauseCA1859refusesIFileSystemfor a field that only ever holds that type.Related Issue(s):
🔄 Type of Change
🎯 Protocol & API Surface
🧪 Testing
No behaviour change. Every console line keeps its exact text, and still prints only after its helper's assertions have passed. Files are written with the same content. No assertion, expected value, test name or test count changed.
Proof: the existing rows pass, under the gate lock on Windows, net10.0, net11.0 and net48:
OpenCode.Sdk.Tests: 12619/12619;OpenCode.Sdk.Tools.TestsexceptNativeAot: 2791/2791.Proven by review, not by a run: four branches that no green run reaches.
CleanupAsynclogging catches print only when cleanup fails after a primary failure.Their text and order were checked line by line.
Clone gate: 0 new. Two duplicates the baseline already held were only re-tokened. They map to their old fingerprints as
quality-gates.mdrequires, proven by running the detector at the base:41876d574ec48db9c045ab0efa440e92PersistentPtyLiveTests162–168 / 244–250c3451242882eaa5c7943699770a884f4SessionMetadataLiveTests108–119 /SessionPermissionRulesLiveTests88–99✅ Completion Gate
verify-clonespass; the test projects are being re-run there under the lock.✅ Code Quality Checklist
🔍 Additional Notes
<returns>docs, theWrite*names that no longer write, and the_fileSystemfield naming.Support/BranchReport.Printis a static console writer that live rows call. It sits outside the*LiveTests.csscope the issue and this fix cover.