Repository navigation
feat(harper-best-practices): deploy from CI with OIDC, and roll back by deployment_id - #119
Merged
Merged
Conversation
dawsontoth
marked this pull request as ready for review
October 8, 2026 20:52
dawsontoth
force-pushed
the
gen/deploying-oidc-and-deployment-id
branch
2 times, most recently
from
October 8, 2026 21:24
b3930d9 to
8bbfbbb
Compare
dawsontoth
marked this pull request as draft
October 12, 2026 13:39
…by deployment_id Split the deploy guidance into two rules generated from the docs, against documentation@e73e5ef (after HarperFast/documentation#711): - deploying-to-harper-fabric covers a CLI deploy and what happens to the release afterwards: restart modes and canary certification, waiting on a rolling deploy's job on the node that received it, staging with activate=false, and going back to a kept release by its deployment_id instead of redeploying an older commit. Deploys replicate by default on Pro and Fabric. - deploying-from-ci is new. It sources the rewritten CI guide: a deploy-only role and user, a trust policy gated on a GitHub environment, Path A's complete workflow with its get_job wait, private-source credentials, Path B, the deployment record, and diagnosing and revoking a policy. As one rule, the sources would come to ~57KB, well over any other rule's input; split, each is ~27-30KB. must_cover anchors pin the new facts, including the workflow's checkout, CLI install, job wrapper and wait loop. The bodies are hand-written against the sources, following the generator's prompt, and committed with the docs build's input hashes. Part of #117. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…crets creating-a-fabric-account-and-cluster told agents to put the cluster username and password in .env or in GitHub Actions secrets. It now has the CLI run harper login and set HARPER_CLI_TARGET, and sends CI to deploying-from-ci, which stores no credential. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Regenerate the deploy rules against documentation@81c1b0e, which documents `harper deploy setup=true provider=github-actions` (HarperFast/harper#3127, HarperFast/documentation#722). deploying-from-ci now leads with that setup and the four conditions under which a job's harper commands authenticate, and keeps the hand-written role and policy for tag releases and customization, with `registration_info` added to the role. creating-harper-apps covers the deploy workflow create-harper 1.13.0 scaffolds (HarperFast/create-harper#147): deploy:setup-ci once, merge to main to deploy, npm run deploy by hand, and going back by deployment_id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dawsontoth
force-pushed
the
gen/deploying-oidc-and-deployment-id
branch
from
October 14, 2026 17:36
221206c to
beec766
Compare
dawsontoth
marked this pull request as ready for review
October 14, 2026 17:47
…I install The CI guide now installs harper@^5.3 and checks out with persist-credentials: false (HarperFast/documentation companion PR), so the 'npm install -g harper' anchor would no longer occur in the rule's sources. Anchor the pinned install instead, and quote Path A's checkout and install steps as the guide now writes them, so Validate passes whichever of the two PRs merges first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🎉 This PR is included in version 1.15.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
⊙ Problem
harper-best-practicestaught deploys from before Harper 5.3: CI signed in with a stored username and password, and nothing mentioned the deploy workflow create-harper now scaffolds. Given only the skill, an agent onmainwrites a deploy workflow it can't authenticate, or keeps a refresh token in a GitHub secret.💡 Solution
Deploy guidance is now two rules generated from
documentation@81c1b0e.deploying-from-cileads withharper deploy setup=true provider=github-actions(HarperFast/harper#3127), which sets up OIDC trusted publishing in one command, and keeps the hand-written policy for tag releases.deploying-to-harper-fabriccovers restart modes, canarycertification, staging, and going back bydeployment_id.creating-harper-appscovers create-harper's scaffolded workflow anddeploy:setup-ci(HarperFast/create-harper#147). Closes #117.This is meant to merge before Harper 5.4.0, which ships the setup command, is published. Until then, the rules send earlier versions to the hand-written route, with commands for the scaffolded workflow.
⚖️ Alternatives
deployment_id#117 proposed first: its input would be ~65KB, against ~31KB and ~35KB for the two halves, and regeneration compresses away more facts the larger the input.npm run generate: there's noANTHROPIC_API_KEYhere, so they're hand-written to the generator's template with real input hashes, as you OK'd.sync:reportlists both as current, and the next regeneration resamples them.More for the reviewer
main. The rule shows the single job a merge-to-maindeploy needs; a complete one would have to come from the docs first.restart=rollingplus a 10-minuteget_jobwait, as the guide and create-harper's workflow do. A job lives only on the node that received the deploy, so polls a load balancer routes elsewhere fail the step after a deploy that succeeded. The rule gives the docs' remedy: one node's URL for the deploy, the wait and the audience.deploying-to-harper-fabricbodies docs: regenerate rules from documentation@2cfb813 #121's and docs: regenerate rules from documentation@e73e5ef #122's syncs regenerated from the old sources, and keeps every fact of the latest that the docs still have.🔧 Changes
harper-best-practices/rules.manifest.yaml:deploying-to-harper-fabricgets a new description and eight new sources, by section: theharper deployparameters, the CLI's operation syntax, fourdeploy_componentsubsections (canary certification, staging, going back, and retrying an activation),list_deploymentsandget_job.Restartingis left out. New anchors pin going back bydeployment_id,replicated=false, and thecertificationtable and the rolling-job wait.deploying-from-ciis new: the setup command's reference section, six sections of the CI guide, plus workload identity, GitHub Actions policy specificity,list_oidc_trustanddrop_oidc_trust. Its anchors hold the setup command,workflow=, its policy name andregistration_info, Path A's trigger andjobs:wrapper, the environment gate, the deploy-only role, load-balanced polling, diagnosing and revoking, and the user setup creates.orderto make room.harper-best-practices/rules/deploying-to-harper-fabric.md: rewritten from the wider sources at81c1b0e. It covers logging in, and pointing GitHub Actions at the setup command, default replication on Pro and Fabric, restart modes andcertification, polling the node that received the deploy, going back bydeployment_id, with a rolling restart in its operation form too, and staging, including what retrying an activation does on each node. Package sources, deploying by reference and private-repository credentials are kept, with a pointer fromsetup=trueto the CI rule, and the examples include a rolling rollback.harper-best-practices/rules/deploying-from-ci.md: new. It covers the one-command setup: its defaults andworkflow=, what it checks, creates and refuses, and when the policy has to be written by hand. Then how a job'sharpercommands authenticate, with the four conditions and a single deploy job; the hand-written role and user, now withregistration_info; the trust policy and its environment gate; private-source credentials, Path A's workflow, Path B, diagnosing a refused run, the deployment record, and rollback, rotation and revocation. Examples give the setup for adeploy.ymlworkflow, replacing the policy setup wrote, the hand-written setup, a push-to-mainpolicy and an incident revocation.harper-best-practices/rules/creating-a-fabric-account-and-cluster.md: step 6 now runsharper loginand setsHARPER_CLI_TARGETinstead of a username and password in.env, and sends CI todeploying-from-cirather than GitHub secrets. fix(templates): set HARPER_CLI_TARGET in the scaffolded .env create-harper#146 switched the scaffolded.envto the same name.harper-best-practices/rules/creating-harper-apps.md: Next Steps log in and setHARPER_CLI_TARGETinstead of putting credentials in.env, and a new Deploying section covers the scaffoldeddeploy.yaml:deploy:setup-cionce, the by-hand setup before 5.4.0, merging to deploy,npm run deployby hand, going back bydeployment_id, and moving an older project over.harper-best-practices/SKILL.mdandharper-best-practices/AGENTS.mdare regenerated from the manifest and rule bodies: the index gets the new descriptions, and AGENTS.md gets 4.1, the new 4.2, the changed 4.3 and 4.4, with the later ops sections renumbered.Reviewers flagged three points in the workflows the CI rule quotes from the docs: Path A's persisted checkout token, its unpinned
harperinstall, and Path B building in the job that holdsid-token: write, which create-harper's Next.js workflow also does. A fix here would be regenerated away, so HarperFast/documentation#731 and HarperFast/create-harper#151 fix them at the source, and the rule picks them up on the next sync. #731 dropsnpm install -g harperfrom the sourced sections, so the anchor is nownpm install --global harper@^5.3, and Path A's quote matches #731's checkout and install. Validate passes whichever PR merges first.✅ Verification
Agents given only the skill, on
mainand on this branch, answered three deploy requests. On this branch they ran the setup command (withworkflow=for adeploy.yml),npm run deploy:setup-cifor a scaffolded project, and the hand-written policy forv*tags, storing no secrets. Onmainthey wrote workflows with no way to authenticate. The setup command itself wasn't run, because 5.4.0 isn't published.Agent answers, smoke test and checks
Agents. Sonnet agents, each told to read only a copy of the skill and answer three requests:
maindeploy.yml)id-token: writeand no trust policy or deploy user ("details not in skill"); else aharper login --for-citoken kept as a GitHub secretharper deploy setup=true provider=github-actions project=my-app workflow=.github/workflows/deploy.yml, withjson=trueand the wait step in the job; no secretsnpm create harper@latest. How do I get it deploying to my Fabric cluster?"npm run deployfrom the machine, optionally withCLI_TARGET_USERNAME/CLI_TARGET_PASSWORDin.env; doesn't know the project has a workflownpm run deploy:setup-cionce (5.4.0), then merge tomain;npm run deployby hand, going back bydeployment_idharper deploy ref=${{ github.ref_name }}, with authentication left openregistration_info) and aworkflow_pathpolicy gated on theproductionenvironment, restricted tov*tags; Path A's workflow with its wait stepLive smoke test, on a throwaway Harper 5.3.1, of the hand-written route's commands (run against an earlier revision of the rules; the role now also lists
get_deploymentandregistration_info):add_rolewith anoperationslist,add_user,add_oidc_trustwithclaims(both aworkflow_refpolicy and a tag-releaseworkflow_pathone),list_oidc_trust,drop_oidc_trust, andalter_user active=false. After the last,list_oidc_trustreportedinvalid_reason: names inactive user 'ci-deploy'. An audience without a port was rejected as the rules say.restart=trueeach returned adeployment_id,list_deploymentslisted them, andharper deploy project=my-app deployment_id=<v1> restart=trueserved v1 again. A payload staged withactivate=falseleft v1 serving until its id was activated, andrestartwithactivate=falsewas refused.harper get_job id=<restartJobId>reportedIN_PROGRESS, thenERROR: single-node core can't run a rolling restart ("Replication not implemented"), as the guide says. A real OIDC exchange from GitHub and canary certification (5.4.0) were not exercised.npm run validatepasses: format, build, tests, both validators, and the relationship lint.node scripts/generation/validate-generated.mjs --docs-path <documentation@81c1b0e>passes, fact retention and everymust_coveranchor included, andnpm run sync:reportlists both deploy rules as current with81c1b0e. It listsload-envas stale from unrelated docs changes; docs: regenerate rules from documentation@356a3bf #123 regenerates it.🤖 Generated with Claude Code
Related PRs: #122 supersedes (its
deploying-to-harper-fabricbody, as with #121's before it), #120 independentComplexity: medium
Deferred findings
3ff0dc941e775055nit maintainability —harper-best-practices/rules.manifest.yaml— New manifest comments restate docs or identifiers instead of a minimal reason — NOT FILEDReview-Coverage: authored=claude; ran=cursor-muse,gemini,codex,cursor-grok; adjudicated=domain; blocked=cursor-composer(no-receipt); declined=cursor-kimi,muse; rounds=7; full=3 @ 638e8a1
Review-Attention: study ~9m (decisions: do-less-alternative, fix-workflows-upstream, substring-anchors-for-yaml; raised: degraded review, open major) @ 638e8a1