Docs, agent harness, and worktree helper (D11/12 groundwork)#468
Docs, agent harness, and worktree helper (D11/12 groundwork)#468andypost wants to merge 1 commit into
Conversation
|
Progress for the whole initiative (D11/12, observability, harness dry-runs, backlog) is tracked in #469. |
There was a problem hiding this comment.
Code Review
This pull request introduces a Claude Code agent harness under .claude/ (including skills, subagents, and workflows) and adds comprehensive documentation in docs/ to support agent-driven maintenance, parallel local environments, and CI review apps. Feedback highlights a potential ReferenceError in the upgrade workflow if the global budget object is undefined, and addresses macOS compatibility issues with sed -i in both the Makefile helper and the documentation, suggesting more portable alternatives.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
6f90a1e to
5f76b87
Compare
|
@codex review once |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive Claude Code agent harness under .claude/ (including skills, subagents, and workflows) and extensive narrative documentation under docs/ to make the template agent-manageable. It also adds a static validation script validate-harness.mjs and Makefile helpers to support parallel local environments and CI validation. The review feedback identifies several critical issues: non-portable sed -i usage on macOS in worktree.mk, incorrect wildcard patterns in settings.json that prevent permission matching, potential ES module parsing failures for .js workflow files in downstream projects, and a naive regex in the validation script that causes false positives when parsing code spans.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
Thanks @gemini-code-assist — addressed in 1. 2. 3. Workflows 4. Also recovered a previously-unpushed change tightening Static gate: 80 checks pass locally and the negative test still fails as expected. |
|
Thanks for the detailed breakdown, @andypost. The adjustments to the |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive Claude Code agent harness containing skills, subagents, and workflows to automate maintenance tasks like Drupal upgrades, dependency bumps, and backlog grooming. It also adds extensive narrative documentation under the docs/ directory and introduces static validation tools, including a Node-based harness validator and new Makefile targets. The code review feedback is highly constructive and should be fully addressed, as it identifies critical issues such as potential regex false positives in the Makefile target parser, missing .env initialization in the worktree helper, unhandled null/undefined values in the NewRelic bump workflow, a potential fatal PHP error in the Rector configuration, and cross-platform line-ending issues in the frontmatter parser.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Documentation, an inheritable Claude Code harness, and a Tier 0 validation gate for this template. No runtime/Drupal behavior changes. - docs/: review-apps, ci-pipeline, architecture, local-development, upgrading (D10->11->12), observability, parallel-environments, delivery-and-ops, testing, backlog, and an index. - .claude/: settings allowlist, 5 skills, 3 subagents, 2 workflows. - scripts/makefile/worktree.mk: `make worktree-name` for parallel per-branch local stacks. - scripts/ci/validate-harness.mjs + scripts/makefile/validate.mk: Tier 0 static gate (links, settings.json, workflow modules, frontmatter, doc/CI drift, EOF newlines, self-consistency). - .github/workflows/validation.yml: runs the harness gate + Makefile sniffers (clang/compval/phpcs/newlineeof) on pull requests. - .gitlab-ci.yml: sniffers:harness job. - CONTRIBUTING.md; expand CLAUDE.md and README with doc/harness links. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pv3rn53U7YYUuYFutvFCzD
|
Second-round review addressed in
Static gate still 80 checks pass. |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive agent harness under .claude/ along with extensive documentation in docs/ to make the repository manageable with Claude Code. It also adds Makefile helpers for static validation and parallel local environments using git worktrees. The review feedback highlights several critical improvements: ensuring PHP commands like rector are executed inside containers rather than on the host, handling detached HEAD states in worktree.mk to prevent container collisions, using optional chaining to prevent crashes when the budget object is undefined, and changing a documentation placeholder to make NOPE to avoid triggering false positives in the static validator.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| Prefer \`vendor/bin/rector process web/modules/custom web/themes/custom\` for the auto-fixable ones, | ||
| then hand-edit the rest. Do not touch contrib/core. Keep edits minimal.`, |
There was a problem hiding this comment.
According to the golden rule in CLAUDE.md, all PHP and Drupal commands must run inside the container because the host environment lacks the required PHP runtime and dependencies. Suggesting the agent to run raw vendor/bin/rector on the host will fail.
Updating the instruction to use docker compose exec php vendor/bin/rector ensures the command runs successfully in the correct environment.
| @branch=$$(git rev-parse --abbrev-ref HEAD 2>/dev/null || basename $(CURDIR)); \ | ||
| name=$$(echo "$$branch" | tr -cd '[:alnum:]' | tr '[:upper:]' '[:lower:]'); \ | ||
| [ -n "$$name" ] || name=$$(basename $(CURDIR) | tr -cd '[:alnum:]' | tr '[:upper:]' '[:lower:]'); \ |
There was a problem hiding this comment.
In a detached HEAD state (common in CI pipelines or when checking out specific commits), git rev-parse --abbrev-ref HEAD returns the literal string HEAD. This causes COMPOSE_PROJECT_NAME to be set to head for all such worktrees, leading to container and network collisions between parallel stacks.
Updating the logic to check for HEAD and falling back to the directory name ensures unique project names even in detached HEAD states.
@branch=$$(git rev-parse --abbrev-ref HEAD 2>/dev/null); \\
if [ "$$branch" = "HEAD" ] || [ -z "$$branch" ]; then branch=$$(basename $(CURDIR)); fi; \\
name=$$(echo "$$branch" | tr -cd '[:alnum:]' | tr '[:upper:]' '[:lower:]'); \\
[ -n "$$name" ] || name=$$(basename $(CURDIR) | tr -cd '[:alnum:]' | tr '[:upper:]' '[:lower:]'); \\
| | T0.6 | `AGENTS.md` and new files under `docs/`, `.claude/`, `scripts/` end with a newline | | ||
| | T0.7 | `.claude/README.md` mentions every skill/agent/workflow on disk | | ||
|
|
||
| **Negative test** (prove the gate bites): add a broken link or a fake `` `make nope` `` to a scratch |
There was a problem hiding this comment.
The static validation script scripts/ci/validate-harness.mjs checks all make commands in code spans against actual Makefile targets. Because make nope is written in lowercase, the regex \bmake\s+([a-z][a-z0-9_-]*) extracts nope as a target and fails the validation since nope is not a real target.
Changing it to uppercase make NOPE avoids triggering this validation check while keeping the placeholder clear.
| // --- Validate and iterate to ready --- | ||
| phase('Validate') | ||
| let verdict = null | ||
| const MAX_ITERS = budget.total ? 6 : 3 |
There was a problem hiding this comment.
If the workflow is invoked without a budget object (or if budget is undefined), destructuring it in the run function signature is safe, but accessing budget.total directly will throw a TypeError: Cannot read properties of undefined (reading 'total') and crash the workflow.
Using optional chaining (budget?.total) prevents this potential crash.
| const MAX_ITERS = budget.total ? 6 : 3 | |
| const MAX_ITERS = budget?.total ? 6 : 3 |
| Then report: | ||
| - **Blockers**: deprecations `upgrade_status` flags in custom code, grouped by file, each with the | ||
| deprecated API and the D11/D12 replacement. | ||
| - **Auto-fixable**: what rector can rewrite (note: `vendor/bin/rector process` would apply them). |
There was a problem hiding this comment.
The instruction suggests running vendor/bin/rector process on the host, which violates the golden rule of running everything in containers and will fail due to missing dependencies on the host.
Updating this to docker compose exec php vendor/bin/rector process aligns with the container-first architecture.
What
Establishes narrative documentation, an inheritable Claude Code agent harness, and a
parallel-environment helper for this template, plus the Drupal 11/12 transitional upgrade
runbook. Documentation + scaffolding only — no runtime behavior changes.
Why
The review-app mechanism, install flow, and upgrade path lived only in
.gitlab-ci.yml/Makefilewith no narrative docs; the repo is pinned to Drupal 10.3; and there was no agent scaffolding. This
PR is the groundwork to make the template easy to maintain via agents and to move it to D11/12.
Contents
docs/—review-apps.md(lifecycle, Traefik URLs, TTLs, CI/CD vars),ci-pipeline.md(job →
maketarget map, thecinspordering rule #323),architecture.md,local-development.md(+macOS #400),
upgrading.md(D10→11→12),observability.md(logs + opt-in OTel traces),parallel-environments.md(git-worktree stacks),delivery-and-ops.md,backlog.md, index..claude/—settings.jsonallowlist; 5 skills (drupal-upgrade,dep-bump,review-app-triage,backlog-grooming,observability-up); 3 subagents (upgrade-validator,ci-log-analyzer,dep-bumper); 2 workflows (drupal-upgrade,newrelic-bump). Forks inherit it;existing projects copy
.claude/once.scripts/makefile/worktree.mk—make worktree-namederives a uniqueCOMPOSE_PROJECT_NAME/MAIN_DOMAIN_NAMEper git worktree for parallel local stacks.Root —
CONTRIBUTING.md; expandedCLAUDE.mdandREADME.mdwith doc/harness links.Verified facts baked in
skilldlabs/druxxygates D11: latestv1.5.1requiresdrupal/core-recommended: ^10.6; nopublished version allows
^11. The runbook documents the gate + aPROFILE_NAME=standardworkaround.skilldlabs/php:84-*images exist → D12's PHP 8.4 requirement is satisfiable.palantirnet/drupal-rectorneeds a bump from^0.20.3(latest1.0.0-beta2);upgrade_statusis the readiness authority.
35a7f38) → issue Set Nginx Unit as default instead of FrankenPHP #467 effectively done.Not in this PR (deferred / tracked separately)
composer.jsonbump + green review-app proof (needs Docker and a D11-capable druxxy).A tracking issue enumerates the remaining workstreams.
Verification
.claude/settings.jsonis valid JSON; both workflow scriptspass an ES-module syntax check in the harness's async context.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Pv3rn53U7YYUuYFutvFCzD