feat(import-sessions): add chunked Sure NDJSON import commands - #25
Conversation
Wire the import_sessions API surface that had no CLI coverage: create POST /api/v1/import_sessions show GET /api/v1/import_sessions/:id add-chunk POST /api/v1/import_sessions/:id/chunks publish POST /api/v1/import_sessions/:id/publish Mirrors the existing dry-run-by-default + --apply contract and reuses dispatchWrite/printGet/PostMultipart. add-chunk accepts a Sure NDJSON file (multipart) or --raw-content, validating sequence and content source client-side. Top-level params match the controller (no wrapping key). Adds payload-builder + registration tests and README examples.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughAdds the ChangesChunked NDJSON Import Sessions Command
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
Suggested reviewers
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 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 |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
What
Adds CLI coverage for the
import_sessionsAPI surface — the onlyapi/v1resource with no command wrapper. This is the chunked Sure NDJSON import flow
(distinct from
imports, which handles CSV with column mapping).import-sessions createPOST /api/v1/import_sessionsimport-sessions show <id>GET /api/v1/import_sessions/:idimport-sessions add-chunk <id>POST /api/v1/import_sessions/:id/chunksimport-sessions publish <id>POST /api/v1/import_sessions/:id/publishWhy
import_sessions(create / show / create_chunk / publish) is implementedserver-side but had no CLI entry point, so the chunked NDJSON import path was
not scriptable. This completes the agent-first contract over the full API.
Design
--applycontract and reusesdispatchWrite/printGet/PostMultipart— no new infra.add-chunkaccepts a Sure NDJSON--file(multipart, reusingmimeForImportFile) or--raw-content(JSON body); validatessequence >= 1,exactly one content source, and the
.ndjson/.jsonextension client-side.client_session_id/client_chunk_ididempotency keys.Tests
categories_create_test.gostyle.
go test ./...,go vet ./..., andtools/validate-samples.shgreenlocally. README updated with examples.
Summary by CodeRabbit
Release Notes
New Features
import-sessionsCLI command for chunked NDJSON imports with subcommands to create sessions, add chunks, view details, and publish.Documentation
Tests