Skip to content

Spike: settle the two gate-mechanism assumptions before building for them #143

Closed

Description

@mmcky

Two cheap experiments decide the shape of the release gate. Both are blockers in the sense that building for the wrong answer wastes the build — #136's 0a should not start until they are settled.

1. Does a local uses: ./path composite action work inside a container: job?

This determines whether one repo can hold both the sandbox and the gate role, which is the question #136 turns on.

If a workflow can actions/checkout this repo at an arbitrary ref into a path and then call uses: ./path/build-lectures, a single gate.yml in the existing canary — carrying a workflow_dispatch input for the candidate ref and a digest-pinned container — holds every property #136 asks for, with no second repo and no v0-next tag. GitHub forbids expressions in uses:, but a checked-out path is not a ref, so the constraint does not apply.

The reason this is not obvious is #83. ${{ github.action_path }} expands to the runner's path, while inside a container: job the action is mounted at /__w/_actions/... — so bash received a nonexistent path and exited 127 before the script ran. That is documented at build-jupyter-cache/action.yml:361-365, and it is the same host-vs-container path-mapping class that local uses: would exercise.

  • In a throwaway branch of QuantEcon/test-actions-lecture-intro, add a workflow with a container: block that checks this repo out into ./actions-repo and calls uses: ./actions-repo/build-lectures on the trimmed toc
  • Record whether the composite resolves, and whether anything inside it that reaches for github.action_path still breaks

Works → harden the canary with a gate.yml; #136 can close as superseded and 0b loses the v0-next tag entirely. Fails → a second ref namespace is genuinely required, #136 stands, and the v0-next design in #135 is the right one.

2. Would a dispatch-driven gate be vacuously green on the preview path?

Both preview actions gate three steps on github.event_name == 'pull_request':

  • preview-netlify/action.yml:48, :63, :101
  • preview-cloudflare/action.yml:60, :75, :148

So a gate run triggered by workflow_dispatch or repository_dispatch skips the build, the deploy and the comment, and reports green having deployed nothing. This is inherited unchanged by a new fixture repo, so it is not an argument for either option — it is a prerequisite for both, and precisely the "test that cannot fail" pattern of #108.

Related: the canary's publish.yml has no workflow_dispatch at all (on: push: tags: 'publish*'), so the publish path cannot currently be driven by a gate either. It has run 9 times ever, last on 2026-02-10 — publish-gh-pages has had zero end-to-end exercise across v0.7.0 → v0.11.1, which is the strongest standing argument for doing this work.

Why this is separate

#135 and #136 both assume a design. These two checks test the assumptions underneath both, cost well under a day, and one of the outcomes removes a repo and a tag from the plan. Blocks #138 item 0a.

Activity

  1. added
    high-priority
    infrastructure
    on Aug 11, 2026
  2. quantecon-services commented on Sep 28, 2026

    @quantecon-services
    Collaborator

    Spike result, 2026-09-28

    Q1: works. A container job in the canary checked out this repo at a SHA into ./actions-repo, then called uses: ./actions-repo/<action>. The canary's whole CI chain ran that way:

    • restore-jupyter-cache
    • build-lectures, once per builder
    • preview-netlify and preview-cloudflare

    build-jupyter-cache ran that way too. Nothing was downloaded from quantecon/actions.

    Q2: confirmed. On push and workflow_dispatch, both preview actions go green having deployed nothing, and nothing in the log says so.

    All three runs used canary branch spike/143-local-uses at 8634225, candidate c0ac111 (main), image quantecon-build@sha256:f41071c3…, and runner 2.337.0:

    What the raw logs show

    Local actions resolve in a container.

    • The step headers read Run ./actions-repo/restore-jupyter-cache, Run ./actions-repo/build-lectures (once per builder), Run ./actions-repo/preview-netlify and Run ./actions-repo/preview-cloudflare.
    • The local jobs have no Download action repository 'quantecon/actions…' line.
    • The remote control job, which used quantecon/actions/…@c0ac111, downloaded exactly that ref.

    github.action_path in a container. The spike ran a probe action at ./actions-repo/….

    The preview path through a local path, on the PR.

    • detect-changes, which runs $GITHUB_ACTION_PATH/../scripts/detect-changed-lectures.sh, succeeded and reported lectures/spike_143_marker.md.
    • Both actions deployed for real, to pr-69--jade-tarsier-d98a19.netlify.app and pr-69.qe-preview-canary.pages.dev. Each served a marker file unique to the run.
    • Both PR comments were posted.

    The build-jupyter-cache residual.

    Q2.

    • On push and on dispatch, both local and at the remote SHA, check-trust and install-cli succeeded. detect-changes, deploy and the comment step were skipped, deploy-url was empty, and nothing appeared in the log.
    • Positive control: the same action with only the deploy step's event clause removed did run the deploy, which failed on the dummy token.
    • That control deployed with an empty PR number (Deploying preview for PR #..., alias pr-). So removing the clause is not a fix.

    What the spike does not show

    • Only one candidate was run. It was c0ac111, which is main and the same as the control. Nothing was staged to fail, so 0d is untested.
    • The canary-CI and PR builds were warm. They restored the canary's build cache: no notebook executed and no intersphinx inventory was fetched. Only the build-jupyter-cache jobs built cold. A gate that restores the canary's cache will not exercise execution or network reads.
    • build-jupyter-cache ran with builders: html. So only 2 of its 4 nested calls ran. The rewired run also tests a patched action.yml, not the shipped bytes.
    • Several paths were not exercised through a local path. They are publish-gh-pages, deploy-cloudflare, setup-environment beyond its container skip path, and every failure path.
    • Real secrets met only the PR run's fixed default candidate. The spike's candidate check accepts any SHA reachable from a branch or tag of this repo; c0ac111 matched main and a claude/* branch. A gate that deploys with secrets should accept only main and v* tags.
    • A local-path gate never exercises how consumers resolve the actions. That means the _actions download and the tag move. For local actions, GITHUB_ACTION_REPOSITORY and GITHUB_ACTION_REF are also empty; nothing reads them today.

    What this means for #138

    • Release gating: a gate.yml in the canary tests the candidate before v0 moves #135. The v0-next tag is not needed. The gate can be a gate.yml whose workflow_dispatch input is the candidate SHA, run on main before v0 moves. With the four-line rewrite it also reaches build-jupyter-cache's sibling chain, which v0-next could not.

    • Release gate fixture: content and hygiene for the canary's gate.yml #136. Its mechanism argument is gone, but not the whole issue.

      • The image and the @v0 pin are set per workflow, not per repo: the spike pinned a digest from a job output.
      • Its content requirements are still unmet in the canary: plotly/kaleido (Pin kaleido<1.0 in both containers to fix ChromeNotFoundError #85), a staged-failure self-test, all three build-jupyter-cache builders, network-free builds (intersphinx), a committed image digest, and a cache scope separate from the canary's CI.
      • I'd suggest re-scoping it to "gate fixture content and hygiene" rather than closing it.
    • The Q2 fix is a prerequisite for a dispatch-driven gate's preview leg, and for 0c. The design I'd recommend:

      • an explicit opt-in input, for example dispatch-alias, restricted to a reserved dispatch- prefix so it can never hit pr-N or Cloudflare production;
      • an event allow-list of workflow_dispatch, plus schedule for 0c. It must never become a deny-list: the pull_request literal is what keeps pull_request_target out (fix(preview): surface deploy errors, pin CLIs, remove unsafe fork guidance #105);
      • a deployed output, and a ::notice:: on every run that does not deploy;
      • callers that assert deployed == 'true'.

      The PR-only half (the pr-N alias, change detection, the comment) still needs a PR leg. That can be manual at first; draft ci: bump docker/login-action from 3 to 4 #69 shows it works.

    • 0c. Scheduling the canary's ci.yml as it stands would give a green run that tested nothing (Q2). publish.yml needs workflow_dispatch and its job-level if: removed. Otherwise a dispatched run skips its only job, tests nothing and never goes red.

    Docs this contradicts

    • docs/dev/PLAN.md 0b: "no parameterised-ref design is possible". A checkout plus a local path is one.
    • docs/dev/PLAN.md 0a: "both are repo-level". The image and the @v0 pin are per workflow; only Dependabot and the lecture content are repo-level.
    • docs/dev/PLAN.md line 42: "A manual dispatch can exercise preview on demand". It skips the deploy.
    • preview-netlify/README.md:180 and preview-cloudflare/README.md:189: "A notification is logged when deployment is skipped". Not on non-PR events.
    • The canary README:
      • The "This repo is not the release gate" section gives @v0 and :latest as reasons, but both are per workflow.
      • "No build-time network access" is wrong: the build fetches intersphinx inventories (_config.yml:77).

    Decisions left open

    • Where the gate lives: gate.yml in the canary, or a new fixture repo. The canary is cheapest: its secrets, Netlify site and Cloudflare project already exist.
    • The Q2 mechanism: an opt-in input in the actions, or a gate that opens a PR. The PR-driven option needs no action change, but does need an App credential and a standing PR.
    • Which candidates the gate accepts: main plus v* tags only, and whether the gate's secrets sit in an environment that only main can use.
    • Build conditions: a committed image digest or :latest resolved once per run; cold or warm builds; and whether intersphinx is off for gate builds.
    • publish-gh-pages: whether the gate includes it. It would overwrite the canary's Pages site, and the github-pages environment's branch policy is unverified.

    Clean-up. Draft QuantEcon/test-actions-lecture-intro#69 is closed and spike/143-local-uses is deleted. The spike workflow is still readable from #69's commits. The runs and logs remain, and so do the evidence artifacts (90-day retention). The pr-69 preview deployments remain, as after earlier staging PRs.


    Generated by Claude Code

  3. added a commit that references this issue on Sep 28, 2026
  4. mmcky commented on Nov 4, 2026

    @mmcky
    ContributorAuthor

    Decisions recorded, 2026-11-04 (maintainer decision session):

    1. Where the gate lives: a gate.yml in the canary (QuantEcon/test-actions-lecture-intro), not a new repo. The gate's fixture lives in its own folder, which Dependabot does not scan, and the image is pinned in the workflow. Release gate fixture: content and hygiene for the canary's gate.yml #136 is re-scoped to the fixture's content and hygiene, and Release gating: a gate.yml in the canary tests the candidate before v0 moves #135 drops the v0-next tag.
    2. Previews outside a pull request: an opt-in input in both preview actions: a reserved dispatch- alias prefix, an event allow-list, a deployed output and a notice whenever nothing deploys. Filed as preview-netlify, preview-cloudflare: deploy outside pull_request on request, and report whether anything was deployed #227, which also takes in preview-netlify, preview-cloudflare: install the deploy CLI only on pull_request runs #193. Not a gate that opens PRs.
    3. Accepted candidates: only commits reachable from main or a v* tag of this repo, checked before any secret is read. The gate's deploy secrets live in a canary environment that only the canary's main branch can use.
    4. Build conditions: frozen. A committed image digest, bumped deliberately when the images change; cold builds, so notebook execution runs; and intersphinx off for gate builds.
    5. publish-gh-pages: included. The gate redeploys the canary's own Pages site from the canary's main. Release-asset packaging is covered by fixture tests in this repo's harness (testing: publish/preview/cache action logic has no automated tests #100, Stage 1.5) rather than by tag-triggered gate runs.

    Closing, since the spike's questions are answered and the decisions recorded. The work continues in #136 (fixture), #135 (gate.yml), #227 (preview opt-in) and the #138 tracker.

    Posted by Claude Code (on behalf of mmcky), from the 2026-11-04 decision session.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    high-priorityinfrastructure

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions