Skip to content

fix(embeddings): a set is counted once it is complete, and once for all its readers - #1288

Merged
frapercan merged 1 commit into
integration/three-familiesfrom
fix/a-set-is-counted-once-it-is-complete
Nov 22, 2026
Merged

frapercan merged 1 commit into
integration/three-familiesfrom
fix/a-set-is-counted-once-it-is-complete

Conversation

@frapercan

Copy link
Copy Markdown
Owner

A prediction set is counted on its first read and the counts are kept
(#1279). Two cases broke that.

A set's page asks for the detail, the proteins and the terms at once, and
on a set nobody had opened each of the three counted it in parallel. On
the re-run count map of 211->227 (11.3 million rows, the store busy with
a retrieval) they outlasted the web's proxy, which answered 500 while the
API went on and kept the counts. A lock per set (pg_advisory_xact_lock)
now makes the later readers wait for the first count, read the set again
under the lock, and return what it kept.

And nothing stopped a page opened while its set was still being written
from freezing a partial count for good. A set is kept now only once the
job that writes it has ended (succeeded, failed or cancelled: a set holds
every row it will once its job stops) or when it names no job. While the
job runs the set is counted live and returned with provisional set,
nothing kept: its proteins are paged straight from its pairs, the detail
says counts_provisional, and its page says the set is still being
written. The sweep (summarize_prediction_sets) leaves such a set for the
next sweep and says so.

The set page's loading note said the counts are computed on every visit,
which #1279 ended; it says now that a set is counted on its first visit.

Checks

  • On dev, every kept summary was compared with its set's rows before the change: 103 of 103 agree, so no partial count had been kept yet.
  • New tests against Postgres: a set whose job runs is read live and nothing is kept, then kept once the job succeeds; a failed job's set is kept as it was left; a reader that waited returns the kept summary without counting again; the sweep leaves a set still being written. The web: the page says the counts are provisional for such a set and says nothing of the kind for a complete one.
  • mypy 1.19.1 on the touched modules: clean. Lint gates pass. eslint on the set page reports the five problems the base version reports.
  • Whole suite against Postgres: 7812 passed, 78 skipped, 11 xfailed, 2 xpassed.

…ll its readers

A prediction set is counted on its first read and the counts are kept
(#1279). Two cases broke that.

A set's page asks for the detail, the proteins and the terms at once, and
on a set nobody had opened each of the three counted it in parallel. On
the re-run count map of 211->227 (11.3 million rows, the store busy with
a retrieval) they outlasted the web's proxy, which answered 500 while the
API went on and kept the counts. A lock per set (pg_advisory_xact_lock)
now makes the later readers wait for the first count, read the set again
under the lock, and return what it kept.

And nothing stopped a page opened while its set was still being written
from freezing a partial count for good. A set is kept now only once the
job that writes it has ended (succeeded, failed or cancelled: a set holds
every row it will once its job stops) or when it names no job. While the
job runs the set is counted live and returned with provisional set,
nothing kept: its proteins are paged straight from its pairs, the detail
says counts_provisional, and its page says the set is still being
written. The sweep (summarize_prediction_sets) leaves such a set for the
next sweep and says so.

The set page's loading note said the counts are computed on every visit,
which #1279 ended; it says now that a set is counted on its first visit.
@frapercan
frapercan marked this pull request as ready for review November 22, 2026 01:12
@frapercan
frapercan merged commit 48b6719 into integration/three-families Nov 22, 2026
21 checks passed
@frapercan
frapercan deleted the fix/a-set-is-counted-once-it-is-complete branch November 22, 2026 01:12
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