Address review: drop unsafe fetch-missing area filtering, avoid double file read - #23
Merged
Conversation
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FPDh1XcpTJT48Tw27fD7Ms
A migration file or database/ code file can now declare one or more areas via a `-- area: NAME[, NAME...]` comment in its leading header block. `pgdb compare`, `pgdb fetch-missing`, `pgdb migrate check`, and `pgdb migrate apply` gain repeatable `--area`/`--exclude-area` options (and the underlying migrate/parser/fetch_missing library functions gain `areas`/`exclude_areas` kwargs) so a caller can restrict to specific areas or drop specific areas, while untagged files always stay in scope as shared/common. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FPDh1XcpTJT48Tw27fD7Ms
…e file read find_missing_objects diffs the *full* live database against scripts with report_extra_db=True to find genuinely untracked objects. Filtering the scripts side by area there would make every object tracked only under a different area look "missing" too, and --write would reconstruct a duplicate file for something that already exists — so pgdb fetch-missing no longer takes --area/--exclude-area. pgdb compare's default (no --report-extra-db) doesn't have this problem, since it never computes "missing in scripts"; combining --report-extra-db with an area filter still can, so the CLI now warns when both are passed together, and the README documents the caveat. Also stop parse_directory from reading each candidate file twice (once to check its area tag, once to parse it) when a filter is active, by checking the area directly off the content it already read instead of pre-filtering the path list. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FPDh1XcpTJT48Tw27fD7Ms
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.
No description provided.