Skip to content

test(shared): cover sandbox markers with an empty mode prefix - #404

Open
sahilkhedkar wants to merge 1 commit into
solongate:mainfrom
sahilkhedkar:test/356-empty-sandbox-mode
Open

sahilkhedkar wants to merge 1 commit into
solongate:mainfrom
sahilkhedkar:test/356-empty-sandbox-mode

Conversation

@sahilkhedkar

Copy link
Copy Markdown
Contributor

SandboxMode() returns an empty string for a nonempty marker such as SOLONGATE_SANDBOX=:1.0.0, because the prefix before the first colon is empty. The existing table-driven test covered absent markers, recognized modes, and legacy values, but did not exercise this case.

Add {":1.0.0", ""} to TestSandboxModeReadsTheWeakerModeWhenItCannotTell, with a comment making the expected behavior explicit. This pins the existing empty-prefix behavior rather than changing it to the legacy run fallback. The PR changes only the test file; runtime behavior is unchanged.

Validation on this PR branch:

  • go vet ./... and go test -count=1 -race ./... passed in all nine Go modules.
  • All 19 OpenCode hook tests passed.
  • ./scripts/sg-parity-check.sh: 10 passed, 0 failed.
  • ./scripts/sg-layers-check.sh: 25 passed, 0 failed.
  • The changed file is gofmt-clean; git diff --check passed.
  • A temporary Go overlay changed the colon condition from i >= 0 to i > 0; the new test failed with got "run", want "", confirming it detects a regression in this branch. No runtime source was modified.

Known repository/environment check failures:

  • ./scripts/sg-unit-check.sh stops at existing formatting issues in unchanged guard files; module checks were run directly as listed above.
  • ./scripts/sg-box-check.sh: 21 passed, 1 failed. The failing assertion was no other user's process (got NO, wanted YES). This remains unresolved and is outside this test-only change.

No live agent-client session was used; verification used Go tests and the repository's Linux integration scripts.

Closes #356

Signed-off-by: Sahil <sahilkhedkar11@gmail.com>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@codacy-production codacy-production Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

✅ No blocking issues noticed

No blocking findings. The required sandbox-marker regression scenario is covered, with no reported implementation or quality issues.

Test suggestions

  • A sandbox marker with an empty mode prefix returns an empty mode rather than the legacy run mode.

TIP Add review instructions in .codacy/instructions/review.md, or an AGENTS.md, so the reviewer knows your conventions.
TIP How was this review? Give us feedback

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.

shared/sandbox: SandboxMode has no test for an env var with an empty mode prefix

1 participant