Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui: don't rely on Dependencies to know if collect_info() has been run #224

Merged
merged 2 commits into from Oct 17, 2023

Conversation

schopin-pro
Copy link
Contributor

@schopin-pro schopin-pro commented Oct 9, 2023

Ever since we've started collecting deps info at crash file creation, that code path was essentially dead, and that resulted in the _MarkForUpload field never touched in some circumstances.

This quick workaround is to actually check for that internal field instead, as it's only written in collect_info(), but I think we'll need a better solution in the long term.

Fixes: ea64857 ("feat: Already add package info during crash")
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/apport/+bug/2038650

@codecov
Copy link

codecov bot commented Oct 9, 2023

Codecov Report

Merging #224 (a16de4e) into main (81eb04e) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #224   +/-   ##
=======================================
  Coverage   82.81%   82.81%           
=======================================
  Files          91       91           
  Lines       18736    18737    +1     
=======================================
+ Hits        15516    15517    +1     
  Misses       3220     3220           
Files Coverage Δ
apport/ui.py 72.18% <100.00%> (ø)
tests/integration/test_ui.py 97.44% <100.00%> (+<0.01%) ⬆️

@schopin-pro schopin-pro force-pushed the lp2038650 branch 3 times, most recently from 6f65a7a to 0c74e9a Compare October 9, 2023 13:40
@schopin-pro schopin-pro changed the title tests: ui: fix crash file generation to also contain Dependencies field ui: don't rely on Dependencies to know if collect_info() has been run Oct 9, 2023
@murraybd
Copy link
Contributor

murraybd commented Oct 9, 2023

I modified apport/ui.py locally with these changes and they worked for me i.e. a crash report was successfully uploaded to the Error Tracker.

Ever since we've started collecting deps info at crash file creation,
that code path was essentially dead, and that resulted in the
_MarkForUpload field never touched in some circumstances.

This quick workaround is to actually check for that internal field
instead, as it's *only* written in collect_info(), but I think we'll
need a better solution in the long term.

Fixes: ea64857 ("feat: Already add package info during crash")
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/apport/+bug/2038650
Signed-off-by: Simon Chopin <simon.chopin@canonical.com>
We started collecting deps in the initial crash file to hopefully have a
more exact picture of the system at the time of the crash. This should
also be reflected in the test data.

This enables coverage for the commit
"ui: don't rely on Dependencies to know if collect_info() has been run"

Signed-off-by: Simon Chopin <simon.chopin@canonical.com>
Copy link
Collaborator

@bdrung bdrung left a comment

Choose a reason for hiding this comment

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

question: collect_info has a "skip if we already ran" check and returns for ProblemType != Crash and Dependencies present. Have you tested this code path?

thought: collect_info sets self.report["_MarkForUpload"] = "True" as first step. So checking for this field means "started collection" and not "finished collection". Moving setting _MarkForUpload might change that.

@schopin-pro
Copy link
Contributor Author

You are indeed right that there's a change of behaviour for non-crash reports: now they might actually get uploaded! Except for Hang reports that are marked for upload on their own, any non-crash report that would come in with already-populated Dependencies would have been totally ignored. With this fix at least we get some data.

I haven't tested though, as I don't have the first idea how to trigger non-crash reports, and crafting bogus reports would hardly prove anything.

As far as moving _MarkForUpload, I say don't bother. The entire thing is an organically grown wonder of complexity, just moving a single thing around is bound to have hideous consequences. Let's just take this small win first, and then work on clearing it all up in a subsequent step.

@bdrung
Copy link
Collaborator

bdrung commented Oct 17, 2023

Besides the Crash problem type there are KernelOops, KernelCrash, Package (for failed install/upgrade of a software package), and Bug (for general bug reports). We should test those as well (and ensure we have test coverage for them as well).

I'll merge this PR since it is a first step in the right direction.

@bdrung bdrung merged commit 5b2ee88 into canonical:main Oct 17, 2023
25 checks passed
@murraybd
Copy link
Contributor

Besides the Crash problem type there are KernelOops, KernelCrash, Package (for failed install/upgrade of a software package), and Bug (for general bug reports). We should test those as well (and ensure we have test coverage for them as well).

There is also the RecoverableProblem problem type which should also be considered and tested.

@schopin-pro schopin-pro deleted the lp2038650 branch February 13, 2024 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants