Skip to content

fix(ci): repair the scheduled observation and package publish workflows - #9

Merged
zz-plant merged 2 commits into
mainfrom
fix/scheduled-observation
Jul 28, 2026
Merged

fix(ci): repair the scheduled observation and package publish workflows#9
zz-plant merged 2 commits into
mainfrom
fix/scheduled-observation

Conversation

@zz-plant

@zz-plant zz-plant commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Two scheduled/tagged workflows have been failing silently. Neither is a code problem.

1. publish.yml — npm has been stale for 71 days

npm's latest @refract-org/cli is 0.5.7 (2026-05-18). The repo is at 0.5.13.

This matters more than the version gap suggests. cli 0.5.7 declares "@refract-org/analyzers": "^0.3.0", which resolves to 0.3.x — before semantic enrichment existed. So the first command in the README:

npx @refract-org/cli analyze "Climate change" --brief

fails on a clean machine with:

SyntaxError: The requested module '@refract-org/analyzers' does not provide an export named 'computeCertaintyProfile'

Verified just now against the live registry. The fix already exists in-repo — 45d4446 chore: bump CLI to v0.5.8 (fix analyzers dep resolution), 2026-05-23 — it simply never reached npm.

Why it never reached npm:

  • v0.5.8 – v0.5.11: npm publish resolved to the bun-backed shim that setup-bun puts ahead of Node's npm in PATH. Bun's implementation has no OIDC token exchange, so every run died with error: missing authentication (run bunx npm login).
  • v0.5.12: reported ✅ success while every package failed with npm error 404 Not Found - PUT https://registry.npmjs.org/@refract-org%2fcli. || true swallowed it.
  • v0.5.13: cancelled.

Changes: resolve npm from the Node toolchain by path; drop || true so a 404 fails the run; drop bun test || echo "publishing anyway"; thread NODE_AUTH_TOKEN through as a fallback.

This does not fix authentication. A 404-on-PUT is npm rejecting the write. Trusted publishing still has to be configured on npmjs.com per package, or an NPM_TOKEN secret added — the repo currently has no secrets set. What this change guarantees is that the next failure is visible instead of green.

2. observe.yml — failing daily since at least 2026-07-21

Every run dies at observations/Bitcoin.json: No such file or directory. The directory is not in the repo, so the redirect failed under bash -e before the CLI ran.

Three further faults sat behind it:

  • The commit step could never commit. git diff --quiet ran after git add, comparing worktree to index — always quiet. It would have printed "No changes" indefinitely. Now git diff --cached --quiet.
  • Every observation would have been unparseable. 2>&1 folded progress output into the JSON. Verified locally: the CLI writes Analyzing "Bitcoin" at depth: detailed... to stderr, which would have landed at the top of the file. Output now goes to $RUNNER_TEMP and moves only on success.
  • permissions: contents: write was never declared, and the push step needs it.

Also passes the pages input through env: rather than interpolating it into the shell with ${{ }}.

🤖 Generated with Claude Code

zz-plant and others added 2 commits July 28, 2026 16:31
The daily run has failed every day since at least 2026-07-25, all at the
same line: `observations/Bitcoin.json: No such file or directory`. The
directory is not in the repo and nothing created it, so the redirect
failed under `bash -e` before the CLI ever ran.

Four fixes, three of which would have surfaced only after the first:

- `mkdir -p observations` before the loop.
- The commit step ran `git diff --quiet` after `git add`, which compares
  the worktree to the index and is therefore always quiet. It would have
  reported "No changes" and committed nothing, forever. Use
  `git diff --cached --quiet`.
- Analysis wrote with `2>&1`, folding progress messages ("Analyzing…",
  "Fetched 20 revisions.") into the JSON file. Every committed
  observation would have been unparseable. Write to `$RUNNER_TEMP` and
  move only on success, so a failed analysis leaves no artifact.
- The `pages` input was interpolated into the shell via `${{ }}`. Pass it
  through `env:` instead.

Also declares `permissions: contents: write`, which the push step needs
and never reached.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
npm's latest `@refract-org/cli` is 0.5.7, published 2026-05-18. The repo
is at 0.5.13. Nothing has landed on npm in 71 days, and the reason is
entirely in this workflow.

`npm publish` resolved to the bun-backed shim that setup-bun puts ahead
of Node's npm in PATH. Bun's implementation has no OIDC token exchange,
so v0.5.8 through v0.5.11 all died with:

    error: missing authentication (run `bunx npm login`)

v0.5.12 then reported **success** while every package failed:

    npm error 404 Not Found - PUT https://registry.npmjs.org/@refract-org%2fcli

`|| true` swallowed it. The tag looked released and was not.

Three changes:

- Resolve npm from the Node toolchain by path, bypassing the shim.
- Drop `|| true`, so a 404 fails the run instead of being reported green.
- Drop `bun test || echo "publishing anyway"`. A publish that ignores its
  own test results is how a broken tarball reaches users.

Also threads `NODE_AUTH_TOKEN` through, so a repo secret works as a
fallback where OIDC trusted publishing is not configured.

Note: this does not by itself fix authentication. The 404-on-PUT means
npm is rejecting the write, so trusted publishing still has to be
configured on npmjs.com for each package, or an NPM_TOKEN secret added —
the repo currently has no secrets set. What this change guarantees is
that the next failure is visible.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@zz-plant zz-plant changed the title fix(ci): repair the scheduled observation workflow fix(ci): repair the scheduled observation and package publish workflows Jul 28, 2026
@zz-plant
zz-plant merged commit 66e868a into main Jul 28, 2026
4 checks 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