Skip to content

Conversation

@Hook25
Copy link
Collaborator

@Hook25 Hook25 commented Oct 10, 2025

Description

This introduces a new experimental systemd-based runner. This new runner adresses in the short term the rfkill permission denied situation but the objective is to make it, in the long run, the default runner for checkbox strict frontends.

For now this new runner is disabled by default and clearly marked as experimental when enabled.

Resolved issues

Fixes: #1211
Fixes: https://warthogs.atlassian.net/browse/CHECKBOX-2003

Documentation

New runner clearly documented in the docstring

Tests

New function is unit tested.

Tested on RPI4 on core24, This can be tested in any environment that has plz-run installed. Currently, only snap packaging is supported.

To test this use the following launcher:

#!/usr/bin/env checkbox-cli
[launcher]
stock_reports = text
[test plan]
unit = com.canonical.certification::smoke
forced=True
[test selection]
forced=True
[features]
systemd_based_job_runner=True

The result must be unchanged, the runner should be completely transparent to the user.

Snap builds:

@codecov
Copy link

codecov bot commented Oct 10, 2025

Codecov Report

❌ Patch coverage is 80.48780% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.02%. Comparing base (278c069) to head (c51b157).

Files with missing lines Patch % Lines
checkbox-ng/plainbox/impl/execution.py 88.46% 3 Missing ⚠️
checkbox-ng/plainbox/impl/session/state.py 62.50% 2 Missing and 1 partial ⚠️
checkbox-ng/checkbox_ng/launcher/subcommands.py 83.33% 1 Missing ⚠️
checkbox-ng/plainbox/impl/session/assistant.py 0.00% 1 Missing ⚠️

❌ Your patch check has failed because the patch coverage (80.48%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2155      +/-   ##
==========================================
- Coverage   53.34%   53.02%   -0.32%     
==========================================
  Files         399      395       -4     
  Lines       42907    42698     -209     
  Branches     7945     7928      -17     
==========================================
- Hits        22887    22641     -246     
- Misses      19214    19255      +41     
+ Partials      806      802       -4     
Flag Coverage Δ
checkbox-ng 71.55% <80.48%> (+0.14%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

pieqq
pieqq previously approved these changes Oct 24, 2025
Copy link
Collaborator

@pieqq pieqq left a comment

Choose a reason for hiding this comment

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

Good stuff! I left a few inline suggestions, mainly on naming stuff.

This PR includes plz-run for the snap version, but not for the Debian packages. Do we need to package plz-run in our PPA and pull it when installing Checkbox?

@Hook25
Copy link
Collaborator Author

Hook25 commented Oct 27, 2025

Even though I have ideas as to the future of this and how it may become the default executor for checkbox eventually, currently it is experimental. The only purpose of it right now is to escape snapd/aa sandbox, so we don't need it on debian at all. I have added an error message if one tries to enable it without having the required plz-run binary though

pieqq
pieqq previously approved these changes Oct 30, 2025
Copy link
Collaborator

@pieqq pieqq left a comment

Choose a reason for hiding this comment

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

Thanks for the fix and the additional logging information!

@Hook25 Hook25 requested a review from Copilot November 3, 2025 11:13
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces an experimental systemd-based job runner for Checkbox that addresses permission issues with rfkill and provides a foundation for escaping the snap/AppArmor sandbox. The new runner executes jobs as systemd units rather than child processes, which can help bypass certain permission restrictions in strict snap environments.

  • Adds a new systemd-based job execution mechanism using plz-run utility
  • Implements feature flag system to enable/disable the experimental runner
  • Adds comprehensive test coverage for both execution methods

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
checkbox-ng/plainbox/impl/execution.py Core implementation of systemd unit execution logic and refactored job execution methods
checkbox-ng/plainbox/impl/session/state.py Added feature flag for systemd-based runner with dependency validation
checkbox-ng/plainbox/impl/session/assistant.py Integration of systemd runner flag into job execution flow
checkbox-ng/plainbox/impl/test_execution.py Comprehensive unit tests for both execution methods
checkbox-ng/plainbox/impl/config.py Configuration option for systemd-based runner feature
checkbox-ng/checkbox_ng/launcher/subcommands.py Minor refactoring to use normal user utility function
checkbox-core-snap/*/snap/snapcraft.yaml Added plz-run dependency to all snap configurations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

# See https://bugs.launchpad.net/snapd/+bug/2003955
env["SYSTEMD_IGNORE_CHROOT"] = "1"
# run the command

Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

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

[nitpick] Empty line should be removed to improve code readability.

Suggested change

Copilot uses AI. Check for mistakes.
from argparse import ArgumentTypeError
from argparse import RawDescriptionHelpFormatter
from argparse import SUPPRESS
from argparse import ArgumentTypeError, RawDescriptionHelpFormatter, SUPPRESS
Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

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

[nitpick] The import statement was changed from multiple lines to a single line. While this works, the original multi-line format may be more readable for long import lists.

Suggested change
from argparse import ArgumentTypeError, RawDescriptionHelpFormatter, SUPPRESS
from argparse import (
ArgumentTypeError,
RawDescriptionHelpFormatter,
SUPPRESS,
)

Copilot uses AI. Check for mistakes.
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.

RTC operation not permitted causes suspend/suspend_advanced_auto failed sometime

3 participants