Skip to content

chore: migrate UI Extensions Core to the todoist scope - #381

Merged
henningmu merged 3 commits into
mainfrom
chore/github-org-rename-001
Nov 11, 2026
Merged

henningmu merged 3 commits into
mainfrom
chore/github-org-rename-001

Conversation

@henningmu

@henningmu henningmu commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

[Posted by Jarvis]

Migrates the active package to @todoist/ui-extensions-core@6.0.1, updates repository/tooling references, and regenerates the real lockfile against the published @todoist tooling packages. The private root, runtime code, card schemas and deployment identities remain unchanged.

Removes the custom release scripts, their tests, the separate pack workflow and the migration release runbook. The remaining manual core-deploy.yml workflow checks/builds core, packs once, and publishes the same tarball to npmjs and GitHub Packages with standard npm commands. The first npm release is interactive; subsequent npm releases use trusted publishing.

Validation: fresh npm ci; full core integrity check (lint, type checking, all 44 tests, CommonJS/ESM builds); repository formatting; production dependency audit; actionlint; fresh read-only review. All pass locally. The legacy React package remains retired; its consumer API blockers are documented separately.

@henningmu
henningmu requested a review from doistbot November 10, 2026 20:22

@doistbot doistbot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This PR reworks the release pipeline for the @todoist/ui-extensions-core scope: tag-triggered publishing is replaced by a main-only pack workflow plus a protected publisher that validates run provenance, main ancestry, artifact digests, and cross-registry state before any write, with strict npm/GitHub credential isolation and a documented lockfile pending the real @todoist/* config packages before merge.

Few things worth tightening:

  • The tamper/path-traversal guards in inspect and downloadOriginal (tar/zip entry allowlists, required dist files, digest checks) aren't exported or covered by tests — consider extracting them into pure, testable functions with rejection cases.
  • The mirror-selection tests only cover failure paths; add a successful github case asserting the GitHub npmrc auth line, token injection, and publish invocation while the npm-facing credentials stay isolated.

I also included a few optional follow-up notes in the details below.

Optional follow-up notes (6)
  • P3 scripts/release-policy.mjs:43: The registry names ['npmjs', 'github'] are hardcoded here while scripts/release.mjs defines the same set in registries (and core-deploy.yml repeats the destination choices). If a mirror is added or renamed, preflightBoth can skip it or fail with a stale name. Keep one source of truth, e.g. export registries from release-policy.mjs, iterate Object.keys(registries) here, and import that map in release.mjs.
  • P3 scripts/release.mjs:246: The sha512-${digest(tarball, 'sha512', 'base64')} construction duplicates the integrity formula already computed in inspect() (line 73). Extract a small integrityOf(bytes) helper next to digest() and use it in both places so the two paths can't drift apart.
  • P3 scripts/release.mjs:223: pkg.repository is dereferenced without a guard. The GitHub Packages metadata endpoint can return repository: null when the package is not linked to a repository, so this line fails with an opaque TypeError: Cannot read properties of null (reading 'full_name') instead of the actionable fail-fast messages used elsewhere in this boundary. Assert the field exists first (e.g., assert.ok(pkg.repository, 'GitHub package repository linkage missing; ask package administrator')) so operators get a clear recovery instruction.
  • P3 scripts/release.mjs:109: The workflow filename is duplicated: workflowPath is already imported as .github/workflows/core-pack.yml, but this API call hardcodes actions/workflows/core-pack.yml. If the workflow file is renamed, the imported constant and metadata.workflow update while this lookup silently breaks. Derive the API path from workflowPath (e.g., workflowPath.replace('.github/', 'actions/')) or define a second constant so the filename lives in one place.
  • P3 scripts/release.mjs:263: In non-interactive (CI) mode this first preflight() is redundant: no state changes between it and the recheck at line 296 (no login runs, only temp npmrc files are written), so both registries are fetched and both tarballs downloaded twice back-to-back for the same result. The pre-login preflight only adds value in interactive mode, where it fails fast before the user completes 2FA. Consider if (interactive) await preflight().
  • P3 scripts/release-policy.mjs:44: The npmjs and github inspections are independent; running them sequentially doubles the worst-case wall time (each has a 30s timeout, and each includes a tarball download). Promise.all over the registry list with results assigned by key keeps the same deterministic copies shape, and preflightBoth still guarantees both reads finish before any write.

Share Feedback • Review Logs

Comment thread scripts/release.test.mjs Outdated
import test from 'node:test'

import { preflightBoth, validateSourceRun, validateTag } from './release-policy.mjs'
import { publish, readTarball } from './release.mjs'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

P2 The suite never exercises inspect or downloadOriginal. Those functions enforce the tamper/path-traversal boundaries: tar entry allowlist and duplicate detection, required dist files, the GitHub artifact SHA-256 digest, and the exact zip entry set. They are also not exported, so a regression there cannot fail any test. Consider exporting them or extracting the validation into pure functions and testing rejection cases such as an unexpected tar/zip entry or a digest mismatch.

Comment thread scripts/release.test.mjs Outdated
}
}
try {
for (const selected of ['npmjs', 'github']) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

P2 This loop only verifies that each selected mirror rejects a divergent opposite mirror. The successful selected='github' path is never exercised, so the GitHub-specific npmrc _authToken=${GH_PACKAGES_TOKEN} line, the GH_PACKAGES_TOKEN env injection, and the GitHub publish invocation are unverified. Add a github success case that asserts GitHub auth/config is present while GH_TOKEN, NODE_AUTH_TOKEN, NPM_TOKEN, and npm_config_registry remain isolated.

@henningmu
henningmu requested a review from doistbot November 10, 2026 20:53

@doistbot doistbot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This PR reworks the release pipeline into a main-only pack workflow plus a protected retained-artifact publisher, with provenance, digest, and both-registry preflight checks, ahead of the @todoist/ui-extensions-core@6.0.1 publication (merge still gated on lockfile regeneration and real validation).

Few things worth tightening:

  • The test suite never exercises inspect/downloadOriginal, leaving the tar entry allowlist, duplicate-entry detection, required dist files, GitHub artifact digest, and zip entry set untested — export them and add rejection cases (unexpected/duplicate tar entries, digest mismatch, unexpected zip entries).
  • The GitHub publication path isn't covered: add a successful selected='github' case asserting the GH_PACKAGES_TOKEN npmrc auth/env injection while GH_TOKEN, NODE_AUTH_TOKEN, NPM_TOKEN, and npm_config_registry stay isolated.
  • Add rejection fixtures for the CLI (e.g. an unexpected zip entry and an out-of-allowlist tar entry like package/../evil) asserting non-zero exit before any write.
  • pull_request triggering now exposes the secret-bearing Bootstrap step to fork PRs — skip that step for forks, drop the token if no longer needed, or move it to a trusted workflow per the Secrets Management standard.

I also included a few optional follow-up notes in the details below.

Optional follow-up notes (9)
  • P3 scripts/release.mjs:226: pkg.repository is dereferenced without a guard. The GitHub Packages metadata endpoint returns repository: null when the package isn't linked to a repository, so this line fails with an opaque TypeError: Cannot read properties of null (reading 'full_name') instead of the actionable message used elsewhere at this boundary. Assert pkg.repository exists first and tell the operator to ask the package administrator to restore linkage.
  • P3 scripts/release.mjs:112: The workflow filename is duplicated: workflowPath is imported as .github/workflows/core-pack.yml, but this API call hardcodes actions/workflows/core-pack.yml. Renaming the workflow file would update workflowPath and metadata.workflow while this lookup silently breaks. Derive the API path from workflowPath (e.g., workflowPath.replace('.github/', 'actions/')) or add a shared constant.
  • P3 scripts/release.mjs:266: In non-interactive (CI) mode this first preflight() is redundant: nothing changes between here and the recheck at line 299 (no login runs, only temp npmrc files are written), yet both registries are fetched and both tarballs downloaded twice. The pre-login check only fails fast before 2FA in interactive mode, so gate it with if (interactive).
  • P3 scripts/release-policy.mjs:43: The registry names are hardcoded here while scripts/release.mjs defines the same set in registries and core-deploy.yml repeats the destination choices. If a mirror is added or renamed, preflightBoth can skip it or fail on a stale name. Keep one source of truth: export registries from release-policy.mjs, iterate Object.keys(registries) here, and import that map in release.mjs.
  • P3 scripts/release.mjs:249: The integrity formula sha512-${digest(..., 'sha512', 'base64')} is duplicated here and in inspect() at line 73. Extract a single integrityOf(bytes) helper next to digest() and use it in both paths (and the tests) so the two computations can't drift.
  • P3 scripts/release.mjs:217: This URL hardcodes the todoist org and ui-extensions-core slug, duplicating repository and packageName already defined in this module. Derive them from those constants (e.g. repository.split('/')[0] and the slug from packageName) or add dedicated constants, so a future org/package rename doesn't silently break this metadata lookup.
  • P3 scripts/release.mjs:123: The retained artifact name ui-extensions-core-release is duplicated between core-pack.yml's upload-artifact name and this filter. Renaming the upload causes this filter to return zero entries and fail with Require one original retained release artifact, without pointing at the rename. Hoist the name into release-policy.mjs so the JS side no longer repeats the literal.
  • P3 scripts/release-policy.mjs:43: The npmjs and github registry inspections run sequentially, so preflight worst-case wall time doubles (each fetch has a 30s timeout and, when a same-version copy exists, downloads the full tarball). The reads are independent and must both finish before any write, so run them concurrently with Promise.all over the registry names and assign results by key to preserve the deterministic copies shape.
  • P3 scripts/release.test.mjs:225: The recorded npm publish invocation is checked only for --ignore-scripts, --provenance=false, and the tag. --access=public and --registry=https://registry.npmjs.org/ are part of the public-release and isolated-routing contract, but neither is asserted; dropping public access or routing the npm publish to the wrong registry would pass. Assert the registry flag, public access, and the scope routing in the generated npmrc.

Share Feedback • Review Logs

Comment thread scripts/release.test.mjs Outdated
import test from 'node:test'

import { preflightBoth, validateSourceRun, validateTag } from './release-policy.mjs'
import { publish, readTarball } from './release.mjs'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

P2 The suite imports only publish and readTarball, so inspect and downloadOriginal are never exercised. Those functions enforce the tar entry allowlist/duplicate detection, required dist files, the GitHub artifact SHA-256 digest, and the exact zip entry set — a regression in any of them would pass CI. Export them (or extract the validation into pure functions) and add rejection cases such as an unexpected tar entry, a duplicate entry, a digest mismatch, and an unexpected zip entry.

Comment thread scripts/release.test.mjs Outdated
}
}
try {
for (const selected of ['npmjs', 'github']) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

P2 This loop only verifies that each selected mirror rejects a divergent opposite mirror. The successful selected='github' path is never exercised, so the //npm.pkg.github.com/:_authToken=${GH_PACKAGES_TOKEN} npmrc line, the GH_PACKAGES_TOKEN env injection, and the GitHub npm publish invocation are unverified. Add a github success case asserting that GitHub auth/config is present while GH_TOKEN, NODE_AUTH_TOKEN, NPM_TOKEN, and npm_config_registry stay isolated.

Comment thread scripts/release-source.test.mjs Outdated

// Run the actual download/verify CLI with a recording gh executable and real
// local tar/ZIP fixtures. There is no network, product build or publication.
test('CLI recovers the original successful artifact after a failed later attempt', () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

P2 This CLI test only exercises the happy download/verify path plus a wrong-attempt and artifact-digest rejection. The archive/tarball tamper guards in inspect/downloadOriginal — unexpected zip entries, tar entry allowlist and duplicate entries, missing required dist files, expired or multiple artifacts, and source-manifest equality — still have no rejection test, so a regression in those release-security checks would pass. Add crafted fixtures that fail, at minimum, an unexpected zip entry and an out-of-allowlist tar entry (e.g. package/../evil), and assert the command exits non-zero before any write.

Comment thread .github/workflows/core-ci.yml Outdated
- 'packages/ui-extensions-core/**'
- 'package.json'
- 'package-lock.json'
- 'scripts/**'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

P2 Adding scripts/** and .github/workflows/** to the pull_request trigger expands the fork-PR surface of a job that still injects NODE_AUTH_TOKEN: ${{secrets.GH_PACKAGES_TOKEN}} in the Bootstrap step. Doist's Secrets Management standard says not to use secrets in workflows triggered by pull requests from forks (https://handbook.doist.com/doc/standard-secrets-management-). Skip the secret-bearing Bootstrap step for fork PRs (or move it to a trusted workflow), or drop the token if the public @todoist/* packages no longer require GitHub registry auth.

@henningmu henningmu changed the title chore: prepare Todoist scope and retained core publication chore: migrate UI Extensions Core to the todoist scope Nov 11, 2026
@henningmu
henningmu requested a review from doistbot November 11, 2026 13:09
@henningmu
henningmu marked this pull request as ready for review November 11, 2026 13:11
@henningmu
henningmu merged commit ea41eb7 into main Nov 11, 2026
3 checks passed
@henningmu
henningmu deleted the chore/github-org-rename-001 branch November 11, 2026 13:11

@doistbot doistbot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This PR migrates UI Extensions Core to the todoist scope, replacing the tag-triggered publish with a single main-only dispatch workflow that packs once and publishes the same tarball to both npm and GitHub Packages, plus docs and tooling/config updates. Few things worth tightening:

  • The deploy workflow publishes to npmjs and then GitHub Packages in one sequential job; if the GitHub publish fails after npm succeeds, re-running fails on npm's exact-version check, leaving the mirrors divergent. Splitting into separate jobs that consume the retained core-package artifact would let a single-mirror failure be retried safely.
  • The PR description (and README) reference scripts/release.mjs, scripts/release-policy.mjs, a core-pack.yml workflow, and their mocked publisher tests — none of which exist in the diff or tree; what ships has no digest/provenance validation, no both-registry preflight, and no consumer of the retained artifact for retries. Either restore that publisher or correct the description/README so operators know the artifact is download-only and retries are manual.

With those addressed plus the pending lockfile regeneration and validation steps noted in the description, this looks ready to land.

I also included a few optional follow-up notes in the details below.

Optional follow-up notes (2)
  • P3 .github/workflows/core-deploy.yml:29: This npm install --global npm@11.19.0 runs before npm ci, but the removed workflow comment documented the opposite ordering as required: upgrading npm before npm ci was the exact pattern that previously caused lockfile format mismatches breaking installation. If 11.19.0 is safe with this lockfile, drop the concern deliberately, but if the upgrade was only moved to enable --provenance at publish time, install npm after npm ci (e.g., right before the Pack step) to keep the documented-safe sequence.
  • P3 docs/consumer-compatibility.md:9: This new file (and the new README section and line 37 here) links to github.com/Doist/ui-extensions/... using the old org name. Redirects work today, but since this PR is exactly the org/scope migration, new docs should point at todoist/ui-extensions so they don't rot if redirects are ever dropped.

Share Feedback • Review Logs

name: core-package
path: ${{ runner.temp }}/core-release/*.tgz
if-no-files-found: error
- name: Publish to npm

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

P2 Publishing to npmjs first in the same job makes partial failures unrecoverable. If the GitHub Packages publish at line 48 fails after npm succeeds, the two registries are left divergent, but re-running this workflow re-runs the entire job and fails here because npm refuses to republish the same version. The old workflow kept the npm and GitHub publishes as separate jobs, so only the failed mirror needed re-running. Split these back into separate jobs that download the retained core-package artifact (or otherwise make each registry write idempotent/preflighted) so a single-mirror failure can be retried without repacking or hitting the already-published registry.

jobs:
# Publish to GitHub package registry
publish-github:
publish:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

P2 The PR description and the prior review rounds reference scripts/release.mjs, scripts/release-policy.mjs, .github/workflows/core-pack.yml, and their mocked tests (inspect/downloadOriginal guards, both-registry preflight, artifact recovery) — none of those files exist in this diff or in the working tree. What actually ships is a single workflow that packs and publishes directly, with no digest/provenance validation, no both-registry preflight, and no consumer of the uploaded core-package artifact for the retry path the README describes ("Keep the original tarball if either registry needs a retry"). Either restore the described publisher and its tests or correct the PR description and README so operators know the retained artifact is currently download-only and retries are manual.

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.

2 participants