Skip to content

Fix(benchmarks): hint when cached download lacks source notebooks#1039

Open
nl917 wants to merge 2 commits into
mainfrom
download-source-tip
Open

Fix(benchmarks): hint when cached download lacks source notebooks#1039
nl917 wants to merge 2 commits into
mainfrom
download-source-tip

Conversation

@nl917
Copy link
Copy Markdown
Contributor

@nl917 nl917 commented May 29, 2026

Summary

If you've previously run kaggle b t download <task> without -s and
later realize you want the source notebooks, running the command again with
-s silently does nothing — the cached output directory already exists, so
the loop short-circuits before the -s flag is ever forwarded to the
download API. You have to discover on your own that -f -s is needed to
backfill.

This adds a one-line tip after the summary when:

  • the user passed -s (--include-source), and
  • the cached directory exists but lacks __notebook__.ipynb /
    __notebook_source__.ipynb.

Before / After

Before (-s on an already-cached run silently does nothing):

$ kaggle b t download hello -s
... gemini-3-flash-preview/291356/   2.40KB     Cached
Done: 1 run(s) cached.

$ ls hello/3/gemini-3-flash-preview/291356/
hello.task.json  *.run.json                       # no source notebook!

After (tip points to the workaround):

$ kaggle b t download hello -s
... gemini-3-flash-preview/291356/   2.40KB     Cached
Done: 1 run(s) cached.

Tip: 1 cached run(s) lack source notebooks. Re-run with -f -s to fetch them.

$ kaggle b t download hello -s -f
... gemini-3-flash-preview/291356/   43.58KB    Done
Done: 1 run(s) downloaded.

$ ls hello/3/gemini-3-flash-preview/291356/
__notebook__.ipynb  hello.task.json  *.run.json   # source notebook present

nl917 added 2 commits May 29, 2026 20:38
If you ran `kaggle b t download <task>` without `-s` and then re-run with
`-s` hoping to backfill the source notebooks, the loop short-circuits on
the existing output directory and the `-s` flag is silently ignored — you
have to discover that `-f -s` is needed.

This adds a one-line tip after the summary when the user passed `-s` but
the cached directory lacks `__notebook__.ipynb` / `__notebook_source__.ipynb`:

    Tip: 1 cached run(s) lack source notebooks. Re-run with -f -s to fetch them.

We don't auto-fetch — explicit `-f` keeps the "cached means don't touch"
contract and gives the user control over the additional network cost.

Two tests added in TestDownload:
- test_download_cached_dir_without_source_prints_tip_when_s_passed
- test_download_cached_dir_with_source_does_not_print_tip
@nl917 nl917 changed the title Download source tip Fix(benchmarks): hint when cached download lacks source notebooks May 29, 2026
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.

Same as #1038 (comment), please update the doc and skill file

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.

Is this PR on top of download-fix?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes, this is based on that branch. This PR is not ready yet :)

output = capsys.readouterr().out

assert "Cached" in output
assert "1 cached run(s) lack source notebooks" in output or "lack source notebooks" in output
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.

Is this redundant?

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.

2 participants