Skip to content

napari/processor: thread cleanup_drop_keys from SettingsConfig to ImInfo (Slice 4 of #245)#253

Merged
aelefebv merged 1 commit into
dechaofrom
slice-4-processor-cleanup-drop-keys
May 12, 2026
Merged

napari/processor: thread cleanup_drop_keys from SettingsConfig to ImInfo (Slice 4 of #245)#253
aelefebv merged 1 commit into
dechaofrom
slice-4-processor-cleanup-drop-keys

Conversation

@aelefebv

Copy link
Copy Markdown
Owner

Summary

Closes #249. Completes the slice chain for #245. Builds on #246 (Slice 1) + #252 (Slice 3).

Test plan

  • uv run pytest -q --ignore=tests/test_*_perf.py — 715 passed, 0 regressions
  • Reviewer: open the napari plugin → select "CSVs only" preset → run full pipeline → verify droppable intermediates are gone after Hierarchy completes
  • Reviewer: run "Run Feature Export" solo button with "CSVs only" → verify cleanup still fires

🤖 Generated with Claude Code

…nfo (Slice 4 of #245)

Wires the napari processor to read ``cleanup_drop_keys`` (a
``frozenset[str]``) from ``SettingsConfig`` and pass it to
``ImInfo.remove_marked_intermediates`` after each per-file
``Hierarchy.run()`` succeeds. Replaces the legacy bool +
``remove_intermediates()`` legacy-method call.

``run_feature_export()`` now constructs the ``cleanup_drop_keys``
via ``settings.to_config().cleanup_drop_keys`` (or empty
``frozenset()`` when settings is None — matches the prior
"checkbox unchecked" no-op semantic). The
``_run_feature_export`` worker only fires cleanup when the set is
non-empty (truthy frozenset), preserving today's effective-no-op
behavior for the default "Keep everything" preset.

Cleanup still fires after Hierarchy regardless of how Hierarchy
was invoked — full pipeline chain (``run_nellie()``) or solo
button (direct ``run_feature_export()`` click) — per PRD #245
User Story 8 and Slice 3's wiring.

Closes #249. Completes the pipeline for #245.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@aelefebv
aelefebv merged commit ebce102 into dechao May 12, 2026
1 of 6 checks passed
@aelefebv
aelefebv deleted the slice-4-processor-cleanup-drop-keys branch May 12, 2026 20:59
aelefebv added a commit that referenced this pull request May 12, 2026
… Qt importorskip + wiki close-out (#245) (#254)

CI fixes for the per-output retention slices (PRs #250-#253):

1. **Windows mmap-release** in
   ``ImInfo.remove_marked_intermediates``. The post-rewrite method
   tried to ``os.remove(im_path)`` while ``self.im`` still held the
   tifffile memmap, triggering ``PermissionError [WinError 32] The
   process cannot access the file because it is being used by
   another process`` on Windows CI. Fix: drop ``self.im`` (and
   ``gc.collect()``) at the start of the method — the existing
   pattern documented at ``_release_iminfo_memmap`` in
   ``test_verifier_iminfo.py``. Always-release is the cheapest
   and safest default; any pipeline intermediate could be
   memmap'd by a stage that's still alive in the process. Callers
   who use ``info.im`` after cleanup get ``None`` (correct — the
   file may be gone).

2. **Ubuntu headless Qt** ImportError on ``libEGL.so.1`` for
   ``test_napari_settings.py``. ``qtpy.QtWidgets`` transitively
   pulls Qt's display libs even for the dataclass-only tests
   (``SettingsConfig`` lives in the same module). Fix: module-level
   ``pytest.importorskip("qtpy.QtWidgets")`` so the entire file
   skips cleanly on systems without Qt's display libs. Tests pass
   normally where Qt loads.

Phase 5 wiki close-out for PRD #245:

- ``wiki/glossary.md`` — new ``DROPPABLE_KEYS`` entry pointing to
  [[decisions/0014-intermediates-policy-frozenset]].
- ``wiki/pipeline.md`` Gotchas — new bullet for the per-output
  cleanup mechanism: end-of-pipeline-only, only-on-success
  (inherits the existing "no try/except around stages" gotcha),
  ``cleanup_drop_keys`` kwarg surface.
- ``wiki/im-info.md`` test-coverage line — updated to call out
  ``remove_marked_intermediates`` + ``DROPPABLE_KEYS`` /
  preset-constants alongside the legacy ``remove_intermediates``
  shim. Test count bumped (~57 → ~68).
- ``wiki/now.md`` — "Active work" cleared; "Recently shipped"
  entry summarizes the four-slice chain, the API surface, the
  failure semantics, the test count delta (715 → 748 non-perf),
  and the new ADR.

Co-authored-by: Claude Opus 4.7 (1M context) <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