Skip to content

Python(fix): handle pytest plugin empty updates - #809

Merged
alexluck-sift merged 4 commits into
mainfrom
al/python/fix/pytest-update-with-no-mask
Oct 1, 2026
Merged

alexluck-sift merged 4 commits into
mainfrom
al/python/fix/pytest-update-with-no-mask

Conversation

@alexluck-sift

@alexluck-sift alexluck-sift commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A test-results log could contain an update that named no fields, which the API rejects. The client logged it without complaint, and because the import cursor only advances past an entry that succeeded, every retry stopped at the same entry and the rest of the log never reached Sift.

Empty update masks

  • An update that names no fields is no longer logged or sent. The caller gets the entity back unchanged with a SiftIgnoredInputWarning, or a ValueError when a live call has no entity to return.
  • Import skips a logged no-op update and advances past it, so a log already stuck on one can be finished by re-running import-test-result-log. The log format does not change.

Unknown model fields

  • A key that is not a field of a create or update model now warns instead of being dropped in silence, and suggests a near match when it looks like a typo. This applies to every create and update model, not just test results.
  • It warns rather than raises, so a reporting mistake cannot abort a test run in progress. SiftIgnoredInputWarning exists so a caller who wants the stricter behavior can promote these two cases through filterwarnings without also promoting unrelated Sift warnings.
  • A key alongside other valid fields is still dropped, and the update proceeds without it. The warning is the only signal in that case.

Verification

  • Replayed against known problematic log files.
  • Exercised the test-results import and update paths against the dev environment.

Move caller_stacklevel out of the public errors module. mkdocs publishes
non-underscore names from there, and a stack-walking utility is not an error
type; it now sits beside the other generic helpers in _internal/util.

Add SiftIgnoredInputWarning so filterwarnings can target an unknown model
field and a no-op update without promoting every other Sift warning.

Stop fabricating an entity when a live no-op update has nothing to return.
_skip_empty_update now hands back a simulated response only on the log and
simulate paths, and raises otherwise. The fabricated entity carried
_simulated=True, which the pytest plugin reads to resolve the report link, so
a caller passing an ID string could not tell it from a real read.

Return from the unknown-key validator before sorting the field names, so the
path where every key is known does no extra work.
@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Python docs preview: https://sift-stack.github.io/sift/python/pr-809/

Deployed from 43426e0. The link may take up to a minute to become live as GitHub Pages propagates.

@alexluck-sift alexluck-sift changed the title Al/python/fix/pytest update with no mask Python(fix): handle pytest plugin empty updates Oct 1, 2026
@alexluck-sift
alexluck-sift requested a review from ian-sift October 1, 2026 00:24
@alexluck-sift
alexluck-sift marked this pull request as ready for review October 1, 2026 00:24
@alexluck-sift
alexluck-sift added this pull request to stack #811 October 1, 2026 00:40
@alexluck-sift
alexluck-sift merged commit a3beb03 into main Oct 1, 2026
26 checks passed
@alexluck-sift
alexluck-sift deleted the al/python/fix/pytest-update-with-no-mask branch October 1, 2026 16:55
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