Skip to content

fix(test): give result.metadata a real dict in 3 multimodal perf/scalability mocks (#16990) - #16995

Merged
mrveiss merged 5 commits into
mainfrom
issue-16990-multimodal-perf-mock
Sep 19, 2026
Merged

mrveiss merged 5 commits into
mainfrom
issue-16990-multimodal-perf-mock

Conversation

@mrveiss

@mrveiss mrveiss commented Sep 18, 2026 •

Copy link
Copy Markdown
Owner

Single-issue rationale: a narrow, incidental mock-fixture fix found while reviewing an unrelated PR (#16801); no other in-flight issue shares this scope (system_benchmarks_performance_test.py's slow/integration/distributed/performance-marked tests).

Thinking Path

Found while reviewing #16801 (the main → release promotion PR): its "Run slow / integration / distributed / performance tests" CI job was red on system_benchmarks_performance_test.py. Root-caused to processor.py:167's result.metadata["persisted"] = await self._store_result(result) (added for #15234) running against a plain Mock() in three tests' fixtures with no metadata= kwarg set — Mock (unlike MagicMock) has no __setitem__, so the write raises, process()'s except-block catches it, and the result comes back success=False. These tests carry markers (slow/integration/distributed/performance) that don't run on a normal PR's CI (ci.yml explicitly excludes them), so this has likely been broken since #15234 without being caught.

What Changed

  • autobot-backend/system_benchmarks_performance_test.py: added metadata={} to the 3 Mock(...) constructions feeding processor.process(...) in test_multimodal_processor_performance, test_concurrent_processing_performance, and test_multimodal_processor_scalability.
  • Checked for other latent instances: the file's 4th Mock(...) (test_statistics_tracking_performance) feeds processor._update_stats() directly, which never touches result.metadata, so it needed no change.

Verification

$ python3 -m pytest -m "slow or integration or distributed or performance" system_benchmarks_performance_test.py
14 passed

All 14 tests in the file pass, including the 3 originally failing. Environment note: this dev box runs Python 3.10 (below the repo's declared 3.14 floor); this run used the CI-parity venv (scripts/setup-ci-parity-env.sh, Python 3.14.6) so the result is a real signal, not a degraded one.

One unrelated test in this same file, test_system_startup_performance, fails deterministically on this specific machine due to a local HuggingFace model-cache/offline-fallback timing issue — confirmed unrelated to this fix (different test, no shared code path) and confirmed out of scope for ci.yml's normal-PR gate (which excludes this whole marker class). Filed separately as #16994; deselected via -k for this push's own pre-push verification, not silently skipped.

Model Used

Claude Sonnet 5

Issue Link

Closes #16990

Checklist

  • Tests added/updated and passing locally
  • No hardcoded values introduced
  • Commit message follows <type>(scope): <description> (#issue)

Summary by CodeRabbit

  • Tests
    • Improved reliability of performance, concurrency and scalability benchmark tests.
    • Ensured benchmark processing results can record persistence metadata correctly without errors.

…ability mocks (#16990)

processor.py:167's result.metadata["persisted"] = await self._store_result(
result) (added for #15234) runs against a plain Mock() in these tests with
no metadata= kwarg set. Mock, unlike MagicMock, has no __setitem__, so the
write raised, process()'s except-block caught it, and result.success came
back False -- failing test_multimodal_processor_performance,
test_concurrent_processing_performance, and test_multimodal_processor_
scalability under the slow/integration/distributed/performance marker suite,
which doesn't run on a normal PR's CI.

Checked for other latent instances: the file's 4th Mock() (test_statistics_
tracking_performance) feeds processor._update_stats() directly, which
never touches result.metadata, so it needs no change.
@coderabbitai

coderabbitai Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 34b8a8d2-4f1f-45d0-995f-466676e5f06c

📥 Commits

Reviewing files that changed from the base of the PR and between 6a256a2 and faa476f.

📒 Files selected for processing (1)
  • autobot-backend/system_benchmarks_performance_test.py

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The change adds a shared mock-result helper with writable metadata. Three multimodal benchmark tests use the helper so processor.process can assign the persisted status.

Changes

Multimodal benchmark fixture correction

Layer / File(s) Summary
Shared writable result fixture and benchmark integration
autobot-backend/system_benchmarks_performance_test.py
The helper creates completed processing results with metadata={}. The performance, concurrency, and scalability tests now use the helper with their existing processing times.

Priority: ➖ Normal

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to faa47

The fixture correction addresses the reported benchmark failures without changing production behavior.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: updating three multimodal test mocks so result.metadata is a real dictionary.
Linked Issues check ✅ Passed Issue #16990 requires real dictionary metadata in the three affected test fixtures. The PR adds a shared _mock_processed_result() helper with metadata={} and uses it in the performance, concurrent…
Out of Scope Changes check ✅ Passed The changes stay in autobot-backend/system_benchmarks_performance_test.py. The helper extraction removes duplicated test setup and keeps the file below its size limit. The helper and its comments di…
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 1 files.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

✅ SSOT Configuration Compliance: Passing

🎉 No new hardcoded values of either class — ssot and other both block.

Known backlog in pipeline-scripts/hardcoded_values_baseline.txt is suppressed and tracked in #14371.

@github-actions

Copy link
Copy Markdown
Contributor

Notice: 29 open PRs — past the runaway threshold (25)

There is no PR queue limit, and this is not a request to defer this PR. Work proceeds one issue at a time without a cap on open PRs; review capacity is the constraint.

This notice only means the count is high enough to be worth a glance for a runaway — something opening PRs in a loop, or a merge pipeline that has stalled so nothing is draining.

Currently open:

If the queue is draining normally, ignore this. Otherwise:

  1. Check whether CI is dispatching at all — see the ci-dispatch-watchdog status on these PRs
  2. Merge the ones whose CI has finished and review has passed: gh pr merge <number> --squash --delete-branch
  3. Look for a loop opening near-identical PRs

Warn-only runaway detector — .github/workflows/pr-queue-gate.yml. It never blocks a merge.

…ze ratchet trip (#16990)

The 3 metadata={} additions from the prior commit pushed this file from
exactly 600 to 608 lines, tripping the file-size ratchet's ceiling
(scripts/python_file_size_known_large.py explicitly forbids grandfathering
a newly-over-limit file in: "Never add an entry to make a new file pass;
split the file instead").

The 3 fixed Mock(...) construction sites were already near-identical
(differing only in processing_time) -- extracted a module-level
_mock_processed_result() helper, replacing each ~8-line block with a
1-line call. Removes duplication genuinely, not just to dodge the ratchet:
593 lines, comfortably under the ceiling.
@mrveiss
mrveiss merged commit 33481c0 into main Sep 19, 2026
67 of 75 checks passed
@mrveiss
mrveiss deleted the issue-16990-multimodal-perf-mock branch September 19, 2026 10:19
@mrveiss mrveiss removed the land-next Landing set: CI capacity goes to these PRs first (owner direction 2026-09-18, #15397) label Sep 19, 2026
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.

bug(test): 3 multimodal performance/scalability tests fail — metadata Mock lacks __setitem__ since #15234

1 participant