Skip to content

fix: exclusion matching, dep graph, module regex; add directory move#5

Closed
peteromallet wants to merge 2 commits intomainfrom
fix/move-command-and-directory-support
Closed

fix: exclusion matching, dep graph, module regex; add directory move#5
peteromallet wants to merge 2 commits intomainfrom
fix/move-command-and-directory-support

Conversation

@peteromallet
Copy link
Owner

Summary

  • Exclusion matching false positives: run_grep and finalize_graph matched --exclude patterns against absolute paths, so a pattern like Wan2GP would exclude ALL files when the project root was Headless-Wan2GP. Now matches against relative paths only.
  • Missing absolute from-imports in dep graph: The from_re regex in Python's build_dep_graph only matched relative imports (from .foo import bar), missing all absolute from X import Y statements. This meant the dep graph was incomplete and desloppify move reported 0 replacements for projects using absolute imports.
  • Module regex word boundary bug: _has_exact_module used \b which treats . as a word boundary, causing source.foo to falsely match inside source.foo.bar. Replaced with lookaround assertions.
  • Directory move support: New feature — desloppify move source/db source/core/db moves an entire package, updating external importers while preserving intra-package relative imports.

Test plan

  • desloppify move source/constants.py source/utils/constants.py --dry-run — shows 13 correct replacements (was 0 before fix)
  • desloppify move source/db source/core/db --dry-run — correctly moves 7 files, updates 2 external importers, preserves intra-package imports
  • Verified exclusion fix: --exclude Wan2GP no longer excludes project files from Headless-Wan2GP/

🤖 Generated with Claude Code

peteromallet and others added 2 commits February 12, 2026 02:02
…support

Bug fixes:
- run_grep: exclusion patterns now match against relative file paths only,
  preventing false positives when project root contains an exclude pattern
  (e.g. "Wan2GP" matching "Headless-Wan2GP" in every absolute path)
- finalize_graph: same relative-path fix for post-graph exclusion filtering
- from_re regex: now matches absolute "from X import Y" in addition to
  relative "from .X import Y", fixing the dep graph missing all absolute
  from-imports
- _has_exact_module/_replace_exact_module: replaced \b word boundary with
  lookaround assertions since \b treats '.' as a boundary, causing
  'source.foo' to falsely match inside 'source.foo.bar'

New feature:
- Directory/package move support: `desloppify move source/db source/core/db`
  moves all files in a directory, updates external importers, and preserves
  intra-package relative imports that don't need changing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When moving a directory, files within the package that import siblings
using absolute paths (e.g. `from source.video.ffmpeg_ops import ...`
inside source/video/crossfade.py) now get those imports updated.

Previously only external importers and relative self-imports were handled,
leaving absolute intra-package imports stale after a directory move.

Relative intra-package imports (from .foo) are correctly skipped since
the files move together preserving their relative positions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
peteromallet added a commit that referenced this pull request Feb 12, 2026
…ion cleanup

Scoring improvements:
- Fix cycle denominator: use graph files (not edges) for realistic potential
- Add small-sample dampening (MIN_SAMPLE=200) to prevent small dimensions swinging score
- Fix smells unit mismatch: per-file weighted failure cap for file-based detectors
- Track scan completeness (full vs fast) per language
- Show dual Health/Strict scores prominently for overall + per dimension
- Dimension deltas show both health and strict changes

New facade detector (Issue #6):
- Detect re-export facade files (pure import/re-export, no logic)
- Detect facade directories (all modules are facades)
- Supports both Python and TypeScript
- Integrated into coupling phase, Organization scoring dimension

PR #5 fixes:
- Exclusion matching uses relative paths (avoids matching project root name)
- Python dep graph regex matches absolute from-imports
- Module word boundary uses lookaround instead of \b
- Directory move support for desloppify move command

Cleanup:
- Remove redundant DETECTOR_NAMES lists — derive from detect_commands dict keys
- Single registration point: add to get_detect_commands() and it works everywhere

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@peteromallet
Copy link
Owner Author

Changes incorporated into main via cacdc6a (manually applied since codebase architecture had diverged from PR base)

@peteromallet peteromallet deleted the fix/move-command-and-directory-support branch February 12, 2026 17:58
peteromallet added a commit that referenced this pull request Feb 22, 2026
…st coverage

Quick fixes:
- Add blank line after PrimaryAction TypedDict (#3)
- Fix _compute_risk_flags local type: list[dict] → list[RiskFlag] (#11)
- Hoist dimension_action_type dicts to module-level constants (#17)

Import path cleanup:
- Remove underscore aliases in _work_queue/core.py and ranking.py (#12)

Type safety:
- Add WorkQueueResult TypedDict for build_work_queue return (#5)
- Change build_work_queue state param to StateModel (#5)

Structural refactors:
- Move scorecard_dimension_rows to engine/planning/dimension_rows.py (#2)
- Replace importlib.import_module with deferred imports in _state/ (#9)
- Extract 13 TypedDicts from narrative/core.py to narrative/types.py (#13)
- Derive _DIMENSION_SPECS from detector registry instead of manual tuple (#18)

Abstraction fitness:
- Remove 16 file_discovery and 3 text_utils re-exports from utils.py (#6)
- Update 12 consumer files to import from source modules directly

AI-generated debt:
- Simplify 46 Google-style docstrings across 18 production files (#7)

Test improvements:
- Add 73 targeted tests for concerns.py internal generators (#15)
- Split smoke test monolith into 6 per-subsystem functions (#16)

Also resolved 4 findings already fixed in current code (#1, #8, #10, #14).
3636 tests passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ikx94 added a commit to ikx94/desloppify that referenced this pull request Mar 2, 2026
…fixes

WIP — coded with Claude Code.

New:
- languages/php/test_coverage.py — full test coverage hooks
  (PHPUnit/Pest assertions, use-statement parsing incl group use,
  has_testable_logic, is_runtime_entrypoint, map_test_to_source)
- languages/php/review_data/dimensions.override.json

Fixes across 10 files addressing ~20 PHP gaps:
- SECRET_NAME_RE: match $variable assignments (peteromallet#14)
- ENV_LOOKUPS: add env(), getenv(), $_ENV[], config() (peteromallet#11)
- LOG_CALLS: add Log::info/error/etc, error_log() (peteromallet#13)
- RANDOM_CALLS: add rand(), mt_rand() (peteromallet#12)
- Import query: group use App\Models\{User, Post} (peteromallet#5)
- resolve_php_import: actually read composer.json PSR-4 (peteromallet#4)
- Unused imports: handle aliased use Foo as Bar (peteromallet#6)
- class_query: add enum_declaration (peteromallet#8)
- _CLOSURE_NODE_TYPES: add anonymous_function_creation_expression (peteromallet#9)
- _BRANCHING_NODE_TYPES: add match_conditional_expression (peteromallet#10)
- Signature _ALLOWLIST: __construct, boot, register, render, etc (peteromallet#22)
- _infer_lang_name: add .php -> php (peteromallet#2)
- generic_lang: entry_patterns parameter (peteromallet#3)
- PHP __init__: wire test_coverage, entry_patterns, zone_rules,
  exclude storage/bootstrap/cache/IDE helpers (peteromallet#1,peteromallet#16,peteromallet#19,peteromallet#20,peteromallet#24)
- Remediation text: add random_bytes() for PHP (peteromallet#15)

Deferred: peteromallet#17 (barrel_names — N/A), peteromallet#18 (dynamic_import_finder)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant