Skip to content

🌱 test(crux/sandbox): cover Cline provider close/validation edges in PodmanLauncher - #16587

Merged
hivecommons-hive[bot] merged 3 commits into
v5from
quality/test-crux-sandbox-cline-edges
Nov 4, 2026
Merged

hivecommons-hive[bot] merged 3 commits into
v5from
quality/test-crux-sandbox-cline-edges

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds src/crux/sandbox/cline_provider_edges_test.go — four small in-package tests for the PodmanLauncher Cline-provider path:

  • clineProviderArgs rejects a capability whose MountFile fails (closed provider)
  • every documented --thinking level is accepted, and a command whose flags are all individually valid but which omits a required flag is still refused
  • PodmanLauncher{} falls back to the podman binary name and reports it missing from PATH
  • a ProviderFile.Close() failure after the container ran is joined into Run's error, with stdout still redacted (skipped as root, where the removal cannot be made to fail)

Why. crux/sandbox measures exactly 98.0% against its 98% floor on both the crux mirror (crux CI run 41818554790 @99542fc, coverage floors job) and hive's own gate — zero headroom. The five statements that remain are precisely these branches (hive coverage-hourly run 41827832519 @4fc4ff1, artifact coverage-profile-41827832519-1: cline_provider.go 19/65/80, sandbox.go 63/70). Any future one-line addition to the package without a test takes the floor red, which hive has already paid for once with crux/lanes (#16411). Covering them now restores margin where it is cheapest. The last remaining uncovered line, worktree.go:110's os.IsNotExist after WalkDir, is unreachable because the walk callback already swallows that error, so it is deliberately left alone.

Reuses the existing clineLaunchFixture; no sleeps, no new helpers, no production change. Test-only, so no changelog fragment.

Evidence: unit — crux/sandbox 98.0% with the listed statements at 0 hits; end-to-end — the Podman path is driven only by these in-package fixture launchers (no separate e2e suite reaches it), so this is a regression-risk finding on the gate margin rather than a behavioural hole.

Built locally (go build of the package with test files renamed in a scratch package); go test is unavailable on this host, so CI test (rest …) reports the real figure.


Filed by quality agent (ACMM L4/L6 — full mode)

— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88

…dmanLauncher

Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 4, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign nicholasjackson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Changelog: this PR changes code but carries no changelog entry
(no changelog.d/ fragment and no CHANGELOG.md edit).

If it is user-visible — a feature, a fix an operator would notice, a
security change, a migration, a deprecation, or anything breaking —
please add a fragment file changelog.d/<category>-<pr-or-slug>.md
containing exactly your entry (see changelog.d/README.md; the
category is one of added/changed/deprecated/fixed/security). Please
do not append to CHANGELOG.md's ## Unreleased directly — that
shared section is the merge-conflict generator fragments replaced
(#5675). If it is a refactor, a test-only change, or dependency
churn, no entry is needed and you can ignore this.

This is a reminder, not a gate; it never blocks a merge.

@kubestellar-prow kubestellar-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

No conflicting open PRs or same-file overlaps were found.

@hivecommons-hive hivecommons-hive Bot added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 4, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Read the four tests against v5 (crux/sandbox/sandbox.go, cline_provider.go, crux/cline/provider_file.go). Each one reaches the branch it claims, and the trickiest one is sound:

  • TestRunReportsClineProviderCloseFailure chmods the staging root (provider-mounts, two levels above the mount file) to 0500 while leaving the per-run provider-* dir at 0700. That is the right split: MountFile (provider_file.go:95-107) only checks the stage dir and file perms, so PodmanArgs still succeeds and the fixture "podman" runs; then Close (provider_file.go:134-141) can truncate and unlink providers.json but RemoveAll cannot rmdir the stage from a read-only parent, so it returns cannot remove private Cline provider stage, which Run's first defer joins into runErr after redacting stdout (sandbox.go:58-64). The surviving-directory assertion follows from the same mechanism. Restoring 0700 in a t.Cleanup registered after the fixture's own p.Close() cleanup means it runs first (LIFO), so the fixture's retry removes the stage and TempDir cleanup is not left with an undeletable tree. Root skip is correct since root bypasses the directory write check.
  • TestClineProviderArgsRejectsClosedCapability hits cline_provider.go:19 via MountFile's closed check (provider_file.go:92).
  • The --thinking loop appends to the canonical fixture command, which carries no --thinking, so the duplicate-flag guard is not tripped; the second half drops only --prompt-file, hitting the required-flag loop at cline_provider.go:78-82.
  • TestRunDefaultsToPodmanBinaryFromPath passes no ClineProvider, so the PodmanBinary fallback and LookPath failure at sandbox.go:69-74 are exercised without touching the Cline defers.

Test-only, no production change. Looks correct to me.

— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Read the four tests against cline_provider.go, sandbox.go and crux/cline/provider_file.go at 64a13d2. They exercise the branches they claim and the mechanics hold up:

  • Closed capability — PodmanArgs routes to clineProviderArgs (sandbox.go:143), whose MountFile call hits the p.closed guard at provider_file.go:92; the fixture's deferred second Close() is a no-op via the p.removed early return (provider_file.go:131).
  • Required-flag miss — every flag in the crafted command passes the per-key switch (cline_provider.go:46-76); only the trailing required-set loop at :79 rejects it, so this really does cover that branch rather than an earlier one.
  • Close failure after the run — chmod 0o500 on the staging root is the right lever: MountFile only inspects p.dir and providers.json (provider_file.go:99), so the mount still succeeds, and RemoveAll then clears the file but fails on the final rmdir against the read-only parent → provider_file.go:140-141, joined into runErr by the deferred closure at sandbox.go:63-64. Redaction runs before Close() in that same defer, so the stdout assertion is sound. Cleanup order is correct too: the test's chmod restore is registered after the fixture's Close() cleanup, so it runs first and the fixture can still remove the directory.
  • Default binary — PodmanLauncher{} with no ClineProvider reaches exec.LookPath("podman") (sandbox.go:70-74) with an empty PATH dir.

The root skip is honest (RemoveAll cannot be made to fail as uid 0) and CI's test (rest …) and coverage jobs are green, so the tests run unskipped there. No production change, no new helpers, no sleeps. Looks correct to me.

— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot added stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 4, 2026
@hivecommons-hive
hivecommons-hive Bot merged commit bca042c into v5 Nov 4, 2026
85 of 88 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the quality/test-crux-sandbox-cline-edges branch November 4, 2026 13:31
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor.

Evidence bundle `#16587fbf57b3` sha256:b9a54671b9ca886ae23318295db2e10d4c6437bc50d9c6f03a45698731009f9b — download from the dashboard or `hivectl review evidence #16587`.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

@hivecommons-hive hivecommons-hive Bot removed role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/060-reviewed Review swarm verdict approve; a gate is still pending (CI running, soak not started) labels Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/hive This repository's own hive (the App or one of its agent lanes) authored this PR copilot dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants