Skip to content

fix: review findings from initial scaffold#2

Merged
NormallyGaussian merged 1 commit into
mainfrom
fix/review-findings
Apr 30, 2026
Merged

fix: review findings from initial scaffold#2
NormallyGaussian merged 1 commit into
mainfrom
fix/review-findings

Conversation

@NormallyGaussian
Copy link
Copy Markdown
Contributor

@NormallyGaussian NormallyGaussian commented Apr 30, 2026

Summary

Closes the gaps from four parallel reviewers (code, tests, docs, workflows) and the extended live smoke against api.parallel.ai. Two real bugs would have shipped broken in 0.0.1 — both caught and fixed here.

Bugs fixed

enrich was broken end-to-end. The SDK rejects JSON-Schema dicts via task_run.execute(output=…) (it accepts only Pydantic classes or strings). Routes via beta.task_run.create + task_run.result instead, with the discriminated-union envelope the API requires:

client.beta.task_run.create(
    input={"objective": ..., "inputs": ...},
    processor=...,
    task_spec={"output_schema": {"type": "json", "json_schema": <schema>}},
)
result = client.task_run.result(run.run_id, api_timeout=int(timeout_s))

Verified live — returns run_id + cited basis.

extract(full_content=True) was broken. Top-level full_content is rejected by the SDK; it lives inside advanced_settings. The original smoke only tested False (the default), so this would have hit the first user who flipped it. Fixed + regression test added.

Code quality

  • Tool names are now publicweb_search, web_fetch, extract, deep_research, enrich. The leading-underscore variants confused LLMs and didn't match the doc-published names.
  • Submodules renamed to _search.py / _extract.py / _task.py to avoid attribute-vs-submodule shadowing in the package namespace.
  • Tracing plugin keys per-call timing on ToolContext.function_call_id (concurrency-safe across overlapping sessions) and adds on_tool_error_callback so timing entries don't leak when tools error out.
  • __version__ read from importlib.metadata — fixes the 0.0.1 vs 0.1.0 drift the reviewers flagged.
  • Dropped the untested enrich_with_model helper.

Packaging / CI

  • parallel-web>=0.5.1 (was >=0.3 — broken on older), google-adk>=1.31.
  • Documentation URL points at the GitHub README until a real docs page exists.
  • auto-release.yml reads head_commit.message via env var, not direct ${{ }} interpolation — closes a shell-injection vector via crafted commit messages.
  • release.sh refuses to run off main, refuses if the release tag already exists.
  • README + integration docs: StreamableHTTPServerParams (doesn't exist) → StreamableHTTPConnectionParams.

Tests

  • New test_search.py, test_extract.py, test_task.py with monkeypatched SDK clients. Covers call shapes (max_results in advanced_settings, full_content nesting, enrich JSON parse errors, _format_result branches).
  • Tracing tests: added concurrent-call test (distinct function_call_id keys don't race) and an error-path test for the new on_tool_error_callback.
  • Live smoke moved to tests/integration/; default pytest no longer needs --ignore flags.
  • 8 → 29 unit tests.

Verification (run on the HEAD of this branch)

Check Result
pytest -v 29/29 passed
ruff check + format --check clean
Live smoke vs api.parallel.ai all 5 tools end-to-end — _enrich direct returns run_id + cited basis; Gemini Flash picks web_fetch and extract with correct citation_count traces

Sequencing

Should merge before PR #1 (the 0.0.1 release). Otherwise 0.0.1 ships broken on PyPI. Once this lands, PR #1 needs a rebase or a re-open on top of main.

Two real bugs caught by extended smoke + four parallel reviewers:

Bugs (would have shipped broken in 0.0.1):
- _enrich: client.task_run.execute(output=dict) raises TypeError; switched
  to client.beta.task_run.create(task_spec={"output_schema": {"type":"json",
  "json_schema": ...}}) + task_run.result(api_timeout=...) for the create+poll
  path. The dict envelope is required by the API contract.
- extract: full_content=True was a top-level kwarg the SDK rejects. Now nested
  under advanced_settings={"full_content": True}.

Code quality:
- Tool names now public (web_search, web_fetch, extract, deep_research, enrich)
  instead of leading-underscore — LLMs handle clean names better.
- Submodules renamed to _search, _extract, _task to avoid attribute/submodule
  shadowing in the package namespace.
- ParallelTracingPlugin keys per-call timing on ToolContext.function_call_id
  (concurrency-safe vs the prior id(tool_args) approach which leaked on errors)
  and adds on_tool_error_callback to record failures.
- __version__ now read from importlib.metadata (was hardcoded, drifted).
- enrich passes api_timeout to result() instead of timeout to create().
- Dropped enrich_with_model helper (was untested + unused public API).

Packaging / CI:
- pyproject: parallel-web>=0.5.1 (was >=0.3, broken on older), google-adk>=1.31.
- pyproject: Documentation URL points at GitHub README until docs page exists.
- auto-release.yml: read commit message via env var, not direct interpolation
  (closes shell-injection vector via crafted commit messages).
- release.sh: refuses to run off main, refuses if release tag already exists.
- README + integration-docs: fixed StreamableHTTPServerParams (doesn't exist)
  to StreamableHTTPConnectionParams.

Tests:
- New test_search.py, test_extract.py, test_task.py with monkeypatched SDK
  client (string-target setattr to handle the namespace shadow).
- test_tracing.py: added concurrent-call test and on_tool_error_callback test.
- test_imports.py: parametrized tool name check; version asserted against
  importlib.metadata.
- Moved smoke_live*.py to tests/integration/ with addopts ignore so default
  pytest no longer needs --ignore flags.
- Live extended smoke (tests/integration/smoke_live_full.py) verifies _enrich
  end-to-end against api.parallel.ai + LLM picking web_fetch and extract.
@NormallyGaussian NormallyGaussian merged commit 41cb24d into main Apr 30, 2026
5 checks passed
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.

1 participant