Skip to content

fix(catalog): debug.generated_at is response time, not cached index timestamp#125

Merged
klappy merged 1 commit into
mainfrom
fix/catalog-generated-at-response-time
Apr 20, 2026
Merged

fix(catalog): debug.generated_at is response time, not cached index timestamp#125
klappy merged 1 commit into
mainfrom
fix/catalog-generated-at-response-time

Conversation

@klappy
Copy link
Copy Markdown
Owner

@klappy klappy commented Apr 20, 2026

The gap

oddkit_catalog was returning debug.generated_at values that lagged server_time by minutes to hours. Observed on 2026-04-20: a catalog response had debug.generated_at: 04:07:00 while server_time: 04:55:05 in the same envelope — 48 minutes stale.

Root cause

workers/src/orchestrate.ts:1745 in runCatalog returned generated_at: index.generated_at — the cached index build timestamp — instead of the current response time. Every other handler in the file uses new Date().toISOString() for this field.

Fix

Two-field change in the runCatalog debug block:

  • generated_at: new Date().toISOString() — consistent with every other handler
  • index_built_at: index.generated_at — preserve the cache-freshness diagnostic under an accurate name

Smoke test

Bug slipped because oddkit_catalog had no coverage in canon-tool-envelope.smoke.mjs. This PR adds a block that:

  • Verifies full envelope via expectFullEnvelope
  • Asserts debug.generated_at age is under 60 seconds
  • Asserts debug.index_built_at is present as a separate field

Canon references

Release-validation-gate

Do not merge until:

  1. Cursor Bugbot reaches completed
  2. Independent Sonnet 4.6 validator reviews via Managed Agents

This touches orchestrate.ts envelope behavior; the validator applies.


Note

Low Risk
Low risk: small envelope/debug field adjustment in oddkit_catalog plus a smoke test asserting timestamp semantics; main risk is minor downstream reliance on the old debug field meaning/name.

Overview
Fixes oddkit_catalog debug timestamps so debug.generated_at reflects response time (matching other handlers) instead of the cached index build time.

Adds debug.index_built_at to preserve the cached index timestamp for cache-freshness diagnostics, and extends the live envelope smoke test to cover oddkit_catalog, including recency checks for generated_at and presence of index_built_at.

Reviewed by Cursor Bugbot for commit 4ce5d1a. Bugbot is set up for automated code reviews on this repo. Configure here.

…imestamp

runCatalog returned index.generated_at as debug.generated_at — the cached
index build timestamp, not the current response time. Every other handler
uses new Date().toISOString() for this field.

Observed during v0.21.0 regression testing: debug.generated_at lagged
server_time by 48 minutes in a single response envelope.

Changes:
- workers/src/orchestrate.ts: runCatalog now sets debug.generated_at
  to new Date().toISOString(). Cached index build timestamp preserved
  as debug.index_built_at for consumers wanting the freshness signal.
- workers/test/canon-tool-envelope.smoke.mjs: add oddkit_catalog
  coverage. Bug slipped because catalog had no smoke assertion.

Canon references:
- klappy://canon/values/axioms (Axiom 1 — Reality Is Sovereign)
- klappy://canon/principles/consistency-same-pattern-every-time
- klappy://canon/principles/cache-fetches-and-parses (PR #125)
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
oddkit 4ce5d1a Commit Preview URL

Branch Preview URL
Apr 20 2026, 12:28 PM

@klappy klappy merged commit 8b19c93 into main Apr 20, 2026
5 checks passed
@klappy klappy deleted the fix/catalog-generated-at-response-time branch April 20, 2026 13:10
klappy pushed a commit that referenced this pull request Apr 20, 2026
Bumps version in package.json, workers/package.json, and both lockfiles.
Fills CHANGELOG [Unreleased] with 0.22.0 entries covering PR #124
(telemetry_public envelope conformance) and PR #125 (catalog
debug.generated_at response time + new index_built_at field).

MINOR bump: both fixes add envelope fields consumers can rely on.

Both bugs caught during the v0.21.1 regression test sweep. Pre-commit
hook verified version sync and typecheck pass.

No code or test changes in this PR — documentation + version only.
klappy added a commit that referenced this pull request Apr 20, 2026
Main shipped 0.22.0 via PR #128 while this branch was in Sonnet 4.6
validator dispatch. PR #128 backfilled CHANGELOG + version bump covering
the envelope-conformance fixes from PR #124 (telemetry_public) and
PR #125 (catalog generated_at).

Per klappy://canon/constraints/release-validation-gate Rule 3 (canon
outranks session artifacts), this refactor is re-versioned to 0.23.0.
The handoff's "ship as 0.22.0" recommendation was session-scoped; main-
reality is the canon.

Resolution:
- CHANGELOG.md: my encode D5+D9 content moves to a new [0.23.0] section
  above the existing [0.22.0] (telemetry + catalog); added a version-
  note blockquote explaining the bump.
- package.json / workers/package.json / both lockfiles: 0.22.0 → 0.23.0.
- workers/src/orchestrate.ts: auto-merged cleanly (catalog fix touched
  runCatalog, encode refactor touched discoverEncodingTypes + classifier
  call sites; zero overlap).
- workers/test/canon-tool-envelope.smoke.mjs: auto-merged cleanly
  (additive on both sides).

Verified:
- tsc --noEmit clean
- governance-parser.test.mjs 105/105 pass
- CHANGELOG structure: [Unreleased] [0.23.0] [0.22.0] [0.21.1] [0.21.0]...
- All conflict markers removed

Sonnet 4.6 validator verdict (session sesn_011CaF5vqjgzN7Mw8s84qvK9,
PASS on all 5 corroborations) remains valid for the encode refactor
content — the rebase does not touch any matcher code or action behavior.
A fresh-context validator re-dispatch will run before promotion per
release-validation-gate Rule 2 out of canon-discipline caution.
klappy added a commit that referenced this pull request Apr 20, 2026
…23.0) (#126)

Migrates oddkit_encode's trigger-word classifier from regex alternation to stemmed phrase-subset matching — the last regex matcher in the canon-parity sweep. Closes the sweep.

Originally scoped as 0.22.0 per the P1.3.4 handoff. While this branch was in Sonnet 4.6 validator dispatch, PR #124 (telemetry envelope) and PR #125 (catalog envelope) landed on main and were released as 0.22.0 via PR #128. Per klappy://canon/constraints/release-validation-gate Rule 3 (canon outranks session artifacts), this refactor rebases forward and ships as 0.23.0.

Bugbot disposition (Rule 1):
- 259170a (first cut, flat stemmedTokens): completed/neutral, high-severity finding on multi-word vocab flattening → fix-forwarded via 113ba11
- 113ba11 (Cursor autofix stemmedPhrases): completed/neutral, low-severity dead-code finding on intersectsStems → fix-forwarded via e404fe0
- e404fe0: completed/success
- eaa1234 (CHANGELOG + assertion 16): completed/success
- d2acf91 (merge origin/main): Bugbot cancelled (new commit pushed before completion)
- 8a0636b (stale-comment fix): completed/success — final head

Sonnet 4.6 validator (Rule 2): agent_011CaF5vo8B5UpqtfZAmSeui, session sesn_011CaF5vqjgzN7Mw8s84qvK9 — verdict PASS on all 5 corroborations against eaa1234. Rebase and comment-fix commits on top are textual/version-only and do not touch matcher code. A fresh validator dispatch will run against the main→prod promotion PR per Rule 2.

Refs:
- Handoff: klappy://odd/handoffs/2026-04-20-p1-3-4-encode-canon-parity
- Canon basis: klappy://canon/principles/cache-fetches-and-parses, klappy://canon/principles/vodka-architecture
- Binding gate: klappy://canon/constraints/release-validation-gate

Non-blocking carry-forward: P13 — Input-E fallback classification (inputs with no canon vocab intersection fall through to types[0] alphabetical = Constraint). Pre-existing behavior, flagged by validator, outside P1.3.4 scope.
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