Skip to content

[CP] Massive Logs Support to CLI (#347) to v2.16-develop - #359

Merged
rquidute merged 1 commit into
v2.16-developfrom
cp/347-massive-logs-support-v2.16
Aug 26, 2026
Merged

[CP] Massive Logs Support to CLI (#347) to v2.16-develop#359
rquidute merged 1 commit into
v2.16-developfrom
cp/347-massive-logs-support-v2.16

Conversation

@rquidute

Copy link
Copy Markdown
Contributor

Summary

Cherry-picks 35f877f ("[Fix] Massive Logs Support to CLI", originally merged as #347) from v2.15.1-develop onto v2.16-develop, which never received it.

Why

While investigating a report that test executions "run fast but get stuck at the last step, seemingly processing a huge number of log lines," I traced it to four compounding issues in the log pipeline that are exactly what #347 already fixed upstream:

  1. Blocking, redundant DB commits (test_db_observer.py): every ~0.5s log-flush tick re-queued the same test_run_execution object (with its ever-growing .log list) onto a plain Queue. At the end of the run, draining that queue ran a synchronous session.commit() on the event loop once per queued item, redundantly re-saving the same, increasingly large log blob over and over — this is the "stuck at the end" symptom.
  2. Unchunked websocket broadcasts (test_ui_observer.py): a burst of log lines was sent as one multi-MB websocket message with no yield point during JSON serialization, which can stall the event loop long enough to miss keepalive pongs.
  3. Missed websocket keepalives under load (main.py): uvicorn's default 20s ws_ping_timeout wasn't overridden, so the stall from Updating notices, code of conduct, and readme #2 could get the websocket dropped mid-broadcast.
  4. Whole-file re-reads for SDK step logs (test_case.py): the incremental log tailer had encoding/step-tracking issues that could reprocess large chunks of test_output.txt repeatedly.

v2.16-develop is missing this fix entirely (confirmed via git merge-base --is-ancestor 35f877f returning false), while v2.16-develop is what recent feature work (e.g. #357) is based on — so this regression is currently live on that line.

Conflict resolution

One cherry-pick conflict in test_collections/matter/sdk_tests/support/tests/python_tests/test_python_test_case.py: both branches independently appended unrelated test functions at the same insertion point. Resolved by keeping both sides' additions in full — verified via AST comparison that every function from both parent commits is present in the merged file with an identical AST to its original (i.e. no test was dropped, corrupted, or duplicated), then ran black to normalize the seam's blank-line spacing.

Testing

  • black, isort, flake8, mypy all pass on every changed file (mypy's 1 remaining finding — test_db_observer.py's insp.session attr-defined error — is pre-existing on v2.16-develop prior to this cherry-pick, confirmed by running mypy against the file before applying this PR).
  • Verified via AST-level diff that the conflict resolution preserved 100% of both parents' test functions (32 = 16 base + 7 added upstream in this fix's own tests + 9 added independently on v2.16-develop since diverging).
  • Full pytest suite (Docker/DB-dependent) was not run in the authoring environment; please run ./scripts/test-local.sh before merge.

* Fixing CLI logs interrupting for some edge cases

* Using WS timeout, changing log funcs to async and chunked output and cathing connection close errors

* Stop redundant DB commits and unbounded log broadcasts under high log volume

* Fixing and adding to the unit tests

* Fixing Black linting errors

* Wrapping websocket closure with a try/catch block.

* Fix PR review findings: task ordering, UTF-8 decoding, and encoding safety

  - TestUIObserver: move __async_updates to instance state (was a shared
    class-level list, leaking Task references across runs)
  - TestUIObserver: broadcast each flush's chunks in order via one
    sequential task instead of one independent task per chunk
  - test_harness_client: use explicit UTF-8 encoding for the SDK log file
  - test_case: read test_output.txt incrementally with a persistent UTF-8
    decoder so split multi-byte characters aren't corrupted across reads
  - test_case: stream display_batch_logs()/_log_remaining_content()
    instead of loading the whole file into memory

* Fixing ui observer unit test
@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 665132fb-1265-4e22-81b5-65e8950c65f2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@mergify

mergify Bot commented Aug 26, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@rquidute rquidute self-assigned this Aug 26, 2026
@antonio-amjr

Copy link
Copy Markdown
Contributor

Gentle reminder: please cherry-pick also the CLI_PR#107 to the CLI repo

@rquidute
rquidute merged commit f13ef24 into v2.16-develop Aug 26, 2026
8 of 9 checks passed
@rquidute
rquidute deleted the cp/347-massive-logs-support-v2.16 branch August 26, 2026 16:19
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.

3 participants