Skip to content

fix(bronze-freshness): correct openai epoch anchor + align wiki ms-parse - #2

Closed
dzarlax wants to merge 1 commit into
SharedQA:claude/dbt-test-coveragefrom
dzarlax:fix/freshness-openai-epoch-anchor
Closed

fix(bronze-freshness): correct openai epoch anchor + align wiki ms-parse#2
dzarlax wants to merge 1 commit into
SharedQA:claude/dbt-test-coveragefrom
dzarlax:fix/freshness-openai-epoch-anchor

Conversation

@dzarlax

@dzarlax dzarlax commented Jun 16, 2026

Copy link
Copy Markdown

What

Follow-up to #1 on this branch — fixes two loaded_at_field anchors found while reviewing the merged freshness declarations before constructorfabric#1346 lands.

  1. openai (bug)bucket_start_time is Unix seconds (an integer), per the connector's own dbt models (to_ai_cost.sql / to_ai_tool_usage.sql: toDate(fromUnixTimestamp(CAST(bucket_start_time AS UInt32)))). The anchor was parseDateTimeBestEffortOrNull(bucket_start_time), which expects a string and would runtime error on all 9 usage tables + costs once OpenAI is ingested. Switched to fromUnixTimestamp(CAST(bucket_start_time AS UInt32)).
  2. confluence / outline (consistency)wiki_pages now uses parseDateTime64BestEffortOrNull(updated_at, 3) to match each connector's own model convention. Functionally equivalent for freshness, but consistent.

Why before merge

openai is empty in the dogfood install, so the runtime error wouldn't surface until OpenAI is ingested — but it's a latent false-positive (page on every run) waiting to happen. Cheaper to fix now than to debug a red gate later.

No other anchors are affected: the remaining inferred columns (day, date, metric_date, snapshot_date, event times) were each cross-checked against the connector's own silver model and parse correctly.

Review of constructorfabric#1346 caught two anchor issues in the per-source freshness blocks:

- openai: `bucket_start_time` is Unix seconds (integer), per the connector's
  own dbt models (toDate(fromUnixTimestamp(CAST(bucket_start_time AS UInt32)))).
  parseDateTimeBestEffortOrNull expects a string and would runtime-error on all
  usage/cost tables. Switch to fromUnixTimestamp(CAST(... AS UInt32)).
- confluence/outline wiki_pages: align to parseDateTime64BestEffortOrNull(updated_at, 3)
  to match each connector's own model convention (functionally equivalent for
  freshness, but consistent).

Follow-up to PR constructorfabric#1 on this branch; keeps constructorfabric#1346 correct before it merges to main.
@dzarlax
dzarlax force-pushed the fix/freshness-openai-epoch-anchor branch from d450676 to cb13e9c Compare June 16, 2026 16:24
@SharedQA

Copy link
Copy Markdown
Owner

Folded into claude/dbt-test-coverage as ab03586 — cherry-picked with your authorship kept, signed off for DCO.

Re-checked each anchor against the connectors' own models before pushing:

  • openai bucket_start_time is integer epoch seconds (to_ai_cost.sql / to_ai_tool_usage.sql both do fromUnixTimestamp(CAST(... AS UInt32))), so parseDateTimeBestEffortOrNull would have errored on ingest — real fix.
  • confluence and outline wiki_pages both parse updated_at with parseDateTime64BestEffortOrNull(updated_at, 3) in their models, so the freshness field now matches.

Closing since it's on the branch. Good catch on the openai one.

@SharedQA SharedQA closed this Jun 17, 2026
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.

2 participants