Skip to content

fix(auto): *Options.from now resolves repeated options to the last occurrence - #627

Open
lbialy wants to merge 3 commits into
mainfrom
fix/correct-the-auto-api-setting-application-logic
Open

fix(auto): *Options.from now resolves repeated options to the last occurrence#627
lbialy wants to merge 3 commits into
mainfrom
fix/correct-the-auto-api-setting-application-logic

Conversation

@lbialy

@lbialy lbialy commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

*Options.from now resolves repeated options to the last occurrence

@lbialy
lbialy requested a balanced review from Copilot August 28, 2026 21:19
@lbialy lbialy added kind/bug Some behavior is incorrect or out of spec area/automation-api The Automation API labels Aug 28, 2026

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.

Pull request overview

Updates automation option merging so repeated options use the last occurrence.

Changes:

  • Refactors option reducers to left-fold with last-value precedence.
  • Preserves accumulation for environment maps.
  • Reorders workspace shell options and adds regression tests.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
ShellTest.scala Tests repeated environment keys.
OptionsTest.scala Tests last-occurrence behavior across option types.
Workspace.scala Reorders shell options by precedence.
Stack.scala Updates stack option reducers.
shell.scala Updates shell option merging.
LocalWorkspace.scala Updates workspace option merging.
auto.scala Updates login/logout option merging.
Suppressed comments (5)

auto/src/main/scala/besom/auto/internal/auto.scala:245

  • This conversion removes the prior invalid-option guard, so LogoutOptions.from(List(null)) now leaks MatchError rather than AutoError. Add an explicit null case to preserve the existing failure behavior.
      opt match

auto/src/main/scala/besom/auto/internal/Stack.scala:1018

  • The previous fallback converted an invalid/null up option to AutoError; this exhaustive match instead throws MatchError for UpOptions.from(List(null)). Retain the former error contract with an explicit null case.
      opt match

auto/src/main/scala/besom/auto/internal/Stack.scala:1175

  • The previous fallback converted an invalid/null refresh option to AutoError; this exhaustive match instead throws MatchError for RefreshOptions.from(List(null)). Retain the former error contract with an explicit null case.
      opt match

auto/src/main/scala/besom/auto/internal/Stack.scala:1324

  • The previous fallback converted an invalid/null destroy option to AutoError; this exhaustive match instead throws MatchError for DestroyOptions.from(List(null)). Retain the former error contract with an explicit null case.
      opt match

auto/src/main/scala/besom/auto/internal/Stack.scala:1377

  • This removes the explicit null handling that previously raised AutoError("Unexpected null history option"); HistoryOptions.from(List(null)) now throws MatchError. Preserve the deliberate error type and message with a null case.
      opt match

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

Comment thread auto/src/main/scala/besom/auto/internal/shell.scala
Comment thread auto/src/main/scala/besom/auto/internal/LocalWorkspace.scala
Comment thread auto/src/main/scala/besom/auto/internal/auto.scala
Comment thread auto/src/main/scala/besom/auto/internal/Stack.scala
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/automation-api The Automation API kind/bug Some behavior is incorrect or out of spec

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants