R5 follow-up: find({type:[array]}) still partial under interleaved writes (7.28.0/cortex 2.5.0) #2
Open
opened 2026-05-29 00:54:52 +02:00 by dpsifr
·
0 comments
No Branch/Tag specified
main
feat/8.0-u64-ids
feat/3.0-diskann
feat/aggregation-percentile-distinct
feat/v4.0.0-vector-metadata-separation
brainy-2.0-clean
feature/enterprise-improvements
cleanup-1.0
v8.9.0
v8.8.2
v8.8.1
v8.8.0
v8.7.1
v8.7.0
v8.6.0
v8.5.2
v8.5.1
v8.5.0
v8.4.0
v8.3.3
v8.3.2
v8.3.1
v8.3.0
v8.2.8
v8.2.7
v8.2.6
v8.2.5
v8.2.4
v8.2.3
v8.2.2
v8.2.1
v8.2.0
v8.1.0
v8.0.17
v8.0.16
v8.0.15
v8.0.14
v8.0.13
v8.0.12
v8.0.11
v8.0.10
v8.0.9
v8.0.8
v8.0.7
v7.33.5
v8.0.0-rc.9
v8.0.0-rc.8
v8.0.0-rc.7
v7.33.4
v8.0.0-rc.6
v8.0.0-rc.5
v7.33.3
v8.0.0-rc.4
v7.33.2
v8.0.0-rc.3
v7.33.1
v8.0.0-rc.2
v8.0.0-rc.1
v7.33.0
v7.32.2
v7.32.1
v7.32.0
v7.31.8
v7.31.7
v7.31.6
v7.31.5
v7.31.4
v7.31.3
v7.31.2
v7.31.1
v7.31.0
v7.30.2
v7.30.1
v7.30.0
v7.29.0
v7.28.0
v7.27.0
v7.26.0
v7.25.0
v7.24.0
v7.23.0
v7.22.1
v7.22.0
v7.21.0
v7.20.0
v7.19.19
v7.19.18
v7.19.17
v7.19.16
v7.19.15
v7.19.14
v7.19.13
v7.19.11
v7.19.10
v7.19.9
v7.19.8
v7.19.7
v7.19.6
v7.19.5
v7.19.2
v7.19.1
v7.19.0
v7.18.0
v7.17.0
v7.16.0
v7.15.5
v7.15.4
v7.15.3
v7.15.2
v7.15.0
v7.14.0
v7.13.0
v7.12.0
v7.11.0
v7.10.0
v7.9.3
v7.9.2
v7.9.1
v7.9.0
v7.8.0
v7.7.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v3.40.3
v3.40.2
v3.40.1
v3.40.0
v3.39.0
v3.38.0
v3.37.8
v3.37.7
v3.37.6
v3.37.5
v3.37.4
v3.37.3
v3.37.2
v3.37.1
v3.37.0
v3.36.1
v3.36.0
v3.35.0
v3.34.0
v3.32.2
v3.32.1
v3.32.0
v3.31.0
v3.30.2
v3.30.1
v3.30.0
v3.29.1
v3.29.0
v3.28.0
v3.27.1
v3.27.0
v3.26.0
v3.25.2
v3.25.1
v3.25.0
v3.24.0
v3.23.1
v3.23.0
v3.22.0
v3.21.0
v3.20.5
v3.20.4
v3.20.3
v3.20.2
v3.20.1
v3.20.0
v3.19.2
v3.19.1
v3.19.0
v3.18.0
v3.17.0
v3.16.0
v3.15.0
v3.14.2
v3.14.1
v3.14.0
v3.13.0
v3.12.0
v3.10.1
v3.10.0
v3.9.1
v3.9.0
v3.8.3
v3.8.2
v3.8.1
v3.8.0
v3.7.1
v3.7.0
v3.6.0
v3.5.1
v3.5.0
v3.3.1
v3.3.0
v3.2.0
v3.1.1
v3.1.0
v3.0.1
v3.0.0
recovery-v3.0-20250910
v2.15.0
v2.14.3
v2.14.2
v2.14.1
v2.14.0
v2.12.0
v2.11.0
v2.10.1
v2.10.0
v2.9.0
v2.8.0
v2.7.4
v2.7.3
v2.7.2
v2.7.1
v2.7.0
v2.6.0
v2.5.0
v2.4.0
models-v2
v2.3.0
v2.1.0
v2.0.2
v2.0.1
models-v1
v2.0.0
session-4-optimizations
v1.5.0
v1.4.0
v1.2.0
v1.1.2
v1.1.1
v1.1.0
v0.62.3
v0.62.2
v0.62.1
v0.62.0
v0.61.3
v0.61.2
v0.61.1
v0.61.0
v0.60.0
v0.59.3
v0.59.2
v0.59.0
v0.58.1
v0.58.0
v0.57.1
v0.57.0
v0.56.0
v0.55.0
v0.54.7
v0.54.6
v0.54.5
v0.54.4
v0.54.3
v0.54.2
v0.54.1
v0.54.0
v0.53.0
v0.52.0
v0.49.0
v0.48.1
v0.48.0
v0.47.0
v0.46.0
v0.45.0
v0.44.0
v0.43.0
brainy-models-v1.0.0
v0.41.0
v0.40.0
v0.39.0
v0.38.0
v0.37.0
v0.36.0
v0.35.0
v0.34.0
models-package-v0.7.0
brainy-models-v0.7.0
models-package-v0.6.0
brainy-models-v0.6.0
brainy-models-v0.5.0
v0.1.0
v0.33.0
v0.32.0
v0.31.0
v0.30.0
v0.29.0
v0.28.0
v0.27.1
v0.27.0
v0.26.0
v0.25.0
v0.24.0
v0.23.0
v0.22.0
v0.21.0
v0.20.0
v0.19.0
v0.18.0
v0.17.0
v0.16.0
v0.15.0
v0.14.0
v0.13.0
v0.12.0
v0.11.0
v0.10.0
v0.9.37
v0.9.36
v0.9.35
v0.9.34
v0.9.33
v0.9.32
v0.9.31
v0.9.29
v0.9.28
v0.9.26
v0.9.23
v0.9.22
v0.9.21
v0.9.20
v0.9.19
v0.9.18
v0.9.17
v0.9.16
v0.9.15
v0.9.14
v0.9.13
v0.9.12
v0.9.11
v0.9.10
v0.9.9
v0.9.8
v0.9.7
v0.9.6
v0.9.5
test
v0.9.4
v0.9.3
v0.9.2
v0.9.1
v0.9.0
v0.8.11
v0.8.10
v0.8.9
v0.8.8
v0.8.7
v0.8.6
v0.8.5
v0.8.4
v0.8.3
v0.8.2
v0.8.1
v0.8.0
v0.7.7
v0.7.6
v0.7.5
v0.7.4
v0.7.3
v0.7.2
v0.7.1
v0.7.0
v0.6.0
v0.5.3
v0.5.2
v0.5.1
v0.5.0
v0.4.1
v0.4.0
v0.3.6
v0.3.5
v0.3.4
v0.3.3
v0.3.2
v0.3.1
v0.3.0
v0.2.6
v0.2.5
v0.2.4
v0.2.3
v0.2.1
v0.2.0
Labels
Clear labels
Something isn't working
Improvements or additions to documentation
This issue or pull request already exists
New feature or request
Good for newcomers
Extra attention is needed
This doesn't seem right
Further information is requested
This will not be worked on
bug
Something isn't working
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
question
Further information is requested
wontfix
This will not be worked on
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set.
Reference: soulcraft/brainy#2
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
R5 follow-up:
find({ type: [array] })still returns partial/empty results after interleaved writes (Brainy 7.28.0 + Cortex 2.5.0)TL;DR
The R5 fix in 7.28 closed the simple repro (
find({ type:[arr], orderBy })on a freshly-written brain returns the right count consistently). But under a realistic access pattern — interleavedadd/update/findcalls on a long-lived brain —find({ type: [array] })still intermittently returns 0 entities while the same query without thetypefilter returns the correct count.Affects:
@soulcraft/brainy7.28.0@soulcraft/cortex2.5.0Observed in production-style code
This is how the Memory service triggers it. The "list all memories" query has three flavours that should agree on count; they don't:
Output across calls in a long-lived brain that has interleaved
add+updatetraffic:Two distinct bugs visible:
brain.add(...)+ (implicit) flush, the firstfind({ type:[array] })call returns 0 — same shape as R5, just under a different trigger (interleaved updates rather than fresh-write).combo=0. After many successful queries,find({ type:[array], where:{retracted:{missing:true}} })returns 0 whilefind({ where:{retracted:{missing:true}} })(no type filter) returns the correct 11. So thetype:[array]filter is intermittently producing an empty intersection.noWhereandnoTypenever drop to 0 once the brain has entities — the failure mode is specifically on queries that includetype: [array].Minimal repro
Workaround in consumer code
Dropping the
typefilter and post-filtering noun types in JS makes the query stable. That's what we'd like to not have to do — it forces an over-fetch and a hot-path JS loop on every list/recall query.Asks
find({ type: [array] })still returns partial/empty results on long-lived brains with interleaved writes — first call AND mid-stream.type:[]filter using a different index path than single-typeorwhere? The fact thatwhere:retracted:missingalone is stable whiletype:[array]alone (and combined) is unstable points at the type-array index code.tests/brainy-probes.test.ts(we maintain a Brainy capability probe that gates upgrades — happy to share or upstream it).Reproducer from the Memory service. Happy to provide a self-contained brainy directory tarball if useful.