refactor: introduce keys.py service-key registry (validate + emit derive from one table)#27
Merged
Merged
Conversation
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.
Behavior-preserving refactor. Collapses the three hand-synced enumerations of the declarative service keys into one deep module,
compose2pod/keys.py— a service-key registry (SERVICE_KEYS: dict[str, KeySpec], each a(validate, emit)pair).parsing.validate()andemit.run_flags()now each derive the ~16 keys from one loop instead of maintaining parallelSUPPORTED_SERVICE_KEYS/ shape-tuple /_*_FLAGSlists.keys.pyowns the token vocabulary (Token/_Expand/_key_value_pairs/PULL_POLICY_MAP, moved fromemit.py) plusSERVICE_KEYS(16 declarative keys) andSTRUCTURAL_KEYS. Uniform shapes bind shared functions (_scalar/_bool/_list/_map); bespoke keys (extra_hosts/pull_policy/ulimits) supply their own bodies.SUPPORTED_SERVICE_KEYS = set(SERVICE_KEYS) | STRUCTURAL_KEYS— derived, so a new declarative key is one entry.emit/parsingimport the neutralkeys.py; the old validator-imports-emitter inversion is gone.tests/test_keys.py): registry/structural disjointness + aSUPPORTED_SERVICE_KEYSsnapshot. Plus a cross-key emission-order lock test.architecture/supported-subset.mdinterpolation list corrected (was stale by ~8 keys, now anchored to the registry);architecture/glossary.mdseeds the vocabulary (service-key spec, service-key registry, structural key).Design/rationale:
planning/changes/2026-07-09.08-service-key-registry.md.Tests: 201 passing at 100% line coverage;
just lint-ciclean. Existing per-key tests unchanged (the correctness proof for a behavior-preserving refactor). One null-handling regression (a plan bug that briefly tightenedpull_policy: null/ulimits: null) was caught in review and fixed to preserve the prior leniency, with regression tests.🤖 Generated with Claude Code