Skip to content

Add resumable device login and Python/Node.js preflight - #859

Open
mconflitti-pbc wants to merge 2 commits into
mainfrom
horse-cockroach-43481eda
Open

mconflitti-pbc wants to merge 2 commits into
mainfrom
horse-cockroach-43481eda

Conversation

@mconflitti-pbc

@mconflitti-pbc mconflitti-pbc commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Intent

Let headless clients start device authentication, return control while a user approves, and finish in a later process. Add native runtime preflight so deployment workflows can use CLI instructions without bundling login or Python/Node.js runtime-check scripts.

Type of Change

  • Bug Fix
  • New Feature
  • Breaking Change

Approach

  • Add --no-wait, --finish, and --timeout to Connect login and Connect Cloud add. Start prints approval details as JSON; finish selects pending state by nickname. State uses private POSIX files, process locking, polling intervals, token checkpoints, and bounded requests. Transient failures retain resumable state; permanent authorization/account failures remove it.
  • Add rsconnect preflight for Python and Node.js on self-hosted Connect and SPCS. Checks consider installed/publishable runtimes, project constraints, and deployment history, including file deployments. Node.js checks use npm's own semver implementation. Python --fix can create a missing .python-version only for new, unconstrained content.
  • Reports distinguish ok, incompatible, unknown, and operational error. Incompatibility exits 3; operational errors exit 1; unresolved checks exit 0 with suggested actions.
  • Preserve existing blocking authentication, credential-file writes, bundle selection, callback arguments, and missing-account exception types. Reauthentication retains exact saved URL keys for deployment history and keyring entries. Diagnostic suppression and strict metadata reads are scoped to the new workflows.

Resumable login and preflight require POSIX. Pending state contains plaintext device codes and token checkpoints, protected by owner-only permissions; same-user processes and backups can still read it. Preflight checks runtime availability, not application or dependency compatibility, and does not support Connect Cloud.

Automated Tests

  • Final affected unit/CLI/API/history/preflight gates: 722 passed, 2 skipped on both Python 3.13 and Python 3.8.
  • 57 passed real CLI subprocess integration cases against isolated local HTTP servers, including cross-process login, concurrency, retry/deadline behavior, token-safe output, and legacy URL/history preservation.
  • Ruff check/format, strict Pyright on the three feature modules, and wheel build passed. Independent compatibility review found no remaining issue.

The full suite was not rerun after the last compatibility fixes. Live Connect and native Windows execution were not performed.

Directions for Reviewers

On POSIX, start a Connect login and show the returned approval URL/code to the user:

rsconnect login https://connect.example.com --name review --no-wait
rsconnect login --name review --finish --timeout 120

After Cloud approval, the equivalent flow is:

rsconnect add --connect-cloud --account ACCOUNT --name cloud-review --no-wait
rsconnect add --connect-cloud --name cloud-review --finish --timeout 120

Check a new Python project with rsconnect preflight --name review ./project --new --fix, and Node.js with rsconnect preflight --name review ./node-app --runtime nodejs. Also verify a redeployment retains its content ID and that incompatible/unresolved runtimes produce the documented JSON and exit codes. Existing blocking login should continue working without the new flags.

Running with deploy to connect skill that relies on these new features for testing:

Screenshot 2026-10-08 at 11 40 09 PM

Checklist

  • I have updated CHANGELOG.md to cover notable changes.
  • I have updated all related GitHub issues to reflect their current state.
  • I have run the rsconnect-python-tests-at-night workflow in Connect against this feature branch.

Keep resumable login and preflight scoped to POSIX while preserving
legacy commands, credential writes and stored deployment URL keys.

Limit private diagnostics and strict metadata reads to the new flows.
Retain pending-state locks, checkpoints and deadlines, and isolate
terminal Cloud account errors from the existing public API.
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://posit-dev.github.io/rsconnect-python/pr-preview/pr-859/

Built to branch gh-pages at 2026-10-08 20:53 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
10733 9361 87% 0% 🟢

New Files

File Coverage Status
rsconnect/device_login.py 89% 🟢
rsconnect/preflight.py 87% 🟢
rsconnect/preflight_node.py 90% 🟢
TOTAL 89% 🟢

Modified Files

File Coverage Status
rsconnect/api.py 88% 🟢
rsconnect/connect_cloud.py 98% 🟢
rsconnect/exception.py 100% 🟢
rsconnect/http_support.py 91% 🟢
rsconnect/main.py 84% 🟢
rsconnect/metadata.py 89% 🟢
rsconnect/oauth.py 86% 🟢
rsconnect/validation.py 90% 🟢
TOTAL 91% 🟢

updated for commit: 7127c64 by action🐍

This branch has not been deployed

No deployments
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