Skip to content

feat: fail clearly instead of prompting in non-interactive/CI environ… - #829

Open
Awosdot wants to merge 4 commits into
Nanle-code:masterfrom
Awosdot:fix/issue-673-ci-prompt-handling
Open

feat: fail clearly instead of prompting in non-interactive/CI environ…#829
Awosdot wants to merge 4 commits into
Nanle-code:masterfrom
Awosdot:fix/issue-673-ci-prompt-handling

Conversation

@Awosdot

@Awosdot Awosdot commented Aug 26, 2026

Copy link
Copy Markdown

Summary of Changes

Implements robust, CI-safe prompt handling to resolve issue #673. Prevents interactive prompts from hanging in headless CI pipelines and provides secure input alternatives.

Key Details:

  • CI Environment Detection: Added checks (CI environment variable and non-TTY stream validation) to reliably detect non-interactive execution contexts.
  • Fail-Fast Error Handling: Prompts immediately return a clear, explicit error message instead of blocking or hanging indefinitely when executed in a CI/headless environment.
  • Secure Fallbacks: Enabled input alternatives via environment variables and CLI parameters to allow automated pipelines to pass required data seamlessly.
  • Automated Testing: Added comprehensive unit tests covering both the CI failure case and the fallback success path.

Closes #673

…ments

Prompting helpers (wallet/backup password & passphrase entry, confirmation
prompts, registry login/signup) used to block forever when run in CI or any
other non-interactive context. They now detect that up front and fail fast
with a clear error, pointing at a secure headless alternative:

- New utils::interactive module: detects `--non-interactive`, `$CI`,
  `$STARFORGE_NON_INTERACTIVE`, or non-tty stdin, and centralizes the
  fail-fast error via ensure_interactive().
- Global `--non-interactive` CLI flag wired in main().
- crypto::prompt_password / prompt_passphrase fall back to
  $STARFORGE_PASSWORD / $STARFORGE_PASSPHRASE (new passphrases still get
  validated against length/strength rules without the interactive retry
  loop).
- confirmation::confirm_operation now requires --yes in non-interactive
  mode instead of blocking on stdin.
- registry login/signup accept --email/--username plus
  $STARFORGE_REGISTRY_EMAIL/_USERNAME/_PASSWORD.

Also fixes small pre-existing build breaks that blocked verification
(missing thiserror dependency, a rusqlite::Transaction mutability
mismatch in database.rs, and two ai_doc_qa modules present on disk but
never declared in mod.rs).

Adds 20 unit tests covering the CI failure case and the fallback success
case for each guarded prompt, plus boundary cases (empty env value,
strict-mode validation on a fallback passphrase, --yes/dry-run bypassing
the check). Documents the new behavior, detection rules, and migration
notes in CI_CD_DEPLOYMENT.md.

Closes Nanle-code#673
@drips-wave

drips-wave Bot commented Aug 26, 2026

Copy link
Copy Markdown

@Awosdot Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Manuelshub

Copy link
Copy Markdown
Collaborator

@Awosdot Please fix all CI issues

Awosdot added 2 commits August 26, 2026 19:56
…ests

cargo test compiles the whole crate's #[cfg(test)] code as one lib test
binary, so ~22 pre-existing, unrelated compile errors (stale struct
literals missing newly-added TemplateEntry/PluginManifest fields, a
duplicate read_spec_entries/ci_passed definition, a missing PartialEq
derive on ComplianceSeverity, an immutable CircuitBreaker borrow, and
tests exercising an already-removed InstalledPlugin::description API)
were preventing the lib test binary from building at all, blocking CI
from ever reaching the non-interactive/CI prompt-handling tests added
for Nanle-code#673.

Fixes are mechanical: added missing fields/derives, fixed mismatched
types, removed duplicate definitions, and dropped 3 tests for the
removed plugin description API. No behavioral changes to the Nanle-code#673
feature itself (utils::interactive, utils::confirmation, utils::crypto,
commands::registry) — its 33 tests pass individually and in the full
suite, both with default parallelism and with --test-threads=1 (as
ci.yml runs). A separate set of ~65 unrelated test failures (database
migrations, feature_flags, ai_* modules, compliance risk scoring, etc.)
remain and are pre-existing logic bugs outside this issue's scope.

closes Nanle-code#673
@Awosdot

Awosdot commented Aug 26, 2026

Copy link
Copy Markdown
Author

Summary of Changes

Implements robust, CI-safe prompt handling to resolve issue #673. Prevents interactive prompts from hanging in headless CI pipelines and provides secure input alternatives.

Key Details:

  • CI Environment Detection: Added checks (CI environment variable and non-TTY stream validation) to reliably detect non-interactive execution contexts.
  • Fail-Fast Error Handling: Prompts immediately return a clear, explicit error message instead of blocking or hanging indefinitely when executed in a CI/headless environment.
  • Secure Fallbacks: Enabled input alternatives via environment variables and CLI parameters to allow automated pipelines to pass required data seamlessly.
  • Automated Testing: Added comprehensive unit tests covering both the CI failure case and the fallback success path.

Closes #673

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.

[2026 CLI] Add a non-interactive mode for automation

2 participants