test: never write the real user state dirs from tests - #138
Merged
Merged
Conversation
13 tests in executor/orchestrator/agent wrote *.meta.json sidecars into the real ~/.local/share/late/sessions via the global SessionDir; all now redirect it to t.TempDir(). Production meta placement is unchanged (the resume lister depends on it).
…gin state file 10 plugin tests rewrote the real ~/Library/Application Support/late/ plugins.json; they now run under the package's sandboxUserConfig convention so the full suite provably writes nothing outside temp dirs.
Closed
5 tasks
Owner
|
Thank you for splitting the PRs that will allow going far quicker at them. |
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.
Several tests were quietly writing to the real user state dirs: session-meta sidecars landed in
~/.local/share/late/sessions, and plugin management tests rewrote the globalplugins.jsonunder~/Library/Application Support/late. This branch redirects all of them to temp dirs, so the suite provably writes nothing there.SessionDiratt.TempDir(). Production meta placement is unchanged (the--continuelister depends on it).sandboxUserConfigconvention, soplugins.jsonis always a throwaway.Note: the sibling feature PRs split from the same upstream base and don't carry these redirects — this branch holds the full isolation set on its own.
Testing
Full suite run against the real home with before/after sentinels on both state dirs:
exit 0 — all 18 packages green (15 ok, 3 without test files).
Proof of no user-dir writes:
Full path+mtime+size listing of both dirs: 499 files before, 499 after, diff empty (tree identical)
config.jsonsha256 before and after:70fa8c8f7fc750b18b9de0513adf599ca2f766d9ac5ebeca51edcc25267eb2a9(unchanged)gofmt -lon the touched files: no output (clean)go vet ./internal/agent ./internal/executor ./internal/orchestrator ./internal/plugin: clean