Skip to content

Wait for slow layer exports in get_export_link - #37

Open
ChrisLoer wants to merge 2 commits into
mainfrom
cloer/export-link-poll
Open

ChrisLoer wants to merge 2 commits into
mainfrom
cloer/export-link-poll

Conversation

@ChrisLoer

Copy link
Copy Markdown

get_export_link (and download_layer, which calls it) raised KeyError: 'export_link' on any layer export slower than the API's 55 s wait. The API then answers 202 {status: "processing", message, poll_endpoint} instead of 200 {export_link}, and the export keeps running server-side with no way for the caller to collect it.

Changes

  • On a 202, get_export_link polls poll_endpoint (the custom export status route), backing off from 2 s to 15 s between polls, and returns download_url once the export is completed.
  • New ExportFailedError when the export fails, and ExportTimeoutError after timeout seconds (default 600). Both carry poll_endpoint; a timed-out export keeps running and can still be collected from it.
  • get_export_link and download_layer take an optional timeout. Existing calls are unchanged.

Testing

  • New tests/export_link_test.py (no API token needed): an immediate link, a 202 → pending → in_progress → completed sequence, a failed export, and the timeout. Reverting get_export_link to the old one-shot read fails 3 of the 4.
  • ruff check, ruff format --diff and mypy . pass.
  • The end-to-end suite in tests/tests.py needs FELT_API_TOKEN and runs in CI; I didn't run it locally.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ARj2mn5it8WunGFqtgbfjv

ChrisLoer and others added 2 commits November 16, 2026 08:58
When a layer export takes longer than the API's wait, get_export_link
gets a 202 with a poll_endpoint instead of an export_link and raised
KeyError. It now polls the export until it completes, fails or times out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ARj2mn5it8WunGFqtgbfjv
felt.com now 301-redirects /api/v2/projects/ to /api/v2/projects, and
urllib follows a 301 on POST as a bodiless GET, so create_project
returned the project list and delete_project raised.

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

1 participant