desloppify icon indicating copy to clipboard operation
desloppify copied to clipboard

scan --by-language reuses the first language state and accumulates cross-language findings

Open drakemorey opened this issue 3 weeks ago • 3 comments

Running desloppify scan --path . --by-language --no-badge on one coherent project with Swift, Python and Bash states prints "states stay independent", but only .desloppify/state-swift.json is created. It then contains all three languages' findings, Python reports carried Swift lint findings, and the Bash scan reports the same findings. status describes a mixed 226-issue state rather than language-specific scores.

Version: 1.0, Python 3.11.14, macOS arm64.

Minimal repro:

  1. Create a folder with one .swift file, one .py file, and one .sh file.
  2. Run desloppify scan --path . --by-language --no-badge.
  3. Inspect .desloppify/state-* and compare detector keys.

Expected: separate state/plan context per language, as advertised. Actual: only state-swift.json written; language scans accumulate in it. CLI log even says "State file missing (state-python.json); attempting recovery from plan.json", then reports Swift violations during Python scan.

Workaround: separate explicit --state .desloppify/LANG/state.json for every scan and command. I cannot confidently patch the runtime cache/state routing in this app-maintenance task; please investigate resetting per-command runtime context in _cmd_scan_by_language. No private data is needed to reproduce.

drakemorey avatar Nov 08 '26 15:11 drakemorey

Additional isolation detail: explicit --state .desloppify/python/state.json isolates scan state, but plan consumers still read the default .desloppify/plan.json via get_state_dir/get_project_root. Review import adds issues to that default plan while scan reconciliation writes beside the explicit state. Thus next --state ... can report an empty or unrelated queue despite open review findings. A temporary external wrapper that selects the language plan before each command makes those existing findings visible; no scanner installation was modified.

drakemorey avatar Nov 08 '26 15:11 drakemorey

Additional integrity defect found in desloppify 1.0 while completing the same isolated multi-language project scan:

After an existing complete review, prepare a partial-dimension refresh:

desloppify --lang swift review --state /.desloppify/swift/state.json --run-batches --dry-run --runner codex --force-review-rerun --dimensions authorization_consistency,contract_coherence,error_consistency,logic_clarity,naming_quality

Expected: the generated review_packet_blind.json contains source scope and review criteria, without prior assessments, outcome history, or targets.

Actual: the generated packet includes top-level historical_review_issues and investigation_batches[].historical_issue_focus. Nested entries expose past assessment scores, fixed/deferred statuses and resolution notes. The same occurred in Python and Bash partial refreshes. The prior complete 20-dimension packets did not contain these keys.

Impact: a context-isolated reviewer can still see historical scoring and resolution claims in the purportedly blind packet. This violates the documented scoring integrity requirement.

Mitigation in this run: stopped all three exposed reviewers, quarantined their results without importing, then started fresh native Codex reviewers using a separately preserved packet containing only static rubric, dimensions and batch indexes. No claim of a Claude review was made. Unsanitized originals remain preserved locally for debugging.

Please remove these fields recursively from the blind artifact (not just the prompt) and add a regression assertion rejecting assessment/history keys, including partial refreshes. This may warrant a separate issue; attaching here to keep the observed workflow defects together.

drakemorey avatar Nov 08 '26 16:11 drakemorey

Follow-up from the same Swift/Python/Bash audit: the SwiftLint adapter loses rule/column identity, and deferred old line-based records survive source movement. This is separate from the blind-packet history leakage already reported above.

Minimal identity collision: SwiftLint JSON can contain four warnings at the same line (for example two force_cast and two identifier_name diagnostics). Each has rule_id/character, but generic_parts/tool_factories.py builds identity from entry.get("id") or f"{smell_id}::{entry['line']}". The Swift generic descriptor maps all rules to swiftlint_violation; these four diagnostics collapse into one ID.

Observed on one small Swift app: initial raw output 262 warnings at 186 unique file/line locations; 49 locations collide, losing 76 warning identities. After source cleanup, direct SwiftLint output contains 178 warnings, but the persisted backlog still retains deferred entries at old line numbers. Re-scanning does not make an old deferred locator authoritative evidence of a current violation. A same-line rule change can also overwrite the meaning of a persisted ID.

Expected: include stable rule identity and sufficient disambiguation (e.g. column/diagnostic identity), and reconcile deferred records that no longer match current detector output. Actual: duplicates/moved warnings inflate the persisted backlog while distinct same-line warnings are collapsed. I am preserving raw output and reconciling each stale locator explicitly, without excluding production paths or changing rules. No separate issue opened.

drakemorey avatar Nov 08 '26 16:11 drakemorey