Skip to content

Freshness: staleness budget + fail-loud --verify-live + monthly reality-check cron (#49) - #55

Merged
kiki830621 merged 4 commits into
mainfrom
idd/49-vs-context7-snapshot-staleness
Jul 5, 2026
Merged

Freshness: staleness budget + fail-loud --verify-live + monthly reality-check cron (#49)#55
kiki830621 merged 4 commits into
mainfrom
idd/49-vs-context7-snapshot-staleness

Conversation

@kiki830621

Copy link
Copy Markdown
Member

Refs #49

Summary

Closes the sample ⟷ reality gap the guard chain left open. Two mechanical signals, both run monthly by a new scheduled workflow (and runnable by hand):

  • --check-staleness (new): exit 1 when captured_at exceeds the age budget (default 120d, --max-age-days). Pure date math with an injected --today — tests never read the wall clock (a wall-clock assertion would itself be the time bomb this catches). Future/malformed dates fail loud.
  • --verify-live (behavior change): now exits 1 on drift instead of only printing warnings — a log nobody reads is not a signal.
  • .github/workflows/freshness.yml: monthly cron + workflow_dispatch. Deliberately NOT PR CI — a time/network-based failure must never redden unrelated PRs; a red scheduled run is the maintainer's refresh signal.
  • evals/look-up/README.md § Refreshing the snapshot: the human procedure both error messages point to. context7's column is a recorded judgment — re-capture is structurally a human act (stated, not hidden).

Tests

TDD (RED→GREEN): +4 staleness (pure math / fresh / over-budget / boundary / future / malformed) + 1 --verify-live exit codes (registry stubbed). 215 total (144 Swift + 71 Python), counts synced via sync-test-counts.sh.

Security

freshness.yml contains no ${{ }} expressions — triggers are schedule/workflow_dispatch (no event-payload text), static commands + stock actions only.

Relation to #48 / PR #54

Complementary halves: #48 = deterministic guards at the PR gate (README⟷sample⟷SVG); #49 = time/network reality checks on a schedule. Separate workflow file → no ci.yml conflict; the only shared file (Testing.md) is touched in different hunks.

Checklist

  • Diagnose (decisions documented: cron not PR-CI; 120d default; verify-live → fail-loud)
  • Implement (2 commits, Refs #49)
  • Verify: /idd-verify #49
  • Verify-gated — no close trailer; manual /idd-close after merge

🤖 /idd-all batch (#48 #49) · Do NOT add Closes/Fixes/Resolves.

…ive + monthly cron (#49)

The guard chain locked README ⟷ sample but nothing checked sample ⟷ reality:
--verify-live only PRINTED drift warnings (exit 0 — a log nobody reads is not a
signal) and nothing bounded the snapshot's age, so `captured 2026-07-02` would
silently rot into an asserted number (#27/#29) with everything green.

- `--check-staleness [--max-age-days N=120] [--today ISO]`: pure date math on
  captured_at with an INJECTED today — the tests never read the wall clock (a
  wall-clock assertion would itself be the time bomb). Over budget / future
  captured_at / malformed dates → loud exit 1.
- `--verify-live` now exits 1 when any recorded ground_truth has drifted
  (behavior change: warn → fail-loud, consistent with the whole guard chain).
- `.github/workflows/freshness.yml`: monthly cron + manual dispatch runs both.
  Deliberately NOT PR CI — a time/network failure must never redden unrelated
  PRs; a red scheduled run is the maintainer's refresh signal. No ${{ }}
  expressions (injection-safe by construction).
- evals/look-up/README.md: § Refreshing the snapshot — the human procedure both
  error messages point to (context7's column is a recorded judgment; re-capture
  is deliberately a human act — stated, not hidden).

Tests (TDD, RED→GREEN): +4 staleness + 1 verify-live exit codes → 71 Python.
Via scripts/sync-test-counts.sh after the +5 staleness/verify-live tests.
Milestone prose left frozen.
kiki830621 added a commit that referenced this pull request Jul 5, 2026
- permissions: contents: read at workflow level — pip install + pytest execute
  PR-influenced code; don't hand them a write-scoped GITHUB_TOKEN (MEDIUM).
- timeout-minutes: 10 on the python job (hang guard).
- De-overclaim "matplotlib-version-independent by design" → COORDINATE-independent:
  the semantic guard compares <text> content, so a matplotlib serialization change
  (entities/tspan) would false-FAIL loudly, never silently pass; matplotlib gets a
  <4 upper bound via #49's requirements pin (MEDIUM, ci.yml comment + Testing ×2).
- README.md CI line was left stale ("swift only") — now includes the Python suite
  (MEDIUM).
- Guard-scope comment: the two R1 HIGHs (snapshot-SOURCE tampering passes the PR
  gate; wiki Home numbers zero-guarded) are closed by sibling #49/PR #55 — the
  freshness workflow gains a pull_request paths trigger on the sample (live
  registry check on any PR touching it) and a Home-pages guard test; landed there
  to avoid cross-PR count/file conflicts. Cross-referenced in both issues.
Closes the R1 findings from BOTH ensembles (the two #48 HIGHs land here by design
— same guard family, avoids cross-PR count/file conflicts; cross-referenced):

- HIGH (#48): snapshot-SOURCE tampering merged green — the PR-gate guards only lock
  rendered artifacts ⟷ sample. freshness.yml gains a `pull_request: paths:` trigger
  on the sample/corpus: any PR touching them runs the LIVE registry check as a hard
  gate; a fabricated ground_truth reddens that PR. Network cost only on the rare
  sample-touching PR.
- HIGH (#48): wiki Home pages' hand-written competitive numbers (0 of 6, 6/6|0/6
  table, react v18 vs 19.2.7) had ZERO guard yet publish to the public wiki — new
  test_home_pages_match_sample derives every token from the sample (exact table row
  binds both scores in order; prose score; react pair; capture date; both languages).
- HIGH (#49): GitHub auto-disables scheduled workflows after ~60d of repo inactivity
  — the cron dies quietly exactly when the repo goes dormant. Acknowledged in
  freshness.yml + README with the recovery path (Actions tab / manual run); the
  paths trigger + manual dispatch are the activity-driven backstops.
- MED: --verify-live treated fetch-failure (None) as "no drift" → false GREEN on
  outage + permanent silent-skip for unsupported ecosystems. Now: per-lib unverified
  warning, "verified X of N" summary, exit 1 on drift OR unverified (distinct
  messages). Test extended (None stub → 1).
- MED (alarm fatigue): drift on a deliberately fast-moving corpus is EXPECTED, so a
  monthly hard-red would train the maintainer to ignore it. Scheduled runs now mark
  the drift step continue-on-error (informational); the staleness budget is the hard
  red (one deliberate nag per budget). PR runs keep both hard.
- MED: staleness tests hardcoded dates against the committed sample's captured_at —
  the documented refresh procedure would break them. Now pinned via a temp fixture;
  refresh-proof (README notes it).
- MED: root README still said --verify-live "warns" → exit-1 semantics + staleness
  documented; module docstring likewise (the 2nd stale spot the DA found).
- LOW: --today now strict (same ISO round-trip as captured_at; lenient "20261030"
  rejected, tested); permissions: contents: read + timeout on freshness.yml; 120d
  rationale documented; "date is an attestation, not a proof" honesty note added;
  matplotlib capped <4 (the #48 serialization-drift MEDIUM).

Tests: +1 (Home guard) → 72 Python / 216 total.
@kiki830621
kiki830621 merged commit ad0e04c into main Jul 5, 2026
1 check passed
@kiki830621
kiki830621 deleted the idd/49-vs-context7-snapshot-staleness branch July 5, 2026 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant