Repository navigation
refactor: single responsibility - #37
Merged
Merged
Conversation
isMissingNetwork matched any Docker output containing "not found". When the selected Docker context is unavailable, the CLI prints `context "x": context not found`, and that was misread as a missing network. docker_network_absent then passed while the network still existed, and Close dropped the network from its retryable cleanup set, so every lab network leaked once the context recovered. A network now counts as missing only when Docker names the exact reference: "network <ref> not found" (current engines) or "No such network: <ref>" (older engines). Every caller passes its exact reference (inspect, Close, and the orphan janitor), so context, transport, and CLI failures now propagate as errors. Regression tests cover: - classification against messages captured from Docker 29.7.2; - context failure and recovery, for both validation and Close; - the janitor's network removal path. All three fail against the old substring match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Session.Run, previously one 360-line function, is now a short read loop over an attempt type, with separate methods for each built-in command, command execution, recording practice, and completion. - runPlay and listMissions are split into option parsing, choosing the starting mission, and rendering helpers. - Docker adapter: - The six copies of the ownership check are now one owns() helper. As a side effect, the two reconcile paths now also check the schema label; they previously skipped it. - The duplicated redaction code is now one redact function over a shared identity type. - Execute is a table-like dispatcher. - Factory.Create delegates to named setup steps. - Container creation builds its arguments from small builders. - Mission validation runs as four ordered checks, and condition validation is split into the field rules and each type's value rules. Left alone on purpose: the shell lexer, grep, tar, find, and the command dispatcher. They're security-sensitive or long flat switches, heavily tested, and splitting them would add risk without making them clearer. Docs and skills: references to moved code in the safety doc, the mission checklist, and the add-mission, extend-sandbox-command, and prepare-iteration skills now point at the new files. Validation - make check-all: passed, including race detection and the smoke test. - go vet for Windows, Linux, and macOS: passed. - make docs-check: passed in strict mode. - All 6 real-Docker integration tests passed, with 0 containers or networks left behind. - git diff --check: clean.
Main gained the squash-merged fix from #35 (1fa140c), which is identical to this branch's fix commit (9a760c2). Both sides touched the files the refactor later moved, so the three conflicts keep this branch's side: - dockerlab_test.go stays deleted. Its contents, including the fix's context-failure fake fields, live in fake_runner_test.go and the related split test files. - network.go keeps the refactored layout. The fixed isMissingNetwork lives in transport.go. - network_test.go keeps the refactored layout. The fix's regression tests live in network_errors_test.go. The merged tree is identical to a22146f, and make check-all passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
No description provided.