Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ The package version runs on its own semver; the schema it is generated from is `

## Unreleased

## 0.145.0 (2026-11-23)

- **A share carries under `elements/` and `spatial/` only what the folder reader serves.** `write_world_file(include_hidden=False)` and `world_file_bytes` now ask `read_folder` which files are elements, and carry those that hold no hidden mark. Every other file there is left out and listed in `unread_left_out=`: a file with another extension (`notes.txt`, a browser's swap file), one deeper than a type folder (a hidden element's file moved into `old/` by hand), one directly under `elements/`, one in a folder that is no type and an object with no non-empty string `id`. Until now a share carried a file with another extension, or one not directly in a type folder, whatever it held, a hidden element's text included, and judged the other kinds by their own mark alone. A file that holds a mark and is not served as an element is listed with the unread, not the hidden.
- **An id that two files hold travels in neither file on a share.** Each file was judged by its own mark, so a hidden element's second, unmarked file travelled. Both files are now left out and listed in `unread_left_out=`, within one layout or across `elements/` and `spatial/`: with two files for one id, which mark is the element's cannot be said.
- **A copy never rewrites a file that was not read as an element.** The default copy takes the author fields out of element files only. A file of the kinds above keeps its bytes, author fields included; before, any JSON object directly in a folder of `elements/` or `spatial/` was rewritten.
- **`read_folder` reads names as written.** The extension is `.json` in lower case and a type folder is the type word in lower case, as the format says. `elements/map/M.JSON` was served as an element and is now skipped and listed (`the extension is not .json in lower case: not read`); `elements/Character/` was read as the character folder and now lands in `ignored_dirs`. A folder this package wrote is read as before: its writers write both in lower case.

## 0.144.0 (2026-11-23)

- **A share leaves out a file it could not read as an element.** `write_world_file(include_hidden=False)` and `world_file_bytes` carry a `.json` file in a type folder only when they read it as an element and found no hidden mark. A file there that could not be read is left out too, since its mark cannot be told: one that is not UTF-8 JSON (a write cut short), is nested more than 200 deep, holds a number that is not finite or an integer of more than 4,300 digits, or is not an object. Until now a share carried a file that was no JSON as it was, so a hidden element whose file was cut short travelled with its text. `unread_left_out=`, a second list the caller passes, receives those files' paths, sorted, apart from `hidden_left_out=`: a broken file is one a person may want to mend. This is the folder format's rule for a share, as ruled on 2026-11-23.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ world = read_world_file("moppetopia.owworld")
world.to_folder("moppetopia-copy")
```

`write_world_file` carries `world.json` byte for byte (its `producer`, `source` and `format_version` included) and the folder's parts, `elements/`, `spatial/`, `media/` and `records/`, and nothing else: never an `api` block, never a tool's own folder unless you hand it in (`private_dir=".atlas"`, which makes the file a private copy rather than one to send around), and never a producer's records its `records/RECORDS.json` entry marks `"private": true` unless you ask (`include_private_records=True`); the manifest itself always travels as it is. A hidden element (`hidden: true` in its file) travels byte for byte, since the file is a copy; for a file you hand to someone else, `include_hidden=False` leaves every hidden element's file out whole, and a list passed as `hidden_left_out=` receives their paths. Nothing else changes, so a link from a visible element to a hidden one keeps an id the file no longer holds. An element's author fields (`created_by`, `changed_by`, `changed_via`, `changed_client` and `doors`) record which member and which tool wrote it, which means nothing to someone the world is handed to, so every element file leaves them out by default (`created_at` and `updated_at` stay): a file holding any of them is rewritten without them in the folder's own form, and a file holding none travels byte for byte. To archive your own world as it is on disk, pass `include_author_fields=True`. A share carries a file in a type folder only when it was read as an element and no mark was found: one that could not be read (not UTF-8 JSON, a write cut short, nested more than 200 deep, a number that is not finite, not an object) is left out as well, and a second list, `unread_left_out=`, receives those paths. A copy carries such a file byte for byte. The same folder gives the same bytes on one Python. `read_world_file` checks the whole archive before it unpacks anything and refuses a file it cannot open safely with a `WorldFileError`, whose `reason` names one of the spec's twelve causes (`unsafe_path`, `collision`, `too_big`, ...). It gives the same verdict as the TypeScript and Unity SDKs on every case of the format's conformance set.
`write_world_file` carries `world.json` byte for byte (its `producer`, `source` and `format_version` included) and the folder's parts, `elements/`, `spatial/`, `media/` and `records/`, and nothing else: never an `api` block, never a tool's own folder unless you hand it in (`private_dir=".atlas"`, which makes the file a private copy rather than one to send around), and never a producer's records its `records/RECORDS.json` entry marks `"private": true` unless you ask (`include_private_records=True`); the manifest itself always travels as it is. A hidden element (`hidden: true` in its file) travels byte for byte, since the file is a copy; for a file you hand to someone else, `include_hidden=False` leaves every hidden element's file out whole, and a list passed as `hidden_left_out=` receives their paths. Nothing else changes, so a link from a visible element to a hidden one keeps an id the file no longer holds. An element's author fields (`created_by`, `changed_by`, `changed_via`, `changed_client` and `doors`) record which member and which tool wrote it, which means nothing to someone the world is handed to, so every element file leaves them out by default (`created_at` and `updated_at` stay): a file holding any of them is rewritten without them in the folder's own form, and a file holding none travels byte for byte. To archive your own world as it is on disk, pass `include_author_fields=True`. A share carries a file under `elements/` or the old `spatial/` only when the package's folder reader (`read_folder`) serves it as an element and it holds no mark. Every other file there is left out as well, and a second list, `unread_left_out=`, receives those paths: a file that is not UTF-8 JSON (a write cut short, or text after the one JSON value), is nested more than 200 deep, holds a number that is not finite, is not an object or has no `id`; a file with another extension, deeper than a type folder (a hidden element's file moved into `old/` by hand) or in a folder that is no type; and both files of an id that two files hold, since which mark is the element's cannot be said (since 0.145.0; 0.144.0 left out only a file in a type folder that it could not parse). A copy carries every such file byte for byte and never rewrites it. The same folder gives the same bytes on one Python. `read_world_file` checks the whole archive before it unpacks anything and refuses a file it cannot open safely with a `WorldFileError`, whose `reason` names one of the spec's twelve causes (`unsafe_path`, `collision`, `too_big`, ...). It gives the same verdict as the TypeScript and Unity SDKs on every case of the format's conformance set.

To send a folder's edits back, keep a copy exported before you edited, then push the difference:

Expand Down Expand Up @@ -253,7 +253,7 @@ for finding in report.findings:

It looks for links to elements that are not there, Events that end before they start, elements with no links in or out, two elements of one type whose names collide once case, character width, spacing and punctuation are folded (a name shared across types, such as a Location and its Pin, is not one), stubs never filled (a known-of element older than `--days`, or an element with no text in any of its type's text fields, on every type but map, marker, pin and relation), and a charter Law untouched after `--changes` changes in the feed. On a folder it also checks `world.json`: a `format_version` older than this package's (flag 9), and an `api_key` in a `world.json` that git tracks (flag 10). On both doors it reads the world's own house rules (flag 11, the checks profile: `x_checks_rules` on the world's Charter, the newest Law with supertype Charter that carries the mark `x_charter_of`, applied by `onlyworlds.apply_checks`) and names every element a rule finds short, with each rule's scoped and short counts, and every rule it cannot apply, with why; an older marked Charter is a finding, its rules not applied; a Law with supertype Charter and no mark is lore, not a Charter and not a finding, and its rules are never applied. Flag 14 names a marked Guide or Domain whose links name an element that is not in the world or a hidden one (every other reader is served the Guide or Domain without it; not through a guest key, and the hidden half only through a key that is served hidden elements). On a spine world (one where an element carries an `x_spine_` key), flag 13 reads each element with `read_spine_element` and names an off-list supertype on a listed type, every value the reader drops and a probe not in the probe form; then, on a source world, it checks that each row (an Object, Construct, Location or Law of a listed kind, the Charter too) is kept by exactly one Seat (a Title with supertype `Seat`, through its field for the row's type; any other Title neither owns nor counts), that every `x_spine_depends_on` id is in the world (not through a guest key), that a `legacy` or `provenance` row has an Event with supertype `Retirement` that names it in `x_spine_retires` and links it through its typed field where the type has one (`objects`, `constructs`, `locations`; an Event has no `laws` field, so a Law's retirement is attributed by the key alone; only through a key that sees every element, hidden ones too), that no row is still at `gone` (its retirement is unfinished), and that no two rows of one row type share a name once trimmed and folded for case (a Seat or any other element is outside that rule). Whether a probe passes and `x_spine_probed` are not checked, and the report says so. A projection (a public world built from a spine, each row naming its keeping Seat in `x_spine_owner`) is marked on its World with `x_spine_projection`, `{source, at}`: `source` the projected-from world's id as a string, a UUID that is no element's id in this world, and `at` the ISO 8601 time of the last rebuild, which must parse; each is a finding on the world otherwise. On a projection only the projection's own checks run: every row must carry `x_spine_owner` (the keeping Seat's name in the source, which need match nothing in the projection) and no element may be hidden; the source's checks do not run there, and the report names each. On an unmarked world `x_spine_owner` is a finding (the projection's third check), and a malformed mark is a finding on the world, which is then read as unmarked. Each check says how much it could compare, and one it cannot run (a folder has no change feed; nothing records whether a message was read) is listed with the reason, never counted as clean. A finding on a message or a room thing (supertype Message, Board, Work item, Spec, Heart, Vote or Sitting) is marked `"kind": "message"` and listed last, outside the count of things to look at. `--json` prints the same report for a tool, and `--packet` prints the findings as work packets (the `packet` extension profile: a Relation with supertype `Work item`, its elements with a reason each under `x_packet_elements`, a JSON array, empty when clean) for a tool that lands them in a world or a parlor. The exit code is 0 when there is nothing to look at, 1 when there is (a message finding too), 2 when nothing could be read.

On a folder, the report names first what it could not read as an element (`report.unread`, each a `file` and a `why`): a file that is not JSON, is nested more than 200 deep or holds a number that is not finite, is not an object or has no `id`, a second file of one id, a directory that is no type's. Every check ran on the rest, so an element in such a file counts as not there and a link to it reads as a link to a missing element; any unread file makes the exit code 1. A dot-prefixed file is a tool's litter and is not listed.
On a folder, the report names first what it could not read as an element (`report.unread`, each a `file` and a `why`): a file that is not JSON, is nested more than 200 deep or holds a number that is not finite, is not an object or has no `id`, a file whose extension is `.json` in another spelling (`M.JSON`), a second file of one id, a directory that is no type's (the type word in lower case). Every check ran on the rest, so an element in such a file counts as not there and a link to it reads as a link to a missing element; any unread file makes the exit code 1. A dot-prefixed file is a tool's litter and is not listed.

The API door reads the key from `OW_API_KEY` and the PIN from `OW_API_PIN`, or from the toolkit's `ONLYWORLDS_API_KEY` and `ONLYWORLDS_API_PIN` when those are not set.

Expand Down
2 changes: 1 addition & 1 deletion src/onlyworlds/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.144.0"
__version__ = "0.145.0"
11 changes: 10 additions & 1 deletion src/onlyworlds/folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,11 @@ def read_folder(root: str | os.PathLike[str], *, legacy: bool = True) -> Folder:
- Every ``*.json`` in a type directory is ingested and keyed on its in-file ``id``;
the filename is never parsed (§3.1). A dot-prefixed file there is a tool's litter,
not an element: skipped and listed (clarified 2026-10-17).
- Names are read as written (ruled 2026-11-23): the extension is ``.json`` in lower case, so
``M.JSON`` is skipped and listed, and a type directory is the type word in lower case, so
``elements/Character/`` lands in ``ignored_dirs``. Two ids are the same id when they are
written the same: one UUID in capitals and in lower case is two elements. Versions before
0.145.0 read an extension and a directory name in any case.
- A file that is not JSON, not an object, or has no non-empty string ``id`` is
skipped, recorded in ``skipped``, and left where it is (§4.1).
- A declared ``type`` beats the directory the file sits in; an absent one is
Expand Down Expand Up @@ -494,7 +499,8 @@ def read_folder(root: str | os.PathLike[str], *, legacy: bool = True) -> Folder:
# By name in code point order (the format's one order), never by Path: a Windows path sorts
# case-blind, so a duplicate id would keep a different file there than on Linux or macOS.
for tdir in sorted((p for p in base.iterdir() if p.is_dir()), key=lambda p: p.name):
dir_type = tdir.name.lower()
# Names are read as written: a type folder is the type word in lower case, one of the 22.
dir_type = tdir.name
if dir_type not in allowed:
folder.ignored_dirs.append(tdir)
continue
Expand All @@ -503,6 +509,9 @@ def read_folder(root: str | os.PathLike[str], *, legacy: bool = True) -> Folder:
if path.name.startswith("."):
folder.skipped.append(SkippedFile(path, "a dot-prefixed file: a tool's litter, not an element"))
continue
if not path.name.endswith(".json"):
folder.skipped.append(SkippedFile(path, "the extension is not .json in lower case: not read"))
continue
try:
body = _load_json(path)
except (ValueError, UnicodeDecodeError) as exc:
Expand Down
Loading
Loading