Return flag tokens instead of mutating a list in place#51
Merged
Conversation
The three _add_*_flags helpers were the only flag sources in the package that mutated a list passed in rather than returning list[Token] -- the convention KeySpec.emit, stores.flags, deploy_resource_flags, and pod.py's own helpers all follow. They sat beside three return-style calls in the same ten-line run_flags body. Behavior-preserving: the generated script is byte-identical.
…change file pod.py's _add_host_flags returns tokens while keeping the _add_ prefix, so the package is not uniform on this; say so rather than implying the prefix always tracks mutation.
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.
Summary
run_flags(emit.py) composed six flag sources in ten lines using two conventions: three helpers mutated a list passed in (_add_env_flags,_add_volume_flags,_add_health_flags, all-> None), while three returned a list to concatenate (KeySpec.emit,stores.flags,deploy_resource_flags).pod.py's helpers (composed bypod_create_flagsasa + b + c). These three were the only exceptions, sitting directly beside three return-style calls in the same function.list[Token]and renames them (_env_flags/_volume_flags/_health_flags) since the_add_prefix described the side effect.Rationale:
planning/changes/2026-07-13.09-uniform-flag-composition.md(Lightweight lane).Test plan
just test-ci— 407 passed (unchanged count), 100% line coveragejust lint-ci— clean