Deduplicate exchanged content - #1355
Open
eilmiv wants to merge 7 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses metadata “flip-flopping” during ingestion by recording which Source last scraped a Scrapable resource and introducing logic to skip updates from other sources unless the incoming metadata is deemed richer. This aligns with issue #1356’s goal of stabilizing metadata when multiple sources provide conflicting versions.
Changes:
- Add
last_scraped_by_idtoeventsandmaterials, and expose it viaScrapable#last_scraped_by_source. - Update the ingestor to persist
last_scraped_by_sourceand to skip writes when the current source is not responsible. - Add/adjust unit tests and fixtures to cover responsibility switching behavior.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
lib/ingestors/ingestor.rb |
Sets last_scraped_by_source on ingest and introduces responsibility logic to avoid cross-source flip-flops. |
app/models/concerns/scrapable.rb |
Adds the belongs_to :last_scraped_by_source association for scrapable models. |
db/migrate/20260729120000_add_last_scraped_by_to_scrapable_models.rb |
Adds the new DB columns for tracking scrape source. |
db/schema.rb |
Reflects the new last_scraped_by_id columns in events and materials. |
test/unit/ingestors/ingestor_test.rb |
Adds tests for setting and switching scrape-source responsibility. |
test/fixtures/events.yml |
Adds an event fixture used by the new responsibility tests. |
test/unit/ingestors/scraper_test.rb |
Updates expected activity count impacted by the new ingestion behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
eilmiv
marked this pull request as ready for review
August 4, 2026 15:00
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of changes
Motivation and context
Closes #1356
Checklist