Skip to content

Add insert-only history tables for gold signal snapshots - #2

Open
Mitchell-MC wants to merge 1 commit into
mainfrom
feature/gold-signal-history-tables
Open

Mitchell-MC wants to merge 1 commit into
mainfrom
feature/gold-signal-history-tables

Conversation

@Mitchell-MC

@Mitchell-MC Mitchell-MC commented Jul 27, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • gold.cart_recovery_signal / gold.fulfillment_risk_signal are overwrite-mode current-snapshot tables (needed for DirectQuery ops consumers per bi/powerbi/data-model.md), so they can't answer historical questions.
  • gold_exec_summary_marts.py previously depended on being scheduled after (but not too long after) the hourly/4h signal jobs to capture a snapshot before it was overwritten — a real timing coupling, called out in its own docstring.
  • Each gold job now also appends its scored rows to a new insert-only *_history table (periodic snapshot fact, keyed by _snapshot_at), and gold_exec_summary_marts.py reads the latest run from history instead of the live snapshot table — removing the timing dependency.
  • Documented the two data-modeling items deliberately not built (conformed dimensions, full Data Vault) in a new README "Data model roadmap" section, with explicit triggers for when to build them.

Test plan

  • ruff check / black --check pass against CI's pinned versions (ruff==0.15.22, black==25.11.0)
  • Added tests/unit/test_gold_exec_summary_marts.py covering the latest-snapshot selection logic; verified the selection logic directly (Spark-free) since this Windows dev environment can't run local PySpark (pre-existing limitation — the untouched test_gold_cart_recovery.py fails the same way here)
  • Confirm pytest tests/unit --cov=src passes in CI (Ubuntu) on this PR

🤖 Generated with Claude Code

gold.cart_recovery_signal and gold.fulfillment_risk_signal are overwritten
each run for DirectQuery ops consumers, so they can't answer historical
questions and gold_exec_summary_marts.py had to depend on run-timing to
capture a snapshot before it was overwritten. Each gold job now also
appends to a *_history table (periodic snapshot fact, insert-only), and
exec_summary_marts reads the latest run from history instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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