Forms follow-up: fix update_form docstring, test cleanup, and submission ordering#48
Conversation
…leanup and submission ordering
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/nc_mcp_server/tools/forms.py (1)
205-207: Docstring fix looks correct; consider a tiny polish forfileFormat.The
filePath→pathcorrection aligns with the Forms v3keyValuePairsschema and matches the observed server behavior cited in the PR description, and the "must be sent together with fileFormat" note is a useful gotcha to surface to callers. No runtime behavior changes here.Optional nit:
fileFormatis listed without any description whilepathhas one, which reads slightly asymmetrically. You could tighten it to something like:Optional docstring polish
- permitAllUsers/showToAllUsers), fileFormat, path (destination - folder for the generated submissions spreadsheet — must be sent - together with fileFormat to (re)link the form to a file). + permitAllUsers/showToAllUsers), fileFormat ("csv"/"xlsx"/"ods") + and path (destination folder for the generated submissions + spreadsheet) — these two must be sent together to (re)link the + form to an exported submissions file.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/nc_mcp_server/tools/forms.py` around lines 205 - 207, The docstring currently mentions fileFormat and path (keyValuePairs for Forms v3) but leaves fileFormat undocumented; add a concise description for fileFormat next to the existing path note in the same docstring so both entries are symmetric—e.g., clarify that fileFormat is the format/type of the linked file (CSV, XLSX, etc.) and that it must be sent together with path when (re)linking the form; update the docstring where fileFormat and path are listed to keep wording parallel and reference the Forms v3 keyValuePairs behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/nc_mcp_server/tools/forms.py`:
- Around line 205-207: The docstring currently mentions fileFormat and path
(keyValuePairs for Forms v3) but leaves fileFormat undocumented; add a concise
description for fileFormat next to the existing path note in the same docstring
so both entries are symmetric—e.g., clarify that fileFormat is the format/type
of the linked file (CSV, XLSX, etc.) and that it must be sent together with path
when (re)linking the form; update the docstring where fileFormat and path are
listed to keep wording parallel and reference the Forms v3 keyValuePairs
behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 1d739a60-d357-4f22-a1af-15c48dee4d99
📒 Files selected for processing (2)
src/nc_mcp_server/tools/forms.pytests/integration/test_forms.py
Summary
Three small follow-up fixes to the Forms tools merged in #47. All found during a deep production-readiness audit; none caught by CI because the first is a docstring-only change and the other two are test-hygiene improvements that don't affect green CI.
Fixes
1.
update_formdocstring:filePath→path(real bug)The Forms v3 API uses
path(notfilePath) as the keyValuePairs key to link a form to a submissions spreadsheet. I verified this against both:apps-extra/forms/lib/Controller/ApiController.php:320checksisset($keyValuePairs['path']).An AI following the old docstring to link a form to a file would get a 500. Also clarified in the docstring that
pathandfileFormatmust be sent together.2.
test_create_produces_form_with_idno longer leaks a formThe test called
create_form(which produces a form with empty title) but never renamed it, so the cleanup filter (title.startswith("mcp-test-")) skipped it. Harmless in CI (fresh instance each run) but pollutes local-dev DBs. Now tags the form with amcp-test-create-idtitle viaupdate_form— placed before the assertions so cleanup catches the form even if an assertion fails mid-test.3.
test_delete_single_submissionno longer assumes submission orderingPreviously picked
listing[\"submissions\"][0][\"id\"], implicitly relying on OCS v3's return order. Now usesmin(s[\"id\"] for s in listing[\"submissions\"])(auto-increment IDs are monotonic → oldest submission deterministically). Also added an assertion that the target was actually removed, not just that the count dropped.Test plan
test_server.pytool registry: 8/8 pass (no tool count change)Summary by CodeRabbit
update_formparameter documentation:pathnow specifies the destination folder for exported submission spreadsheets and must be set alongsidefileFormat.