Repository navigation
Conversation
A sample counts its analyses from the catalog: getAnalysesNum reads the review state of each one from its brain, and getProgress is computed from that count. Both are catalog metadata on the sample. An analysis promotes its submit and its verify to the sample from within its own after-transition event, which runs before the machinery that reindexes the analysis. The sample is therefore reindexed while the brain of the analysis that triggered it still carries the state it had before, and it stores a count and a progress that are one analysis behind. A verified sample with a single analysis reports 33% instead of 66%, and its analyses count reads "nothing verified, one waiting" although the analysis is verified and the sample is not. With two analyses it reports 60% instead of 80%. The error is the last analysis of each sample, which is the one that moves the sample, so it shows on every sample a laboratory ever submits or verifies. Reindexing the state of the analysis before anything is promoted is enough. review_state is both an index and a metadata column on every senaite catalog, and reindexObject passes update_metadata=1 along with the index list, which the queue carries and the catalog multiplex processor honours, so the brain the sample then reads is current.
ramonski
force-pushed
the
fix/sample-progress-one-analysis-behind
branch
from
October 10, 2026 08:45
e494248 to
875df68
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the issue/feature this PR addresses
A sample counts its analyses from the catalog:
getAnalysesNumreads the review state of each analysis from its brain, andgetProgressis computed from that count. Both are catalog metadata on the sample, and the samples listing draws the progress bar from them.An analysis promotes its
submitand itsverifyto the sample from within its own after-transition event, which runs before the machinery that reindexes the analysis. The sample is therefore reindexed while the brain of the analysis that triggered it still carries the state it had before, and it stores a count and a progress that are one analysis behind.The error is always the last analysis of a sample, which is the one that moves the sample, so it shows on every sample a laboratory ever submits or verifies.
Current behavior before PR
A verified sample with one analysis, read back from the catalog:
The analysis itself is verified and the sample is verified, but the sample's own metadata says nothing is verified and one analysis is still waiting. The progress bar reads 33% where the formula gives 66%. With two analyses it reads 60% instead of 80%.
Desired behavior after PR is merged
And for two analyses, 80% verified and 40% submitted.
Why reindexing the state alone is enough
review_stateis both a FieldIndex and a metadata column on every senaite catalog (BaseCatalog.INDEXESandCOLUMNS), and the count is read from the metadata.reindexObject(idxs=["review_state"])passesupdate_metadata=1along with the index list,IndexQueuecarries it throughoptimize(), andCatalogMultiplexProcessor.reindexhands it to_reindexObject. The brain the sample then reads is current, and nothing else about the analysis is reindexed twice.The placement matters more than the scope. The queue merges the entries for one object at the position of that object's first entry, so reindexing the analysis after the sample has already been told about the transition is too late. It goes before anything is promoted.
Verification
[1, 1, 0, 0]and 66%; a two-analysis sample reports[2, 2, 0, 0]and 80% verified,[0, 2, 0, 2]and 40% submitted. Before the change, 33%, 60% and 40%. Reproduced across several fresh instances.bin/test-senaite -s senaite.core -t "Workflow*": 33 tests, 0 failures.bin/test-senaite -s senaite.core -t "Analysis*": 42 tests, 0 failures.