Repository navigation
Write podbench's own comments once, not once per run - #201
Merged
Merged
Conversation
Found by running `--print-values --values` by hand against p47 the day after
Phase 5, over a values file that had already been through it. The values were
idempotent; the comments were not. Each of podbench's own grew another copy of
itself on every run:
# Declared and deliberately *not mounted* by the application. ...
# Declared and deliberately *not mounted* by the application. ...
- name: podbench-home
`test_running_the_merge_twice_changes_nothing` compared `yaml.safe_load(once)`
with `yaml.safe_load(twice)` and passed throughout, because parsed values cannot
see a comment. It now compares the text, and a third pass as well.
Neither end of the round trip can be asked whether a comment is already there.
ruamel attaches a comment it parsed to the node *before* it, so the key a
comment sits above has nothing on it to find - and replacing a key's value drops
a comment parsed onto that value, so a comment in the input can be missing from
the output. That second half is not hypothetical: checking the input alone fixed
the duplication and silently lost the fsGroup comment instead, because the
supervisor `args` it had been parsed onto are replaced on every run.
So the comments are deferred, the tree is rendered once, and each is written
only where the render did not already carry it. Verified three passes deep
against the real services/bl47p-ea-fastcs-01/values.yaml: byte-identical.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015LEmzFsLaoa5zWeQvdN1Xe
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Found by running the Phase 4 command by hand against p47 the day after Phase 5 —
over a values file that had already been through it once, which is the ordinary
case after a chart bump or when you just want to see what is deployed.
The values were idempotent. The comments were not:
test_running_the_merge_twice_changes_nothingcomparedyaml.safe_load(once) == yaml.safe_load(twice)and passed the whole time,because parsed values cannot see a comment. It now compares the text, and
runs a third pass as well.
Why the obvious fix is wrong
Neither end of the round trip can be asked whether a comment is already present:
comment sits above has nothing on it to find —
ca.itemsis empty there.value, so a comment present in the input can be absent from the output.
That second half is not hypothetical. Checking the input document alone fixed
the duplication and silently lost the
fsGroupcomment instead — it had beenparsed onto the supervisor
args, which are replaced on every run.So the comments are deferred, the tree is rendered once, and each is written
only where that render did not already carry it. Converges by construction: a
comment that survived is left alone, one that was destroyed is rewritten, and
either way it appears exactly once.
Verified
Three passes deep over the real
services/bl47p-ea-fastcs-01/values.yamlonp47-beamline, reading the live pod each time: byte-identical.1647 tests pass, pyright clean.
🤖 Generated with Claude Code
https://claude.ai/code/session_015LEmzFsLaoa5zWeQvdN1Xe