Skip to content

Search/download/rescan/community support#1

Merged
supernothing merged 13 commits into
masterfrom
feature/search-download-support
Feb 21, 2019
Merged

Search/download/rescan/community support#1
supernothing merged 13 commits into
masterfrom
feature/search-download-support

Conversation

@supernothing
Copy link
Copy Markdown
Contributor

Getting close enough for a review, still some changes to searching to be made.

@supernothing supernothing changed the title WIP Search/download/rescan/community support Search/download/rescan/community support Feb 18, 2019
@mjkoo
Copy link
Copy Markdown

mjkoo commented Feb 18, 2019

This seems reasonable at first glance but I think blocks on TODOs from associated consumer PR

@supernothing
Copy link
Copy Markdown
Contributor Author

Should be ready, holding off merge until consumer changes make it to prod.

@supernothing supernothing merged commit f147809 into master Feb 21, 2019
@supernothing supernothing deleted the feature/search-download-support branch February 21, 2019 19:52
sbneto added a commit that referenced this pull request May 26, 2026
Bot review + import-surface audit caught real issues across two areas.

Bug fix (bot #1): ReportTemplate.upload_logo built a PolyswarmRequest
with `data=` carrying a file-like. httpx 0.27 reserves `data=` for
Mapping form bodies — a raw byte payload must go through `content=`.
Under requests this worked; under httpx it didn't. Read the file
into bytes and pass `content=` so the outbound PUT body is non-empty.

Import-surface compat (preserving what was importable on develop):

- `from polyswarm_api import PolyswarmAPI` is documented (spec 05,
  AGENTS.md "Caller surface unchanged", canonical aio/api.py
  docstring) but wasn't actually exposed at the top level — the
  bot caught this. Added the re-export.
- `from polyswarm_api.aio import AsyncPolyswarmRequest,
  AsyncPolyswarmSession` worked on develop (re-exported through the
  giant inline `aio/__init__.py`). The slim codegen-era
  `aio/__init__.py` had dropped them. Restored as explicit
  re-exports from `aio.core`.
- `async_upload_logo` (function + monkey-patch site) had been removed
  as "dead code" in an earlier round. It's part of the develop
  import surface (`polyswarm_api.aio.async_upload_logo`,
  `polyswarm_api.aio.upload.async_upload_logo`). Restored on the
  canonical async side; the rename map (`async_upload_logo` ->
  `upload_logo`) generates a sync mirror at
  `polyswarm_api.upload.upload_logo`. Note: the function is
  preserved as a public callable but not used internally — the
  resource-method upload path (ReportTemplate.upload_logo via
  `_single(...)`) is what `report_template_logo_upload` actually
  calls.

Tests:
- `test_async_report_template_logo_upload` exercises the full
  `report_template_logo_upload` flow against respx, asserts the PUT
  body is the file bytes and the Content-Type header is set. Would
  have caught the data=/content= bug at PR time; locks in the fix.

Other bot notes addressed in chat (not code):
- `_coerce_request` / `_exec` docstrings reference `AsyncPolyswarmRequest`
  in the generated sync `core.py` — string literals; unasync doesn't
  rewrite them. The canonical docstring already calls out the sync
  mirror; tolerable as the bot noted.
- `wait_for` / `report_wait_for` test gap — the asyncio->time codegen
  rule it would exercise is documented as a constraint, and breakage
  would manifest loudly (e.g. `time.gather`) rather than silently.
  Not blocking; better tested at the codegen smoke layer if at all.
- Major-version bump (3.x -> 4.0) for the develop->master step is
  noted in the PR description; this PR stays at 3.21.0 per gitflow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants