Skip to content

chore: adopt the AI-native SDLC playbook and changie - #258

Merged
goanpeca merged 23 commits into
mainfrom
adopt-sdlc-playbook
Nov 24, 2026
Merged

goanpeca merged 23 commits into
mainfrom
adopt-sdlc-playbook

Conversation

@goanpeca

@goanpeca goanpeca commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adopts the AI-native SDLC playbook in b2-action, adapted to the harness this repo already has (the AGENTS.md map and the docs/ system of record), and moves the changelog to changie fragments so b2-action matches blazer and the other Backblaze Labs repos and SDKs. The skills are synced with the latest playbook (2026-11-24).

Closes #177. Part of #257, which stays open for the repo-admin settings and the deferred items below.

What changes

AI-native SDLC playbook (adapted to this repo, not copied)

  • REVIEW.md: four review passes (Bugs, Contract, Security, Compliance) tuned to how this Action actually fails (inputs parsed but never forwarded, wrong bucket handed to the SDK, outputs wrong on failure paths, secrets reaching outputs), plus severity, path:line evidence, report format, a do-not-report list, and convergence rules.
  • .claude/skills/: the playbook's process skills (ai-native-sdlc, sdlc-intent, sdlc-spec, sdlc-plan, sdlc-feedback-loop, sdlc-claude-md, sdlc-policy-skill, sdlc-subagents, sdlc-pr-review, sdlc-hook-gate, sdlc-harness-translate, sdlc-issue-templates, sdlc-explain-module, sdlc-risk-tiers, sdlc-review-tuning, sdlc-review-audit), each with an "In b2-action" note that maps it onto this repo's layout, plus a repo policy skill, b2-action-invariants, that restates each golden rule as an edit-time check and names the CI gate that enforces it.
  • .claude/hooks/ wired in .claude/settings.json: guard-dist.mjs (PreToolUse) denies hand-edits to the generated dist/ with a self-explaining reason, resolving symlinks and .. the way the OS does, and biome-check.sh (PostToolUse) exits 2 with Biome's message so the agent fixes the file. Both fail closed on an unreadable tool call. CI stays the authoritative gate.
  • .claude/agents/: verifier, code-simplifier, and researcher subagents.
  • AGENTS.md: adds REVIEW.md and .claude/ to the map and a "Workflow for larger changes" section that maps the playbook chain onto the existing layout (intent is the GitHub issue, spec is docs/design-docs/<slug>.md, plan is docs/exec-plans/active/NNNN-slug.md) instead of adding a parallel intent/ tree that would duplicate docs/.
  • pnpm ci:local: one command that mirrors the full PR gate (lint, release provenance, typecheck, tests, build, dist freshness, coverage, action.yml sync, changelog check, docs lint and links, prod audit).
  • PR template gains Testing, Risk, and How to revert sections and checklist items for ci:local, a fresh-context review against REVIEW.md, revert-failing tests, and recording repeated review lessons.
  • CODE_OF_CONDUCT.md, the same text b2-mcp uses.
  • .github/ISSUE_TEMPLATE/task.yml: a Task issue form (matching blazer's) for maintenance, tooling, CI, docs, release, and dependency work. It sets the native Task issue type and asks for the goal, checkable "done when" conditions, scope, area, and the risk tier from review-process.md. CONTRIBUTING.md now describes all three forms.
  • docs/design-docs/review-process.md: the risk-tiered review proposal, listed in the design-doc index with a new Proposal status.
  • .github/risk-tiers.json: the proposal's tiers and always-human paths as data, read by the sdlc-risk-tiers classifier. __tests__/risk-tiers.test.ts pins representative paths to their tier and checks CODEOWNERS names every always-human path (that test added RELEASE.md, src/inputs.ts, src/client.ts, and src/errors.ts to CODEOWNERS). Nothing gates on it yet. Run over the last 14 merged PRs, the classifier matched the table except fix: bump deps for Dependabot alerts 31-36 #233, lifted to High by 1,418 regenerated dist/ lines.
  • Review baseline in review-process.md from the sdlc-risk-tiers metrics script: 90% of the last 50 merged PRs had no human approval. The script now excludes Copilot, whose copilot-pull-request-reviewer login has no [bot] suffix and was counted as a person.
  • sdlc-review-audit script, adapted to this layout (follows CLAUDE.md to AGENTS.md, accepts bug_report.yml/feature_request.yml, reads tracked files only). On this branch it reports 6 MISSING rows, all branch-protection settings for an admin. AGENTS.md gains a Goals and non-goals section from that audit. The adapted assets pass all 44 of the playbook's own asset tests.
  • sdlc-review-tuning/assets/nightly-review.yml: a scheduled read-only review template hardened to this repo's workflow rules (SHA pin, persist-credentials: false, pinned Claude Code, timeout, concurrency). It is not installed; it waits on the API key and budget.
  • docs/design-docs/review-lessons.md: a pre-PR checklist mined from every review on all 48 merged PRs (192 findings across 31 PRs, almost all from Copilot, with the author replies), grouped by area with PR evidence: stale docs and comments, tests that do not prove the fix, Windows, scripts that exit 0 without running, secrets, workflows, concurrency, contract, and dependencies. It also records the review-process lessons and the one finding still open (ci: check docs on PRs #65). Linked from the AGENTS.md map, REVIEW.md, b2-action-invariants, and the PR template.

Code review layers (from "Solving code review at Anthropic")

  • .github/workflows/claude-review.yml: two separate Claude passes on every ready, non-fork PR, one running the REVIEW.md passes and one a security pass. Findings are inline and tagged Important, Nit, or Pre-existing; the jobs never approve. Pinned to anthropics/claude-code-action v1.0.250 (a release at least a week old), limited to read and comment tools, contents: read plus pull-requests: write, the two-clause Dependabot guard, and a concurrency group. Inactive (a notice, then skip) until an admin adds ANTHROPIC_API_KEY. Registered in the workflow-policy test, conventions.md, and the DEVELOPMENT gates table.
  • REVIEW.md gains: where review runs (before the PR, on every PR, by a human), every finding gets an answer, confirm a fix is pushed before saying "Fixed", root cause on bug fixes, flag the bug class across the diff, flag stale docs, say plainly when there is nothing to fix, and after three rounds ask the author to reconsider the approach.
  • docs/design-docs/review-process.md (still a Proposal) now carries the full model: the goal of least human time with revert and incident rates as guardrails, review layers, risk tiers set by the change, always-human paths (every workflow and composite action, .claude/, release and credential code), trusted authors only, bot approvals never count, the person prompting an agent is a reviewer, per-commit approval, review effort by tier, incidents as reviewer evals, measuring noise by author response, and a settings table with the current ruleset state.
  • CODEOWNERS: adds Felipe (ffumero2003, admin) to every rule, makes the always-human paths explicit, and orders broad rules before specific ones so the release and CI rules are no longer shadowed.

changie, uniform with blazer

  • .changie.yaml uses blazer's formats and the six Keep a Changelog kinds. Two deliberate differences: Removed is auto: major because the Action is past 1.0 (a major means a new floating vN tag), and the replacement bumps package.json version, this repo's single version source.
  • The existing history is split verbatim into .changes/v1.0.0.md through .changes/v1.2.0.md, and CHANGELOG.md is now generated by changie merge. Verified: every released heading and bullet is still present. The only differences are that the [Unreleased] entries became fragments and each compare link now sits beside its version.
  • Releases keep the signed pnpm version flow. Its version lifecycle step now runs scripts/changelog-release.mjs (replacing cut-changelog.mjs): changie batch v<version>, then changie merge. Simulated end to end: a prerelease leaves the fragments, a stable bump writes .changes/v1.3.0.md with the correct v1.2.0...v1.3.0 link, and a rerun is a no-op. RELEASE.md documents the new runbook, including checking changie next auto before cutting.
  • changie is pinned as a devDependency (1.26.0, no install scripts), so pnpm changelog:new needs no separate install.
  • Changelog gate (the ci: enforce CHANGELOG entry on release-relevant PRs #177 ask): .github/workflows/changelog.yml runs scripts/changelog-check.mjs, which fails a PR that changes src/, dist/, action.yml, or dependencies without adding a fragment, and validates that every fragment batches. It carries the two-clause Dependabot guard plus a skip-changelog label opt-out, is registered in __tests__/workflow-policy.test.ts, and is listed in conventions.md. Pure logic is unit-tested.
  • lychee now skips the changie sources under .changes/, whose links are relative to the generated root CHANGELOG.md; the generated file is still link-checked, and a test asserts both.

Security

Risk

Medium. No Action runtime code changes: src/ and dist/ match main. The release changelog step changes; it is verified by simulation, but its first real use is the next release, so follow the updated RELEASE.md runbook and check changie next auto first.

How to revert

Before the next release, reverting this PR is clean. After a release has been cut with changie, a revert also needs that release's .changes/vX.Y.Z.md content folded back into CHANGELOG.md by hand, because cut-changelog.mjs would return.

Verification

pnpm ci:local exits 0 on this branch: Biome clean, release provenance OK, typecheck clean, 545 tests pass, coverage 98.05 / 95.53 / 100 / 98.86, dist fresh, 35 inputs and 19 outputs aligned, changelog-check: OK, cspell and markdownlint clean, lychee 0 errors, and the prod audit passes its high threshold (one moderate advisory remains: minimatch GHSA-g3hv-75wg-m249, fixed only in minimatch 11, which @actions/glob does not allow yet). actionlint and zizmor 1.22.0 report nothing. The hooks were exercised with sample tool calls: dist/ edits are denied, src/ edits pass, a malformed .ts file returns exit 2 with Biome's message, and Markdown is skipped.

Needs a repo admin

  • Add the ANTHROPIC_API_KEY repository secret to turn on the two Claude review passes in claude-review.yml.
  • In the main ruleset, require approvals with code-owner review, dismiss stale approvals and require approval of the last push, require the status checks (CI, security, changelog, Claude review), require conversation resolution, and turn on a merge queue. Today it only blocks deletion and force-push, requires linear history, and runs Copilot review.
  • Create the skip-changelog label; the changelog workflow and CONTRIBUTING.md reference it.
  • Decide whether the changelog fragment check becomes a required status check on main.
  • Confirm branch protection on main requires a code-owner approval, so an author agent cannot approve its own PR (REVIEW.md assumes this).
  • Review docs/design-docs/review-process.md and accept, reshape, or close it.

Notes for reviewers

  • Deferred, as in Adopt the AI-native SDLC playbook and codify recurring review lessons #257: continuous evals in CI (needs an ANTHROPIC_API_KEY secret), per-environment deploy MCP tiers, and a close-the-loop control-band monitor. The router skill says these are not shipped yet.
  • The playbook skills keep the playbook's generic text so they can be re-synced; each carries an "In b2-action" note, and the few places this repo deliberately differs (test-first commits that respect the pre-commit hook, the fail-closed gate template, confirming a fix is pushed before replying) are reapplied on every sync. The repo-specific guidance lives in AGENTS.md, REVIEW.md, and b2-action-invariants.
  • Hooks run only inside Claude Code sessions; they are edit-time help, not enforcement.

@goanpeca goanpeca added this to the v1.3.0 milestone Oct 28, 2026
@goanpeca goanpeca added documentation Improvements or additions to documentation security Security hardening or vulnerability labels Oct 28, 2026
Copilot AI balanced review requested due to automatic review settings October 28, 2026 02:55
@goanpeca goanpeca added the ci CI/CD pipeline and automation label Oct 28, 2026
@goanpeca goanpeca self-assigned this Oct 28, 2026
@github-actions

Copy link
Copy Markdown

Build artifact for this PR: build.tar.gz (valid 1 hour)

@github-actions

Copy link
Copy Markdown

Build artifact for this PR: build.tar.gz (valid 1 hour)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The approval gate fails open when jq fails, and prerelease processing overwrites the requested version, producing an incorrectly versioned bundle and failing the release workflow’s tag/package-version check.

2 open issues
1 file not reviewed
  • pnpm-lock.yaml: Generated file
What changed in this PR

Adopts the AI-native development workflow within the repository’s existing AGENTS.md and docs/ structure, introduces changie-based release notes, and updates the Action’s bundled HTTP dependency.

Changes:

  • Adds review guidance, shared skills, subagents, edit-time hooks, and a combined local verification command.
  • Migrates changelog history to changie sources and adds fragment validation and release automation.
  • Updates undici to 6.29.1 and rebuilds the shipped bundle to include security fixes.

Approval remains the code owner’s call.

File Description
scripts/​run-lychee-lib.mjs Excludes changie source files from link checks.
scripts/​cut-changelog.mjs Removes the previous changelog release script.
scripts/​changelog-release.mjs Adds changie batching and merge automation.
scripts/​changelog-check.mjs Checks fragment presence and batch validity.
REVIEW.md Defines review passes and evidence standards.
RELEASE.md Documents the changie release process.
pnpm-workspace.yaml Updates the production undici override.
pnpm-lock.yaml Records changie and updated dependency resolutions.
package.json Adds changie, local verification, and release scripts.
docs/​references/​README.md Adds the changie reference.
docs/​design-docs/​review-process.md Proposes risk-tiered human review.
docs/​design-docs/​index.md Indexes the review proposal.
docs/​design-docs/​conventions.md Documents changelog workflow exclusions.
dist/​index.js Rebuilds the Action with updated undici.
DEVELOPMENT.md Documents local verification and changelog checks.
cspell.json Excludes changie sources from spellchecking.
CONTRIBUTING.md Explains fragments and the development workflow.
CODE_OF_CONDUCT.md Adds community conduct guidance.
CHANGELOG.md Converts release history to generated output.
AGENTS.md Maps the new workflow onto existing documentation.
.github/​workflows/​changelog.yml Adds PR-time changelog validation.
.github/​pull_request_template.md Adds risk, revert, and verification prompts.
.cspell/​project-words.txt Adds terminology used by the new tooling.
.claude/​skills/​sdlc-subagents/​SKILL.md Guides parallel sessions and subagents.
.claude/​skills/​sdlc-spec/​SKILL.md Guides requirements and design.
.claude/​skills/​sdlc-pr-review/​SKILL.md Guides structured PR review.
.claude/​skills/​sdlc-policy-skill/​SKILL.md Guides policy skills and supporting checks.
.claude/​skills/​sdlc-plan/​SKILL.md Guides implementation planning.
.claude/​skills/​sdlc-intent/​SKILL.md Guides problem and intent capture.
.claude/​skills/​sdlc-hook-gate/​SKILL.md Guides approval-gate hooks.
.claude/​skills/​sdlc-hook-gate/​assets/​gate-template.sh Supplies an approval-gate template.
.claude/​skills/​sdlc-harness-translate/​SKILL.md Maps playbook artifacts between layouts.
.claude/​skills/​sdlc-feedback-loop/​SKILL.md Guides verification and regression testing.
.claude/​skills/​sdlc-claude-md/​SKILL.md Guides assistant-context maintenance.
.claude/​skills/​b2-action-invariants/​SKILL.md Encodes repository-specific invariants.
.claude/​skills/​ai-native-sdlc/​SKILL.md Routes tasks through the development stages.
.claude/​settings.json Registers edit-time hooks.
.claude/​hooks/​guard-dist.sh Guards against direct bundle edits.
.claude/​hooks/​biome-check.sh Reports Biome failures after edits.
.claude/​agents/​verifier.md Defines an independent verification helper.
.claude/​agents/​researcher.md Defines a codebase research helper.
.claude/​agents/​code-simplifier.md Defines a behavior-preserving simplification helper.
.changie.yaml Configures release formats and version replacement.
.changes/​v1.2.0.md Preserves version 1.2.0 release notes.
.changes/​v1.1.0.md Preserves version 1.1.0 release notes.
.changes/​v1.0.1.md Preserves version 1.0.1 release notes.
.changes/​v1.0.0.md Preserves initial release notes.
.changes/​unreleased/​Security-20261027-214657.yaml Records the new undici security update.
.changes/​unreleased/​Security-20261027-214655.yaml Migrates existing unreleased security notes.
.changes/​unreleased/​Changed-20261027-214700.yaml Records workflow and changelog adoption.
.changes/​unreleased/​.gitkeep Retains the empty fragment directory.
.changes/​header.tpl.md Defines the generated changelog introduction.
__tests__/​workflow-policy.test.ts Adds the changelog workflow to policy checks.
__tests__/​run-lychee.test.ts Tests changie exclusions and changelog inclusion.
__tests__/​changelog-check.test.ts Tests shipped-path and fragment detection.

Review effort: Balanced

Comment thread scripts/changelog-release.mjs Resolved
Copilot AI balanced review requested due to automatic review settings October 28, 2026 03:01
@github-actions

Copy link
Copy Markdown

Build artifact for this PR: build.tar.gz (valid 1 hour)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The approval gate fails open when decision generation fails, and prerelease merging overwrites the package version, causing incorrect build metadata and a tag/package mismatch.

2 open issues
2 resolved since last review
1 file not reviewed
  • pnpm-lock.yaml: Generated file

Review effort: Balanced

Comment thread scripts/changelog-release.mjs Resolved
Copilot AI balanced review requested due to automatic review settings October 28, 2026 03:11
@github-actions

Copy link
Copy Markdown

Build artifact for this PR: build.tar.gz (valid 1 hour)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The regression fixture can miss a version rollback because its version field is not replaceable, and equivalent path spellings can bypass the dist guard.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

Medium severity Normalize paths before protecting the dist bundle

.claude/​hooks/​guard-dist.sh:14

Important — Bugs: The hook allows ./dist/index.js, an absolute path containing /./dist/index.js, and src/../dist/index.js, although each resolves to the protected bundle. Normalize the tool path and project root before matching dist/ so equivalent path spellings cannot bypass the guard. Add regression cases for these paths and an allowed source-file edit.

2 resolved since last review
1 file not reviewed
  • pnpm-lock.yaml: Generated file

Review effort: Balanced

Comment thread __tests__/changelog-release.test.ts Resolved
Copilot AI balanced review requested due to automatic review settings October 28, 2026 03:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The regression fixture places version last without a trailing comma, so the configured replacement never matches and the test cannot detect the version rollback it is intended to catch.

1 open issue
1 file not reviewed
  • pnpm-lock.yaml: Generated file

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 28, 2026 03:23
@github-actions

Copy link
Copy Markdown

Build artifact for this PR: build.tar.gz (valid 1 hour)

Signed-off-by: Gonzalo Peña-Castellanos <goanpeca@gmail.com>
@github-actions

Copy link
Copy Markdown

Build artifact for this PR: build.tar.gz (valid 1 hour)

@goanpeca

Copy link
Copy Markdown
Contributor Author

Copilot's review summary flagged that renaming a workflow out of a shipped directory could bypass the changelog requirement. Confirmed and fixed in 9501c9b: git diff --name-only collapses a rename to its new path, so moving .github/workflows/x.yml to a non-shipped path looked docs-only. scripts/changelog-check.mjs now passes --no-renames to both diff calls, so the old path counts. A new integration test in __tests__/changelog-check.test.ts moves a workflow out without a fragment and expects failure; it fails with the fix reverted. pnpm ci:local is green (520 tests), actionlint and zizmor 1.22.0 report nothing.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The workflow executes PR-controlled gate code with access to the API key and PR-write token, enabling credential theft or review bypass.

1 open issue
1 file not reviewed
  • pnpm-lock.yaml: Generated file

Review effort: Balanced

Comment thread .github/workflows/claude-review.yml Resolved
Copilot AI balanced review requested due to automatic review settings October 28, 2026 04:30
Signed-off-by: Gonzalo Peña-Castellanos <goanpeca@gmail.com>
@github-actions

Copy link
Copy Markdown

Build artifact for this PR: build.tar.gz (valid 1 hour)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Human assessment is needed because a reproduced symlink-and-parent-path bypass allows writes into the protected dist directory.

No open issues 🎉

1 resolved since last review
1 file not reviewed
  • pnpm-lock.yaml: Generated file

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 28, 2026 04:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Code-owner runtime validation is needed because the Claude review jobs have not run with real credentials and the signed release flow has only been simulated.

No open issues 🎉

1 file not reviewed
  • pnpm-lock.yaml: Generated file

Review effort: Balanced

Signed-off-by: Gonzalo Peña-Castellanos <goanpeca@gmail.com>
Copilot AI balanced review requested due to automatic review settings October 28, 2026 04:44
@github-actions

Copy link
Copy Markdown

Build artifact for this PR: build.tar.gz (valid 1 hour)

@goanpeca

Copy link
Copy Markdown
Contributor Author

Copilot's latest summary reported a symlink-and-parent-path bypass of the dist/ guard hook. Reproduced and fixed in 053a2b0: .claude/hooks/guard-dist.mjs normalized .. lexically before resolving symlinks, so with link -> dist/sub an edit to link/../index.js read as index.js while the OS writes dist/index.js. The hook now walks the path one segment at a time and resolves each symlink before applying .., as the OS does. Two new tests in __tests__/claude-hooks.test.ts cover a symlink into dist/ and .. out of one; the second fails on the old hook. pnpm ci:local is green (523 tests).

The other summary (real-credential Claude runs and the signed release flow are still unexercised) needs no code change: those are the activation prerequisites already listed in docs/design-docs/review-process.md and wait on the ANTHROPIC_API_KEY secret and a real release.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Code-owner validation is needed because the secret-bearing Claude jobs have only exercised their skip path, leaving inline-comment permissions unverified, while the signed changie release flow has only been simulated.

No open issues 🎉

1 file not reviewed
  • pnpm-lock.yaml: Generated file

Review effort: Balanced

Signed-off-by: Gonzalo Peña-Castellanos <goanpeca@gmail.com>
@github-actions

Copy link
Copy Markdown

Build artifact for this PR: build.tar.gz (valid 1 hour)

@github-actions

Copy link
Copy Markdown

Build artifact for this PR: build.tar.gz (valid 1 hour)

@goanpeca
goanpeca merged commit f8d3acb into main Nov 24, 2026
34 checks passed
@goanpeca
goanpeca deleted the adopt-sdlc-playbook branch November 24, 2026 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci CI/CD pipeline and automation documentation Improvements or additions to documentation security Security hardening or vulnerability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: enforce CHANGELOG entry on release-relevant PRs

2 participants