Skip to content

test(scenarios): grade the #8884 guard via its engine-src path - #9104

Merged
loopover-orb[bot] merged 2 commits into
JSONbored:mainfrom
bitfathers94:fix/issue-8884
Jul 26, 2026
Merged

test(scenarios): grade the #8884 guard via its engine-src path#9104
loopover-orb[bot] merged 2 commits into
JSONbored:mainfrom
bitfathers94:fix/issue-8884

Conversation

@bitfathers94

Copy link
Copy Markdown
Contributor

test(scenarios): grade the #8884 guard via its engine-src path

The scenario source-upload guard now lives in packages/loopover-engine/src/
scenario-input-safety.ts, but the suite reached it through the @loopover/engine
barrel, which resolves to the built dist/*.js copy. v8 then attributed the
executed statements to dist while reporting the src file (in coverage.include)
at 0%, so codecov/patch graded the moved lines as uncovered. Import the guard
directly from its engine-src module (the same relative-path pattern other
engine-src suites use) so coverage lands on the real file: 19/19 statements,
patch 100%.

Closes #8884

Validation

Verified locally on this branch before opening:

  • npm run typecheck
  • npx turbo run build:tsc build:verify
  • npm run test:coverage — patch coverage 100.0% of changed lines

…l-branch collector

collectLocalBranchMetadata only called the local assertSourceUploadDisabled
helper, which checks the LOOPOVER_UPLOAD_SOURCE env flag and nothing else. The
real forbidden-source-upload-key / oversized-content scan lived in
assertScenarioLocalBranchInputSafe (src/scenarios/input-model.ts) but had no
production importer, so source-content fields smuggled into the metadata-only
scenario input were never refused on the actual entry point.

Move that guard into @loopover/engine so both the backend scenario-input model
(re-exported, public surface unchanged) and the loopover-mcp collector share
one scan, wire it into collectLocalBranchMetadata in place of the weaker env
check, and drop the now-dead assertSourceUploadDisabled. Add a regression test
asserting the mcp collector itself rejects forbidden-key, oversized, and
non-array changedFiles payloads.

Closes JSONbored#8884
The scenario source-upload guard now lives in packages/loopover-engine/src/
scenario-input-safety.ts, but the suite reached it through the @loopover/engine
barrel, which resolves to the built dist/*.js copy. v8 then attributed the
executed statements to dist while reporting the src file (in coverage.include)
at 0%, so codecov/patch graded the moved lines as uncovered. Import the guard
directly from its engine-src module (the same relative-path pattern other
engine-src suites use) so coverage lands on the real file: 19/19 statements,
patch 100%.
@bitfathers94
bitfathers94 requested a review from JSONbored as a code owner July 26, 2026 17:40
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.88%. Comparing base (9df67ed) to head (d3172d0).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9104      +/-   ##
==========================================
- Coverage   93.88%   93.88%   -0.01%     
==========================================
  Files         810      811       +1     
  Lines       80600    80598       -2     
  Branches    24454    24453       -1     
==========================================
- Hits        75675    75669       -6     
  Misses       3560     3560              
- Partials     1365     1369       +4     
Flag Coverage Δ
backend 95.17% <100.00%> (-0.01%) ⬇️

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

Files with missing lines Coverage Δ
...kages/loopover-engine/src/scenario-input-safety.ts 100.00% <100.00%> (ø)
packages/loopover-mcp/lib/local-branch.ts 100.00% <100.00%> (ø)
src/scenarios/input-model.ts 100.00% <ø> (ø)

... and 1 file with indirect coverage changes

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

loopover-orb Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-26 18:02:59 UTC

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

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR relocates the #8884 scenario-input safety guard from src/scenarios/input-model.ts into packages/loopover-engine/src/scenario-input-safety.ts, re-exports it from both src/scenarios/input-model.ts and the engine barrel, and switches the production collector (packages/loopover-mcp/lib/local-branch.ts) and the test suite to import it via the engine-src relative path instead of the @​loopover/engine barrel (which resolves to the built dist copy for coverage purposes). The move is a straight cut-and-paste with identical guard logic (verified against the full file content), the backend re-export keeps the public surface of src/scenarios/input-model.ts unchanged, and the mcp collector now calls the shared guard at the real collection entry point (collectLocalBranchMetadata) rather than the old weaker env-flag-only check. The new test in test/unit/local-branch.test.ts exercises the guard through the real collector, which is the correct path being graded.

Nits — 5 non-blocking
  • packages/loopover-engine/src/scenario-input-safety.ts:34 — the `4000` oversized-payload threshold is an unexplained magic number; consider naming it e.g. `MAX_CHANGED_FILE_FIELD_CHARS`.
  • packages/loopover-mcp/lib/local-branch.ts:1 imports `assertScenarioLocalBranchInputSafe` from `@​loopover/engine` (the dist barrel) for production use while the tests import the engine-src copy directly — worth a one-line comment noting this asymmetry is intentional (production uses the built package, tests target coverage attribution) so a future reader doesn't 'fix' it into consistency.
  • test/unit/scenario-input-model.test.ts full diff wasn't available for review here, so I couldn't independently confirm its import change matches the stated intent — worth double-checking it also targets the engine-src path per the PR description.
  • Consider adding a brief top-of-file note in scenario-input-safety.ts pointing at src/scenarios/input-model.ts's re-export so the two-file split doesn't surprise the next contributor who edits one and misses the other.
  • If dist/src coverage-attribution mismatches like this one recur, consider a lint rule or CI check flagging `@​loopover/engine` barrel imports inside test files targeting src-migrated modules.

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 #8884
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low 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: 52 registered-repo PR(s), 41 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor bitfathers94; Gittensor profile; 52 PR(s), 0 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: minor
Linked issue satisfaction

Addressed
The diff wires assertScenarioLocalBranchInputSafe into collectLocalBranchMetadata in local-branch.ts, replacing the weaker assertSourceUploadDisabled, and adds a regression test in test/unit/local-branch.test.ts asserting the production entry point rejects forbidden-key and oversized-content payloads.

Review context
  • Author: bitfathers94
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: TypeScript
  • Official Gittensor activity: 52 PR(s), 0 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
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 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit 48e0b52 into JSONbored:main Jul 26, 2026
8 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(scenarios): assertScenarioLocalBranchInputSafe is a dead safety guard -- never called in production

1 participant