Skip to content

problem_report: let load() return skipped keys#580

Open
bdrung wants to merge 1 commit intocanonical:mainfrom
bdrung:fix-load-binary-false
Open

problem_report: let load() return skipped keys#580
bdrung wants to merge 1 commit intocanonical:mainfrom
bdrung:fix-load-binary-false

Conversation

@bdrung
Copy link
Copy Markdown
Member

@bdrung bdrung commented Apr 21, 2026

The documentation for ProblemReport.load() says:

If binary is False, binary data is not loaded; the dictionary key is created, but its value will be an empty string.

Commit 64820a0 ("apport-unpack: Fix ValueError: ['separator'] has no binary content") changed this behavior to fix a crash in apport-unpack.

Setting non-loaded values to None will make type hints more complicated and less useful. Values in the problem report should not be allowed to be None.

Instead of adding dictionary keys with a special value for not loaded keys, just let load() return the keys that were skipped. This reduces guess work and make the code more robust.

Remove ProblemReport.has_removed_fields() since that information is lost and this function was only used in Apport tests.

@bdrung bdrung force-pushed the fix-load-binary-false branch from c55cd5d to 8432d1c Compare April 21, 2026 10:03
The documentation for `ProblemReport.load()` says:

> If binary is False, binary data is not loaded; the dictionary key is
> created, but its value will be an empty string.

Commit 64820a0 ("apport-unpack: Fix ValueError: ['separator'] has
no binary content") changed this behavior to fix a crash in
apport-unpack.

Setting non-loaded values to `None` will make type hints more
complicated and less useful. Values in the problem report should not be
allowed to be `None`.

Instead of adding dictionary keys with a special value for not loaded
keys, just let `load()` return the keys that were skipped. This reduces
guess work and make the code more robust.

Remove `ProblemReport.has_removed_fields()` since that information is
lost and this function was only used in Apport tests.
@bdrung bdrung force-pushed the fix-load-binary-false branch from 8432d1c to 48f97fe Compare April 21, 2026 10:45
@bdrung bdrung changed the title problem_report: fix non-loaded values to empty string in load() problem_report: let load() return skipped keys Apr 21, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.44%. Comparing base (be024b6) to head (48f97fe).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #580      +/-   ##
==========================================
- Coverage   84.45%   84.44%   -0.01%     
==========================================
  Files         104      104              
  Lines       20939    20931       -8     
  Branches     3212     3210       -2     
==========================================
- Hits        17683    17675       -8     
+ Misses       2816     2815       -1     
- Partials      440      441       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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