Skip to content

fix(ingestion): include source URL in extraction fingerprint - #742

Merged
DerekRoberts merged 1 commit into
mainfrom
cursor/fingerprint-includes-url-9b9a
Oct 2, 2026
Merged

DerekRoberts merged 1 commit into
mainfrom
cursor/fingerprint-includes-url-9b9a

Conversation

@DerekRoberts

Copy link
Copy Markdown
Collaborator

Summary

extraction_fingerprint signed extractor version, type, selector, and part, and left out source.url. After a registry URL change, the local file could still match content_hash, so --check and --sync sent the previous page's If-None-Match and If-Modified-Since to the new address. A 304 then reported MATCH for a page that was never fetched.

The fingerprint now includes the URL. A changed URL is an unconditional fetch. --check reports DRIFT_DETECTED with Extraction inputs changed when the extracted hash still matches, and --sync rewrites the file and stores a new fingerprint. Catalogue entries on main do not have a stored fingerprint yet, so this does not change the next scheduled --check until a sync writes one.

Test plan

  • Python 3.14 container (python:3.14-slim): pytest tests/test_sync_sources.py --noconftest — 74 passed
  • Changed URL sends no validators and is not MATCH
  • --sync rewrites the file with the new URL and replaces the fingerprint
  • GitHub Actions on this commit
Open in Web Open in Cursor 

A changed registry URL was still treated as the same extraction, so
stored validators could be sent to the new address and a 304 reported
MATCH. The fingerprint now includes the URL, and --check reports drift
until --sync re-extracts.
@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Essentials

Run ID: a3c1d8c2-f001-420e-b696-1680f7c4d70a

📥 Commits

Reviewing files that changed from the base of the PR and between 944dd2b and d386075.

📒 Files selected for processing (3)
  • app/data/sources.yaml
  • app/scripts/sync_sources.py
  • app/tests/test_sync_sources.py
 ___________________________________________________________________________
< This code is one line away from greatness-and 40 lines away from clarity. >
 ---------------------------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Comment @coderabbitai help to get the list of available commands.

@DerekRoberts DerekRoberts self-assigned this Oct 2, 2026
@DerekRoberts
DerekRoberts marked this pull request as ready for review October 2, 2026 20:49
Copilot AI balanced review requested due to automatic review settings October 2, 2026 20:49
@DerekRoberts
DerekRoberts merged commit d2406e4 into main Oct 2, 2026
18 of 19 checks passed
@DerekRoberts
DerekRoberts deleted the cursor/fingerprint-includes-url-9b9a branch October 2, 2026 20:49
Copilot stopped reviewing on behalf of DerekRoberts due to an error October 2, 2026 20:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Copilot was unable to run its full agentic suite in this review.

Copilot review overview

Review effort: Lite
Findings: 1 Medium severity · 2 Low severity

Open (3)
What changed in this PR

Update extraction fingerprinting to include the source URL so validators (ETag/Last-Modified) are not reused when a registry URL changes, and add tests to validate the new behavior.

Changes:

  • Include url in extraction_fingerprint() identity calculation and update documentation/comments.
  • Add tests ensuring URL changes trigger unconditional refetch, drift detection, and file rewrite during --sync.
  • Update sources.yaml inline documentation to reflect the new fingerprint definition.
File Description
app/​scripts/​sync_sources.py Extends extraction fingerprint to include URL and clarifies intent in docstrings/comments.
app/​tests/​test_sync_sources.py Adds regression tests for URL-change behavior in --check and --sync.
app/​data/​sources.yaml Updates schema comments to document URL-included fingerprint behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 943 to 956
def extraction_fingerprint(source: SourceEntry) -> str:
"""Identity of the inputs that turn upstream HTML into the stored Markdown."""
"""Identity of the page and the inputs that turn its HTML into stored Markdown.

``url`` is part of the identity. Validators stored for one page must not be
sent to a different address after the registry URL changes.
"""
raw = "\n".join((
EXTRACTOR_VERSION,
source.type or "",
source.selector or "",
source.part or "",
source.url,
))
return hashlib.sha256(raw.encode("utf-8")).hexdigest()
source.type or "",
source.selector or "",
source.part or "",
source.url,
result = check_source_drift(entry, tmp_path)

assert result.status == "DRIFT_DETECTED"
assert result.status != "MATCH"
@kilo-code-bot

kilo-code-bot Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Code Review Roast 🔥

Verdict: No Issues Found | Recommendation: Merge

Oh wait, this PR is actually clean. I need to sit down. I had my flamethrower warmed up and everything.

The fingerprint change is wired in correctly on every path that matters: _validators_for_intact_baseline refuses stored validators when the fingerprint no longer matches (so a moved URL gets an unconditional fetch, not somebody else's If-None-Match), --check reports DRIFT_DETECTED with Extraction inputs changed when the bytes still match, and --sync rewrites the file and re-stores a fingerprint that now includes url. The new tests even assert the outgoing request carries no validators — this is the rare diff that audited its own apology.

📊 Overall: Like finding a unicorn in production — I didn't think clean PRs existed anymore, but here we are.

Files Reviewed (3 files)
  • app/data/sources.yaml
  • app/scripts/sync_sources.py
  • app/tests/test_sync_sources.py

Reviewed by efficient · Input: 0 · Output: 0 · Cached: 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants