Skip to content

test(api): pin the export deadlines and an import's blank lines - #2253

Merged
thesyncim merged 2 commits into
mainfrom
fix/ai-3484-export-rule-tests
Nov 23, 2026
Merged

thesyncim merged 2 commits into
mainfrom
fix/ai-3484-export-rule-tests

Conversation

@thesyncim

Copy link
Copy Markdown
Member

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

- Tests for an export cut by its overall deadline, an export out of time before its first
  row, and an import with blank lines.
- An import line that is not one JSON object says an import is one JSON object per line.
- The spec and the README state the export and import limits.
- Two checks that could not change an answer are removed.
@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.

Verdict: GO. Round 1 of #2253, head 876563a merged onto current main (8e6e0bc). No Blocker. One follow-up (R1.1), which does not block.

The four follow-ups from #2220 are closed:

  • Each of the four mutants from #2220 R1.1 now fails a test: line deadline not capped at the hour (TestAnExportCutAtItsDeadlineReadsAsBroken), context without the deadline and skipped 503 branch (TestAnExportOutOfTimeBeforeItsFirstRowIsToldToTryAgain), blank-line skip removed (TestAnImportWithBlankLinesIsRead). I also mutated the other side of the cap (line deadline = time left only): TestAnExportWhoseClientStopsReadingIsLetGo fails.
  • #2220 R1.2: both removed checks cannot change an answer. The error-document deadline ran only when written == 0, and encode was never called then. FETCH on a done context fails on its own (the transaction is rolled back with it).
  • #2220 R1.4: openapi.yaml equals go run ./cmd/openapi, and generated.sh reports in step. go generate (sdks/go) and uv run generate.py (plugins/stream) leave no diff. The JS file passes npm run types --check. No other SDK carries these strings. The README sentences match the code: maxExports = 4, 409, 503, exportWait one hour, exportLineWait one minute, maxImportLine 64 MiB, 413.
  • #2220 R1.3: the 400 reads "this is not an export: an import is one JSON object per line: ..."; the wording itself is not pinned (R1.1).

Tests on the merged tree: TestDataMoveSuite in internal/api (49 pass) and internal/store pass. CI on the head: every check passes, including integration (api), integration (store), integration (router).

  • [Should fix, follow-up] R1.1 — datamove.go:216: the 400 wording is not pinned. Replacing the message with the old one ("this is not an export: "+err.Error()) passes the whole suite. Ready rows, checked to fail under that mutant and pass on head, in DataMoveSuite: (a) POST /v1/data/import?full=true with each export line written by json.MarshalIndent(line, "", " ") (one object over several lines): expect 400 and Contains(failure, "one JSON object per line"); (b) the same export lines written with json.Marshal and no newline between them (two objects on one line): same expectations.

Note: the PR also changes TestAnExportHungUpOnLetsGoAtOnce to seed its 20,000 rows in 20 statements of 1,000 (the PR text names the driver read timeout), which the PR body does not list. The test passes.

Comment thread acceleration/internal/api/datamove.go Resolved

@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.

Approving on the reviewer's GO. The #2220 R1.1 to R1.4 follow-ups are closed. R1.1 here (the new 400 wording is not pinned) is a follow-up with two ready test rows.

@thesyncim
thesyncim merged commit 2952b10 into main Nov 23, 2026
23 of 24 checks passed
@thesyncim
thesyncim deleted the fix/ai-3484-export-rule-tests branch November 23, 2026 23:11
Nash0x7E2 pushed a commit that referenced this pull request Nov 24, 2026
**Changes**
- None to the router: two tests pin the 400 an import answers when a
line is not one JSON object.

**Tests**
- `TestAnImportWithAnObjectOverSeveralLinesIsToldToWriteOnePerLine`: an
export written with each line indented over several lines is answered
400, and the failure says "one JSON object per line". It fails when the
failure is the parser's text alone (`"this is not an export:
"+err.Error()`).
- `TestAnImportWithTwoObjectsOnALineIsToldToWriteOnePerLine`: an export
written with no newline between its lines is answered 400 with the same
words. It fails under the same wording change.

Follow-up to #2253 (Kanat's R1.1)

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

Labels

config data-layer-review: ready Data layer review fix: passed automated review, merges cleanly, ready for a human review docs plugins project-info

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants