feat: available + compliant criteria evaluation and seal status logic update - #1819
Open
cka-y wants to merge 6 commits into
Open
feat: available + compliant criteria evaluation and seal status logic update#1819cka-y wants to merge 6 commits into
cka-y wants to merge 6 commits into
Conversation
cka-y
marked this pull request as ready for review
August 27, 2026 20:32
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.
Summary:
Completes the Seal of Reliability criteria set for #1784 by adding the last two evaluators, Available and Compliant, and makes the feed-level outcome say why a feed does not hold the seal. Builds on #1817 (Official / Stable / Fresh) and follows the algorithm in #1761. Fresh / continuous coverage remains out of scope and is tracked by #1782.
Three changes:
Available (
available.py) — the latestgtfs_feed_availability_checkin a rolling 24h window hassuccess = TRUE. A window with no check at all isunknown, not a failure: it means we did not look, not that the feed was down. 14-day grace period, serves probation.Compliant (
compliant.py) —total_error = 0on the latest validation report of the feed's latest dataset. Scoped to the latest dataset rather than to the feed: a verdict on a superseded dataset does not describe what we are serving today. A latest dataset with no report yet (unvalidated, or validation lagging publication) isunknown, which freezes the criterion at its last confirmed verdict instead of failing it. 30-day grace period, serves probation.Feed-level
seal_status—has_sealis a boolean and cannot distinguish judged and did not qualify from cannot be judged yet.roll_up_seal_statusinshared/common/seal_criteria.pynow derives a four-value status:granted,not_granted,unknown(at least one criterion has never produced a verdict),never_evaluated(none ever has). It is derived, not stored — a pure function ofconfirmed_statusplus probation on rows both the job and the API already hold — so there is no schema change in this PR. Exposed onGET /v1/gtfs_feeds/{id}/reliabilityas a new optional field.Every criterion evaluation also now emits a log line (feed, criterion, observed, confirmed, previous confirmed, phase, reason), plus one per feed for the roll-up. The run report gains
seal_statusper feed and aseal_status_countssummary.Expected behavior:
grantedand holds the seal, as before.not_granted,has_seal: false.unknown,has_seal: false— it is not denied the seal, it just cannot be decided yet. On a fresh environment most feeds sit here until availability checks and validation reports exist.unknownrun, so one bad night for the availability or validation job cannot blank the seal across the catalogue.GET /v1/gtfs_feeds/{id}/reliabilityreturns the newseal_statusalongside the existinghas_sealand the six criteria.Please make sure these boxes are checked before submitting your pull request - thanks!
./scripts/api-tests.shto make sure you didn't break anything