Skip to content

fix: handle empty API responses and double /api prefix in schedule script#100

Closed
tervezo-ai[bot] wants to merge 2 commits intomainfrom
auto/warpgrid-issue-handling-dwrlaqs6vbr42fjgoigx2iu8
Closed

fix: handle empty API responses and double /api prefix in schedule script#100
tervezo-ai[bot] wants to merge 2 commits intomainfrom
auto/warpgrid-issue-handling-dwrlaqs6vbr42fjgoigx2iu8

Conversation

@tervezo-ai
Copy link
Copy Markdown
Contributor

@tervezo-ai tervezo-ai bot commented Mar 13, 2026

Summary

  • Fixed tervezo_api() to strip whitespace from response body before JSON parsing, preventing JSONDecodeError on whitespace-only responses
  • Added try/except around json.loads on the success path, consistent with the error handler
  • Fixed URL construction to strip trailing /api from TERVEZO_API_URL env var, preventing double /api/api/v1/ prefix

Context

The script crashed with JSONDecodeError when the Tervezo API returned empty or whitespace-only response bodies. Additionally, with TERVEZO_API_URL=https://app.tervezo.ai/api, the URL was incorrectly constructed as /api/api/v1/....

Test plan

  • Dry-run validates correctly, identifying GitHub US-108: DNS shim integration tests #10 (US-108: DNS shim integration tests) as the next ready issue
  • Empty string, whitespace-only, and valid JSON responses all handled correctly
  • Live scheduling blocked by Tervezo API v1 returning HTTP 500 (server-side issue)

🤖 Generated with Claude Code


View implementation in Tervezo

nadilas and others added 2 commits March 13, 2026 19:06
…ript

- Strip whitespace from response body before JSON parsing to prevent
  JSONDecodeError on whitespace-only responses
- Wrap json.loads in try/except for JSONDecodeError on success path,
  consistent with the error handler
- Strip trailing /api from TERVEZO_API_URL to prevent double
  /api/api/v1/ prefix in URL construction

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Covers the two bug fixes (double /api prefix, empty response handling),
dependency graph analysis, blocking deps extraction, and error handling.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@tervezo-ai
Copy link
Copy Markdown
Contributor Author

tervezo-ai bot commented Mar 13, 2026

Closing as superseded by PR #103, which handles both /api and /api/v1 suffixes and includes a warning log for non-JSON responses. #103 is a strict superset of this PR.

@tervezo-ai tervezo-ai bot closed this Mar 13, 2026
@tervezo-ai tervezo-ai bot deleted the auto/warpgrid-issue-handling-dwrlaqs6vbr42fjgoigx2iu8 branch March 13, 2026 21:03
tervezo-ai bot pushed a commit that referenced this pull request Mar 13, 2026
Reviewed and merged 6 PRs, closed 1 as superseded:
- PR #103: fix schedule script URL prefix and non-JSON responses
- PR #1: wasmtime 41.0.3 → 41.0.4 security bump
- PR #99: Postgres database proxy integration tests (US-114)
- PR #101: signal handling integration tests (US-110)
- PR #104: threading model declaration host function (US-118)
- PR #102: MySQL and Redis Wasm integration tests (US-117)
- PR #100: closed as superseded by #103

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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