Repository navigation
feat(feed): Retry logic + Stale check - #61
Kyl-Bempah wants to merge 4 commits into
Conversation
Addressing XWING-2223 Signed-off-by: Kyl-Bempah <24903083+Kyl-Bempah@users.noreply.github.com>
chubirka
left a comment
There was a problem hiding this comment.
Shouldn't a feed-service with these retries go into traust-core @smith-xyz ?
|
So the logic behind this is in part due to the XWING-2225 work:
Moving feeds onto core's FeedProvider + ObjectStore — the actual "feed-service" — is XWING-2225, which is gated on core shipping the S3 ObjectStore. I can move the RetryPolicy up as part of that if you'd rather it live in core. @smith-xyz do you have thoughts on the implementation between 2223 vs 2225? |
Signed-off-by: Kyl-Bempah <24903083+Kyl-Bempah@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Kyl-Bempah The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Hey Michele updated this pull, you were right, and my earlier reply was based on a wrong premise. I misinterpreted the http statement as traust-core doing no outbound work instead of it just not having landed yet. So the retry logic now lives in core, and this PR is cut down to more of an framework layer, summary of changes below. Moved to traust-core (traust-security/traust-core#8,
What's left in this PR:
Dependency: The PR also now adds The degraded exit code (AC#3) is still deferred to XWING-2220. |
Addressing XWING-2223
Hardens
fetch_feedsso a rate limit or transient error no longer becomes an error, and a run built on a stale fallback is no longer indistinguishable from a fresh one. Not a rewrite — adds seams around the existing urllib flow. XWING-2223What changed
RetryPolicy+fetch_with_retry) around all three download sites (non-paginatedfetch, the paginated page loop,load_vex): 429 honoursRetry-After(seconds or HTTP-date, capped bymax_wait_s); 5xx and timeouts use capped exponential backoff + jitter; a non-429 4xx fails fast; exhausted attempts raiseFeedErrorand the caller falls back to the cached copy.feeds-meta.jsonnow recordslast_error,last_attempt_at,staleper feed (on failure and success), andfeed_status()surfaces them.retry:block inconfig/feeds.yaml(defaults) with per-feed override, loaded viafeeds_config.retry_defaults().Acceptance criteria
last_error/last_attempt_at/stalein meta +feed_status) ✅feeds.yaml, defaults + per-feed override) ✅--result-json) — deferred to XWING-2220 (_outcome.py+ the exit-code value, Girish).main()is left untouched so it bolts on cleanly once 2220 lands.Open question (does not block review)
AC#4 says "sha256 mismatch keeps the old copy," but EPSS/KEV/rh-cve publish no checksum — only the VEX archive does (XWING-2224). This implements "corrupt" as "fails to decode as its declared type," isolated in
_validate_payload; if a checksum source exists, only that one function changes. Confirming with Shaun on the ticket.Tests
test_fetch_feeds.py50 passed (7 new),test_feeds_config.pygreen,ruffclean. All new tests are offline (fake urlopen).Out of scope
VEX deletions/mirror (2224); shared cache location (2225); the degraded exit code (2220).
🤖 Generated with Claude Code