Skip to content

Spec 002: the report made in the background, behind its address (R4) - #98

Closed
adamjohnwright wants to merge 1 commit into
mainfrom
spec002/report-async
Closed

adamjohnwright wants to merge 1 commit into
mainfrom
spec002/report-async

Conversation

@adamjohnwright

Copy link
Copy Markdown
Contributor

Spec 002, research R4's open decision, settled. The user left the choice to us.

Why: a report cannot be drawn within the edge's 100 s.

  • Spec 001's T007 measured one diagram with an analysis token at 4.5 s cold, with the render service drawing two at once (19.6 s for the last of eight).
  • So a report's figures alone take about a minute for 25 pathways and two minutes for 50, against the ~40 s left after the gateway's wait.
  • More concurrency doesn't help: the host's processors are the limit (spec 001 T005).

Decision: the report is made in the background, behind today's address.

  • Wait, then answer: a request starts the report, or joins one already being made for the same token and parameters, and waits up to 30 s.
  • Ready: 200 with the PDF, sent only once complete, so FR-203's error answers still hold.
  • Not ready: 202 with Retry-After: 10. A browser gets a small page that asks again by itself; a script following Retry-After gets the PDF.
  • Kept: a finished report is held for one hour (FR-211 amended), and a report is abandoned after 5 minutes.
  • SC-203 becomes the time to a ready PDF:
    • 25 pathways: today's time, or 2 minutes if today's is faster;
    • 50 pathways: 4 minutes.
  • WebsiteAngular's part: the "PDF Result" button opens the address in a tab rather than downloading it, and the gateway passes 202 and Retry-After through.

Alternatives considered (R4): a shorter gateway wait, more concurrency or fewer pathways (none gets under 40 s); streaming the PDF early (breaks FR-203); a new address for the result (breaks people's scripts).

🤖 Generated with Claude Code

Spec 001 T007 measured one diagram with an analysis token at 4.5 s cold, two
drawn at once: a report's figures take about a minute for 25 pathways and two
for 50, against the 40 s the edge's 100 s leaves after the gateway's wait. The
user left the choice to us. The report is now made in the background: a
request starts or joins it and waits up to 30 s, then answers 200 with the PDF
or 202 with Retry-After (a self-refreshing page for a browser); the same
address serves the PDF once ready, and a finished report is kept for an hour.
SC-203 is the time to a ready PDF (25 pathways: today's, or 2 minutes; 50: 4
minutes). The website's button opens the address in a tab; the gateway passes
202 through.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adamjohnwright

Copy link
Copy Markdown
Contributor Author

Replaced by the follow-up PR with this review's findings fixed.

adamjohnwright added a commit that referenced this pull request Nov 2, 2026
…105)

Spec 002's R4 settled (the user left it to us). Spec 001 T007 measured one
figure with an analysis token at 4.6 s cold, two drawn at once, so a report's
figures alone take about a minute for 25 pathways and two for 50, past the
edge's 100 s. The report is now made in the background behind today's address:
a request starts or joins it and waits up to 30 s, then answers 200 with the
PDF or 202 with Retry-After (a page that asks again, for a browser). A finished
report is kept in memory only, at most 512 MB in all, for an hour, checked
against the analysis service before it is sent; the printer's working page is
on memory-backed storage. The gateway stops queueing report requests, keeps its
per-client share and names the client in a header it always overwrites; the
service's port is reachable only from trusted internal callers. SC-203 is the
time to a ready report. Reviewed through #98-#104.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant