fix(selfhost): list globalThis-cast and dual-arg severity env vars in the reference (#8627) - #8634
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
…g severity reads The self-host env-reference generator missed three PostHog knobs (POSTHOG_SERVER_NAME, POSTHOG_MIN_SEVERITY, POSTHOG_REPO_MIN_SEVERITY): - POSTHOG_SERVER_NAME is read via a globalThis-cast process.env access, whose '.env' base is a '.process' property access rather than a bare identifier, so isEnvContainer walked past it. Recognize globalThis.process(.env) as a container. - POSTHOG_MIN_SEVERITY / POSTHOG_REPO_MIN_SEVERITY are passed as two name literals to resolveSeverityThreshold(env, repo, MIN, REPO_MIN). The literal-arg helper map supported a single index; make it carry multiple indices and register the helper. The same resolveSeverityThreshold generalization also surfaces PAGERDUTY_MIN_SEVERITY and PAGERDUTY_REPO_MIN_SEVERITY (services/notify-pagerduty.ts), which were missed for the identical reason; the regenerated reference now lists all five.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8634 +/- ##
=======================================
Coverage 92.77% 92.77%
=======================================
Files 798 798
Lines 79464 79464
Branches 24078 24078
=======================================
Hits 73725 73725
Misses 4592 4592
Partials 1147 1147
Flags with carried forward coverage won't be shown. Click here to find out more. |
|
Caution 🛑 LoopOver review result - reject/close recommendedReview updated: 2026-07-25 16:14:55 UTC
Review summary Nits — 3 non-blocking
Why this is blocked
📋 Copy for AI agents — paste into your coding agentDecision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
|
LoopOver is closing this pull request on the maintainer's behalf (conflicts with the base branch — resolve and open a fresh PR; No linked issue detected). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed. |
Problem
Closes #8627.
The self-host env-reference generator (
scripts/gen-selfhost-env-reference.ts) failed to list three PostHog env vars thatsrc/selfhost/posthog.tsactually reads:POSTHOG_SERVER_NAME— read atposthog.ts:179via(globalThis as unknown as {...}).process?.env?.POSTHOG_SERVER_NAME. The.envbase here is a.processproperty access, not a bareprocess/envidentifier, soisEnvContainerwalked past it.POSTHOG_MIN_SEVERITY/POSTHOG_REPO_MIN_SEVERITY— passed as two name literals toresolveSeverityThreshold(env, repo, "POSTHOG_MIN_SEVERITY", "POSTHOG_REPO_MIN_SEVERITY")atposthog.ts:81. The literal-arg helper map only supported a single argument index.Fix
isEnvContainer: recognizeglobalThis.process(.env)(through casts/parens) as an env container, via a smallisGlobalThisProcesshelper. Generalized — not special-cased to the one literal.ENV_NAME_LITERAL_ARG_HELPERS: carry multiple literal-name arg indices per helper, and registerresolveSeverityThresholdat args[2, 3].isEnvNameLiteralArgHelperCalland the collect handler now iterate all configured indices.Because the helper fix is general, it also correctly surfaces
PAGERDUTY_MIN_SEVERITY/PAGERDUTY_REPO_MIN_SEVERITY(src/services/notify-pagerduty.ts:103, the same helper) — these were missing for the identical reason. The regenerated reference now lists all five, each attributed to its real source file.Tests
test/unit/selfhost-env-reference-script.test.ts(globalThis-cast read; dual-literalresolveSeverityThreshold). Reverting either fix fails its test.npm run selfhost:env-reference -- --checkpasses with the regenerated reference committed.