Skip to content

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

Description

@aelefebv

Parent PRD

#245

What to build

Wire the napari processor to read cleanup_drop_keys from SettingsConfig (delivered by Slice 3 / #248) and pass it through to ImInfo.remove_marked_intermediates (delivered by Slice 1 / #246):

  1. In nellie_napari/nellie_processor.py's run_feature_export():
    • Replace the remove_intermediates_checked = self.nellie.settings.remove_intermediates_checkbox.isChecked() line with cleanup_drop_keys = self.nellie.settings.to_config().cleanup_drop_keys.
    • Pass cleanup_drop_keys (a frozenset[str]) through to the _run_feature_export worker (replacing the old remove_intermediates_checked: bool parameter).
  2. In _run_feature_export:
    • Change parameter remove_intermediates_checked: boolcleanup_drop_keys: frozenset[str].
    • Replace if remove_intermediates_checked: ... self.current_im_info.remove_intermediates() with if cleanup_drop_keys: ... self.current_im_info.remove_marked_intermediates(cleanup_drop_keys). The if cleanup_drop_keys test on a frozenset is True iff non-empty, matching the legacy "checkbox checked" semantic.
    • Keep the try/except around the cleanup call (legacy was wrapped to surface "Error removing intermediates" via show_info).

Acceptance criteria

  • nellie_processor.run_feature_export() reads the drop set from SettingsConfig.cleanup_drop_keys, not from the (now-removed) remove_intermediates_checkbox.
  • _run_feature_export() passes the drop set to ImInfo.remove_marked_intermediates, and only when the set is non-empty.
  • Manual smoke test: run the full pipeline with the new "CSVs only" preset selected → after Hierarchy completes, all 14 droppable files are gone, all CSVs survive. Run the full pipeline with the default "Keep everything" preset → no files removed.
  • Manual smoke test: run only "Run Feature Export" (solo button, not via run_nellie()) with "CSVs only" selected → cleanup still runs after Hierarchy (consistent with the legacy behavior, per PRD §Out of scope and User story 8).
  • No new test file is required for this slice; it is a wiring change verified via the upstream to_config round-trip test (Slice 3) and the remove_marked_intermediates tests (Slice 1). Optionally add a smoke-style integration test in an existing processor test file if one exists.
  • pytest -q --ignore=tests/test_*_perf.py passes — full regression on the test suite.

Blocked by

User stories addressed

From PRD #245:

  • User story 8 (cleanup fires after Hierarchy regardless of how Hierarchy was invoked).

This slice completes the round-trip for user stories 1, 2, 3 (via Slice 3 + this wiring), making the per-output policy actually effective at run time.

Wiki context

  • wiki/pipeline.mdprocessor mirrors run.py's stage list; this wiring keeps that parallel.
  • wiki/decisions/0014-intermediates-policy-frozenset.md — confirms the wiring's contract: empty drop set → no cleanup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions