The provider is late: when can a forecast remain on display?

Separate model age from successful requests and decide when a retained forecast needs a stale label or must be hidden.

A generated illustration of waiting for a weather update; it does not depict a real station.
A generated illustration of waiting for a weather update; it does not depict a real station.

The weather service responds successfully, the cache is available, and the page opens. Yet the forecast on that page may belong to an old model run. A label saying “Updated just now” after every HTTP request conceals the difference: the user sees a recent retrieval time beside data whose content has not changed.

When a provider is delayed, the product needs an explicit answer: which stored value may still be displayed, how should it be labelled, and when should it disappear? We will examine this using our own synthetic timeline. The example makes no weather API calls and does not describe an actual service outage. It checks display rules for one active forecast version.

Timestamps that must not share one field

Model initialization, forecast validity, response retrieval and availability checks have different roles. The official Open-Meteo model updates page describes initialization, completion of processing and model-run availability separately. It also warns that metadata for an individual model cannot be equated directly with updates to a Best Match response.

For this exercise, we call the model reference time issued_at. That is our field name, not an assumption that every provider uses the same name or treats initialization as publication. Unknown initialization remains null.

Exercise field Meaning
issued_at Known reference time of the model run
valid_from, valid_until Declared interval for which a forecast exists
first_received_at When this exact version was first received and validated in this Cache
last_successful_retrieval Most recent retrieval of a complete, validated and accepted body
last_checked_at Time of the latest attempt, including an error or unchanged response

The last two fields describe delivery activity. They help establish whether requests are happening at all, but they are not a model-age clock. Successfully retrieving an old run does not make it new.

Start the clock from a particular version

Let T0 be a hypothetical origin at which the model was initialized. Ten minutes later, the application accepts version A. Its declared range spans two days. Some time later, the provider returns the same version and the same data.

We record a new successful retrieval time but retain issued_at = T0 and first_received_at = T0+10min. Otherwise, endless repeated downloads would restart the permitted display period every time. Version identity is part of the teaching contract: one version cannot silently change its model time or range.

Changed bytes or content require a new validated version. It may start a new first-reception clock, but the preserved model reference time continues to constrain its age. New packaging for an old run does not bypass the model’s maximum age.

For this purpose, Cache keeps the current forecast separately from a ledger of previously validated versions. Each ledger entry contains immutable metadata and the first receipt time. Replacing active A with B does not erase A’s history. When exact A returns, its original time is used; changes to its model time, run identity or boundaries are rejected even after B, before any state mutation. The ledger also remembers a valid older response that was not activated. This does not change the latest successful acceptance time of the current forecast.

A 304 response answers a different question

HTTP Caching, RFC 9111, describes how a 304 response updates metadata in a stored HTTP response. That validates a representation under HTTP rules. It does not establish that the meteorological calculation was produced again.

In our model, a 304 changes last_checked_at, but neither first reception of the data nor last_successful_retrieval, which deliberately counts only complete accepted bodies. This naming choice needs to be fixed in the contract. Another application may separately track successful revalidation, but that timestamp cannot replace model initialization either.

A request error also advances the latest-attempt time and records its outcome. The previous accepted version remains. The display decision is made again for the current time; a stored fresh=true flag would quickly become outdated along with the data.

Two ages and two levels of limits

The exercise calculates model-run age and accepted-version age separately. Each has a soft limit, beyond which a stale label is required, and a hard limit, beyond which display stops. Exceeding either relevant limit is sufficient.

The following are author-selected numbers for a teaching example, not provider guarantees or a ready-made policy for every weather product:

View Model: normal display / maximum age Version: normal display / maximum age
current 1 hour / 3 hours 15 minutes / 1 hour
hourly 6 hours / 18 hours 1 hour / 6 hours
daily 12 hours / 36 hours 3 hours / 12 hours

An age exactly equal to a limit is still permitted at that level. The transition occurs on the next second. These numbers make differences between views testable; they were not derived from API availability statistics or model accuracy.

For example, A is first received at second 600, then B with the same model time but a different range at second 1000. If A returns at second 4200, its age since first receipt is 3600 seconds: current display with a stale label is still permitted. At second 4201, it is no longer permitted. Recently retrieving A again does not reset that age to zero.

A new request, an error or republishing a cache entry does not extend a hard limit. Data may be retained for diagnostics longer than it is displayed to visitors. Storage retention and acceptable display duration are separate decisions.

Why the extra version limit is so strict

Age since first acceptance limits the use of one version even while the provider keeps confirming that it is unchanged. This is a stronger rule than “no successful request within an hour”. We chose it for the exercise so that replay cannot conceal the absence of a new run. A product with a long update cycle may need a different limit or a different, separate delivery-health indicator.

Before selecting numbers, establish the actual need: which hour or day the visitor is reading, the expected model cycle, an acceptable delay for that view, and what a stale warning means. Then observe real delivery and test boundary scenarios. The label current or daily alone is not enough to choose an appropriate duration.

A network error is not a prerequisite for stale data. Requests may succeed flawlessly while no new run appears. Conversely, one failed request does not by itself require hiding an acceptable forecast. The time limits and data required for the selected request remain decisive.

One version after two hours

Return to version A, received ten minutes after T0. At T0+2h, the model is two hours old and the version is one hour and fifty minutes old. Each view requests its required interval within the declared two-day range.

Our selected numbers produce the following decisions:

View Decision Reason
current Hide The maximum hour since first acceptance of the version has been exceeded
hourly Display with a stale label The version’s normal one-hour limit has been exceeded, but the hard limits have not
daily Display as fresh under this policy Both ages fall within their normal limits

“Fresh” here means only that the agreed time conditions are satisfied. It is not a forecast-accuracy assessment. Likewise, a three-day horizon or a future valid time does not make an old run newer: the time for which a forecast is calculated is not the time when its underlying run was created.

Unknown time and an older run returning

When issued_at is absent, source age cannot be confirmed. The exercise returns unknown and hides the value. This is an intentionally conservative policy for our example. Another product may allow a distinct label for unknown age, but must not automatically call such a forecast fresh because retrieval was recent.

If a run with a known later reference time is already stored, a response with an older or unknown time does not replace it. A new attempt is recorded and the accepted version is retained. This rule concerns one model sequence; it does not compare different models’ quality or choose a fallback provider.

A newer run is not accepted merely because of its name either. Valid temporal boundaries and identity are required. If the same version suddenly has a different range, the example rejects the immutable-version conflict. Initialization in the future relative to retrieval is also rejected, and a clock moving backwards does not become a negative, “extremely fresh” age.

Range boundaries do not establish data completeness

Before display, the requested interval must fit within valid_from and valid_until. This exercise checks only the declared range: it contains no weather rows and does not find temperature or precipitation gaps inside that range. A real application must separately validate required fields, temporal support, units and coverage.

The example has one active version, while ledger entries remain in memory without eviction for the lifetime of one Cache. The model runs entirely in memory, without I/O or a database. That is the lifetime covered by the guarantee against rejuvenation through replay. A new instance loses the ledger and cannot recover an old version’s first receipt. History retention, its size, shared access and recovery after a restart need separate decisions; this bounded exercise does not implement them.

The exercise does not combine an old long forecast with a new short one or calculate the age of each field in a composed response. For a composed forecast, one newest timestamp for the whole card can conceal older contributions. Such a product needs the identity and age of each source actually contributing to a value.

Interface labels must match the decision. For stale, a message can explain that a stored forecast is displayed, together with its model reference time and validity. For unavailable, the number should not remain beneath an old “current” label. Delivery status can be shown separately without concealing the data’s age.

Check the rules using controlled time

The package includes freshness.py and test_freshness.py. Run python -B test_freshness.py from the example directory. In the local Python 3.12.3 execution, all 35 test methods completed successfully: repeated full bodies, A→B→A, historical version conflicts, 304 responses, errors, newer and older runs, unknown time, boundaries to the second, and different decisions from the three policies. A separate case demonstrates losing the ledger in a new instance.

The clock is explicitly passed into each operation; there is no need to wait actual hours or deliberately stop a service. This checks our own logic using synthetic events. It does not establish provider availability, external-storage reliability or the behaviour of a deployed application.

Honest continued display starts with immutable data provenance and a defined deadline. With both retained, a provider delay becomes an understandable product state: an acceptable old version can be shown with an explanation, or removed in time, without inventing an update.

  1. Caching Stale results or errors: choosing a stale-data policy
  2. Architecture HTTP cache and application cache: who refreshes the page?
  3. Weather The process finished, but was the whole forecast updated?
  4. Weather Forecasts and observations: what weather data does the user see?

A project by the author · Weather Solution200

After reading, a look outside.

Temperature, rain and wind in your city. Check the forecast and plan the hours ahead.

Check the forecast
Next article