Skip to content

fix(api): an app runs one export at a time; an import line over 64 MiB is refused with 413 - #2220

Merged
thesyncim merged 1 commit into
mainfrom
fix/ai-3484-one-app-cannot-hold-the-pool
Nov 23, 2026
Merged

thesyncim merged 1 commit into
mainfrom
fix/ai-3484-one-app-cannot-hold-the-pool

Conversation

@thesyncim

@thesyncim thesyncim commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Changes

  • An app runs one export at a time on a router; a second one is answered 409 conflict until the first ends.
  • A router runs at most four exports at once (maxExports); one more is answered 503 until one ends.
  • An export ends after an hour (exportWait), or when one line has taken a minute to write (exportLineWait).
  • An export reads each table through a cursor in its snapshot, 100 rows at a time (exportBatchRows), so one that ends partway reads at most the rest of its batch before it lets go.
  • An import line over 64 MiB is answered 413. An import is one JSON object per line, the format an export writes.
  • A name that no agent config, router config or voice holds is cached for a minute; one that was found is still cached for the hour.
  • The new responses are in the spec, and the clients, the Go SDK included, are regenerated.

Tests

  • TestASecondExportOfAnAppIsRefusedWhileOneIsRunning: a second export of an app is answered 409. It failed before the fix.
  • TestOtherRequestsAreServedWhileExportsRun: another request is served while exports of one app run. It failed before the fix.
  • TestOtherRequestsAreServedWhileExportsOfManyAppsRun: another request is served while exports of several apps run, and the fifth is answered 503. It failed before the fix.
  • TestAnExportWhoseClientStopsReadingIsLetGo: an export nobody reads ends at the line deadline. It failed before the fix.
  • TestAnExportReadSlowlyEndsAtItsDeadline: an export read slowly ends at its overall deadline. It failed before the fix.
  • TestAnExportHungUpOnLetsGoAtOnce: an export hung up on a few lines into a large table ends within 2 s. It failed before the fix.
  • TestAnImportLineOverTheLimitIsRefused: a line over 64 MiB is answered 413. It failed before the fix, with a 400.
  • TestAnImportLineJustUnderTheLimitIsRead: a line one byte under 64 MiB is imported whole.
  • TestANameNoConfigHoldsIsCachedForAMinuteOnly, TestANameNoRouterConfigHoldsIsCachedForAMinuteOnly, TestANameNoVoiceHoldsIsCachedForAMinuteOnly: a miss is cached for a minute and a hit for the hour. Each failed before the fix.

Fixes AI-3484

- An app runs one export at a time on a router, answered 409 otherwise, and a router runs
  at most four exports at once, answered 503 otherwise.
- An export ends after an hour, or when one line has taken a minute to write.
- An export reads each table through a cursor, 100 rows at a time, so one that ends partway
  reads at most the rest of its batch.
- An import line over 64 MiB is answered 413.
- A name that no agent config, router config or voice holds is cached for a minute rather
  than an hour.
@thesyncim
thesyncim force-pushed the fix/ai-3484-one-app-cannot-hold-the-pool branch from d7650d0 to 7dee5f4 Compare November 23, 2026 15:53
@thesyncim
thesyncim marked this pull request as ready for review November 23, 2026 15:54
@thesyncim
thesyncim requested a review from kanat November 23, 2026 15:54
@thesyncim thesyncim added the data-layer-review: ready Data layer review fix: passed automated review, merges cleanly, ready for a human review label Nov 23, 2026

@kanat kanat left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Round-1 review at 7dee5f4e3, merged onto main 31fd2dd96. CI is green on this head.

Checked and sound:

  • Both touched suites pass on the merged tree, and -race -count=20 on the six concurrency and deadline tests passes.
  • openapi.yaml, the JS types and the Go and Python clients match what their generators produce.
  • The export still reads in one REPEATABLE READ snapshot. DECLARE/FETCH run in that tx, and in a probe they returned rows in the same order and with the same plan as the plain query.
  • #2201 merges clean with this PR, and its opt-out order tests pass on the merge.
  • Slots are released by defers, so a crashed export cannot leak one.
  • A miss key is dropped on create (agent_config.go:370, router_config.go:79, voice.go:72).
  • The errors use APIError envelopes.
  • Merge-tree: #2209 conflicts textually in store/redis.go, agent_config_test.go and router_config_test.go. #2221 merges clean.

Mutations: 19 checked. 6 survived: 4 are real (R1.1), and 2 are equivalent (R1.2).

Verdict: NO-GO, for R1.1 (four new rules have no test that pins them; the test rows are in the comment).

Comment thread acceleration/internal/api/datamove.go Resolved
Comment thread acceleration/internal/api/datamove.go Resolved
Comment thread acceleration/internal/api/datamove.go Resolved
Comment thread acceleration/internal/api/datamove.go Resolved
@thesyncim thesyncim removed the data-layer-review: ready Data layer review fix: passed automated review, merges cleanly, ready for a human review label Nov 23, 2026

@kanat kanat left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: GO, re-graded under this repo's pr-review skill (no Blocker, and no Should fix that has to land before merge). R1.1 is a test-coverage gap on code that behaves correctly, so it is a follow-up: the ready test rows are in the earlier review. The Nits stay optional.

@thesyncim
thesyncim merged commit 07bf0f7 into main Nov 23, 2026
28 checks passed
@thesyncim
thesyncim deleted the fix/ai-3484-one-app-cannot-hold-the-pool branch November 23, 2026 17:51
thesyncim added a commit that referenced this pull request Nov 23, 2026
Follow-up to #2220 (Kanat's review).

**Changes**
- An import line that is not one JSON object is answered 400 with "an
import is one JSON object per line", so a pretty-printed file, or two
objects on one line, says what to change.
- The spec says an app runs one export at a time on a router, and its
503 includes an export that ran out of time before its first row.
- The data-move section of `acceleration/README.md` states the one
export per app, the four exports per router, the hour and the minute per
line, and the 64 MiB import line.
- Two checks that could not change an answer are gone: a write deadline
reset before an error that no line had preceded, and a context check
before each batch of an export, whose next read fails on a cancelled
context anyway.
- The spec and the clients are regenerated.

**Tests**
- `TestAnExportCutAtItsDeadlineReadsAsBroken`: an export cut by its
overall deadline reads as a broken response with no cursor line. It
fails when the line deadline is not capped by the overall one.
- `TestAnExportOutOfTimeBeforeItsFirstRowIsToldToTryAgain`: an export
out of time before its first row is answered 503. It fails without the
overall deadline, and with a 500 in place of the 503.
- `TestAnImportWithBlankLinesIsRead`: an import with blank lines between
its lines writes every row. It fails when blank lines are not skipped.

Part of AI-3484
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants