refactor(selfhost): dual-read LOOPOVER_-prefixed env vars alongside GITTENSORY_#5561
Merged
Conversation
…ITTENSORY_
Introduces LOOPOVER_-prefixed equivalents for the 7 self-host operational
env vars actually read outside the GITTENSORY_REVIEW_* feature-flag family:
GITTENSORY_API_TOKEN, GITTENSORY_MCP_TOKEN, GITTENSORY_VERSION,
GITTENSORY_REPO_CONFIG_DIR, GITTENSORY_ENABLE_PAGERDUTY,
GITTENSORY_ENABLE_UNSAFE_CODEX_REVIEWER, and GITTENSORY_DISCORD_WEBHOOK.
A new shared src/utils/env.ts (dualPrefixEnvString/Flag/StrictFlag) is the
single source of the precedence rule (LOOPOVER_ wins when both are set,
falls back to GITTENSORY_ otherwise) so it can't drift per call site the
way this repo's existing per-file nonBlank/envString helpers already have.
An untouched .env with only GITTENSORY_* vars keeps working byte-identical.
Regenerated apps/gittensory-ui/src/lib/selfhost-env-reference.ts LAST, after
all variable changes landed, per the issue's own explicit ordering warning.
Also fixed the generator itself (scripts/gen-selfhost-env-reference.mjs): its
AST scanner only recognized literal env.NAME reads and a small helper
allowlist, so swapping a literal read for a dualPrefixEnvString() call made
that var invisible to the doc generator entirely -- taught it to recognize
the three new helpers and expand each into both prefix rows.
Scope note: the issue's text ("roughly twenty... including a whole family of
feature-flag variables") also covers the 22-variable GITTENSORY_REVIEW_*
family (CONTENT_LANE, CONTINUOUS, GROUNDING, RAG, SAFETY, etc.), which is
NOT included here -- filed as a dedicated follow-up (#5555) rather than
tripling this PR's size, since the same dualPrefixEnvFlag helper applies
directly once that PR lands.
Advances #4774 (see #5555 for the remaining REVIEW_* flag family).
2 tasks
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | 095ba28 | Commit Preview URL Branch Preview URL |
Jul 13 2026, 05:19 AM |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5561 +/- ##
=======================================
Coverage 94.91% 94.91%
=======================================
Files 570 571 +1
Lines 45351 45360 +9
Branches 14675 14680 +5
=======================================
+ Hits 43046 43055 +9
Misses 1571 1571
Partials 734 734
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Important 🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪 🔍 Gittensory is reviewing…AI analysis is in progress. This comment will update when the review is complete. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed · 🟪 Reviewing |
This was referenced Jul 13, 2026
JSONbored
added a commit
that referenced
this pull request
Jul 13, 2026
…side LOOPOVER_ (#5593) Closes #5555. Follow-up to #4774/#5561, which covered the 7 self-host operational vars but deliberately left out this larger 22-variable GITTENSORY_REVIEW_* feature-flag family. Applies the already-merged dualPrefixEnvFlag/dualPrefixEnvString helpers (src/utils/env.ts) to all 22 flags, so LOOPOVER_REVIEW_* wins when both prefixes are set, falling back to the legacy GITTENSORY_ name otherwise. An untouched self-host .env keeps working unchanged. Two flags needed special handling rather than a mechanical swap: - REVIEW_REPOS is a raw comma-separated allowlist string, not a boolean flag -- uses dualPrefixEnvString, not dualPrefixEnvFlag, across its 2 read sites in cutover-gate.ts. - REVIEW_SELFTUNE has 2 independent read sites (selftune-wire.ts and a deliberate duplicate in settings/repository-settings.ts, inlined there specifically to avoid an import cycle) -- both converted, importing dualPrefixEnvFlag directly from utils/env rather than reintroducing the cycle. CONTENT_LANE's flag.ts previously used a hand-rolled Set-membership truthy check instead of the shared regex; functionally identical for the 4 accepted tokens (1/true/yes/on, trimmed, case-insensitive), so safely replaced with the shared helper. apps/gittensory-ui/src/lib/selfhost-env-reference.ts is NOT regenerated here -- its generator's DEFAULT_SOURCE_ROOTS never included src/review/**, src/queue/**, or src/settings/** (confirmed: none of these 22 vars, even in their single-prefix form, appear in that file on main either), so it's out of scope for this doc, unrelated to this change. Added LOOPOVER_REVIEW_* companion lines to .env.example / .env.selfhost.example instead, next to each flag's existing GITTENSORY_REVIEW_* line, matching #5561's documentation pattern -- this is the real documentation surface for these flags.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduces
LOOPOVER_-prefixed equivalents for the 7 self-host operational env vars actually read outside theGITTENSORY_REVIEW_*feature-flag family:GITTENSORY_API_TOKEN,GITTENSORY_MCP_TOKEN,GITTENSORY_VERSION,GITTENSORY_REPO_CONFIG_DIR,GITTENSORY_ENABLE_PAGERDUTY,GITTENSORY_ENABLE_UNSAFE_CODEX_REVIEWER, andGITTENSORY_DISCORD_WEBHOOK.A new shared
src/utils/env.ts(dualPrefixEnvString/Flag/StrictFlag) is the single source of the precedence rule (LOOPOVER_wins when both are set, falls back toGITTENSORY_otherwise) so it can't drift per call site the way this repo's existing per-filenonBlank/envStringhelpers already have. An untouched.envwith onlyGITTENSORY_*vars keeps working byte-identical.Regenerated
apps/gittensory-ui/src/lib/selfhost-env-reference.tslast, after all variable changes landed, per the issue's own explicit ordering warning. Also fixed the generator itself (scripts/gen-selfhost-env-reference.mjs): its AST scanner only recognized literalenv.NAMEreads and a small helper allowlist, so swapping a literal read for adualPrefixEnvString()call made that var invisible to the doc generator entirely — taught it to recognize the three new helpers and expand each into both prefix rows, with test coverage.Scope note
The issue's text ("roughly twenty... including a whole family of feature-flag variables") also covers the 22-variable
GITTENSORY_REVIEW_*family (CONTENT_LANE,CONTINUOUS,GROUNDING,RAG,SAFETY, etc.), which is not included here — filed as a dedicated follow-up (#5555) rather than tripling this PR's size, since the samedualPrefixEnvFlaghelper applies directly once that PR lands.Test plan
npm run test:cigate green.test/unit/utils-env.test.tscovers all 3 helper functions' precedence/blank-handling behavior.npm run selfhost:env-reference:checkpasses clean against the committed, regenerated file.npm audit --audit-level=moderate— 0 vulnerabilities.Advances #4774 (see #5555 for the remaining
REVIEW_*flag family).