test(worker): fix umask- and host-dependent test fixtures #353
No reviewers
Labels
No labels
Epic 5
MCP
P1
PR-0
PR-1
api
api-layer
architecture
area:backend
area:frontend
arrow
authentication
backend
bug
chat
client
clipboard
common-module
compose
cross-cutting
cross-cutting-requirement
data-layer
data-models
database
desktop-client
documentation
duplicate
enhancement
epic
epic-1
epic-2
epic-3
epic-4
epic-5
epic-6
epic-7
epic-llm-config
error-handling
feature
frontend
good first issue
help wanted
implementation
infrastructure
installer
invalid
kotlin
ktor
llm
medium-priority
message
multiplatform
needs-review
needs-triage
packaging
performance
phase-1
phase-2
phase-3
phase-4
phase-5
phase3
phase:3
priority: high
question
refactor
refactoring
resource-sharing
security
server
server-module
services
session
session-management
settings
setup
shutdown
state
storage
streaming
sub-issue
tests
tooling
type:task
ui
ui/ux
user-accounts
user-management
ux
viewmodel
websocket
windows
windows-integration
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Torvian.eu/chatbot!353
Loading…
Reference in a new issue
No description provided.
Delete branch "test/credential-validator-fixture-umask"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Two worker test fixtures depended on ambient process state, so
:worker:testfailed 100% of the time inside the shipped worker image even though production behaviour was correct.1.
CredentialEnvironmentValidatorTestandumask 0002. TheworkingDirectory()fixture created its directory withcreateDirectory(), i.e.0777 & ~umask. The worker entrypoint runsumask 0002(needed so/app/workspaceand/app/cachestay group-writable on their2775setgid mounts), so the fixture became0775andCredentialEnvironmentValidatorrejected it on the group-write bit — as designed. Four tests failed, and two of them (rejects a missing askpass helper,rejects an askpass helper that cannot be executed) failed with an unrelated message because the working-directory check precedes the askpass check, so they no longer reached the assertion they exist for.2.
TerminalEnvironmentTestand a polluted host. The leak check comparedSystem.getenv()keys against the produced environment, so any host exportingTERM,PAGER,NO_COLORorPROMPT_COMMANDproduced a false failure.Fix
0711, mirroring what deployment sets on/home/vault/work, insiderunCatchingfor hosts without a POSIX view.result.keys - base.keysis limited to the nine documented terminal variables, which makes it independent of the ambient environment and strictly more sensitive to unexpected variables.Both changes are test-only. No
mainsource, deployment, build, or configuration file is modified, and the validator's security checks are untouched.Validation
CredentialEnvironmentValidatorTest: 11 tests, 0 failed, 0 skipped underumask 0002,0077and0022, each preceded by./gradlew --stopbecause the Gradle daemon captures the umask of the shell that started it. Also passed class-scoped underumask 0000.TerminalEnvironmentTest: 6 tests, 0 failed, withTERM,PAGER,NO_COLORandPROMPT_COMMANDexported and in a clean environment.TerminalEnvironment.ktwas caught by the new assertion, then reverted;worker/src/mainis unchanged.:worker:test: 810 tests, 4 skipped (pre-existing), 0 failed, under bothumask 0002and0077.Known residuals (out of scope here)
CredentialEnvironmentValidatorcreates an absent secret root withFiles.createDirectoriesand chmods only the leaf, so intermediate components are0775under a permissive umask when/run/torvianwas not pre-created. No secret material can exist at that moment, since the directory is empty and per-attach trees are0700created byrun-as-vault.umask 0002condition this branch fixes.