Skip to content

fix(novelty): routing partial-file guard reads status "partial" alone - #764

Open
antonwolfy wants to merge 1 commit into
intel:mainfrom
antonwolfy:fix/partial-status-guards
Open

antonwolfy wants to merge 1 commit into
intel:mainfrom
antonwolfy:fix/partial-status-guards

Conversation

@antonwolfy

Copy link
Copy Markdown
Contributor

Summary

Two result-file guards read a file marked only by "status": "partial" as finished, where the same file with a partial block is treated as partial (#700, the same cause #642/#702 fixed in the atoms reader).

Site Input On main Now
novelty/items.py _refuse_partial {"status": "partial"} already raises ProbeFileError since #633 (items.py:271), pinned by test_novelty_items_refuses_a_probe_file_marked_partial_by_status_alone unchanged
commands/novelty_routing_report.py _is_partial_file {"status": "partial"} False: a capped run saw a finished result and wrote its partial result to routing.partial.json True: the capped run replaces the file

load_artifact in artifacts.py:341 already tests "partial" in data or data.get("status") == "partial", as does the atoms reader (atoms.py:786). The remaining reads of partial in novelty_routing_report.py (:392, :477, :647) are on in-memory payloads the run built, not on files.

Closes #700

Changes

  • _is_partial_file in dokimi/commands/novelty_routing_report.py tests "partial" in earlier or earlier.get("status") == "partial", the marker the atoms reader uses. Files with a partial block, with neither marker, and non-dict JSON are handled as before.
  • A test in tests/test_novelty_routing_spend_cap_partial.py: _is_partial_file is true for {"status": "partial"}, and save_result writes a partial payload over it.
  • Changelog fragment (Fixed).

Risk

A routing file holding only {"status": "partial"} is now overwritten by a capped run instead of kept with the partial result going to a sidecar. Files written by dokimi carry both markers, so only a hand-edited or foreign file is affected.

Testing

On Linux, at 740119e (on main 7137604):

  • make ci-local: 33 passed, 0 failed, 14 skipped (steps needing micromamba, semgrep, other Python versions or a PR context). Not run: the matrix legs on other Pythons.
  • The new test fails on main's code at assert _is_partial_file(marked) and passes here. The guard tests (test_docs_code_refs, test_growth_ratchet, test_audit_test_quality, test_import_architecture) pass.
  • Mutants: comparing the status to another value fails assert _is_partial_file(marked); dropping not _is_partial_file(out) from save_result fails assert save_result(...) == marked.
  • Merged together with fix/cache-dir-unusable on main 7137604: pytest -n auto 20449 passed, 19 skipped, mypy clean, ruff check clean.

Revert

A plain revert restores the old guard. Nothing is stored.

Checklist

  • Tests added/updated and pytest passes
  • ruff, mypy, and schema checks pass
  • Docs updated (or N/A) — see the docs-drift checklist in CONTRIBUTING.md
  • Self-reviewed per "Before opening a PR" in AGENTS.md
  • No ad-hoc run artifacts committed
  • New files carry the SPDX license header (or are exempt in .github/.licenserc.yaml)

…intel#700)

`_is_partial_file` in `novelty_routing_report.py` tested only the `partial` key, so a routing file holding `{"status": "partial"}` was taken for a finished result and a capped run wrote its partial result to a sidecar instead of replacing it. It now tests `"partial" in data or data.get("status") == "partial"`, the marker the atoms reader and `artifacts.py` use.

`_refuse_partial` in `novelty/items.py` already refuses a probe file marked by status alone (landed with intel#633, pinned by `test_novelty_items_refuses_a_probe_file_marked_partial_by_status_alone`), so only the routing guard changes here.

Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
@antonwolfy
antonwolfy requested a review from a team as a code owner November 14, 2026 20:04
@antonwolfy antonwolfy self-assigned this Nov 14, 2026
@exai-bot

exai-bot commented Nov 14, 2026 •

Copy link
Copy Markdown

✅ OpenCodeReview: Review complete: 0 finding(s) across 3 selected item(s).

CI at 740119e: 25 passing, 3 skipped.

Review details
  • Commit reviewed: 740119e against merge base 7137604
  • Coverage: 3 files in 1 groups
  • Engine: OpenCodeReview v1.13.5-exai.4.8f73eada, us.openai.gpt-6.1-sol
  • Usage: 52k tokens (31k from cache), 8s
  • Tool calls: 8 (6 file_read, 2 code_search)
  • small change set: 3 files

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.72%. Comparing base (7137604) to head (740119e).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #764   +/-   ##
=======================================
  Coverage   95.72%   95.72%           
=======================================
  Files         415      415           
  Lines       55363    55363           
  Branches     9516     9516           
=======================================
  Hits        52994    52994           
  Misses       1466     1466           
  Partials      903      903           
Files with missing lines Coverage Δ
dokimi/dokimi/commands/novelty_routing_report.py 98.18% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vchamarthi vchamarthi 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.

Ready to merge at 740119e: _is_partial_file now also treats {"status": "partial"} as a partial file, matching the atoms reader and load_artifact; it does so, and nothing to fix was found.

Verified

  • Status-only marker: {"status": "partial"} is a partial file on the head and not on main; the new test passes on the head and fails on main.
  • Changed tests: All 51 tests in tests/test_novelty_routing_spend_cap_partial.py pass on the head.
  • Test pins the clause: Dropping the status clause from _is_partial_file fails the new test.
  • Finished and odd files: {"status": "ok"}, [], null and {} are not partial files on the head.
  • Merge with main: Merges onto main with no conflict and the whole local run passes.

This branch has not been deployed

No deployments
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.

probe and routing partial-file guards check the partial key alone, not status

4 participants