Read the Markdown source ↗

Evidence Freshness Check

Separate fresh, stale, and future-dated observations using explicit per-item freshness rules.

Version: 1.0.0. License: MIT. Status: tested reference baseline; no comparative ranking is claimed.

Contract

Require offset-aware ISO timestamps, unique observation IDs and nonnegative maximum ages. Compute age against the explicit now value. Negative age is future; age greater than max_age_seconds is stale; equality is fresh. Return ages and states in input order.

The exact required input fields and types are in input.schema.json. Extra fields are rejected at declared object boundaries. JSON duplicate keys and non-finite numbers are rejected by the CLI. Input strings are case-sensitive unless stated otherwise. Array order is preserved unless the contract specifies sorting.

Use

Unpack the ZIP, enter its directory, and run:

python3 baseline.py < example.input.json
python3 -m unittest -v

Python 3.10 or newer, standard library only. The reference implementation exposes run(input_dict) and accepts one JSON object on standard input. Success returns {"ok": true, "result": ...} with exit code 0. Invalid input returns {"ok": false, "error": "..."} with exit code 1. example.output.json contains the result without the CLI envelope. Import callers receive exceptions for invalid input.

Example input

{
  "now": "2026-01-01T00:01:00Z",
  "observations": [
    {
      "id": "a",
      "observed_at": "2026-01-01T00:00:00Z",
      "max_age_seconds": 60
    },
    {
      "id": "b",
      "observed_at": "2026-01-01T00:00:00Z",
      "max_age_seconds": 30
    }
  ]
}

Example result

{
  "observations": [
    {
      "id": "a",
      "age_seconds": 60,
      "status": "fresh"
    },
    {
      "id": "b",
      "age_seconds": 60,
      "status": "stale"
    }
  ]
}

Boundaries

The caller defines acceptable age from the task or source contract. This artifact does not choose freshness windows, correct clock skew, or establish that a fresh observation is true. Python datetime syntax is accepted, not the entire ISO 8601 standard.

This package performs no network calls, executes no submitted commands, and writes no user files. Host applications own authorization, resource budgets, and persistence. Example values are fixtures, not recommended policies or limits.

Acceptance and provenance

cases.json records named expected results and rejection cases. test_baseline.py runs those cases and checks the command-line contract. manifest.json records file digests. The specification, implementation, and evidence are separate files so a replacement implementation can target the same contract.

Original code and examples generated for this Arcomm collection. No third-party code is bundled. Read LICENSE for reuse terms.

Download

Download the file

SHA-256: 1492bc4877e41faf9243ccab13a90a42393a97a194a6d992a6152020fdd3d7ef

Size: 6856 bytes.

Revisions

Revision history