Repository navigation
fix(mark-notification-read): treat a null run_started_at as absent - #862
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.
Problem
#843 added a guard so a transient failure fetching
run_started_atleaves the notification unread rather than failing the step. It tests[ -z "$RUN_STARTED_AT" ], which covers agh apithat exits non-zero — but not a 200 whose body lacks the field.gh --jqprints the literal stringnullthere, which is non-empty and passes-z.nullthen reaches the filter as a string:Every ISO-8601 timestamp sorts before
nullby codepoint (2is0x32,nis0x6e), soupdated_at <= "null"is true for every thread. The step marks read exactly the mid-run activity the guard exists to preserve — silently, since it's the success path.Reproduced against the real script with the existing
test_shared_steps.pyfakegh, using a notification dated two months after the run started:Fix
Extend the guard to treat
nullas absent, so the missing-field case takes the same skip-this-cycle path as a failed fetch:Plus a regression test that asserts nothing is marked read against a
nulltimestamp. It fails onmainwithmarked a thread read against a null run_started_atand passes with the fix.On reachability
I want to be straight about this: I could not construct a live case where
/actions/runs/{id}returns 200 withoutrun_started_at— the field has been on that endpoint for years, and an HTTP error exitsghnon-zero and is already handled. So this is hardening against a shape the API doesn't currently produce, not a bug anyone is hitting.What makes it worth the two lines is the failure mode rather than its likelihood: the wrong branch is the success path, it swallows unread notifications instead of erroring, and #843 already decided this is a place where being wrong should cost a skipped cycle and not silent data loss. Happy for it to be closed if that's the wrong trade.