Skip to content

Rebuild snapshots whose source versions can't show the data is unchanged - #432

Merged
aaron-kumo merged 1 commit into
mainfrom
aaron/snapshot-unknown-version-reuse
Nov 23, 2026
Merged

aaron-kumo merged 1 commit into
mainfrom
aaron/snapshot-unknown-version-reuse

Conversation

@aaron-kumo

@aaron-kumo aaron-kumo commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

What

Graph.snapshot() reuses an existing index whenever every table's data version matches the one it was built from. A version of kind unknown (an undated BigQuery table, a single object with no modification time, or a source plugin returning a plain str) can stay the same after its data changes, so such a snapshot is reused indefinitely and serves stale data. This PR rebuilds snapshots over unknown versions on every call. exact, timestamp, listing and hour_bucket versions keep reusing, and the drift report is unchanged.

  • When any table's version kind is unknown, snapshot() folds a fresh token into data_version, so the call builds a new index with a new id that no later call matches. Earlier snapshots and their indexes are untouched.

Why

A plain version string only promises that unchanged data gives the same value, not that changed data gives a different one, so it can't justify reusing an index. version_kind already marks such versions unknown, and the drift report already refuses to compare them; reuse ignored the kind.

Change map

File-by-file change map.

Testing Done

  • New test_snapshot_reuses_an_index_only_over_known_versions, with real ingest from local files: graphs with exact/timestamp and listing/hour_bucket versions reuse their index; a plain str, SourceVersion('-1') and a mixed graph each rebuild with a new id, leave the earlier index in place and log the tables. The rebuild cases fail on main.

@aaron-kumo

aaron-kumo commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator Author

Change map

File Function / scope What changed Why
packages/kumo-engine/kumo/engine/graph.py _snapshot_no_lock; module docstring Fresh token in data_version when a version is unknown; INFO log unknown versions can't show the data is unchanged
packages/kumo-engine/test/test_snapshot_manifest.py test_snapshot_reuses_an_index_only_over_known_versions Reuse or rebuild per kind Covers the rule
packages/kumo-engine/test/test_snapshot_clock.py Fake backend Version tagged exact Its deterministic-id test needs reuse

@copy-pr-bot

copy-pr-bot Bot commented Nov 20, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@aaron-kumo
aaron-kumo temporarily deployed to gha-kumo-workflow-tests November 20, 2026 07:07 — with GitHub Actions Inactive
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Graph._snapshot_no_lock now checks the kinds of staged table versions. When a version kind is unknown, it logs the affected aliases and adds a fresh run ID to the fingerprint inputs. Tests cover index reuse for known version kinds and rebuilding when either source version is unknown. The snapshot clock fixture now uses a SourceVersion value with exact precision.

Merge Risk: Minimal · up to 3f047

Snapshots over sources with unknown version kinds now rebuild their index on each call instead of reusing one, and sources with known versions keep reusing indexes. No concrete merge-blocking risk was found in this change. The separate agent-skills CI check is failing on a stale published copy and should be refreshed independently.

Security architecture risk: Low · up to 3f047

The change prevents stale snapshot reuse without expanding permissions. However, failed or cancelled rebuilds can leave a different partial index after each call. Repeated retries can consume the scratch disk unless abandoned output is reclaimed.

Retained concerns

  • Low · reliability · inferred: Fresh identity disconnects failed unknown-version builds from subsequent retries. Cancellation, terminal ingest failure, or interruption can leave partial output that the next snapshot call no longer revisits, while normal cleanup removes only staged sources. Repeated outer retries can therefore accumulate abandoned indexes and exhaust storage used by other work on the same filesystem. Completed snapshot retention is intentional; reclamation ownership for unsuccessful builds is the concern.
Security review details

Security Blast Radius

  • inferred — The supported availability exposure is caller-authorized snapshot work consuming its configured scratch filesystem. Accumulated failed builds can affect other graphs or workloads sharing that storage. The inspected change does not establish an unauthenticated or cross-tenant attack path.

Trust Boundaries and Controls

  • observed — The existing graph-key FileLock still serializes staging and index creation. Completed-output lookup requires a readable success marker; missing markers do not qualify partial indexes for reuse. Fresh-token generation occurs inside that lock.

Resilience and Maintainability Implications

  • observed — The export cleanup routine operates within one snapshot-version location. Because fresh data versions select different locations, that routine does not bound accumulation across successive unknown-version snapshots or reclaim abandoned local ingest output.

Hardening Proposals

  • proposed — Assign explicit reclamation ownership to unsuccessful build directories, separate from completed-snapshot retention. Consider terminal-failure cleanup and bounded recovery of interrupted builds, coordinated with the graph lock and preserving previously completed or actively used indexes.
Pre-merge checks: Passed 2 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Change Map Design Review Inconclusive Could not read the PR conversation comment that the check requires. The check reviews the Change map in the comment that begins with <!-- kumo-pr-change-map -->. What I checked: - The checkout has n… Provide the body of the <!-- kumo-pr-change-map --> PR conversation comment (for example, paste its text or make it available to the review). Then re-run this check. The map should cover: 1. The observed failure, with the concrete stale-d…
Passed Passed checks: 2 passed

Check name Status Explanation
Pr Size Passed The PR changes 3 files, which is at or below the limit of 40. The check's file count comes from the review-scoped range refs/coderabbit/pre-merge-check/base..head, which the instructions name as aut…
Public Resource Access Passed The check applies only to external resource references (URLs, repository locations, package source locations) that this PR adds or modifies. I compared the base and head refs. The PR changes three fil…
Full details: Pr Size

Explanation

The PR changes 3 files, which is at or below the limit of 40. The check's file count comes from the review-scoped range refs/coderabbit/pre-merge-check/base..head, which the instructions name as authoritative. Evidence: - git diff --name-status over that range lists 3 modified files, all in the PR's scope: - packages/kumo-engine/kumo/engine/graph.py - packages/kumo-engine/test/test_snapshot_clock.py - packages/kumo-engine/test/test_snapshot_manifest.py - --shortstat reports 3 files changed, 55 insertions, 5 deletions. These totals match the raw summary's per-file line counts (+16/-4, +3/-1, +36/-0). - The base is an ancestor of the head, and base..head contains 1 commit. This matches the PR title's single commit. Adjudication of the prior FAIL (252 files): - The prior run used origin/main (merge base b53781b1) as the base. The review-selected base is 40e4df14, a different commit. The prior run's 252-file and 19-commit counts come from that other base. - The review-scoped range contains only the one snapshot commit. The prior claim that 18 unrelated commits belong to this PR's diff does not hold for the authoritative range. - Because the prior failure's file count rests on the wrong base, I refute it. The PR-size condition is not met on the reviewed range. Caveat: if the provider's PR view or the origin/main comparison later shows a larger range, the review base would need to be rechecked. Based on the authoritative range, the count is 3. Prior failure refuted: The prior FAIL counted 252 files using origin/main (merge base b53781b) and 19 commits. The review-scoped base refs/coderabbit/pre-merge-check/base (40e4df1) is an ancestor of head, and base..head contains 1 commit touching 3 files (graph.py, test_snapshot_clock.py, test_snapshot_manifest.py). The shortstat (3 files, 55+/5-) matches the raw summary line counts. The prior file count does not d...

Full details: Public Resource Access

Explanation

The check applies only to external resource references (URLs, repository locations, package source locations) that this PR adds or modifies. I compared the base and head refs. The PR changes three files: packages/kumo-engine/kumo/engine/graph.py, packages/kumo-engine/test/test_snapshot_clock.py, and packages/kumo-engine/test/test_snapshot_manifest.py. I scanned every added and removed line in the diff for http(s)://, git+, git@, github.com, registry names, s3://, gs://, file://, and scoped package names. No matches were found. The added lines contain only Python imports (kumo_core.sources.identity, kumo.engine.connector.file), code, and prose. Module names in imports are not package source locations, and the "BigQuery" mention in the docstring is a product name, not a reference. The PR adds no external resource reference that needs an anonymous public access check, so the check passes.

Full details: Change Map Design Review

Explanation

Could not read the PR conversation comment that the check requires. The check reviews the Change map in the comment that begins with &lt;!-- kumo-pr-change-map --&gt;. What I checked: - The checkout has no copy of that comment. The marker appears only in docs/development/review.md, which describes the convention. The comment itself is not stored in the repository. - The PR description links the change map at https://github.com/NVIDIA/kumo-engine/pull/432#issuecomment-7032942770. Live GitHub comment retrieval is not available in this run, and gh is not available in the sandbox. - The PR range changes three files: graph.py, test_snapshot_clock.py and test_snapshot_manifest.py. The range is available, so the code evidence is available. The design claims in the map are not. Code context from the diff (not a verdict on the map): - _snapshot_no_lock adds new_run_id() to version_parts when any version_kind(...) == 'unknown'. Graphs with such a version then never reuse an index. Every call builds a new index. - The module docstring now says that unknown versions rebuild on every call. The description also says earlier indexes are left in place. - The map should state the cost of this behavior. Each call with an unknown version runs a full ingest and builds a new index. It should also say whether old indexes are cleaned up. Because the map text is missing, the check cannot test its necessity, abstraction layer, preserved behavior, verification scope or stopping condition. Missing evidence cannot establish PASS.

Resolution

Provide the body of the &lt;!-- kumo-pr-change-map --&gt; PR conversation comment (for example, paste its text or make it available to the review). Then re-run this check. The map should cover: 1. The observed failure, with the concrete stale-data case (for example, an undated BigQuery table or a plain str version) and the file or path where it was seen. 2. The inspected existing behavior, including version_kind, the drift report refusal and the reuse check in snapshot(). 3. The reason a fresh new_run_id() token is the smallest sufficient change. Compare it with alternatives such as a per-table content check or a version-kind rule at the source layer. 4. The cost of rebuilding on every call for unknown versions, and whether old indexes need cleanup or a retention rule. 5. Focused verification, for example the new test_snapshot_reuses_an_index_only_over_known_versions test, and whether it covers the mixed-graph case. 6. The stopping condition, and any optional refinements listed separately from the required change.

Finishing Touches

Fix failing CI checks

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between b58c6c2 and 3f0473b.

Files selected for processing: 3

  • packages/kumo-engine/kumo/engine/graph.py
  • packages/kumo-engine/test/test_snapshot_clock.py
  • packages/kumo-engine/test/test_snapshot_manifest.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.

Graph.snapshot() reused an existing index whenever the tables' data
versions matched. A version of kind unknown (a plain str from a
plugin, an undated BigQuery table, a single object with no mtime)
can stay the same after its data changes, so such a snapshot was
reused indefinitely.

When any table's version kind is unknown, fold a fresh token into
data_version: the call builds a new index with a new id that no later
call matches, and logs which tables caused it. Other kinds keep
reusing, and earlier snapshots are untouched.
@aaron-kumo
aaron-kumo force-pushed the aaron/snapshot-unknown-version-reuse branch from a13fd89 to 3f0473b Compare November 20, 2026 07:19
@aaron-kumo
aaron-kumo temporarily deployed to gha-kumo-workflow-tests November 20, 2026 07:19 — with GitHub Actions Inactive
@aaron-kumo
aaron-kumo marked this pull request as ready for review November 20, 2026 07:22
@aaron-kumo
aaron-kumo merged commit 76d4b2e into main Nov 23, 2026
125 of 126 checks passed
@aaron-kumo
aaron-kumo deleted the aaron/snapshot-unknown-version-reuse branch November 23, 2026 20:40

This branch was previously deployed

1 inactive deployment
gha-kumo-workflow-tests — 3f0473b0 Deployed Nov 20, 2026 by aaron-kumo via import #2762
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