Skip to content

test(#826): verify ${VAR} substitution semantics for harness env vars - #860

Open
fullsend-ai-coder[bot] wants to merge 1 commit into
mainfrom
agent/826-verify-env-var-expansion
Open

test(#826): verify ${VAR} substitution semantics for harness env vars#860
fullsend-ai-coder[bot] wants to merge 1 commit into
mainfrom
agent/826-verify-env-var-expansion

Conversation

@fullsend-ai-coder

Copy link
Copy Markdown

Summary

Add TestEnvVarExpansionSemantics to internal/harness/harness_test.go to document and verify the three-outcome contract for ${VAR} references in harness env fields. This answers the question in the issue: when an operator never configures a variable, ValidateRunnerEnvWith rejects it with an error before os.Expand runs — so downstream fail-closed checks (e.g. post-review.sh's REVIEW_PROTECTED_PATHS) are never hit for truly unset variables.

Related Issue

Closes #826

Changes

  • Added 9 subtests covering the full expansion contract:
    • Unset var rejected in runner_env, env.runner, and env.sandbox
    • Empty-string var passes validation and expands to ""
    • Set var passes validation and expands to its value
    • Mixed literal+var values expand correctly
    • Cross-target (env.runner + env.sandbox) expansion works independently
    • Optional host_files skip unset vars; required ones reject them

Testing

  • All 9 subtests pass (go test ./internal/harness/... -run TestEnvVarExpansionSemantics)
  • Full harness package tests pass (go test ./internal/harness/...)
  • go vet ./internal/harness/... clean
  • Secret scan passed

Closes #826

Post-script verification

  • Branch is not main/master (agent/826-verify-env-var-expansion)
  • Secret scan passed (gitleaks — c887fc47c59d8b87b5282ca44044d2933d30df41..HEAD)
  • PR body secret scan passed (gitleaks — no-git)
  • Pre-commit hooks passed (authoritative run on runner)
  • Tests ran inside sandbox

Add TestEnvVarExpansionSemantics to document and verify the
three-outcome contract for ${VAR} references in harness YAML
(runner_env, env.runner, env.sandbox):

1. Var unset -> ValidateRunnerEnvWith rejects (run aborts)
2. Var set to "" -> validation passes, expands to empty string
3. Var set to value -> validation passes, expands to value

Also covers mixed literal+var expansion, cross-target (runner
and sandbox) expansion, and optional vs required host_files
with unset variables.

This answers the question posed in the issue: when an operator
never configures a ${VAR} reference, ValidateRunnerEnvWith
rejects it with an error before expansion occurs, so the
fail-closed abort in post-review.sh is never reached for
truly unset variables.

Note: golangci-lint was not available in the sandbox. go vet
and go test passed. Pre-commit could not run (network error).

Closes #826
@fullsend-ai-review

fullsend-ai-review Bot commented Aug 2, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 9:43 AM UTC · Completed 9:55 AM UTC
Commit: 84271b8 · View workflow run →

@fullsend-ai-review

Copy link
Copy Markdown

Looks good to me

@fullsend-ai-review fullsend-ai-review Bot added the ready-for-merge All reviewers approved — ready to merge label Aug 2, 2026
@guyoron1

guyoron1 commented Aug 2, 2026

Copy link
Copy Markdown
Owner

/fs-fix

@fullsend-ai-coder

fullsend-ai-coder Bot commented Aug 2, 2026

Copy link
Copy Markdown
Author

🤖 Finished Fix · ✅ Success · Started 10:31 AM UTC · Completed 10:35 AM UTC
Commit: 84271b8 · View workflow run →

@fullsend-ai-coder

Copy link
Copy Markdown
Author

🔧 Fix agent — iteration 1 (human-triggered)

No changes made. The PR was already approved by the review bot with no findings. The human /fs-fix command included no specific instruction. All tests pass (9/9 subtests in TestEnvVarExpansionSemantics). Secret scan clean.

Disagreed (1):

  1. no actionable feedback: The review bot approved the PR with 'Looks good to me' and no findings. The human triggered /fs-fix without any specific instruction (HUMAN_INSTRUCTION=none). All 9 subtests in TestEnvVarExpansionSemantics pass. No code changes are needed.

Tests: passed

Next steps:

  • /fs-review — request a re-review of the changes
  • /fs-fix <your instruction> — run another fix pass with specific guidance
  • Push commits directly — review re-runs automatically on push
    Updated by fullsend fix agent

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity in the last month. It will be closed in 2 weeks if no further activity occurs. Remove the stale label to reset the inactivity timer.

@github-actions github-actions Bot added the stale label Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-merge All reviewers approved — ready to merge stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Verify ${VAR} substitution semantics for unset harness env vars

1 participant