Skip to content

fix(orchestrator): hoist --force flag evaluation above TTY check#55

Merged
JacksonFergusonDev merged 1 commit intomainfrom
fix/make-force-flag-unconditional
Mar 15, 2026
Merged

fix(orchestrator): hoist --force flag evaluation above TTY check#55
JacksonFergusonDev merged 1 commit intomainfrom
fix/make-force-flag-unconditional

Conversation

@JacksonFergusonDev
Copy link
Copy Markdown
Owner

Overview

This PR fixes a control flow bug in Orchestrator._evaluate_collisions where the --force flag was being ignored if the command was executed in a standard interactive terminal.

The Bug

When evaluating workspace collisions, the orchestrator checked for non-interactive environments (via sys.stdin.isatty() and PYTEST_CURRENT_TEST) before evaluating self.force. This meant that passing --force in a normal terminal still dropped the user into the blocking TUI prompt, breaking automation scripts and fixture generation.

The Fix

Hoisted the self.force condition to be the first logic gate evaluated after collision targets are aggregated.

  • If --force is True: Immediately defaults to CollisionStrategy.MERGE and returns.
  • If --force is False: Falls through to the standard environment checks (aborting if non-interactive, prompting if interactive).

Impact

Allows scripts to cleanly generate directory trees and fixtures using the CLI without hanging on the questionary prompt or requiring environment variable hacks.

Previously, the `--force` flag was ignored during interactive terminal
sessions because `sys.stdin.isatty()` was evaluated first, routing the
execution flow directly to the questionary prompt.

This commit hoists the `self.force` check to the top of the
`_evaluate_collisions` method, ensuring the explicit CLI flag acts as an
unconditional override for the merge strategy, regardless of the
environment's interactive status.
@JacksonFergusonDev JacksonFergusonDev merged commit aa88e36 into main Mar 15, 2026
6 checks passed
@JacksonFergusonDev JacksonFergusonDev deleted the fix/make-force-flag-unconditional branch March 15, 2026 22:45
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