Skip to content

registry-client: apply VLT_TOKEN to the default registry alias - #1992

Merged
ruyadorno merged 1 commit into
mainfrom
ruyadorno/default-token
Oct 23, 2026
Merged

ruyadorno merged 1 commit into
mainfrom
ruyadorno/default-token

Conversation

@ruy-bot

@ruy-bot ruy-bot Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

VLT_TOKEN was only sent when VLT_REGISTRY matched, so configs with just registries.npm (what vlt setup writes) got no auth. Now it applies to VLT_REGISTRY if set (a registry scalar is exported as it), else registries[default-registry-alias]. Fixes #1845

Changes

  • registry-client: defaultRegistryKey(); getToken/getTokenByURL take a default key; RegistryClient.defaultRegistryKey used for request auth
  • cli-sdk: query auth headers + vlt token ls use it
  • vlt registry <alias> <cmd> doesn't move the default: VLT_TOKEN stays on the default alias
  • docs: what "default registry" means for VLT_TOKEN; env token precedence

Tests

  • registry-client: defaultRegistryKey, getToken/getTokenByURL (default alias, VLT_REGISTRY wins, scoped/lookalike urls, precedence), request + requestStream auth headers
  • cli-sdk: query-auth, token ls

Follow-ups

  • Behavior change: VLT_TOKEN without VLT_REGISTRY was ignored; now authenticates the default registry and beats a keychain login there.
  • vlt logout with VLT_TOKEN set authenticates list/revoke with it, not the keychain token being revoked; pre-existing with VLT_REGISTRY. Fix (auth logout requests with the revoked token)?
  • Background cache revalidation gets no registry config, so config-bound env tokens aren't sent there; pre-existing.
  • Single non-default alias (e.g. vlt.io main) still needs VLT_TOKEN_<registry>.

Co-authored-by: Ruy Adorno [email protected]

`VLT_TOKEN` was only sent when `VLT_REGISTRY` matched, so configs
with just `registries.npm` (as `vlt setup` writes) got no auth.
Now it applies to `VLT_REGISTRY` if set (a `registry` scalar is
exported as it), else `registries[default-registry-alias]`.

Fixes #1845

## Changes
- `defaultRegistryKey()`; `getToken`/`getTokenByURL` take a default key
- `RegistryClient.defaultRegistryKey` passed on request auth
- query auth headers and `vlt token ls` use it
- docs: default registry for `VLT_TOKEN`, env token precedence

## Tests
- registry-client auth + request tests for default alias,
  `VLT_REGISTRY` precedence, `registry` option (`vlt registry <alias>`)
  not moving it, scoped/lookalike urls
- cli-sdk query-auth + token list

Co-authored-by: Ruy Adorno <[email protected]>
@vercel

vercel Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs Ready Ready Preview Oct 9, 2026 10:50pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Oct 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c0bc9f8c-3d7f-406f-b19a-0d9f9bc10c45

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

🐰 Bencher Report

Projectvltpkg
Branchruyadorno/default-token
Testbedubuntu-latest
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
vlt install: vue & cache-lockfile📈 view plot
🚷 view threshold
811.33 ms
(+11.87%)Baseline: 725.26 ms
906.58 ms
(89.49%)
vlt install: vue & cache-lockfile-node-modules📈 view plot
🚷 view threshold
307.76 ms
(-10.88%)Baseline: 345.34 ms
431.68 ms
(71.29%)
vlt install: vue & clean📈 view plot
🚷 view threshold
13,210.01 ms
(-0.08%)Baseline: 13,220.57 ms
16,525.71 ms
(79.94%)
vlt install: vue & lockfile📈 view plot
🚷 view threshold
5,434.43 ms
(+6.84%)Baseline: 5,086.56 ms
6,358.19 ms
(85.47%)
🐰 View full continuous benchmarking report in Bencher

@ruyadorno
ruyadorno merged commit 67f1987 into main Oct 23, 2026
20 checks passed
@ruyadorno
ruyadorno deleted the ruyadorno/default-token branch October 23, 2026 04:28

This branch was successfully deployed

1 active deployment
Preview — 5b1e36bd Deployed Oct 9, 2026 by vercel[bot]
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.

[BUG] Plain VLT_TOKEN is ignored unless VLT_REGISTRY is set (does not apply to the default registry alias)

1 participant