Skip to content

Refactor: Improve ai-code-backends-infra.el#256

Open
tninja wants to merge 5 commits intomainfrom
kang_feat
Open

Refactor: Improve ai-code-backends-infra.el#256
tninja wants to merge 5 commits intomainfrom
kang_feat

Conversation

@tninja
Copy link
Owner

@tninja tninja commented Mar 22, 2026

Using C-c a r to auto suggest the best point to improve, with codex gpt 5.4 x-high model

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors session lifecycle handling in ai-code-backends-infra.el by extracting repeated logic into focused helper functions, and adds ERT coverage to lock in the refactored behavior. This supports the backend session UX (toggle/reuse/create) while keeping behavior stable and making the core flow easier to reason about.

Changes:

  • Extracted session target/context resolution into ai-code-backends-infra--resolve-session-target and ai-code-backends-infra--resolve-session-context.
  • Extracted session reuse, successful startup finalization, and startup failure handling into dedicated helpers.
  • Added ERT tests covering session reuse behavior, target/context resolution, startup finalization, and startup failure UI messaging.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
ai-code-backends-infra.el Refactors session toggle/create flow into smaller helpers for target resolution, reuse, finalize, and failure handling.
test/test_ai-code-backends-infra.el Adds focused ERT tests validating the new helper behaviors and ensuring no regressions in session lifecycle behavior.

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.

2 participants