fix(config): fallback when user info is unavailable#29296
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate FoundPR #29289: fix(config): handle os.userInfo() failure in container/sandbox environments Why it's related: This PR appears to be addressing the exact same issue - handling You should check if PR #29289 is already merged or if it covers the issue from #29292 that your current PR is meant to close. |
|
Checked #29289. It addresses the same issue in |
|
thanks for the fix i'm going to close this one only to keep the patch smaller and avoid adding a new helper file. i opened #29332 with the same fallback inlined at the existing call sites. appreciate you jumping on this. |
Issue for this PR
Closes #29292
Type of change
What does this PR do?
Config startup currently assumes
os.userInfo().usernameis always available. In minimal containers or sandboxed environments without a passwd entry, that call can throw and prevent config initialization from completing.This PR adds a small config username helper that falls back to
"user"when system user lookup fails or returns an empty username. It is used for both the default config username and macOS managed preference lookup, so the same failure mode does not crash either path.How did you verify your code works?
bun test test/config/config.test.ts -t "falls back to a generic username"bun test test/config/config.test.tsbun typecheckPATH="$HOME/.bun/bin:$PATH" .husky/pre-pushScreenshots / recordings
Not applicable; config startup behavior only.
Checklist