Skip to content

refactor: isolate optional imports and remove dead state - #13

Merged
JNZader merged 4 commits into
mainfrom
refactor/ruff-optional-f841-slice-2
Aug 19, 2026
Merged

refactor: isolate optional imports and remove dead state#13
JNZader merged 4 commits into
mainfrom
refactor/ruff-optional-f841-slice-2

Conversation

@JNZader

@JNZader JNZader commented Aug 19, 2026

Copy link
Copy Markdown
Owner

Search and Intelligence package facades mixed optional-backend probes with public reexports, creating E402 pressure and child-to-facade initialization back-edges. Twelve unused locals also looked like unfinished behavior even though repository output contracts showed they were unsupported state.

This is Slice 2 of the approved three-PR stacked-to-main chain. It restructures optional availability and removes only evidence-backed dead state; mechanical cleanup and Ruff policy remain in Slice 3.

Optional dependency boundaries

  • Search now owns backend detection in private _availability.py; core BM25/types/preparation exports remain usable without FAISS.
  • Semantic Search exports remain lazy and initialize only when accessed.
  • Intelligence now owns parser availability in a private leaf; compressor and extractor registry no longer import the partially initialized package facade.
  • Pure/fallback Intelligence surfaces remain available without extras; enhanced registry behavior remains available with extras.
  • Clean subprocess tests cover missing, Search-only, Intelligence-only, combined, facade-first, child-first, lazy-load, required-failure, and fault-injection modes.

Evidence-backed F841 dispositions

All twelve approved locals were removed without inventing Built columns, internal-only call filtering, stack-driven setup behavior, AST prompt content, or other latent features. Each row has a named output anchor and a rollback probe that reproduces its original Ruff finding while preserving behavior.

Verification

Measured on refactor/ruff-optional-f841-slice-2 at 509220e:

  • Complete suite: 3567 passed, 13 skipped, 88 warnings.
  • Slice 2 focused union: 405 passed, 8 skipped.
  • Intelligence partition: 405 passed, 5 skipped.
  • Broad Search suite: 66 passed, 8 skipped.
  • Optional import surfaces: 5 passed.
  • F841 output anchors: WU9 150 passed, WU10 91 passed, WU11 69 passed.
  • Rollback recurrence: 12/12 rows exactly once.
  • Focused E402/F401/F841 Ruff, uv lock --check, and git diff --check: PASS.
  • Diff: 16 files, 233 additions, 41 deletions = 274 changed lines.

No build, dependency-version, lockfile, CI, Ruff-policy, suppression, or unsafe-fix change is included. No global Ruff-zero claim is made.

Review trail

  • Post-apply Judgment Day: two explicit empty ledgers; APPROVED.
  • Formal SDD verification: 4/4 requirement clusters and 14/14 executed behavioral scenarios compliant; zero findings.
  • Pre-commit, pre-push, and pre-PR risk sweeps: explicit empty ledgers.
  • Open BLOCKER/CRITICAL findings: 0.

Commit structure

Four conventional commits separate optional boundary architecture, display/diagram state, context/setup/graph state, and remaining Intelligence/prompt state. Shared optional-surface tests remain with the structural commit.

Follow-ups noted — not implemented here

Slice 3 will correct the remaining accidental import ordering and mechanical E741/F541 findings, prove the literal pre-policy Ruff-zero gate, then align and pin reproducible local/CI Ruff policy.

@JNZader
JNZader merged commit 0a3177b into main Aug 19, 2026
9 of 10 checks passed
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