Skip to content

[quality] 🧪 test: cover CheckoutRootFor traversal guard and terminal-urls handler contract - #5433

Merged
clubanderson merged 1 commit into
v4from
quality/test-checkout-root-and-terminal-urls-handler
Sep 1, 2026
Merged

[quality] 🧪 test: cover CheckoutRootFor traversal guard and terminal-urls handler contract#5433
clubanderson merged 1 commit into
v4from
quality/test-checkout-root-and-terminal-urls-handler

Conversation

@kubestellar-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds dedicated tests for two functions at 0% coverage (per go tool cover -func on main). Test-only; no production code touched.

Files/functions claimed (disjoint from open hold-gated PRs #5428 and #4032):

  • src/pkg/config/checkout_root_test.go (new) → tests ProjectConfig.CheckoutRootFor in src/pkg/config/config.go. Disjoint from [quality] 🧪 test(config): hermetic entrypoint boot-prelude tests on in-cluster hosts #5428, which owns only src/pkg/config/entrypoint_boot_test.go.
  • src/pkg/dashboard/terminal_urls_handler_test.go (new) → tests handleAgentTerminalURLs in src/pkg/dashboard/terminal_urls.go. The extraction pipeline (prepareTerminalURLs/filterAuthURLs) is already covered in terminal_urls_test.go; only the handler branches were untested.

What's pinned:

Verified locally: go test ./pkg/config -run TestCheckoutRootFor and go test ./pkg/dashboard -run TestHandleAgentTerminalURLs both pass.

Related Issue

None — coverage gap found via hourly coverage analysis.


Filed by quality agent (hold-gated mode). Human review required.

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

…urls handler contract

Two functions at 0% coverage get dedicated tests:

- pkg/config ProjectConfig.CheckoutRootFor (config.go): table tests for
  bare/org-qualified/deep repo slugs, the empty no-op sentinel, whitespace
  trimming, and the path-traversal guard ('.', '..', separators) that keeps
  a config-supplied repo name from escaping checkouts_dir.

- pkg/dashboard handleAgentTerminalURLs (terminal_urls.go): HTTP contract
  tests — 503 on nil AgentMgr, and the documented 'no pane is not an error'
  behavior (200 with empty urls/authUrls lists, never null, never an error)
  for both a not-running agent and an unknown agent.

Test-only change; no production code touched.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: sec-check <sec-check@hive.kubestellar.io>
@kubestellar-hive kubestellar-hive Bot added the hold label Sep 1, 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 clubanderson 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

@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

Changelog: this PR changes code but does not touch CHANGELOG.md.

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 line under ## Unreleased. 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/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 1, 2026
@clubanderson
clubanderson merged commit 9c93782 into v4 Sep 1, 2026
51 of 52 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the quality/test-checkout-root-and-terminal-urls-handler branch September 1, 2026 13:00
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

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

Check out what's new:

Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

copilot dco-signoff: yes Indicates the PR's author has signed the DCO. hold size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant