Repository navigation
feat(server): gitenv keys accept ~ home paths; document setup + lazy load (t3o-34) - #72
brentkelly wants to merge 2 commits into
Conversation
…y load (t3o-34)
- expandTilde: a gitenv key may be written `~/projects/foo` (or bare `~`),
expanded against the server user's home; `~otheruser` is left as-is (needs a
passwd lookup) and, staying non-absolute, is skipped as before. Previously a
`~`-prefixed key failed the isAbsolute check and was silently dropped.
- Add a user-facing setup section to docs/user/source-control.md ("Using a
different GitHub identity for specific projects") in shipped-product voice,
plus a troubleshooting entry; cross-link it from the contributor doc.
- Make the on-demand load explicit in both docs: nothing reads the file at
boot; it is read on each GitHub-touching action and re-read on mtime/size
change, so you can create or edit it with the server running, no restart.
- Test: a ~-keyed entry resolves (drives os.homedir via $HOME).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
brentkelly
left a comment
There was a problem hiding this comment.
High-Level Summary
Follow-up to #71: gitenv keys may now be written with a leading ~/~/ (expanded against the server user's home via os.homedir()), plus user + contributor doc updates and an explicit "loaded lazily" note. GitHub-only, server-side. Reviewed on GitHub; same-repo trusted author.
The core change is small, correct, and well-targeted: expansion happens in parseGitenv before the isAbsolute gate, ~otheruser is left non-absolute and skipped as documented, and the new test drives real os.homedir() via $HOME. No correctness, security, or regression concerns found. Two nitpicks only.
… both tilde branches (t3o-34) Review round 1 (both 🟢): (1) the troubleshooting entry said the key must be an absolute path 'not a subfolder or a symlink', which contradicted the ~ support this PR adds and overstated strictness (subfolder keys resolve to the repo root, symlinks are realpath'd) — reworded to 'an absolute path, or a ~-rooted path'. (2) added tests for the two previously-uncovered expandTilde branches: a bare ~ key, and the deliberate non-expansion+skip of ~otheruser. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
brentkelly
left a comment
There was a problem hiding this comment.
Re-review adjudication — round 1
Both prior findings (🟢 Nitpicks) verified against current head ec133e3.
| # | severity | file:line | finding | claim | verdict |
|---|---|---|---|---|---|
| 1 | 🟢 | docs/user/source-control.md:196 | Troubleshooting entry contradicted ~ support / overstated subfolder+symlink strictness |
fixed | ✅ fix-upheld |
| 2 | 🟢 | apps/server/src/sourceControl/gitenv.test.ts:163 | Only 1 of expandTilde's 3 branches tested |
fixed | ✅ fix-upheld |
#1 — Line 196 now reads "Confirm the key points at the project's main folder — an absolute path, or a ~-rooted path", and the inaccurate "(not a subfolder or a symlink)" clause is gone. Matches the setup section and the parser.
#2 — Two new tests added: "expands a bare ~ key to the home directory" (path === "~" → homedir()) and "does not expand ~otheruser and skips the entry" (stays non-absolute, dropped at the isAbsolute guard). All three expandTilde branches are now exercised; suite is 13 tests.
No disagreements. RESPOND is a no-op this round.
brentkelly
left a comment
There was a problem hiding this comment.
High-Level Summary (round 2)
De-novo re-review of the current head (ec133e3). This PR adds ~/~/ home-path expansion to gitenv keys (expandTilde, applied in parseGitenv before the isAbsolute gate), plus user/contributor doc updates and an explicit "loaded lazily" note. GitHub-only, server-side. Reviewed on GitHub; same-repo trusted author.
The core change is small and correct: expansion runs before the isAbsolute gate, ~otheruser stays non-absolute and is skipped exactly as documented, and the parsed key still flows through resolveMainRepositoryRoot/realpathOrSelf so worktree and subfolder resolution are unaffected. No correctness, security, or regression concerns.
Status of round-1 findings (both were 🟢 Nitpicks)
- ✅ Troubleshooting wording contradicted
~support (docs/user/source-control.md) — reworded to "an absolute path, or a~-rooted path"; no longer overstates strictness. - ✅ Only one of
expandTilde's three branches was tested — commit 2 adds a bare-~test and a~otheruserskip test; all three branches (~,~/, non-expanded) are now covered with non-vacuous assertions.
Nothing new or outstanding. 🟢 Looks good to me, no changes required.
🤖 Automated review loop summary (default 5-round cap)Termination✅ Converged at round 2 — the round-2 fresh review of head ✅ What was fixed
⏭️ What was rejectedNone.
|
Summary
Follow-up to #71 (per-project GitHub token overrides via
gitenv), which merged tot3o.~home paths in keys. Agitenvkey may now be written~/projects/foo(or bare~), expanded against the server user's home. Before this, a~-prefixed key failed theisAbsolutecheck and was silently dropped — a real footgun, since "absolute path" invites~.~otheruseris deliberately left unexpanded (it needs a passwd lookup) and, staying non-absolute, is skipped as before. Kept the module dependency-free (adds onlynode:os).docs/user/source-control.md— "Using a different GitHub identity for specific projects" — in shipped-product voice (no source paths/internals), plus a troubleshooting entry; cross-linked from the contributor doc.Test plan
vp test run apps/server/src/sourceControl/gitenv.test.ts— 11 pass, incl. the new "expands a leading ~ in a key to the home directory" (drivesos.homedirvia\$HOME)docs/user/source-control.mdreads in product voice with no repo internals leaked~/project=...entry authenticates that project as the configured identity; creating the file with the server already running takes effect on the next actionModel: Claude Opus 4.8 via Claude Code.