Skip to content

conftest stubs download_file on moon_cli only — the engine keeps... - #163

Open
harshvardhan60792 wants to merge 1 commit into
LeyckerS:mainfrom
harshvardhan60792:fix/160-conftest-stubs-download-file-on-moon-cli
Open

conftest stubs download_file on moon_cli only — the engine keeps...#163
harshvardhan60792 wants to merge 1 commit into
LeyckerS:mainfrom
harshvardhan60792:fix/160-conftest-stubs-download-file-on-moon-cli

Conversation

@harshvardhan60792

Copy link
Copy Markdown

Fixes #160

conftest stubbed download_file on moon_cli only, leaving moon_engine holding the real function; moved the patch inside the shared host loop so both front-ends get it, with a comment explaining why.

Testing: Added test_engine_download_mode_uses_stubbed_download_file, which fails without the fix and passes with it; also confirmed it turns red when the engine drops a success increment, per the issue's verification recipe. Ran the full suite (pytest tests/ -q): 51 passed.


Description

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would change existing behavior)
  • Documentation update
  • Refactor / code cleanup
  • Other:

Checklist

  • I have tested my changes locally
  • If this affects shared logic (extraction, download engine), I also
    applied the equivalent change to moon_cli.py
  • I have kept the single-file architecture (no package split)
  • I have not added new dependencies without justification in the PR
    description

Screenshots / logs (if applicable)

Comment thread web/app.js Outdated
common: "Common", common_sub: "· both methods",
extractors: "Extractors", dl_streams: "DL streams", retries: "Retries",
rec16: "rec. 16", rec8: "rec. 8", rec8p: "rec. 8",
note_extractors: "datanodes is limited to Pages lanes regardless of this value",

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.

#160 Only mentioned fixing the tests in conftest.py; why modify the frontend?

Comment thread web/index.html Outdated
<output id="outWorkers">16</output>
<input type="range" id="workers" min="2" max="32" step="1" value="16" data-rec="16">
</label>
<p class="note" data-i18n="note_extractors">datanodes is limited to Pages lanes regardless of this value</p>

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.

I just remembered #83. This modification of yours should be intended to fix #83, but I did not see any mention of it in the PR body.

@XEDAB XEDAB 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.

Could you add the test declaration and a mention of the fix for #83 (which modified the frontend part)?Please add a mention of #83 in the PR description. This PR also modifies web/app.js and web/index.html — to fix #83, but the body currently only shows "Fixes #160".

Comment thread tests/test_no_chrome.py
cleanup()


def test_engine_download_mode_uses_stubbed_download_file(browser_calls):

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.

The download mode test here is a good addition — I forgot to add this test in my #162 (sorry).

Moved the download_file stub inside the shared host loop so moon_engine gets it too; added regression test.
@harshvardhan60792
harshvardhan60792 force-pushed the fix/160-conftest-stubs-download-file-on-moon-cli branch from fad9d41 to d49e96b Compare August 10, 2026 05:42
@LeyckerS

Copy link
Copy Markdown
Owner

@harshvardhan60792 — thank you for this, and I owe you a clear explanation rather than a quiet close.

On the ordering. #160 was offered to @XEDAB on 8 August (they reported the underlying problem while working on #157). They claimed it here on 9 August at 06:11 with their verification work, and opened #162 at 06:43. This pull request was opened at 20:00 the same day — about thirteen hours after there was already an open pull request against that issue. #162 is now merged.

That is not a criticism of you. An open PR is easy to miss, and the issue had no assignee because GitHub only accepts assignees who have commented on the issue itself — a limitation I have run into repeatedly and have not solved. But when two people fix the same thing, the one who claimed it first and opened first gets it, and I would apply that rule the other way round without hesitating.

Now the part that matters: your regression test is not in #162, it is genuinely wanted, and I verified that myself before writing this.

I checked out your branch, reverted only the conftest.py line, and ran the suite:

FAILED tests/test_no_chrome.py::test_engine_download_mode_uses_stubbed_download_file
1 failed, 8 passed in 24.72s

Against 13.48s with the fix in place. That eleven-second difference is the bug: without the stub the engine reaches the real downloader and makes an actual network request to a fake URL. Your test does not just assert the fix is present — it makes the failure mode visible in the runtime. That is a better demonstration than the manual recipe I put in the issue, and #162 does not have it.

So: would you open it again as just the test? Branch fresh from mainconftest.py is already fixed there — and bring only:

  • test_engine_download_mode_uses_stubbed_download_file
  • the mode parameter on run_engine and the dl_done key it returns
  • the one-line update to test_engine_unsupported_host_fails_once_without_browser's expected dict

That is a real contribution standing on its own, not a consolation prize: it is the thing that stops #160 coming back. Reference this pull request in the body and I will review it the same day.

If you would rather not, that is completely fair and no hard feelings — say so and I will open it as an issue crediting you, so nobody re-does your analysis from scratch.

Either way: you read the issue properly, wrote a test that fails for the right reason, and stated in your description that it does — which I was able to confirm exactly as written. That is a good first showing here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

conftest stubs download_file on moon_cli only — the engine keeps the real one, and nothing currently notices

3 participants