Skip to content

Add hackathons CLI and MCP↔CLI parity gate#998

Open
kaggle-agent wants to merge 4 commits intomainfrom
agent/mooneyp-20260505143129-989e6edb
Open

Add hackathons CLI and MCP↔CLI parity gate#998
kaggle-agent wants to merge 4 commits intomainfrom
agent/mooneyp-20260505143129-989e6edb

Conversation

@kaggle-agent
Copy link
Copy Markdown
Collaborator

@kaggle-agent kaggle-agent commented May 5, 2026

The MCP server recently gained four hackathon tools with no CLI
counterpart, leaving CLI users unable to reach them. This adds
kaggle hackathons (alias h) covering overview, write-ups
list/download, and resolve-links.

To stop the same drift from happening again, it also adds a parity
script + CI workflow that fails when a new [McpServerTool] ships
without either a matching CLI command or an explicit reasoned skip
in tools/mcp_cli_mapping.yaml.


Task: mooneyp-20260505143129-989e6edb
Context: https://chat.kaggle.net/kaggle/pl/9sxo1mzxytfi9p1f7aohhf578r

Comment on lines +15 to +44
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install kaggle CLI (editable)
run: |
python -m pip install --upgrade pip
pip install -e .

- name: Run MCP ↔ CLI parity check
env:
# Read-only token for the private Kaggle/kaggleazure repo.
# Configure under: Settings → Secrets and variables → Actions.
GITHUB_TOKEN: ${{ secrets.KAGGLEAZURE_READ_TOKEN }}
run: |
python tools/check_mcp_cli_parity.py \
--mcp-client-url https://raw.githubusercontent.com/Kaggle/kaggleazure/ci/Kaggle.Sdk/mcp/McpClient.cs \
| tee parity-report.md

- name: Upload parity report
if: always()
uses: actions/upload-artifact@v4
with:
name: mcp-cli-parity-report
path: parity-report.md
@paultimothymooney
Copy link
Copy Markdown
Contributor

@sloppy investigate and resolve the failing checks:

All four kaggle-cli-branch-3-{11,12,13,14} Cloud Build checks fail at the same step — the lint step (black formatter). Four files would be reformatted:

src/kaggle/test/test_hackathons_cli.py
tools/check_mcp_cli_parity.py
src/kaggle/api/kaggle_api_extended.py
(one more in the same diff)
Mostly multi-line strings/calls that black wants collapsed onto a single line. Just run black . (or format ) on those four files and push again.

@kaggle-agent
Copy link
Copy Markdown
Collaborator Author

Re: @paultimothymooney's review:

Ran black on the four files flagged by the lint step (src/kaggle/cli.py, src/kaggle/api/kaggle_api_extended.py, src/kaggle/test/test_hackathons_cli.py, tools/check_mcp_cli_parity.py). black --check is now clean on all four, the 24 hackathons tests still pass, and the parity script still exits 0.

@paultimothymooney
Copy link
Copy Markdown
Contributor

@sloppy the same 4x tests are still failing.

In src/kaggle/test/test_hackathons_cli.py around line 18, there are two consecutive blank lines between the from kaggle import cli as kaggle_cli import and the # ---- Fixtures & helpers ---- comment. black wants exactly one blank line there.

Fix: delete one of the blank lines after the imports in test_hackathons_cli.py, or just run black src/kaggle/test/test_hackathons_cli.py locally and push.

@kaggle-agent
Copy link
Copy Markdown
Collaborator Author

Re: @paultimothymooney's review:

You're right — turns out my local black was pinned at 24.10.0 (the floor in pyproject.toml), but Cloud Build's hatch env pulls the latest, which is stricter about blank lines after imports. Removed the extra blank line in test_hackathons_cli.py. black --check . is now clean against the latest black version, and the 24 tests still pass.

Copy link
Copy Markdown
Contributor

@stevemessick stevemessick left a comment

Choose a reason for hiding this comment

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

Need to update pyproject.toml. Maybe less unit test mocks, too.

Comment thread src/kaggle/test/test_hackathons_cli.py Outdated
@@ -0,0 +1,297 @@
"""Tests for ``kaggle hackathons`` CLI commands.

The hackathon endpoints (``get_hackathon_overview``,
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 premise here is incorrect. Rather than writing tests to avoid new kagglesdk APIs, we instead increment the kagglesdk version in pyproject.toml.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in the pending diff. The misleading docstring is replaced; the new one notes that only the two endpoints kagglesdk has not yet released (export_hackathon_write_ups_csv, get_resolved_writeup_links) still use lazy imports — and those will be inlined as soon as kagglesdk ships them. The pyproject floor is now >= 0.1.23.

@kaggle-agent
Copy link
Copy Markdown
Collaborator Author

Re: @stevemessick's review:

Already addressed in the pending diff. Bumped kagglesdk >= 0.1.21>= 0.1.23 in pyproject.toml, then deleted the _require_sdk_method and _build_* helpers for the two endpoints now in the SDK (get_hackathon_overview, list_hackathon_write_ups) — their request types are top-of-file imports and the methods are one-liners against the SDK client. Tests for those paths shed all the _build_* mocks and just stub the SDK method directly. Net diff is roughly -118/+50 across the three files.

@kaggle-agent kaggle-agent force-pushed the agent/mooneyp-20260505143129-989e6edb branch from 7f99236 to 97e2ab6 Compare May 5, 2026 16:09
paultimothymooney and others added 4 commits May 5, 2026 22:51
Wraps the new hackathon MCP tools (overview, write-ups list/download,
resolve-links) with `kaggle hackathons` (alias `h`) so CLI users have
parity with the MCP surface. Adds a parity check script + CI workflow
so future MCP tools can't ship without either a matching CLI command
or an explicit, reasoned skip — closing the drift gap that motivated
this work.

Co-authored-by: kaggle-agent <kaggle-agent@users.noreply.github.com>
The kaggle-cli-branch-3-{11,12,13,14} checks were failing because the
new files in this PR weren't run through black. Reformatted the four
flagged files; no behavior changes.

Co-authored-by: kaggle-agent <kaggle-agent@users.noreply.github.com>
My local black was 24.10.0 (the pyproject floor) and was happy, but
Cloud Build's hatch env pulls the latest black which is stricter about
blank lines between imports and the next block.

Co-authored-by: kaggle-agent <kaggle-agent@users.noreply.github.com>
Per review: the right fix for "kagglesdk doesn't have these yet" is to
bump the floor, not work around it. Bumped to >= 0.1.23 (latest) and
dropped the lazy-import + getattr plumbing for the two endpoints that
ship there, so `hackathon_get_overview` and `hackathon_list_writeups`
now use top-of-file imports and the tests stub the SDK client directly
instead of mocking helper indirection.

The CSV-export and resolve-links endpoints still aren't in any released
kagglesdk, so those wrappers keep a small lazy import (with a TODO) and
the test fixture stubs those two modules in `sys.modules`.

Co-authored-by: kaggle-agent <kaggle-agent@users.noreply.github.com>
@kaggle-agent kaggle-agent force-pushed the agent/mooneyp-20260505143129-989e6edb branch from 97e2ab6 to 0796f8b Compare May 5, 2026 22:51
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.

4 participants