Repository navigation
Fix Citation behavior required by Catalog - #74
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
At least one introduced bug in graph filtering date parsing (ISO ...Z handling) will raise at runtime and likely fail the new graphviz tests.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 2
Open (2)
What changed in this PR
This PR updates Citation’s export, merge, graph, URL-validation, and notification behavior to match expectations needed by the downstream Catalog integration, and adds targeted regression coverage to lock those behaviors in.
Changes:
- Introduces a transaction-safe
publications_changedsignal with anotify_publications_changed()helper, and wires it into publication-affecting write paths (serializer saves, merges, URL status updates, admin action, orphan cleanup). - Reworks primary-publication CSV exporting to keep each publication on a single CSV row (including correct multi-author formatting) and adds coverage for write vs stream parity.
- Hardens graph filtering/aggregation and SuggestedMerge content-type handling (plus migration
0036), with regression tests for the new constraints and behaviors.
| File | Description |
|---|---|
| tests/test_validate_urls.py | Verifies URL validation continues after request failures and logs failure details. |
| tests/test_serializers.py | Adds post-commit notification test for PublicationSerializer.save() and validates merge serializer constraints. |
| tests/test_merge.py | Adds end-to-end tests for SuggestedMerge tag merges, signals, and unsupported model errors. |
| tests/test_management_commands.py | Ensures orphan cleanup emits publication-change notifications with related IDs. |
| tests/test_graphviz_data.py | Adds regression tests for graph filtering/aggregation behavior and immutability of filter criteria. |
| tests/test_export_data.py | Confirms CSV export keeps a publication’s data in one row and streaming matches writing. |
| tests/test_auditlog.py | Makes audit log contribution tests robust to non-pk=1 publications. |
| tests/test_admin.py | Tests curator assignment auditing and post-commit notification behavior. |
| citation/signals.py | Adds publications_changed signal and notify_publications_changed() (on-commit, normalized IDs, robust receiver error logging). |
| citation/serializers.py | Emits post-commit publication-change notifications on PublicationSerializer.save(); restricts SuggestMerge model_name values. |
| citation/ping_urls.py | Fixes pattern count logging (len() vs .count()). |
| citation/models.py | Improves URL status logging on request failures, adds post-commit notifications, tightens SuggestedMerge supported models, fixes tag merge relationship update, and adds supported-model error. |
| citation/migrations/0036_alter_suggestedmerge_content_type.py | Migration aligning SuggestedMerge content-type constraints with supported models. |
| citation/management/commands/validate_urls.py | Fixes misplaced debug log statement indentation. |
| citation/management/commands/remove_orphans.py | Wraps in a transaction and emits post-commit notifications for removed orphan IDs. |
| citation/management/commands/cache_data.py | Normalizes log message casing and minor import ordering. |
| citation/graphviz/data.py | Replaces Haystack-based filtering with ORM-based filtering and updates aggregation logic. |
| citation/export_data.py | Refactors CSV exporter to support nested FK attributes, stable author aggregation, and consistent streaming output. |
| citation/apps.py | Sets AppConfig.path for the app module. |
| citation/admin.py | Makes curator assignment atomic/bulk-audited and emits post-commit notifications. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
simplifies downstream filtering so we can use native ORM queries instead of row by row processing added some initial tests with cases pulled from a representative sample of prod data but may still be incomplete
alee
approved these changes
Sep 21, 2026
alee
left a comment
Member
There was a problem hiding this comment.
LGTM, thanks Anton! Minor comments on tests but no blockers
This was referenced Sep 21, 2026
asuworks
added a commit
to asuworks/catalog
that referenced
this pull request
Sep 27, 2026
Pin comses/citation#74 merge commit fbce715.
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
SuggestedMergecontent-type handling and add migration0036;This should merge before the Catalog PR so Catalog can pin the resulting upstream Citation commit.
Verification