Add scrollback recovery script for the test-pollution incident#35
Merged
Add scrollback recovery script for the test-pollution incident#35
Conversation
…ollback either (#36)
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.
Summary
servers.json, but it doesn't help users whose real chat history is now stranded under orphan UUID directories in~/Library/Application Support/Brygga/scrollback/.Scripts/recover-scrollback.shwalks the disk, lists orphan scrollback dirs sorted by recency, and prints exactmvcommands the user can copy after re-adding their server. Read-only by design — never moves or deletes anything itself._test,alice,__server__only) into a single summary line so the user's real chat history stays visible.Changes
Scripts/recover-scrollback.sh— new file, executable. ~170 lines of bash + one-liner Python embed for JSON parsing (avoidsjqdependency sincepython3ships with macOS).servers.json.~/Library/Logs/Brygga/(the user's real network names, intact becauseDiskLoggerkeys by network not UUID).MOST RECENT / FILES / FIRST 10 CHANNELS, sorted newest-first. Empty dirs and pure-test-fixture orphans are excluded; test pollution is summarized as a count.Test plan
swift build/swift test— N/A, docs/script only (no source code).swiftformat --lint .— N/A, no Swift changed../Scripts/recover-scrollback.shruns against my real scrollback directory and surfaces 4 real orphan dirs (Libera sessions) above 143 hidden test-fixture orphans.Application Support(initial bug —find | xargswas word-splitting; fixed with-print0).Risk / rollback
mv,rm, or any other mutation. Only prints commands.Scripts/alongsidebuild-app.sh. Not built into the app, not run by CI, not invoked at app launch.Follow-up (separate PR)
Same injection treatment for
ScrollbackStore.sharedandScrollbackIndex.sharedsoIRCSessionTestsstops creating fresh orphan dirs on everyswift testrun. Today, every test pass adds ~30 new orphans (visible at the top of the recovery script's hidden-summary count). Lower priority than theServerStorefix because the impact is "more dirs accumulate" not "user data overwritten", but worth fixing for hygiene.