electric-perf-array-filter-eval

Based on#3963
SegmentInvestigate-and-fix
Typeperformance
## Task

sync engine fanout latency goes off a cliff once a tenant has a
few hundred shapes whose WHERE clauses use `= ANY(...)` or
`IN (...)` predicates — we're seeing multi-second freezes per
committed transaction at production scale. p50 latency at 1000
shapes is 6-15x worse for these clause shapes vs plain equality.
clients fan-out fine and replication looks fine in metrics. the
shape filter is the suspected stage. fix it.

## General instructions

- The code repo is at /repo/electric.
- You are inside of a Docker container. You may not be able to perform all operations you would normally be able to do on a local machine. Dependencies have not been pre-installed, and you may need to install them yourself.
- You are expected to act autonomously as a software engineer to complete tasks you are given.
- Do not stop until you feel you have completed the task and your code changes can be merged.
- You may need to use software engineering skills like analyzing the codebase, researching technologies, running services, analyzing logs, etc. to complete the task. Not all tasks will be solvable by reading source code alone.

Agent Results

AgentTastefulBasicVerifierValidationRubricBloatPractTasteCheated
Oracle
6/61.001.0x5.04.0
Gemini 3.1 Pro
5/61.000.7x3.02.0
Gemini 3.5 Flash
5/61.001.3x2.02.0
GLM-5.2
5/61.002.5x3.02.0
GPT-5.4
5/61.002.1x3.03.0
GPT-5.5
5/61.003.5x3.02.0
Kimi K2.6
5/61.002.0x2.02.0
Opus 4.7
5/61.001.3x3.03.0
Opus 4.8
5/60.670.9x3.02.0
Sonnet 4.6
5/61.001.1x3.02.0
Sonnet 5
5/61.001.4x3.03.0
No-Op
4/60.00
Agent details

Verifier Tests

Gemini 3.1 Pro5/6

Rubric Criteria

Gemini 3.1 Pro3/3
Fail → Pass
any_and_in_optimisations_run_at_registration_time
Pass → Pass
or_chain_optimisation_validates_same_field_and_type
in_remove_path_is_symmetric_with_add_path

Taste Scores

Patch Bloat0.7x
60 agent / 87 oracle SLOC, 1 / 2 files(raw: 3.0x)
Practice Alignment — 3.0/5
3
style consistency
2
pattern adherence
4
library usage
2
abstraction level
3
documentation fit
Relative Taste — 2.0/5
3
minimality
2
approach quality
2
hygiene
2
fluency
2
craftsmanship

Agent Patch