Skip to content

fix(backend): restore pyright-clean main after #22207 and #22326 - #22539

Merged
Git-on-my-level merged 2 commits into
mainfrom
fix/main-red-22207-pyright
Oct 19, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
fix/main-red-22207-pyright

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Summary

Fix-forward for red main. #22207 merged as 6881acc with Backend unit shards 1–6 failing; every shard failed the enforced pyright lane with the same 16 errors (unit tests themselves passed). #22326, which landed on top of #22452, then pushed process_segment past pyright's complexity limit.

No skips, no # type: ignore, no config changes.

After the first push, this PR's own shards 1/3/4/6 also failed on five test files that are red on current main for reasons unrelated to #22207. Each passed on its own PR's base and broke when main moved underneath it. All five fixes are test-only:

Branch lane/main-red-22207 into main.

Lane / contract

Lane main-red (two-lane lead fix-forward), contract: CI-green main; owner sign-offs for edits to other lanes' files: none

Product invariants affected

none

Verification

  • pyright 1.1.403 (-p pyrightconfig.json, repo venv) on both touched files: 17 errors → 0 errors.
  • Targeted unit tests, per-file sessions, on m5: all 55 files under backend/tests/unit that reference process_segment, utils.sync.pipeline or desktop_previews pass (includes test_desktop_previews.py, test_database_desktop_previews_resilience.py, test_sync_v2.py, test_sync_cap_hold_recovery.py, test_sync_cloud_tasks.py).
  • The five repaired files pass per-file on m5 (request_context 2, batch_upload_storage 33, from_segments 66, external_tools_sanitization 5, joan tombstone guard 6). Before the fix, all five failed identically with and without this PR's source changes.
  • Full backend unit suite via m1-check plus the PR's own CI shards. Not run: integration/emulator suites, since the change is typing plus a refactor.

Rollback

Revert the commits. Main returns to its pyright-red and test-red state; runtime behaviour is identical either way, because the second commit is test-only.

Failure-Class: none
Line-Count-Exception: backend/utils/sync/pipeline.py | 3566 -> 3580 | lane main-red: growth reviewed; extracting _assign_segment_speakers to clear pyright's complexity limit adds a signature (+14 net after deduplicating the cap-hold block)

🤖 Generated with Claude Code

Main's backend unit shards fail the enforced pyright lane:

- database/desktop_previews.py (#22207): 16 reportUnnecessaryIsInstance
  errors. The runtime guards stay; they move into validators that take
  `object` (_payload, _string, _expected_generation, _datetime), so the
  checks are meaningful to pyright. Public signatures, error messages and
  check order are unchanged.
- utils/sync/pipeline.py:process_segment (#22326 on top of #22452):
  "code is too complex to analyze". Behaviour-neutral split: the two
  identical cap-hold defer blocks become one hold_for_cap closure, and the
  final-pass / speaker-identification block moves to
  _assign_segment_speakers with the same exception handling.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-19T15:41:26.013052Z 5ab8062 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

Five unit files fail on current main. Each one passed on its own PR's base
and broke when main moved underneath it; none is a product regression.

- test_request_context.py (#19738): tested the JIT budget surface that
  #22209 removed from llm_gateway/gateway/request_context.py. Keep the
  request-id tests; drop the tests for removed code.
- test_users_joan_followup_tombstone_guard.py (#19867): called
  delete_person_endpoint, but the joan followup route is
  delete_followup_question_endpoint.
- test_developer_from_segments_idempotency.py (#21265): process fakes
  rejected the trigger=CLIENT_FINALIZE kwarg the router passes since #19788.
- test_external_tools_sanitization.py (#19406): the stubbed utils package
  lacked utils.generated_compute (#21488) and utils.model_text. Stub the
  default-off gate as disabled and load the stdlib-only model_text for real.
- test_batch_upload_storage.py: the database.vector_db stub lacked
  delete_action_item_vectors_batch, which merge_conversations imports since
  #15953.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit 1e2c55a into main Oct 19, 2026
61 checks passed
@Git-on-my-level
Git-on-my-level deleted the fix/main-red-22207-pyright branch October 19, 2026 18:01
aryanorastar added a commit that referenced this pull request Oct 20, 2026
Main's #22539 restored type checking by keeping process_segment whole with
an analyzer-ceiling ignore instead of extracting
_record_sync_segment_exception, so the boundary note this PR added no
longer describes the code. The regression tests stay; they exercise
behavior and pass against main's implementation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
aryanorastar added a commit that referenced this pull request Oct 21, 2026
…gment outcomes (#22558)

## Summary

Regression tests for desktop-preview validation and sync segment
outcomes.

This PR originally restored type checking in
`backend/database/desktop_previews.py` and
`backend/utils/sync/pipeline.py`. Main's #22539 has since fixed the same
problem in both files, so the production changes were dropped in favor
of main's code. What remains is test coverage that passes against main's
implementation:

- `test_database_desktop_previews_resilience.py`: untrusted preview
metadata (non-dict payloads, wrong types, bad generations) is rejected
by the validators rather than crashing.
- `test_sync_capture_pipeline.py`: segment assignment outcomes through
`process_segment`.

## Verification

- Both files pass on the merged tree against main's code (82 passed),
each run in its own pytest process.
- No production code, flag, deployment or data change.

Failure-Class: none

## Product invariants affected

none

🤖 Generated with [Claude Code](https://claude.com/claude-code)
aryanorastar added a commit that referenced this pull request Oct 21, 2026
…tate (#22595)

## Summary

Makes three backend test files independent of deployment state and the
fast-unit CPU budget. Main's backend CI is green, and most of the drift
this PR first repaired has since been fixed on main (#22494, #22539);
those edits were dropped in favor of main. What remains:

- `test_developer_from_segments_idempotency.py`: a `segment_api_client`
fixture builds the FastAPI router and auth overrides once, outside the
request being measured, so router setup no longer counts against the
fast-unit CPU guard.
- `test_modulate_stt.py`: the "Deepgram disabled" cases patch
`PROVIDER_SERVING_SURFACES` explicitly instead of relying on whichever
providers the current policy happens to disable. They are renamed from
"retired" to "disabled" to say what they test.
- `test_streaming_deepgram_backoff.py`: adds coverage that a configured
cloud Deepgram serves the available streaming languages, alongside the
existing refusal cases.

## Verification

- All three files pass on the merged tree (66 + 104 + 86 passed), each
in its own pytest process.
- Test-only; no production code, flag, deployment or data change.

Failure-Class: none

## Product invariants affected

none

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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