Repository navigation
feat(bundle): read an environment_universe folder as the inverse of environment-universe get, whatever its names - #232
Conversation
…nvironment-universe get, whatever its names A folder directly holding one file is an environment named by its path from the universe's folder, or, under metadata/, a metadata key named by its path from there, so names and keys holding / round-trip as the nested folders get writes. A name an @Local id can't hold as it is (__, characters outside the id set, a segment opening or closing with a space, too long) is written under a hash of it instead of being refused; every name that works today keeps its ids. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…d can take, and list every path to a folder A hashed id is now <base>__sha256__<16 hex>: names holding __ are always hashed, so no name's own id holds it, and a name spelled like another's hash keeps an id of its own. Folders are listed by every path to them, guarding only against a link back to a folder that holds it, so metadata in another case is refused even as a link to an environment's folder. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Chaos verificationOn an Ubuntu 24.04 VM (m5.2xlarge) and a stock macOS 15.8 VM (below), the old release (agentenv-framework 0.9.1334 from PyPI) against this PR (481e31c, with the review fixes). Both commits gave the same results. Fuzzed round trip.
No regression. 60 flat universes of the kind the old reader accepts were written by the old release, then run by this PR in the same state root. All 60 came back CoopBench. This is the materialized copy, with its universe's 15
macOSThe same battery ran on a stock macOS 15.8 VM (mac-m4.metal; APFS, case-insensitive). Both fuzz passes kept apart names that differ only in case, since
After the maintainability refactor (6c68921)The whole battery ran again on fresh Ubuntu and macOS VMs. That covered the fuzz on both versions, the 60-universe no-regression run, CoopBench (dry runs and the full task) and the NFD probe. Every result matched the earlier rounds:
After moving the format into its own module (7a517bb)The whole battery ran again on fresh Ubuntu and macOS VMs, with the same results as every earlier round on both:
|
… id is refused naming the fix Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…its files, and its children's ids from its own naming _Walk now records every folder it visits, so universe_layout reads files and folders from one walk with one set of rules, and _subfolders goes. _child_id derives through EnvironmentUniverseArtifact.derived_environment_id and derived_metadata_id, which the CLI uses too, adding only the hashed fallback. Every id is unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ule of its own, read and written from it environment_universe_folder holds the format both ways: environment_path and metadata_path, where environment-universe get writes each file, and read_folder, their inverse, which takes a folder's listing and raises UniverseFolderError naming paths in the folder. The bundle keeps only the walk and the bundle-relative prefix on each problem; messages and ids are unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Summary
A bundle's
environment_universefolder is laid out asenvironment-universe get --output-dirwrites one, but the reader only took one folder level.getwrites: each environment to<environment_name>/<file>and each metadata file tometadata/<key>/<file>, names verbatim. A key or name holding/, such asscenarios/<name>.yaml, comes out as nested folders.__, characters an@localid can't hold, or a segment opening or closing with a space, even thoughgetwrites them all.The folder is now read as the exact inverse of
get, whatever it holds:metadata/. A folder holding only folders is part of their names, and a folder can hold its own file and nested entries at once, soaanda/bboth work.@localid can hold keeps the ids it has today:<universe>__<name>over<universe>__<name>__file, and<universe>__metadata__<key>. Any other name is written under…__sha256__<16 hex of its SHA-256>in its place. Names holding__are always hashed, so no name's own id can take that form, and a name spelled like another's hash keeps an id of its own. That covers__(which could clash with another child's ids), characters outside the id set, a segment opening or closing with a space, and ids over 4096 bytes. The universe still stores the name or key itself.metadata/;metadataspelled in another case.metadata/reads back as a metadata key, so it needs an artifact folder of its own.Where the format lives. The folder format now has a module of its own,
artifact/artifacts/environment_universe_folder.py, used in both directions:environment_pathandmetadata_pathsay wheregetwrites each file.read_folderis their inverse. It takes a folder's listing and raisesUniverseFolderErrornaming paths in the folder.The bundle keeps only the walk, now one walk for both files and folders, and puts the bundle's path in front of each problem.
universe_layoutand its helpers have leftbundle/authoring.py.Bundle authoring and
getonly, so not hot path.Tests
environment-universe put,get --output-dirinto a bundle, then a bundle write, and compares the stored universe with the original: names, keys, filenames and bytes.gmail,drive/shared,g__mail,crm: v2andslack, and keysmanifest,scenarios,scenarios/a.yaml,scenarios/b.yaml,deep/x/y/z.json,m__kandq&a?.g__mailandq&a?get the hashed form. A name spelled like another's hash keeps an id of its own.Metadatain another case is refused even as a link to an environment's folder. A nested folder with two files is refused, naming it, and the empty-folder test now names the deepest empty folder. The six cases the old reader refused for nesting,__or edge spaces are now accepted layouts.read_folderreads back whatenvironment_pathandmetadata_pathlay out, and names each problem by its path in the folder.🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; no new blocking issue was found.Summary
The PR lets bundles read nested environment names and metadata keys, with hashed IDs for names that local IDs cannot hold.
Reviews (5) · Last reviewed commit: "refactor(artifact): give the environment..." · Reviewed by Greptile