Skip to content

Auto-install missing database driver extras on sync#1187

Open
ClaireGz wants to merge 3 commits into
mainfrom
feat/1184-sync-auto-install-driver-extras
Open

Auto-install missing database driver extras on sync#1187
ClaireGz wants to merge 3 commits into
mainfrom
feat/1184-sync-auto-install-driver-extras

Conversation

@ClaireGz

@ClaireGz ClaireGz commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Issue

Closes #1184

Implemented

  • When nao sync connects to a warehouse whose driver extra isn't installed, it now auto-installs it (or prompts to install), then continues the sync — instead of failing with a "run pip install 'nao-core[...]'" error. This matches what nao init already does.
  • Interactive runs ask before installing (default yes); non-interactive / CI runs install automatically so the sync never hangs.
  • Only installs the extras for the warehouses actually being synced.

Tests done

  • make lint clean.
  • Unit tests for the missing-extra detection, the prompt/auto-install flow, and the sync call site (interactive, non-interactive, and non-database-provider cases).
  • Not yet exercised end-to-end against a live warehouse with an uninstalled driver — see PR discussion.

🤖 Generated with Claude Code

`nao sync` now installs a missing database driver extra the same way
`nao init` does, instead of only printing the missing-extra error and
failing. The shared install/prompt logic is factored into
`deps.ensure_extras_installed` and reused by both commands.

Interactive sessions prompt (default yes); non-interactive/CI sessions
auto-install without prompting so sync does not hang.

Closes #1184

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

🚀 Preview Deployment

URL https://pr-1187-d2825a0.preview.getnao.io
Commit d2825a0

⚠️ No LLM API keys configured - you'll see the API key setup flow when trying to chat.


Preview will be automatically removed when this PR is closed.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 5 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread cli/nao_core/commands/sync/__init__.py Outdated
Address Cubic P3: `_collect_databases_to_sync` was a second, independent
implementation of the item selection the provider loop performs, so a
future filtering change could make driver installation target different
connections than the sync.

Resolve each selection's filtered items once (`_filter_items_for_selection`)
and reuse that list for both missing-driver-extra detection and provider
execution, so the two can no longer diverge.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 1 file (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread cli/nao_core/commands/sync/__init__.py Outdated
Address Cubic P2: resolving all selections up front moved `get_items()`
outside the per-provider exception handling, so a single provider's
resolution failure aborted the whole sync command.

Capture each selection's resolution result (items or error) into a
`PlannedSync` once — preserving the single source of truth for which
items are synced — and re-raise a captured resolution error inside the
per-provider try/except so it is recorded as a failure, other providers
still sync, and the summary prints.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

[feature] nao sync should auto-install (or prompt for) missing database driver extras, like nao init

1 participant