Skip to content

fix(review): trim whitespace on three truthy env flag checks#6641

Merged
JSONbored merged 1 commit into
JSONbored:mainfrom
RealDiligent:feat/critical-issue-env-flag-trim-6635
Jul 16, 2026
Merged

fix(review): trim whitespace on three truthy env flag checks#6641
JSONbored merged 1 commit into
JSONbored:mainfrom
RealDiligent:feat/critical-issue-env-flag-trim-6635

Conversation

@RealDiligent

Copy link
Copy Markdown
Contributor

Summary

  • Adds .trim() to the env truthy checks in gittensor-wire.ts, maintainer-recap-wire.ts, and pr-reconciliation.ts, matching isRagEnabled / sibling *-wire.ts flags.
  • Adds regression tests asserting whitespace-padded truthy values (e.g. true\n, 1) still activate each flag.

Closes #6635

Test plan

Made with Cursor

@RealDiligent
RealDiligent requested a review from JSONbored as a code owner July 16, 2026 16:48
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

Closes JSONbored#6635

Co-authored-by: Cursor <cursoragent@cursor.com>
@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.64%. Comparing base (a47d1c3) to head (7d9217e).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6641   +/-   ##
=======================================
  Coverage   93.64%   93.64%           
=======================================
  Files         680      680           
  Lines       68026    68026           
  Branches    18673    18673           
=======================================
  Hits        63704    63704           
  Misses       3347     3347           
  Partials      975      975           
Flag Coverage Δ
shard-1 43.93% <33.33%> (-0.09%) ⬇️
shard-2 36.99% <100.00%> (+0.21%) ⬆️
shard-3 32.41% <33.33%> (-0.01%) ⬇️
shard-4 34.17% <0.00%> (-0.60%) ⬇️
shard-5 31.50% <0.00%> (+0.52%) ⬆️
shard-6 45.77% <66.66%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/review/gittensor-wire.ts 100.00% <100.00%> (ø)
src/review/maintainer-recap-wire.ts 98.07% <100.00%> (ø)
src/review/pr-reconciliation.ts 100.00% <100.00%> (ø)

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 16, 2026
@loopover-orb

loopover-orb Bot commented Jul 16, 2026

Copy link
Copy Markdown

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-16 17:24:59 UTC

6 files · 1 AI reviewer · no blockers · readiness 86/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This is a small, well-targeted fix that adds `.trim()` to three env-flag truthy checks (`isGittensorPluginEnabled`, `isRecapEnabled`, `isPrReconciliationEnabled`) so whitespace-padded values like `"true\n"` or `" 1 "` still match the `/^(1|true|yes|on)$/i` regex, matching the existing `isRagEnabled` convention. Each change is paired with a regression test covering newline- and space-padded truthy values, and the diff closes issue #6635. The fix is minimal, low-risk, and directly traceable: without `.trim()`, a value like `"true\n"` fails the anchored regex, so the added guard makes the previously-dead whitespace-tolerant path actually reachable.

Nits — 3 non-blocking
  • The three regression tests are near-identical copy-paste across files (gittensor-wire.test.ts, maintainer-recap-wire.test.ts, pr-reconciliation.test.ts); consider a small shared test helper if this pattern recurs again for other *-wire flags.
  • None of the new tests cover a whitespace-only value (e.g. `" "`) which should still resolve to false — worth adding for completeness, though the existing regex trivially handles it correctly.
  • Consider extracting the shared `/^(1|true|yes|on)$/i` regex + `.trim()` truthy-check into a single utility (e.g. `parseEnvFlag`) since it's now duplicated across at least four files (isRagEnabled plus these three) — reduces the chance of a fourth file missing `.trim()` in the future.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #6635
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ❌ 8/20 High review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 357 registered-repo PR(s), 174 merged, 32 issue(s).
Contributor context ✅ Confirmed Gittensor contributor RealDiligent; Gittensor profile; 357 PR(s), 32 issue(s).
Improvement ✅ Minor risk: clean · value: minor
Review context
  • Author: RealDiligent
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 357 PR(s), 32 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Add a concise scope and risk note.
  • Then work through the remaining 1 step in the Signals table above.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask 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.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

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.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot added the manual-review Gittensor contributor context label Jul 16, 2026
@JSONbored
JSONbored merged commit 28b2343 into JSONbored:main Jul 16, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. manual-review Gittensor contributor context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing .trim() on 3 truthy-flag env checks (gittensor-wire, maintainer-recap-wire, pr-reconciliation)

2 participants