Skip to content

0.148.1: read_world_file accepts a tool's world.json under a dot-folder inside the world - #49

Merged
tmoosting merged 1 commit into
mainfrom
dot-folder-inside
Nov 24, 2026
Merged

tmoosting merged 1 commit into
mainfrom
dot-folder-inside

Conversation

@tmoosting

Copy link
Copy Markdown
Member

What changed

read_world_file refused a world file whose world holds a tool's own world.json under a dot-folder (abbey/.atlas/world.json, abbey/elements/character/.trash/world.json) as a second world (OW-5). A dot-folder is never a world, wherever it sits, and read_folder never reads one, so the same tree opened as a folder and was refused as a file.

The OW-5 loop in src/onlyworlds/worldfile.py now skips a path when any folder segment of it (every segment but the last, relative to the world's root) starts with a dot. One condition, plus its comment and the module docstring's OW-5 bullet. Nothing else moves:

  • every other check still runs on those entries (paths, names, duplicates, collisions, size and count), and they are still returned in entries (and written by to_folder), as before;
  • a . or .. segment is still refused (unsafe_path, checked before this loop);
  • a nested world.json outside a dot-folder and outside records/ (abbey/inner/world.json) is still refused;
  • records/ is still excepted;
  • the writer is untouched: it still carries a dot-folder only when the caller hands it in (private_dir).

This follows a ruling on the world-file conformance checks OW-4 and OW-5; the conformance case comes with the next schema distribution serial. Version 0.148.1, with its CHANGELOG.md entry.

Tests (tests/test_worldfile.py)

Five new tests, archives built in the test with zipfile; the npm SDK's pull request has the same five cases in the same order:

  1. abbey/.atlas/world.json (another world's id) and abbey/.atlas/world-prefs.json: accepted, the world is abbey's, every entry returned, and read_folder over to_folder's output reads only abbey's one character and equals read_folder over the same tree written directly (world, elements, skipped, duplicates, ignored directories).
  2. The same with abbey/elements/character/.trash/world.json.
  3. The same with abbey/..atlas/world.json.
  4. Still refused: abbey/inner/world.json (more_than_one), abbey/inner/.atlas/../world.json and abbey/.atlas/./world.json (unsafe_path), and abbey/inner/world.json beside abbey/inner/.hidden/world.json or beside a dot file abbey/inner/.hidden (more_than_one, naming abbey/inner/world.json).
  5. abbey/records/lab/world.json: still accepted.

Red before, green after: with the source change stashed, uv run pytest tests/test_worldfile.py gave 4 failed, 32 passed, 2 skipped (tests 1, 2 and 3 refused with more_than_one; test 4 refused naming abbey/inner/.hidden/world.json first); with it, 36 passed, 2 skipped (the two skips are Windows-only: NTFS names, symlinks).

Gates (AGENTS.md, in order)

  • uv sync --locked: Checked 16 packages in 1ms
  • uv run pytest -q: 2392 passed, 45 skipped in 128.08s (0:02:08); the .owworld fixture-set replay passes untouched
  • uv run ruff check .: All checks passed!
  • uv run ruff format --check .: 141 files already formatted
  • uv run mypy --strict src tests: Success: no issues found in 131 source files
  • uv run python codegen/generate_schema.py --check: ok: _schema.py and the vendored checker match v0.34.1-dist.145
  • uv run python codegen/generate_tools.py --check: ok: _tools.py matches the tools list at aa009695f03d7c78972793b034c145990ce4c1b7
  • uv run python codegen/generate_anchors.py --check: src\onlyworlds\_anchors.py is current
  • uv run python codegen/generate_directions.py --check: src\onlyworlds\_directions.py is current
  • uv run python codegen/generate_casefold.py --check: _casefold.py current: 1457 rows
  • uv run python codegen/generate_nfc.py --check: _nfc.py current: 922 classes in 388 runs, 2061 mappings, 81 exclusions
  • uv run python scripts/public_words.py: public words: 0 finding(s) in 154 file(s); the new changelog entry alone: 0 finding(s) in 1 file(s)
  • uv run python scripts/public_words.py --commits origin/main..HEAD: public words: 0 finding(s) in 1 commit message(s)

Run on Windows, Python 3.14. Not run locally: the wire and live tests (OW_OPENAPI, OW_LIVE; no route or method changed, and CI's wire job runs them), okf-reference and folder-conformance (CI jobs), and the wheel job (no packaging change).

Looked wrong, left alone

  • read_folder skips a dot-prefixed file in a type folder and lists it in skipped; the npm SDK's folder source passes over it silently. Not file against folder, and outside this change.

🤖 Generated with Claude Code

…er inside the world

The reader refused a world file whose world holds a world.json under a
dot-folder (abbey/.atlas/world.json, abbey/elements/character/.trash/world.json)
as a second world (OW-5). A dot-folder is never a world, wherever it sits, and
read_folder never reads one, so the same tree opened as a folder and was
refused as a file.

The OW-5 loop now skips a path when any folder segment of it, relative to the
world's root, starts with a dot. Nothing else moves: every other check still
runs on those entries, a . or .. segment is still refused, they are still
returned in entries, a nested world.json elsewhere (abbey/inner/world.json) is
still refused, and records/ is still excepted. This follows a ruling on the
world-file conformance checks OW-4 and OW-5; the conformance case comes with
the next schema distribution serial.

Five tests build the archives by hand, the same cases in the same order as the
npm SDK's: three accepted shapes (a root dot-folder, one under a type folder, a
..atlas name), each written out with to_folder and read with read_folder
against the same tree written directly; the refusals that stay; and records/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tmoosting
tmoosting merged commit 8da00ae into main Nov 24, 2026
11 checks passed
@tmoosting
tmoosting deleted the dot-folder-inside branch November 24, 2026 05:15

This branch was previously deployed

1 inactive deployment
pypi — 8da00aec Deployed Nov 24, 2026 by tmoosting via publish #236
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant