Validate ignored_referencing_fields configuration and add tests#1
Merged
Conversation
The command used to silently skip ignore paths that did not match any FK pointing at the target model, so a typo or a stale path (e.g. after a model moved to another app) quietly changed collection behavior. Validate every configured path on each run, dry runs included. https://claude.ai/code/session_01NWap56ibZN8sey8mQfa8uw
SupraSummus
force-pushed
the
claude/quirky-meitner-vzfwws
branch
from
June 10, 2026 06:22
4fffc10 to
dec980b
Compare
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
This PR adds validation to the garbage collection command to ensure that configured
ignored_referencing_fieldsactually match existing ForeignKey fields. It also includes comprehensive tests and documentation updates.Key Changes
find_fk_fields()function now tracks which ignored field paths are actually matched against existing ForeignKeys. If any configured paths don't match, aCommandErroris raised with a clear message about the stale or incorrect configuration.test_ignored_referencing_field_does_not_keep_row_alive(): Verifies that ignored referencing fields don't prevent garbage collectiontest_unmatched_ignored_field_path_fails_loudly(): Ensures the command fails with a helpful error message when configuration contains invalid field pathsCacheandCacheLogtest models to support the new test casesgc_ignored_referencing_fieldswill cause the command to fail, catching configuration errors earlyImplementation Details
find_fk_fields()by maintaining amatched_ignoredset that tracks which ignored paths were successfully matchedhttps://claude.ai/code/session_01NWap56ibZN8sey8mQfa8uw