Repository navigation
Fail a job with an unreadable evidence payload once instead of forever - #41
Merged
Merged
Conversation
A payload that is not JSON, or JSON that is not an object, raised inside the worker loop before process_evidence, so the job kept its lease and came back every time the lease ran out. run_job now parses it and fails the job with the evidence quarantined, as process_evidence does for any other failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…able-payload-fails # Conflicts: # CHANGELOG.md
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.
From bugs-memorygate-2 BUG-5.
The worker read
json.loads(evidence.normalized_payload_json or "{}").get("content")before it calledprocess_evidence. A payload that is not JSON, or is JSON but not an object, raised at that read. The loop'sexcept Exception: db.rollback()caught it, so the job stayedprocessingwith its lease. Each time the lease ran out, the job was claimed again and failed the same way.What changed:
run_job(db, job), which can be tested.run_jobparses the payload. If it can't, it calls_fail, which fences the lease, marks the jobfailedand quarantines the evidence, asprocess_evidencedoes on failure._fail. Its result is unchanged.Evidence:
test_an_unreadable_payload_fails_the_job_once, parametrized over not-JSON and a JSON list. After the job fails, a later claim past the old lease returnsNone.raisein the handler fails both cases.stale_anchors()is[].GLM wrote the change. Claude reviewed it and ran the mutant.
🤖 Generated with Claude Code