Skip to content

fix: failed trust reads misreported as unconfigured; publish boolean replaces permissions - #15

Merged
theoephraim merged 1 commit into
mainfrom
fix/sync-trust-reads-publish-boolean
Sep 17, 2026
Merged

theoephraim merged 1 commit into
mainfrom
fix/sync-trust-reads-publish-boolean

Conversation

@theoephraim

Copy link
Copy Markdown
Member

Two bugs found while syncing the varlock monorepo

sync reported every package as "not configured". Trust configs are read with a captured npm trust list --json, which can't run npm's browser 2FA itself. When the read failed (npm's "remember for 5 minutes" approval wasn't ticked or had lapsed) it returned [], indistinguishable from an empty config — so sync claimed nothing was set up and offered to "fix" all 32 packages.

  • listTrust now returns a result that distinguishes a failed read (EOTP etc., parsed from npm's JSON error) from an empty config.
  • sync probes one captured read right after npm's interactive approval (with a short retry for the registry's grace to become visible) and cancels with an actionable message if it didn't stick.
  • A read that fails mid-run is listed as "couldn't be read" and left alone; add/wizard fail that package instead of writing blind.

31 packages showed as out of sync on permissions. npm grants createStagedPackage to every trusted publisher, so a config created with --allow-publish reads back with both, and fledgling flagged drift on everything.

  • The setting is now a boolean: "publish": true (default) / --publish / --no-publish. fledgling init asks a yes/no. Drift only compares whether createPackage is present. configureTrust always passes --allow-stage-publish (npm requires at least one flag).
  • permissions: publish | stage | both still works (stagefalse, others → true) with a deprecation note.

Verified

Local build against the varlock worktree: with the 2FA grace active, sync reports 31 in sync + 1 unconfigured (the package whose trust step had failed during add); a scoped sync <pkg> --yes configured it. Bogus --otp exercises the failed-read paths in both sync and add. --permissions stage warns and resolves to staged only; --no-publish renders "no (staged only)". Typecheck + build pass.

…n replaces permissions

- listTrust distinguishes a failed npm trust list (EOTP etc.) from an empty
  config; sync probes after the browser 2FA approval and stops with a clear
  message if it didn't stick, mid-run failures are listed as unreadable, and
  add/wizard fails the package instead of writing blind.
- npm grants createStagedPackage to every trusted publisher, so a publish-only
  config read back as drift on every package. The setting is now a boolean
  `publish` (--publish / --no-publish); the old `permissions` still works
  with a deprecation note.
@github-actions

Copy link
Copy Markdown

bumpy-frog

The changes in this PR will be included in the next version bump.

minor Minor releases

  • fledgling 1.2.1 → 1.3.0

Bump files in this PR

Click here if you want to add another bump file to this PR


This comment is maintained by bumpy.

@theoephraim
theoephraim merged commit 843ab0a into main Sep 17, 2026
1 check passed
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