Repository navigation
A top-level schema: in envshield.yml is the project contract (V2-1) - #95
Merged
Merged
Conversation
…tract (V2-1) A service without its own `schema:` uses the top-level `schema:`. One interpreter, config_manager.service_schema_ref, answers which schema a service entry uses, for the live lookups (get_service_schema_path, get_schema_users, the default-file helper) and for revision lookups in schema_snapshot, so `schema diff` and `check --since` work on the new layout too. Services with their own `schema:` behave exactly as before, and the two layouts mix. On the project contract every service needs `dir`, except a project's only service, which defaults to `.`. A registered service with neither key gets an error naming both options. `init` writes the top-level form and gives the service an explicit `dir: .`, so a later `service add` doesn't make it required after the fact. Closes #18. Records the real-repository trial and new evidence on BL-208 (P0, #94, predates this change).
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.
Closes #18
In one line:
envshield.ymlcan name one project contract with a top-levelschema:, so services no longer need their ownschema:line. Existing layouts are unchanged.Problem
Every service had to name its own schema, and there was no single project-level contract for
init,service addandservice discoverto build on (#19, #44).Design
schema:if it has one (legacy, unchanged); otherwise the top-levelschema:. Layouts can be mixed. One interpreter,config_manager.service_schema_ref, decides this everywhere:get_service_schema_path,get_schema_users, the default-file helper for unresolvable peers;schema_snapshot, soschema diffandcheck --sincework on the new layout. Leaving the revision path out would have been the BL-005 shape: correct for one caller only.dir, except a project's only service, which defaults to.. Duplicatedirand unscoped secrets with more than one user hit the existing shared-schema errors unchanged.get_service_schema_pathstill returnsNone, soservice list,uninstallandservice removedon't crash on a broken entry. Loading, directory resolution and hooks raise one error naming both options.initwrites the top-level form and gives the service an explicitdir: .. Without it, a laterservice add, which writes a legacy own-schema service until V2-2 · Append-only contract writer; init, service add/discover and import join the project contract #19, would make the first service'sdirrequired after the fact.name:entry (YAML null) is a service with no settings of its own.Alternatives
get_service_schema_pathfor a registered service with no schema: rejected, becauseservice listanduninstallwould crash on a broken entry instead of reporting it.dirout of the generated config: rejected, because it breaks theinit→service addpath.Security
envshield.ymlpaths (../outside.tomlis rejected).Compatibility
Projects with per-service
schema:behave exactly as before. All existing tests pass unchanged. Newly generatedenvshield.ymlfiles use the top-level form.Tests
envshield/tests/test_config_manager.py::TestProjectContract, covering:dirfor every resolution case the issue lists (top-level only, per-service only, mixed, single service withoutdir, several withoutdir, neither key);dir;dir, unscoped secrets with one and with two users, invalid top-level values;ruff checkandruff format --checkclean.init,service add,service list,check,schema diffandcheck --since. Every command in a bare-entry project runs without a traceback.Real-repository trial (13 repos; recorded in BACKLOG.md above BL-208)
initwrites the top-level form,schema diffagainst HEAD exits 0 everywhere, and no command produced a traceback.service addof a second service works on all 13. The first service checks as before; the new one reports only that its schema file doesn't exist yet.main9.7 s, branch 9.5 s. The trial's slower raw times came from the test suite running concurrently.Found, not fixed here
P0, BL-208 / #94:
initwrites values it doesn't recognize as secret intoenv.schema.tomlasdefaultValue. That includes a password inside a URL (redis://:pass@host) and, on the trial repositories, names such as..._PASSPHRASEand..._CREDENTIALS. It predates this PR (the importer is untouched) and blocks any release.Product / market impact
Foundation for Phase 2, one contract per project (§1: "one file to maintain"). Not a differentiator by itself.
🤖 Generated with Claude Code
https://claude.ai/code/session_01376EvgPvifpHL8LP5BYoPc