Skip to content

test: add portable Linux target validation - #198

Merged
kevin-orellana merged 2 commits into
mainfrom
feature/linux-target-validation
Oct 30, 2026
Merged

kevin-orellana merged 2 commits into
mainfrom
feature/linux-target-validation

Conversation

@kevin-orellana

@kevin-orellana kevin-orellana commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Human readable section

Problem: An installed Linux package needs repeatable checks for file access, shutdown, and isolation between runs. A successful startup alone does not prove these behaviors.

Solution: Add a portable runner that retains its fixtures, executable hashes, logs, and results. For example, one Box writes an allowed file. A later Box must refuse that same file after the grant is removed.

Trade-off: These are focused package checks. They supplement the deterministic suite and do not qualify a cloud deployment or prove native enforcement.

Description

The runner reuses the existing lifecycle fixture. Seven ordinary checks cover startup, file effects, normal exit, termination, forced termination, a harness deadline, and a subsequent isolated run. An optional eighth check requires a recognized native setup refusal without workload entry.

Restoration commands preserve a bounded live fixture and check continuity afterward. Actual platform suspend/resume responses must be collected separately. The harness deadline does not exercise a service's timeout interface.

Negative tests reject false success from absent workload entry, unrestricted access, missing heartbeat evidence, unrelated setup errors, and timeouts. Cleanup identifies fixture processes and checks their identity before signaling them.

Linux continuous integration runs the Python tests and installed-package checks, then uploads their evidence. Existing deterministic cases and the Linux advisory policy remain intact.

The existing Git denial test also needs a fixture repair. Its fixture path was canonical, but its home prefix was not. Canonicalizing both lets the original assertions run when the home is a symlink. This changes no product code or permissions.

Related Issues

Related to #48. This PR does not close the broader coverage work.

Type of Change

Other: test infrastructure, one test-fixture repair, and contributor documentation.

Testing

Local validation used ARM64 Linux. The ordinary package was built from main revision 0b31256607813d98f0e2a1f9c392d8d5e0620d12; this PR changes no product source. The optional refusal check separately used native candidate 58d0fc24b548409812de4ccf2eefd8f5889b6c8b.

Check Result and scope
Full deterministic suite, bash test-integ/run.sh 120 passed, zero failures/errors, nine declared macOS-only skips; full coverage, 129 expected and recorded.
Standalone harness units, cargo test --manifest-path test-integ/Cargo.toml --all-features --locked --lib --bins 93 passed.
Runner units, python3 -m unittest discover -s test-integ/tools -p test_target_validation.py -v Eleven passed. Independent mutation checks confirmed the evidence checks detect their defects.
Installed ordinary package Seven checks passed after the final runner fixes.
Installed native candidate on an unsupported configuration Eight checks passed, including the expected native setup refusal. This is refusal evidence, not positive native qualification.
Local restoration fixture Seven continuity checks passed. No platform suspension occurred in this local check.
Git denial fixture Original source reproduced StripPrefixError; the repaired case passed with its assertions retained.
Builds and formatting Product all-features build, standalone harness all-features/no-default-features builds, and both formatting checks passed.
Lint The exact workspace just clippy recipe passed when run directly because just was unavailable. It uses the existing repository allowances. Standalone harness Clippy passed with one unchanged comment warning.
Strict workspace Clippy Ran and failed on unchanged vendored shell warnings, including argument count, borrowed state across await, and explicit auto-deref. No shell source changed.
Independent feature-critic review Initial findings and the three hosted-review findings were fixed with regression coverage. Final local follow-up review passed.

Hosted CI passed for head 8c9d3bf02087782f6b31358ff514d7d30eb17f2e: Linux recorded 120 passes and nine declared macOS-only skips; macOS recorded 121 passes and eight declared Linux-only skips. All 11 runner tests and seven package checks passed. The CI Gate and macOS native build/unit job passed. The second hosted review confirmed all three findings are resolved and reported no remaining concerns. Human approval remains required.

No cloud deployment, positive native cloud qualification, service cancellation test, or full agent workload matrix ran for this PR.

  • I ran the relevant suites (just check, or cargo test --workspace --all-features)
  • If I touched Rust, I ran cargo fmt --all and cargo clippy --workspace --all-targets --all-features -- -D warnings

The checked items attest to execution. The table records the strict Clippy failure and the narrower suite selection explicitly.

Checklist

  • I have read the CONTRIBUTING document
  • I have reviewed and understand every line of code in this PR, including any generated by AI tools, and I can explain why it works
  • My change is focused and reasonably small; I have split unrelated work into separate PRs
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • My changes generate no new warnings

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

## Problem

Installed Linux packages lack a reusable target check with retained evidence.
The Git path test also fails before its denial assertion when the home is a symlink.

## Solution

Reuse the lifecycle probe in a portable Python runner. Record file effects,
shutdown, prior-grant isolation, native refusal, and restoration continuity.
Add negative controls, Linux workflow steps, and a contributor guide.
Canonicalize the test home without changing its assertions. No product interface changes.

## Tests

The full deterministic suite passed 120 cases with nine declared macOS-only skips.
All 93 harness units and nine Python regressions passed. Mutation checks pin
false startup, permission, timeout, isolation, and cleanup evidence.
Installed main checks passed seven cases; the native candidate passed eight,
including expected setup refusal. Local continuity passed seven checks without
platform suspension. The original Git fixture reproduced StripPrefixError;
the repaired fixture passed. Builds, formatting, and repository-configured Clippy
passed. Strict workspace Clippy still fails on unchanged vendored shell warnings.
No cloud deployment, native cloud qualification, or product-wide test campaign ran.
Comment thread test-integ/tools/target_validation.py Resolved
Comment thread test-integ/tools/target_validation.py Resolved
@github-actions

Copy link
Copy Markdown

Assessment: Comment

Well-scoped test infrastructure. The runner reuses the existing Phase 3 lifecycle probe, adds no new dependencies (pure stdlib), and the signal path is genuinely careful — pidfd_open plus a start-time recheck and a boundary-safe argv match, pinned by a test that confirms a similarly-named sibling process survives cleanup. CI wiring is correct (the aarch64 guard matches the ubuntu-24.04-arm leg, and both required helper binaries are produced by the build step). All nine unit tests pass locally.

Review Categories
  • Testing: One negative test asserts a subset of a result dict's fields where a full-shape equality would catch regressions in the unasserted containment checks (inline).
  • Robustness: Two edge cases in the runner — output truncation coupling a safety-relevant negative stdout check to output volume, and a finally-block wait that can mask an evidence row for a wedged box (inline). Both are low-likelihood with today's fixtures; worth a guard or a comment.
  • Docs/CI: docs/dev/linux-target-tests.md, README, and workflow changes are clear and honest about scope (operator-asserted revision, no native qualification, fixture-only without real suspend/resume).

Nice work keeping the evidence honest about what it does and does not prove.

@github-actions

Copy link
Copy Markdown

Assessment: Approve

Re-reviewed at 8c9d3bf (previously reviewed 5ff8382). All three comments from the prior pass are fully addressed, and I independently verified each: result() now scans the complete output stream before truncating (with workload_entered driving refused()), the post-kill wait is guarded via kill_timed_out and rejected by succeeded(), and the file-effect test now asserts the full checks dict. Two well-targeted new tests back the runner changes — notably one that forces the entry marker across the 64KB chunk boundary and beyond the retained tail. py_compile is clean and all 11 tests pass locally.

No remaining concerns.

@kevin-orellana
kevin-orellana merged commit b950cd0 into main Oct 30, 2026
20 checks passed
@kevin-orellana
kevin-orellana deleted the feature/linux-target-validation branch October 30, 2026 16:41
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.

3 participants