Add feeds FileFeed upload support#324
Conversation
|
Claude finished @axisrow's task in 2m 57s —— View job Claude PR Review — Add feeds FileFeed upload support
Overall this is a clean, well‑scoped PR: a typed FileFeed surface, dry‑run fidelity, six new dry‑run tests covering both Below are observations worth considering — nothing here is blocking. Notable observations1. The 50 MiB cap is pre‑base64; the wire payload after b64 + JSON envelope is ~33% larger. The Yandex Direct docs publish a feed file size limit, but I couldn't find an explicit 2. 255 is a common filesystem 3. Lines 200–203 already short‑circuit when 4.
5. No CLI‑side guard against changing The PR body cites the Yandex constraint that "changing source/business type is not allowed" on 6. Filename is forwarded verbatim, no path-traversal stripping — If a user passes 7. Dry‑run reads and base64‑encodes the file This is intentional and correct (otherwise dry‑run wouldn't show a faithful payload), but for a 50 MiB feed it means Tests & WSDL bookkeeping
VerdictLooks ready to merge once the magic‑constant sourcing is either documented or explicitly called out as defensive. The substantive concerns are all minor — the security boundary, the parity bookkeeping, and the test coverage are all in good shape. |
There was a problem hiding this comment.
Pull request overview
Adds typed CLI support for uploading local feed files as FileFeed payloads in direct feeds add/direct feeds update, aligning the CLI with the Yandex Direct Feeds WSDL surface while keeping the no-raw-JSON contract intact.
Changes:
- Added
--file-feed-path/--file-feed-filenameflags and payload building that base64-encodes local files intoFileFeed.Data(and setsSourceType=FILEforfeeds add). - Enforced mutual exclusivity between
UrlFeedandFileFeedoptions (with updated parity-gate expectations). - Updated dry-run tests, README examples, and optional-field audit classification to mark FileFeed paths as supported.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| direct_cli/commands/feeds.py | Implements FileFeed CLI flags, base64 payload building, and validation/mutual-exclusion logic for add/update. |
| tests/test_dry_run.py | Adds dry-run coverage for FileFeed payloads and mix/validation rejection cases. |
| tests/test_wsdl_parity_gate.py | Updates WSDL↔CLI mappings and internal validation expectations for feeds.add SourceType/FileFeed coverage. |
| tests/WSDL_OPTIONAL_FIELD_AUDIT.md | Reclassifies Feeds FileFeed optional WSDL paths as supported and updates summary counts. |
| README.md | Documents example invocations for FileFeed uploads on feeds add/update. |
| try: | ||
| data = path.read_bytes() | ||
| except OSError as exc: | ||
| raise click.UsageError( | ||
| f"Cannot read --file-feed-path {file_feed_path!r}: {exc}" | ||
| ) | ||
|
|
||
| if len(data) > _FILE_FEED_MAX_BYTES: | ||
| raise click.UsageError( |
There was a problem hiding this comment.
Fixed in ea61cf2: _file_feed_payload now checks path.stat().st_size before read_bytes(), so oversized files are rejected before loading them into memory.
| if len(data) > _FILE_FEED_MAX_BYTES: | ||
| raise click.UsageError( | ||
| "FileFeed.Data must be at most 50 MiB before base64 encoding." | ||
| ) |
There was a problem hiding this comment.
Fixed in ea61cf2: added focused dry-run rejection coverage for overlong --file-feed-filename and oversized --file-feed-path.
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
276363b to
ea61cf2
Compare
|
Addressed actionable review feedback in
|
|
Claude finished @axisrow's task in 1m 29s —— View job Claude PR Re-Review — Add feeds FileFeed upload support
Verdict: LGTM — all review items addressedThe follow-up commit cleanly resolves every actionable item from the prior round. No new concerns. Item-by-item verification1. Copilot #1 — read entire file before size check ( 2. Copilot #2 — missing tests for oversized file / overlong filename
3. Prior review #1 / #2 — magic constants without source
4. Prior review #5 — no CLI warning on 5. Prior review #3 — redundant WSDL parity bookkeepingCross-checked the audit/gate changes:
Minor nit (non-blocking)The new Nothing else to flag — ready to merge. |
|
Codex Review: Didn't find any major issues. Hooray! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Final review classification after fix and 5-minute window:
No blocking/actionable comments remain. CI is green. |
Summary
--file-feed-path/--file-feed-filenamesupport forfeeds addandfeeds updateFileFeed.Database64 and setSourceType: FILEfor add payloadsUrlFeedandFileFeedoptions, update README examples, and mark FileFeed WSDL rows supportedDocs checked
feeds.add:SourceTypeisURL | FILE;FileFeed.DataandFileFeed.Filenameare required insideFileFeedfeeds.update:FileFeed.DataandFileFeed.Filenameare required insideFileFeed; changing source/business type is not allowedVerification
python3 -m pytest tests/test_dry_run.py -k feedspython3 scripts/build_wsdl_optional_field_audit.py --checkpython3 -m pytest tests/test_wsdl_parity_gate.pypython3 -m pytest tests/test_cli.py tests/test_dry_run.py tests/test_wsdl_parity_gate.pymypy .git diff --checkCloses #264