Repository navigation
Refuse any revision that would rewrite the live world - #72
Merged
Merged
Conversation
data/world/ was tracked on main in #64 and #67 so the hub built on the local test server could be shipped to the droplet once. That worked, and then the mechanism stayed armed. The droplet pulled it on 2026-10-11 and its live world was replaced by the local snapshot: the deployment statuses record the seed changing from 1691256543523180978 to 2945200692062874765 and the spawn moving from 587,98,87 to 16,74,-16. #68 untracked it again and added the .gitignore rule, but nothing stops that from being undone, and every branch cut before that date still tracks all 146 files. Tracking the save is unsafe in both directions. Region files are binary so git cannot merge them, and whichever side deploys next destroys what the other built. Untracking is equally destructive: dropping a path from the index deletes it from the working tree on the next checkout, so the cleanup commit is itself capable of erasing a live save. playerdata/, stats/ and advancements/ are the players' own inventories, positions and hub homes. tests/test_world_not_tracked.py is the tripwire, with four checks that each stop a different mistake: the .gitignore rule (an accidental add -A), the tracked-file list (an add -f, or a merge of an older branch), and two on the droplet guard below. Both failure directions are proved against a throwaway repo rather than asserted against a string, because the untracking direction is the easy one to leave untested. gitops/deploy.sh now refuses a revision whose diff touches data/world/, before it pulls. CI gates the repo, but only the droplet gates the live world, and that box holds the only real copy. It exits loudly on every tick rather than skipping quietly, because a main that would eat the save needs a person. tests/test_world_no_player_data.py opened by stating data/world/ is tracked, which inverted in #68. Left alone it reads as a guarantee about a directory it no longer sees any files in, so it now says what it actually is: the second line of defence if the world ever becomes tracked again.
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.
Why
data/world/ was tracked on main in #64 and #67 so the locally built hub could be
shipped to the droplet once. That worked, and the mechanism stayed armed. The
droplet pulled it on 2026-10-11 and its live world was replaced by the local
snapshot. The deployment statuses record it: seed 1691256543523180978 became
2945200692062874765, and spawn 587,98,87 became 16,74,-16.
#68 untracked the world and added the .gitignore rule, but nothing stops that
being undone, and every branch cut before 2026-10-11 still tracks all 146 files.
Merging any one of them re-arms it.
Tracking the save is unsafe in both directions:
silently destroys what the other side built.
from the working tree on the next checkout, so the cleanup commit itself can
erase a live save.
positions and hub homes.
What
tests/test_world_not_tracked.py, wired into CI: fails if anything underdata/world/ is tracked, if the .gitignore rule is missing, or if the droplet
guard is absent or sits after the pull.
gitops/deploy.shrefuses a revision whose diff touches data/world/, beforeit pulls. CI gates the repo; only the droplet gates the live world, and that
box holds the only real copy. Loud exit on every tick, not a quiet skip.
tests/test_world_no_player_data.pyopened by stating data/world/ is tracked,which inverted in Hub guard, slower hunger, and track the board configs #68. Corrected to describe what it now is: the second line
of defence if the world is ever tracked again.
Validation
All checks mutation-tested rather than trusted green:
git add -fa region fileThe guard's detection is proved against a throwaway repo in both directions
(adding world files, and untracking them), because the untracking direction is
the one that deletes a save and the easy one to leave untested.
Local run: test_world_not_tracked, test_world_no_player_data,
test_client_server_mods, test_custom_mods_reviewed, test_kubejs_script_hazards,
test_security_alerts, test_design_role.js all pass; bash -n clean on all nine
shell scripts; ci.yml parses.
Note
This changes no world content and no mod list, so it is safe to deploy: the diff
touches no data/world/ path, which the new guard itself confirms.