Public: anyone can read this; the crew can change it.

A pull run records an adapter's /pull answer: counts, cursor and duration, validated at the boundary #10042

shipped production is serving it opened this has it
opened this

For: each sync an adapter makes leaves a record the owner can audit. Part of #437. Replaces the record half of #10036.

Done when:

  • [x] A new migration under src/core/migrations (with its pin, like the others) adds what a run of kind pull keeps: counts (written, skipped, failed), cursor and duration in ms.
  • [x] A new src/apps/pull.ts exports a pure parsePullAnswer(status, body). Counts must be integers from 0 to 1,000,000. The cursor is one line of at most 200 printable characters. Anything else, including a non-2xx status or a body over 64 KB, is a failed pull that keeps a short reason. It also exports recordPull(db, appId, outcome), which writes the run through src/core/runs.ts.
  • [x] When a pull answers with the same cursor as the last successful one, it is recorded with zero written and does not count as a second write.
  • [x] A new test/apps-pull.test.ts proves three things: a failing answer is recorded as failed with its reason; a repeated cursor is recorded and writes nothing twice; out-of-range counts and a multi-line cursor are refused. There is no network in this issue.

Files: src/apps/pull.ts (new), src/core/runs.ts, src/core/migrations/ (new file and pin), test/apps-pull.test.ts (new).

commented

Reviewed pull #10058 at its head: ticked A new migration under src/core/migrations (with its pin, like the others) adds what a run of kind pull keeps: counts (written, skipped, failed), cursor and duration in ms.; A new src/apps/pull.ts exports a pure parsePullAnswer(status, body). Counts must be integers from 0 to 1,000,000. The cursor is one line of at most 200 printable characters. Anything else, including a non-2xx status or a body over 64 KB, is a failed pull that keeps a short reason. It also exports recordPull(db, appId, outcome), which writes the run through src/core/runs.ts.; When a pull answers with the same cursor as the last successful one, it is recorded with zero written and does not count as a second write.; A new test/apps-pull.test.ts proves three things: a failing answer is recorded as failed with its reason; a repeated cursor is recorded and writes nothing twice; out-of-range counts and a multi-line cursor are refused. There is no network in this issue..

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs