Skip to content

[chore] Correct three test comments that claimed more than the tests prove - #6687

Merged
mmabrouk merged 2 commits into
release/v0.115.3from
fix/release-1153-session-context-comments
Sep 8, 2026
Merged

[chore] Correct three test comments that claimed more than the tests prove#6687
mmabrouk merged 2 commits into
release/v0.115.3from
fix/release-1153-session-context-comments

Conversation

@mmabrouk

@mmabrouk mmabrouk commented Sep 8, 2026

Copy link
Copy Markdown
Member

Context

Three comments and one test name in #6667 claim more than the code does. A Codex review caught them after that PR had been approved, so they landed with it. A CodeRabbit review of this PR then found that my first attempt at one of them was wrong on two further counts. Nothing here changes behaviour, and no assertion moves.

Changes

A comment described an ordering pytest does not guarantee, and the fixtures now enforce it. sdk_singleton and backend_facts are both function-scoped with no dependency between them, so their relative order is unspecified. Argument order in the test signature does not decide it. One of them sets an environment variable the other reads, so backend_facts now depends on sdk_singleton and the order is a real dependency rather than a described one.

That ordering was the smaller half. init prefers AGENTA_API_INTERNAL_URL, then AGENTA_API_URL, over the host passed to it, and derives the host from whichever is set. Either can already be in the environment, so no amount of fixture ordering settles where the exporter points. The comment no longer names a target. It says the host is a preference that either variable overrides, and keeps the claim that does hold: isolation is not needed here, because nothing reads a span and the exporter flushes off the request path, so a failed export cannot change a result.

The fixture docstring claimed to own the SDK singleton. It restores the ag.tracing alias and nothing else. init also replaces the singleton's api, async_api, and tracer, and installs a provider and exporter, and those stay. The docstring now states that narrower guarantee, and notes that pytest unwinds the fixture after a failing test but not after a failure raised before the yield.

A test was named for a close that always happens. test_the_client_is_always_closed_on_the_abandonment_path proves the context manager's exit is entered and that the caller does not wait for it. It cannot prove the close completes, and nothing can: if aclose hangs there is no way past it. Renamed to test_the_clients_close_is_entered_on_the_abandonment_path, with the limit stated.

Tests

No test logic changed. Services unit 167 passed; the SDK session-context suite 48 passed. ruff format and check clean at the CI-pinned 0.15.12.

Notes

Timing on the merge, not a judgment call: these were flagged in a review round that finished after #6667 was approved, and the release manager chose not to spend another CI cycle on comment-only edits. This PR can ride the next batch or move to v0.115.4.

One thing worth carrying forward. Both wrong versions of the exporter comment came from running pytest --setup-show, seeing an order, and writing it down as though it were guaranteed. Observing an order is not the same as pytest promising one, which is why the fix here is a dependency rather than better wording.

Follow-up to #6667, comment and name only, no behaviour change.

The exporter comment described the ordering backwards. The fixture sets up
before the one that sets AGENTA_API_URL, so the loopback host is used; an
ambient value would still win, which is why this is not exporter isolation.

The fixture docstring said it owns the SDK singleton. It restores the
ag.tracing alias and nothing else, and init also replaces api, async_api and
the tracer and installs a provider.

The abandonment test was named for a close that always happens. What it can
prove is that the close is entered and that the caller does not wait for it.
@vercel

vercel Bot commented Sep 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
agenta-documentation Ready Ready Preview Sep 8, 2026 8:23pm UTC

Request Review

@mmabrouk

mmabrouk commented Sep 8, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

📝 Summary

Summary by CodeRabbit

  • Documentation
    • Clarified test documentation for session abandonment and client close behavior.
    • Documented SDK fixture restoration and cleanup behavior, including exporter handling when the API URL is absent or already configured.

Walkthrough

The pull request clarifies an abandonment-path test name and docstring. It also expands SDK singleton fixture documentation for restoration scope, initialization effects, exporter selection, and failure cleanup.

Changes

Test lifecycle clarification

Layer / File(s) Summary
Lifecycle test contracts
sdks/python/oss/tests/pytest/unit/agents/platform/test_session_context_http.py, services/oss/tests/pytest/unit/agent/test_session_context_resolution.py
The test name and docstring now state that client close is entered without asserting completion. The fixture documentation defines restoration scope, initialization side effects, exporter selection, and cleanup behavior.

Priority: ⬇️ Low

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

Merge Risk: 🔵 Low · up to c589f

The fixture documentation may mislead maintainers about which API URL the test exporter uses, making future test changes harder to reason about. Clarify the ordering or declare it explicitly before merge.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 60.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the correction of three overstated test comments and accurately reflects the main changeset.
Description check ✅ Passed The description directly explains the corrected comments, test name, fixture behavior, and unchanged test behavior.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/release-1153-session-context-comments

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

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Status Destroyed (PR closed)

Updated at 2026-09-08T20:33:12.401Z

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Advanced

Run ID: dc05feba-27d9-40f0-9e76-36fbd9fb2eb6

📥 Commits

Reviewing files that changed from the base of the PR and between 3ded1f9 and c589f92.

📒 Files selected for processing (2)
  • sdks/python/oss/tests/pytest/unit/agents/platform/test_session_context_http.py
  • services/oss/tests/pytest/unit/agent/test_session_context_resolution.py

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

Comment thread services/oss/tests/pytest/unit/agent/test_session_context_resolution.py Outdated
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Two function-scoped fixtures with no dependency have no guaranteed order, so a
comment describing one was asserting something pytest does not promise.
backend_facts now depends on sdk_singleton, which is the fixture whose
environment variable the other reads.

The comment no longer claims where the exporter points either. init prefers
AGENTA_API_INTERNAL_URL and then AGENTA_API_URL over the host passed to it, and
either can be ambient, so ordering alone settles nothing. The claim that does
hold is that isolation is not needed here.
@mmabrouk
mmabrouk merged commit e1681c0 into release/v0.115.3 Sep 8, 2026
49 of 50 checks passed
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.

1 participant