Skip to content

Make FileOutcomeReport outcome labels configurable - #1707

Merged
JonasWurst merged 7 commits into
mainfrom
jonas-lig-10234-make-fileoutcome-vocabulary-flexible
Jul 23, 2026
Merged

Make FileOutcomeReport outcome labels configurable#1707
JonasWurst merged 7 commits into
mainfrom
jonas-lig-10234-make-fileoutcome-vocabulary-flexible

Conversation

@JonasWurst

@JonasWurst JonasWurst commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

What

TLDR

So far the FileOutcomeReport.log_summary() always produced logs like added=N, Example added paths. After this, this PR can be changed to embedded=N / Example embedded paths.

Detailed

FileOutcomeReport.log_summary() was hard-coded to the add-images vocabulary (added=N, Example added paths), so pipelines that reuse the report logged misleading verbs — the image-embedding path reported added=N when files are actually embedded.

This adds a per-instance label_overrides: dict[FileOutcome, str] that affects only log_summary(); any outcome absent from the dict falls back to outcome.value. A small _label() helper routes both the counts line and the example-paths lines through the overrides.

The image-embedding path (embed_image_files_batched) now builds the report with label_overrides={FileOutcome.ADDED: "embedded"}, so it logs embedded=N / Example embedded paths.

raise_if_all_failed() and its message are unchanged — they keep the fixed "missing"/"broken" wording. Existing callers (add-images, YOLO/VOC scans) are unaffected since label_overrides defaults to empty.

The crop-embedding path is intentionally left out (under review on another branch); video is pending.

Testing

  • Extended tests/core/test_file_outcome_report.py: default still logs added=/Example added paths; an ADDED: "embedded" override logs embedded=/Example embedded paths while other outcomes keep their default labels; a second override (MISSING) proves generality.
  • make static-checks and affected tests pass.

🤖 Generated with Claude Code

Summary by CodeRabbit

Summary

  • New Features
    • Added optional per-outcome label overrides to end-of-run file outcome reporting, including “File outcomes” counts and per-outcome “Examples” sections.
    • Updated image embedding reporting to label newly embedded files as “embedded”.
  • Bug Fixes
    • Ensured overridden labels are reflected consistently across summary counts and example-path entries, while non-overridden outcomes keep default labels.
  • Tests
    • Expanded and adjusted log-output assertions for both override behavior and the updated “already_present” “Examples” formatting.

Add label_overrides so non-add pipelines log the right verb. The
image-embedding path now logs embedded=N instead of added=N.
raise_if_all_failed() is unaffected; the overrides only touch
log_summary(). Existing callers are unchanged (default empty).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@JonasWurst
JonasWurst requested a review from a team as a code owner July 21, 2026 13:54
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

FileOutcomeReport supports custom labels for summary counts and example-path headings. Image embedding labels added files as “embedded”, with tests covering default and overridden labels.

Changes

Outcome label overrides

Layer / File(s) Summary
Report label override behavior
lightly_studio/src/lightly_studio/core/file_outcome_report.py, lightly_studio/tests/core/test_file_outcome_report.py, lightly_studio/tests/core/image/*
Adds per-outcome display-label overrides, applies them to counts and example-path messages, and updates logging assertions for the new format.
Embedding label integration
lightly_studio/src/lightly_studio/dataset/image_embedding.py
Configures added image files to use the “embedded” display label.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: configurable FileOutcomeReport labels.
Description check ✅ Passed The description covers the change, motivation, and testing, but it does not explicitly answer the changelog checklist from the template.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jonas-lig-10234-make-fileoutcome-vocabulary-flexible

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 62dad9fb18

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lightly_studio/src/lightly_studio/core/file_outcome_report.py Outdated
Comment thread lightly_studio/src/lightly_studio/core/file_outcome_report.py Outdated
- Type label_overrides as Mapping (read-only) per Python guidelines
- Move _label helper below public log_summary

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lightly-fast-track-bot

lightly-fast-track-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

❌  Fast Track: checks did not pass

Guardrail Result Message
dummy Always passes.
frontend/complexity 0 file(s) checked.
backend/complexity 5 file(s) checked, no violations.
backend/coverage Guardrail threw: Command failed: uv run pytest tests/core/test_file_outcome_report.py tests/dataset/test_image_embedding.py --cov=src/lightly_studio/core --cov=src/lightly_studio/dataset --cov-report=json:coverage.json -q --no-header ImportError while loading conftest '/home/runner/work/lightly-studio/lightly-studio/lightly_studio/tests/conftest.py'. tests/conftest.py:18: in from lightly_studio.api import features src/lightly_studio/init.py:18: in from lightly_studio.core.start_gui import ( src/lightly_studio/core/start_gui.py:12: in from lightly_studio.api.server import Server src/lightly_studio/api/server.py:11: in from lightly_studio.api.app import app src/lightly_studio/api/app.py:16: in from lightly_studio.api.routes import ( src/lightly_studio/api/routes/webapp.py:19: in raise RuntimeError(f"Directory '{webapp_dir}' does not exist in '{project_root}'") E RuntimeError: Directory '/home/runner/work/lightly-studio/lightly-studio/lightly_studio/src/lightly_studio/dist_lightly_studio_view_app' does not exist in '/home/runner/work/lightly-studio/lightly-studio/lightly_studio/src/lightly_studio'
diff-size PR adds 59 line(s) (limit: 215).
frontend/coverage 0 file(s) checked.

View the guardrail run

To run the guardrails locally, from fast_track/ run make install once, then make run-guardrails (or GUARDRAILS=<name1>,<name2> make run-guardrails for some guardrails).

Reflects efbd13b.

@JonasWurst

Copy link
Copy Markdown
Contributor Author

/review

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
lightly_studio/tests/core/test_file_outcome_report.py (1)

147-161: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert that overridden successful outcomes still suppress examples.

This test verifies the custom count label but not the corresponding no-examples contract. Add negative assertions for a.jpg and Examples 'embedded'; the image-embedding path supplies this override.

Suggested assertions
         assert "embedded=1" in text
         assert "added=1" not in text
+        assert "a.jpg" not in text
+        assert "Examples 'embedded'" not in text
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lightly_studio/tests/core/test_file_outcome_report.py` around lines 147 -
161, Extend test_log_summary__label_overrides to assert that the overridden
successful outcome suppresses its examples: verify caplog.text does not contain
“a.jpg” or “Examples 'embedded'”, while preserving the existing custom-label and
non-overridden count assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@lightly_studio/tests/core/test_file_outcome_report.py`:
- Around line 147-161: Extend test_log_summary__label_overrides to assert that
the overridden successful outcome suppresses its examples: verify caplog.text
does not contain “a.jpg” or “Examples 'embedded'”, while preserving the existing
custom-label and non-overridden count assertions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e731462d-e7c1-4f4c-8d91-b07d57c6f504

📥 Commits

Reviewing files that changed from the base of the PR and between eb1fe7d and 21656d9.

📒 Files selected for processing (2)
  • lightly_studio/src/lightly_studio/core/file_outcome_report.py
  • lightly_studio/tests/core/test_file_outcome_report.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • lightly_studio/src/lightly_studio/core/file_outcome_report.py

@JonasWurst
JonasWurst added this pull request to the merge queue Jul 23, 2026
Merged via the queue into main with commit 6ee448e Jul 23, 2026
23 checks passed
@JonasWurst
JonasWurst deleted the jonas-lig-10234-make-fileoutcome-vocabulary-flexible branch July 23, 2026 12:23
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.

2 participants