Skip to content

fix: migrate Comms CLI to todoist owner and package scope - #116

Closed
henningmu wants to merge 1 commit into
mainfrom
chore/github-org-rename-001
Closed

henningmu wants to merge 1 commit into
mainfrom
chore/github-org-rename-001

Conversation

@henningmu

Copy link
Copy Markdown
Contributor

[Posted by Jarvis]

Prepares Migration 001 for @doist/comms-cli → @todoist/comms-cli and the GitHub owner rename. WAITING_FOR_PUBLICATION — draft, not mergeable. Proposed first new-scope release: 4.1.1, derived from current main/tag/npm 4.1.0 and guarded normal semantic-release analysis.

  • Migrate package/import/mock/docs/skill/install/self-update and workflow owner references while preserving tdc, config/keyring/OAuth identities, domains and API semantics.
  • Adapt SDK 4 attachment uploads to the destination workspace. Preserve native tests, dry-run and write guards.
  • Retain one build artifact for identical npmjs/GitHub publication. Separate protected bootstrap/publisher from build; preserve latest/next, original run/attempt/archive evidence, both-registry preflight before each write, safe absence proof, channel protection, interrupted-release recovery and idempotent stable source/skill bookkeeping.

Merge/publication gates

  1. Actual @todoist/comms-sdk@4.0.1 and transitive @todoist/sdk-kmp@0.6.2 publication/access (SDK #139, KMP #74).
  2. Existing cli-core owner must provide its real current-forward @todoist/cli-core successor; current old-scope main/npm is 1.10.0. ~1.10.0 is a temporary compatibility constraint, not an invented release. Exact-pin the genuine version, regenerate the lock and run fresh verification. The original lock is intentionally unchanged.
  3. Rename/M01 access, protected npm-release, actual package visibility/linkage/ACLs, interactive real-artifact bootstrap and subsequent npm trust. Automatic publication remains disabled until COMMS_CLI_AUTOMATIC_RELEASES=true.
  4. Existing OAuth owner must ensure continuity of the immutable raw GitHub client-ID URL, fetched without redirects. This PR preserves it and existing grants.

M04 CLI producer precedes M05 TodoistOS #616. That consumer needs this final producer version, tdc, explicit old-installation transition, matching dual-registry bytes and actual install evidence.

Evidence

  • Old-scope baseline npm run verify passed.
  • Provisional overlay only: real published @doist/comms-sdk@4.0.0 + @doist/cli-core@1.10.0; 1,585 tests passed across 69 files, including the normal pre-push hook. Types/build/skill sync, local version/update-help and pre-commit checks passed.
  • Required changed-tree npm run verify stops at the genuine manifest/lock publication gate. No fabricated lock, skipped checks or production aliases.
  • Update destination, workspace uploads, registry readability, skill-record and future-SDK packaging regressions failed before their changes and passed afterward. Disposable mutations breaking dual preflight/archive digest produced 13/1 failures.
  • Publisher/updater actionlint, lint/format and whitespace passed. Whole workflow scan additionally reports the existing ubicloud custom label; no runner/check was changed.
  • One fresh read-only review: SDK pack guard finding reproduced and fixed; no remaining blocking source findings.

Not verified: genuine new-scope install/pack, Node 26, live Comms/OAuth, actual publication/OIDC/retry, or post-rename access. No merge, dispatch, publication, release/tag creation, deployment, account/settings change, global CLI update or team message was performed.

See docs/releasing.md for exact setup, merge, bootstrap, retry and consumer-resume commands.

@henningmu
henningmu requested a review from doistbot November 11, 2026 09:56

@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 the CLI to the @todoist owner/package scope and splits the release pipeline into a single build artifact plus a protected publisher, with solid dual-registry and release-record guards.

Few things worth tightening:

  • The automatic npmjs publish path has no credentials and no provenance, so it will fail with ENEEDAUTH once automatic releases are enabled — wire up trusted publishing or retain a scoped token in the isolated npmjs environment.
  • The SDK-update workflow's dispatch-triggered builds never meet the push-event condition for auto-publishing, and the resulting unrecorded artifact then blocks every later main build until a maintainer manually dispatches the publisher; pushing with a bot app token or dispatching the publisher directly would fix it.
  • LICENSE doesn't exist in the repo, so packing fails with ENOENT once the dependency gates clear — add the file or make the copy optional (the pack test's fixture masks this).
  • Subsequent publish/check-registry/record steps re-download and re-hash the same artifact roughly eight times per run; a lightweight verified mode would cut that, and @todoist/cli-core should be exact-pinned instead of ~1.10.0 per repo standards.

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

Optional follow-up notes (8)
  • P3 release.config.js:17: The configured plugin ./scripts/release-analysis.mjs imports @semantic-release/commit-analyzer and @semantic-release/release-notes-generator, but neither is declared in package.json. They only resolve because semantic-release currently hoists them transitively. Add both as direct devDependencies so this build does not depend on npm's hoisting layout.
  • P3 scripts/record-release.mjs:51: This gitAuth block duplicates the identical auth array in scripts/source-release-record.mjs (line 132). Export that configuration from one shared module (for example release-policy.mjs, or export it from source-release-record.mjs) and import it here, so the credential.helper=!gh auth git-credential override and http.extraheader reset cannot drift between the recorder and the source commitback.
  • P3 scripts/pending-release.mjs:42: This local api closure is the fourth copy of the same JSON.parse(execFileSync('gh', ['api', repos/${REPOSITORY}/${path}])) requester in scripts/ (github-pages.mjs default requester, artifact-source.mjs, validate-source-run.mjs). Extract one shared requester — e.g. export the default from github-pages.mjs — and use it here, so future changes to gh invocation (auth env, maxBuffer) land in one place.
  • P3 scripts/pending-release.mjs:16: Lines 15–16 are two separate imports from the same module ('./release-policy.mjs'). Merge them into one import: import { validateSourceRun, REPOSITORY, VERSION } from './release-policy.mjs'.
  • P3 scripts/github-release-record.mjs:250: assertRecordedBaseline already fetched the release assets and both asset bodies at lines 223–244, then assertPublishedRecord immediately fetches them again through inspectAssets (api.assets plus one api.readAsset per file). Nothing mutates in between, so pass the already-read asset list/bytes into the check (or inline it) to avoid duplicate GitHub round-trips.
  • P3 scripts/github-release-record.test.ts:285: This unexpected asset setup branch is dead code: the it.each array for this describe (lines 266–274) never produces 'unexpected asset', so the branch can never run. Either add the scenario to the array or delete the branch so the test doesn't imply coverage that doesn't exist.
  • P3 scripts/pending-release.test.ts:45: retainedPlans is only exercised with the default beforeBaseline = () => false, so the if (beforeBaseline(run.head_sha)) continue path is never covered. An inverted predicate would skip pending runs and let checkPendingReleases pass over an unrecorded retained artifact. Add a case where beforeBaseline returns true and assert the run is skipped without a download or yielded value.
  • P3 docs/releasing.md:147: This export line contradicts the requirement two paragraphs above it: "Obtain GH_PACKAGES_TOKEN through the existing secure credential flow, never in source or shell history." Exporting an interactive-shell variable is exactly how the token lands in shell history (and possibly a terminal transcript). Suggest instead reading the token at use time from a file or the credential manager, e.g. GH_PACKAGES_TOKEN=$(cat "$TOKEN_FILE") with a note to keep the file out of shared storage. See https://handbook.doist.com/doc/standard-secrets-management-wbKmIfrtgr

Share Feedback • Review Logs

env:
GH_TOKEN: ${{ github.token }}
GH_PACKAGES_TOKEN: ${{ github.token }}
run: node scripts/release.mjs publish .tmp/release npmjs

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 automatic npmjs publish has no npm credentials. scripts/release.mjs publish ... npmjs uses command: 'publish', which skips the interactive npm login that only bootstrap-npm performs, strips NODE_AUTH_TOKEN/NPM_TOKEN from the isolated environment, and then publishes with --provenance=false, so it never enters the OIDC trusted-publishing path either. Once COMMS_CLI_AUTOMATIC_RELEASES=true is enabled, this step will fail with ENEEDAUTH. Use trusted publishing (provenance) for later npmjs releases or supply a scoped npm token that the isolated npmjs environment retains.

if: >-
(github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main') ||
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'push' && vars.COMMS_CLI_AUTOMATIC_RELEASES == 'true')

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 SDK-update releases can never auto-publish, and their artifacts block later builds. update-comms-sdk.yml pushes its commit with GITHUB_TOKEN (which does not trigger workflows) and then runs gh workflow run release.yml, so the only build for an SDK bump is a workflow_dispatch run — and this condition requires workflow_run.event == 'push', so it never publishes even after COMMS_CLI_AUTOMATIC_RELEASES=true. Since prepare-release.mjs fails any later push build while an unrecorded artifact exists (Retained release ... is not recorded), every SDK update also bricks the next main build until a maintainer manually dispatches publish-release.yml. Fix by having update-comms-sdk.yml push with the release bot app token (producing a real push-event build that auto-publishes) or by dispatching publish-release.yml itself after the artifact build succeeds.

runAttempt: process.env.GITHUB_RUN_ATTEMPT,
}),
)
execFileSync('node', ['scripts/release.mjs', 'pack', '.tmp/release'], { stdio: 'inherit' })

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.

P1 Handle the missing LICENSE before packing. This command reaches scripts/release.mjs, which unconditionally copies LICENSE, but that file doesn't exist in the repository. Once the dependency gates are cleared, release builds will still fail with ENOENT before uploading an artifact. Add the file or make its copy optional, and cover the actual repository layout—the pack test currently masks this by creating a fixture LICENSE.

env:
GH_TOKEN: ${{ github.token }}
GH_PACKAGES_TOKEN: ${{ github.token }}
run: node scripts/release.mjs publish .tmp/release npmjs

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 Each publish/check-registry invocation re-enters release.mjs verify(), which re-downloads the full GitHub artifact through compareRetainedArtifact and re-inspects the tarball. The job already ran the same verify in the previous step, and record-release.mjs (line 121) repeats it three more times internally, so a normal both publish downloads and hashes the same artifact roughly eight times. Add a lightweight mode for the subsequent publish/check-registry/record steps (or pass the already-verified metadata/tarball) while keeping the per-write registry preflights.

Comment thread package.json
"dependencies": {
"@doist/cli-core": "1.9.0",
"@doist/comms-sdk": "3.11.0",
"@todoist/cli-core": "~1.10.0",

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 @todoist/cli-core is declared as ~1.10.0, a range specifier. The TypeScript repository standards require dependencies in package.json to be pinned to exact versions (https://handbook.doist.com/doc/standard-backend-repositories-). Every other dependency here is exact-pinned; pin this to the genuine published version before merge and regenerate the lockfile to match.

@scottlovegrove

Copy link
Copy Markdown
Collaborator

Obsolete now, closing

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.

3 participants