fix: treat JSON parsing errors as fatal errors - #629
Conversation
Causes them to fail fast and provide better error messages. Fixes aws#552
|
Claude finished @simonmarty's task in 3m 58s —— View job Code Review — PR #629: treat JSON parsing errors as fatal
Overall this is a clean, well-targeted fix. Introducing a typed Below are a few things worth considering. 1. Behavioral change in the failover path (main consideration)Previously, a JSON/JMESPath error inside
if utils.IsFatalError(err) {
return nil, err // now short-circuits on the FIRST region's JMES error
}For a genuinely invalid JMESPath expression this is exactly what we want — every region would fail identically. The one edge case: if the secret content differs across regions (e.g. primary holds malformed/legacy JSON but the failover region has valid JSON), the old code would have failed over and succeeded, whereas the new code fails fast on the primary. This is a very unlikely scenario, and failing fast with a clear message is arguably the better behavior anyway — but since it's a behavioral change to failover, it's worth a conscious decision. If you agree it's acceptable, a one-line note in the PR description or a code comment would help future readers. 2.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #629 +/- ##
==========================================
+ Coverage 60.84% 61.72% +0.88%
==========================================
Files 11 11
Lines 710 729 +19
==========================================
+ Hits 432 450 +18
- Misses 261 262 +1
Partials 17 17 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@simonmarty let me know if you'd like to see any tweaks based on review from Claude. It's 100% right on item 1 that some times trying multiple regions might work, but it did not really seem like a real use case as it would mean someone has a secret in multiple regions where either 1 of the regions is JSON and the other is not, or they are both JSON but have different structure. Both scenarios seem very unlikely. |
|
Yeah I agree with you that the secret value being different between the primary and the failover region is not something that we should worry about. I think can assume they are either both valid JSON or both invalid but I'm double checking. |
Review runs can end without posting anything to the PR, leaving no visible record that the review happened (upstream issue anthropics/claude-code-action#1087, still open with no input-level fix). Enable `track_progress: true` so the action forces tag mode and maintains a tracking comment on the PR: the comment is created before the model runs and is finalized with the outcome and a job link even if the model fails to follow the prompt, a stronger guarantee than a prompt-driven `gh pr comment` instruction. Tag mode's default prompt already directs the model to write its review into the tracking comment, so instructing it to post a separate summary comment would duplicate the same content (the tracking comment carrying a full review is observable in the wild, e.g. aws/secrets-store-csi-driver-provider-aws#629 runs this same pattern). Keep only the content requirement in the prompt: when there are no issues, the summary must state specifically what was reviewed and verified rather than a bare "no issues found" — the false sense of security that motivated switching review methodologies. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Review runs can end without posting anything to the PR, leaving no visible record that the review happened (upstream issue anthropics/claude-code-action#1087, still open with no input-level fix). Enable `track_progress: true` so the action forces tag mode and maintains a tracking comment on the PR: the comment is created before the model runs and is finalized with the outcome and a job link even if the model fails to follow the prompt, a stronger guarantee than a prompt-driven `gh pr comment` instruction. Tag mode's default prompt already directs the model to write its review into the tracking comment, so instructing it to post a separate summary comment would duplicate the same content (the tracking comment carrying a full review is observable in the wild, e.g. aws/secrets-store-csi-driver-provider-aws#629 runs this same pattern). Keep only the content requirement in the prompt: when there are no issues, the summary must state specifically what was reviewed and verified rather than a bare "no issues found" — the false sense of security that motivated switching review methodologies. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Causes them to fail fast and provide better error messages. Fixes #552
Description
Why is this change being made?
What is changing?
Related Links
Testing
How was this tested?
SecretProviderClasswith ajmesPathpointing to a nonexistent key (NONEXISTENT_KEY) and verified the pod's status showed this error:jmesPathhavepath: "[username", verified the pods status showed this error:When testing locally, provide testing artifact(s):
Reviewee Checklist
Update the checklist after submitting the PR
If not, why:
If not, why:
If not, why:
If not, why:
If not, why:
If not, why:
If not, why:
If not, why:
If not, why:
If not, why:
Reviewer Checklist
All reviewers please ensure the following are true before reviewing:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.