Skip to content

chore(coverage): stop adapter coverage from depending on packet timing - #946

Merged
yordis merged 2 commits into
masterfrom
yordis/fix-deterministic-adapter-coverage
Sep 28, 2026
Merged

yordis merged 2 commits into
masterfrom
yordis/fix-deterministic-adapter-coverage

Conversation

@yordis

@yordis yordis commented Sep 28, 2026

Copy link
Copy Markdown
Member
  • Master CI failed the 100% coverage gate with every test passing, because some adapter branches only ran when the server's response happened to split across packets a certain way, or when DNS answered fast enough.
  • A coverage gate that flips on scheduler luck reddens unrelated merges and hides real gaps, so each of those branches now has a test that pins the packet layout it needs.

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@yordis
yordis requested a review from a team as a code owner September 28, 2026 12:03
Copilot AI lite review requested due to automatic review settings September 28, 2026 12:03
@github-actions github-actions Bot added the chore label Sep 28, 2026
@cursor

cursor Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Test-only changes; no production adapter logic is modified.

Overview
Makes Tesla adapter test coverage deterministic so CI’s 100% coverage gate no longer depends on DNS timing or how TCP splits HTTP responses.

Finch: The streaming error test now targets a closed local listener (:econnrefused) instead of nonexistent.invalid, so the failure path is exercised reliably.

Gun: Adds a test that forces Gun’s final {:gun_data, …, :fin, data} to arrive as separate :nofin and :fin messages via a reply_to splitter, covering plain-body assembly across multiple messages.

Mint: Adds a "responses split into scripted packets" suite that injects scripted {:tcp, socket, packet} sequences (headers-only, body split across packets, chunked vs plain, :stream / :chunks / max_body) so packet-boundary branches are hit without scheduler luck.

Reviewed by Cursor Bugbot for commit f913388. Bugbot is set up for automated code reviews on this repo. Configure here.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Gun tests do not deterministically pin packet layout, so the targeted coverage branch may remain untested.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

Stabilizes adapter coverage by making packet layouts and connection failures deterministic.

Changes:

  • Adds scripted Mint packet tests.
  • Adds Gun multi-part response coverage.
  • Uses a refused loopback connection for Finch failure testing.
File Reviewed changes
test/​tesla/​adapter/​mint_test.exs Adds deterministic packet-layout tests.
test/​tesla/​adapter/​gun_test.exs Adds multi-part body coverage, but relies on timing-sensitive sends.
test/​tesla/​adapter/​finch_test.exs Replaces DNS-dependent failure testing.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread test/tesla/adapter/gun_test.exs Outdated
…n TCP segmentation

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@yordis
yordis merged commit f1d040b into master Sep 28, 2026
12 checks passed
@yordis
yordis deleted the yordis/fix-deterministic-adapter-coverage branch September 28, 2026 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants