Skip to content

Commit efa1570

Browse files
authored
Merge pull request #173 from dotkernel/upgrade-7.1
created page - upgrade to 7.1, skill
2 parents 4f786f7 + a2b9e26 commit efa1570

4 files changed

Lines changed: 215 additions & 0 deletions

File tree

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
name: upgrade-plan
3+
description: >
4+
Use when asked to plan, prepare or draft a new upgrade page for the Dotkernel documentation — for
5+
example "plan the 7.1 to 7.2 upgrade page", "what changed between releases", or "list the pull
6+
requests for the next upgrade guide". Produces a plan file in .claude/ that lists the pull
7+
requests of a release, split into important and optional updates, based on the release notes,
8+
commits and code of the source repository. Planning only: it does not create the page.
9+
---
10+
11+
# Upgrade page plan
12+
13+
Produce `.claude/PLAN-UPGRADE-<to>.md` for a new `docs/book/v<major>/upgrading/UPGRADE-<to>.md` page.
14+
This skill only plans.
15+
Do not create the page, edit `mkdocs.yml` or edit any other file until the user approves the plan and asks for it.
16+
17+
## Inputs
18+
19+
- `from` and `to`: the release tags, for example `7.0.0` and `7.1.0`. Ask if either is missing.
20+
- `repo`: defaults to `dotkernel/api`. Other Dotkernel repositories work the same way.
21+
- Check the tag exists with `gh release list -R <repo>` before going further.
22+
23+
## Steps
24+
25+
1. **Gather.** Run `bash .claude/skills/upgrade-plan/gather.sh <from> <to> [repo] > <scratchpad>/upgrade-<to>.md` and read the output.
26+
It prints the release notes, commit and file counts, the `composer.json` diff, the files touched by each pull request, and the commits on the release branch after the tag.
27+
2. **Read the code.** Never classify from titles.
28+
For every pull request that touches `src/`, `config/`, `bin/`, `composer.json`, migrations or entities, read its diff with `gh pr diff <n> -R <repo>`.
29+
With many pull requests, hand this step to a subagent and keep only its conclusions.
30+
3. **Classify** each pull request as important or optional using the rules below.
31+
4. **Cross-check** and record the findings in the plan:
32+
- pull requests that must be read together, for example one removes a file and a later one recreates it elsewhere
33+
- titles that disagree with the code, such as a class named differently in the title and the diff
34+
- release-note oddities: a changelog entry missing most pull requests, or dated differently from the release
35+
- which branch the release comes from, since a minor release may come from the previous branch
36+
5. **Scope.** List commits on the release branch after the tag as out of scope and unreleased.
37+
6. **Write the plan** to `.claude/PLAN-UPGRADE-<to>.md`, using the layout below.
38+
7. **Lint and report.**
39+
Run `npx --yes markdownlint-cli2 --config ~/.claude/markdownlint.jsonc ".claude/PLAN-UPGRADE-<to>.md"` and fix every issue.
40+
Tell the user the counts, the headline items, and anything from step 4 that needs a decision.
41+
42+
## Classification rules
43+
44+
Important: the change affects a project that has copied the skeleton.
45+
46+
- PHP version constraint, or any change to `require` or `conflict` in `composer.json` that reaches runtime
47+
- major version bumps of runtime dependencies
48+
- configuration files added, removed, renamed or with changed keys
49+
- database schema: entity columns, enums, DBAL types, migrations
50+
- entity, repository, service or interface signature changes
51+
- new or changed middleware, pipeline or routes, and any change of response, header or error behavior
52+
- security fixes and security headers
53+
- changes to Composer scripts or the post-install script
54+
55+
Optional: skipping it does not change how the application runs.
56+
57+
- CI workflows and GitHub Action bumps, Renovate, Qodana, code coverage
58+
- README, changelog and other documentation, API collections
59+
- dev-only dependencies with no effect on project code, and comment or type-only cleanups
60+
- config `.dist` clarifications
61+
62+
When unsure, classify as important and say why in the description.
63+
State the condition where a change only matters sometimes, for example "only when using PostgreSQL".
64+
65+
## Plan layout
66+
67+
Follow `.claude/PLAN-UPGRADE-7.1.md` if it exists, otherwise this order:
68+
69+
1. Goal, including the target file path and the page used as the template.
70+
2. Sources checked: release dates, target branch, commit and file counts.
71+
3. Findings that shape the page: the headline changes and the step 4 cross-checks.
72+
4. Pull requests: an important table and an optional table with `PR | Description`, each PR as a full URL, most impactful first.
73+
Escape `|` inside table cells as `\|`.
74+
5. Out of scope: unreleased commits.
75+
6. Page outline: the newest existing `UPGRADE-*.md` is the template, with the same headings, one sentence per line and the same bullet marker.
76+
Details has `### Important updates` and `### Optional updates`, and the FAQ covers PHP versions, migrations, moved config, and whether optional updates are required.
77+
7. Files to change on execution: the new page, the nav entry in `mkdocs.yml` (newest first), and `upgrading.md` only if it links the other version pages.
78+
8. Verification: markdownlint, a check that every PR URL from the release notes appears exactly once, `mkdocs build --strict` if available, and a check of versions against `composer.json` at the tag.
79+
80+
## Rules
81+
82+
- Every claim in the plan and in later FAQ answers must come from a diff or the release notes, not from memory.
83+
- Link pull requests by full URL, as the existing upgrade pages do.
84+
- Major releases (for example 6.x to 7.0) need migration guidance in the FAQ and not just a pull request list; say so in the plan.
85+
- Never publish or share the plan outside the repository.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bash
2+
# Collect the raw facts for an upgrade plan between two releases of a Dotkernel repository.
3+
# Usage: gather.sh <from-tag> <to-tag> [owner/repo] (default repo: dotkernel/api)
4+
# Output: Markdown on stdout. Needs gh (authenticated) and jq.
5+
set -euo pipefail
6+
7+
FROM="${1:?usage: gather.sh <from-tag> <to-tag> [owner/repo]}"
8+
TO="${2:?usage: gather.sh <from-tag> <to-tag> [owner/repo]}"
9+
REPO="${3:-dotkernel/api}"
10+
11+
for tool in gh jq; do
12+
command -v "$tool" >/dev/null || { echo "missing required tool: $tool" >&2; exit 1; }
13+
done
14+
15+
echo "# Raw data: $REPO $FROM -> $TO"
16+
echo
17+
18+
echo "## Release $TO"
19+
gh release view "$TO" -R "$REPO" --json tagName,publishedAt,targetCommitish,body \
20+
-q '"- published: \(.publishedAt)\n- target branch: \(.targetCommitish)\n\n\(.body)"'
21+
BRANCH="$(gh release view "$TO" -R "$REPO" --json targetCommitish -q .targetCommitish)"
22+
echo
23+
24+
echo "## Compare $FROM...$TO"
25+
gh api "repos/$REPO/compare/$FROM...$TO" --jq '"- commits: \(.ahead_by)\n- changed files: \(.files | length)"'
26+
echo
27+
28+
echo "## composer.json diff"
29+
echo '```diff'
30+
gh api "repos/$REPO/compare/$FROM...$TO" --jq '.files[] | select(.filename == "composer.json") | .patch' || true
31+
echo '```'
32+
echo
33+
34+
echo "## Files per pull request in the $TO release notes"
35+
gh release view "$TO" -R "$REPO" --json body -q .body | grep -o 'pull/[0-9]*' | sort -t/ -k2 -n -u | cut -d/ -f2 |
36+
while read -r pr; do
37+
gh pr view "$pr" -R "$REPO" --json number,title,mergedAt,files \
38+
-q '"### #\(.number) \(.title)\n- merged: \(.mergedAt)\n- files: \([.files[].path] | join(", "))\n"'
39+
done
40+
41+
echo "## Commits on branch $BRANCH after tag $TO (unreleased)"
42+
gh api "repos/$REPO/compare/$TO...$BRANCH" \
43+
--jq '"- ahead: \(.ahead_by)", (.commits[] | "- \(.sha[0:7]) \(.commit.message | split("\n")[0])")' 2>/dev/null ||
44+
echo "- (branch $BRANCH not comparable)"
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Upgrading from 7.0 to 7.1
2+
3+
## Summary
4+
5+
The changes you need to port into your project when moving from Dotkernel API 7.0 to 7.1, each linked to the pull request that introduced it.
6+
The headline items are the new PHP 8.3 minimum, the upgrade to `mezzio-authentication-oauth2` 3.x, and the schema change to the admin login log.
7+
8+
## Details
9+
10+
> You can find the release notes in [7.1.0](https://github.com/dotkernel/api/releases/tag/7.1.0) and a complete list in [Changelog](https://github.com/dotkernel/api/blob/7.0/CHANGELOG.md)
11+
12+
### Important updates
13+
14+
These changes affect your PHP version, dependencies, configuration, database schema, entities or runtime behavior.
15+
16+
* Upgrade `mezzio/mezzio-authentication-oauth2` to `^3.0.1`: the OAuth entities and repositories are adapted, `Admin` and `NumericIdentifierTrait` types are tightened, and the post-install script now generates `config/autoload/mail.local.php` [https://github.com/dotkernel/api/pull/511](https://github.com/dotkernel/api/pull/511)
17+
* Bump PHPUnit to `^12.5.23` and drop PHP 8.2 support: `composer.json` now requires PHP `~8.3.0 || ~8.4.0 || ~8.5.0` and tests use stubs instead of mocks [https://github.com/dotkernel/api/pull/510](https://github.com/dotkernel/api/pull/510)
18+
* Implement browscap in `AdminLogin`: the columns `deviceBrand`, `deviceModel`, `osPlatform`, `clientEngine` and `clientVersion` are removed and `isCrawler` is added, so a schema migration is required [https://github.com/dotkernel/api/pull/513](https://github.com/dotkernel/api/pull/513)
19+
* Remove `config/autoload/mail.global.php`: mail settings now live in `mail.local.php` [https://github.com/dotkernel/api/pull/499](https://github.com/dotkernel/api/pull/499)
20+
* OAuth2 token invalidated on Composer install/update: adds `bin/generate-oauth2-keys.php`, which skips existing keys, and points `post-update-cmd` to it [https://github.com/dotkernel/api/pull/506](https://github.com/dotkernel/api/pull/506)
21+
* Add security headers in `config/autoload/response-header.global.php`: `X-Content-Type-Options` and `Referrer-Policy` on all responses, `Cache-Control: no-store` and `Pragma: no-cache` on the token endpoints [https://github.com/dotkernel/api/pull/490](https://github.com/dotkernel/api/pull/490)
22+
* Add `MalformedRequestBodyMiddleware`, piped in `config/pipeline.php`: a malformed request body now results in a `BadRequestException` [https://github.com/dotkernel/api/pull/476](https://github.com/dotkernel/api/pull/476)
23+
* Require `symfony/var-exporter` to keep LazyGhost support [https://github.com/dotkernel/api/pull/485](https://github.com/dotkernel/api/pull/485)
24+
* Core sync: `created` becomes nullable in `TimestampsTrait` and `EntityInterface`, and the Admin, User and role entities are updated [https://github.com/dotkernel/api/pull/486](https://github.com/dotkernel/api/pull/486)
25+
* Bump `zircote/swagger-php` to `^6.0.0` [https://github.com/dotkernel/api/pull/522](https://github.com/dotkernel/api/pull/522)
26+
27+
### Optional updates
28+
29+
These changes cover development tooling, CI and documentation.
30+
Skipping them does not affect how the API runs.
31+
32+
* Bump `dotkernel/dot-maker` to `^2.0.0` and add a Composer `conflict` on versions below `2.0` [https://github.com/dotkernel/api/pull/494](https://github.com/dotkernel/api/pull/494)
33+
* Update PostgreSQL host configuration in `config/autoload/local.php.dist` to `127.0.0.1` [https://github.com/dotkernel/api/pull/465](https://github.com/dotkernel/api/pull/465)
34+
* Add Bruno collection, update readme [https://github.com/dotkernel/api/pull/516](https://github.com/dotkernel/api/pull/516)
35+
* Update API version in README example [https://github.com/dotkernel/api/pull/473](https://github.com/dotkernel/api/pull/473)
36+
* Configure Renovate [https://github.com/dotkernel/api/pull/515](https://github.com/dotkernel/api/pull/515)
37+
* Update branch for Qodana workflow to 7.0 [https://github.com/dotkernel/api/pull/491](https://github.com/dotkernel/api/pull/491)
38+
* Update Qodana action version to v2025.3 [https://github.com/dotkernel/api/pull/500](https://github.com/dotkernel/api/pull/500)
39+
* Update `JetBrains/qodana-action` to v2026 [https://github.com/dotkernel/api/pull/523](https://github.com/dotkernel/api/pull/523)
40+
* Update `JetBrains/qodana-action` to v2026.1.3 [https://github.com/dotkernel/api/pull/527](https://github.com/dotkernel/api/pull/527)
41+
* Update `actions/checkout` to v6 [https://github.com/dotkernel/api/pull/518](https://github.com/dotkernel/api/pull/518)
42+
* Update `actions/checkout` to v7 [https://github.com/dotkernel/api/pull/528](https://github.com/dotkernel/api/pull/528)
43+
* Update `actions/cache` to v5 [https://github.com/dotkernel/api/pull/517](https://github.com/dotkernel/api/pull/517)
44+
* Update `actions/cache` to v6 [https://github.com/dotkernel/api/pull/530](https://github.com/dotkernel/api/pull/530)
45+
* Update `codecov/codecov-action` to v6 [https://github.com/dotkernel/api/pull/520](https://github.com/dotkernel/api/pull/520)
46+
* Update `codecov/codecov-action` to v7 [https://github.com/dotkernel/api/pull/526](https://github.com/dotkernel/api/pull/526)
47+
48+
## FAQ
49+
50+
**Q: Is there an automated upgrade from 7.0 to 7.1?**
51+
52+
A: No.
53+
You implement each listed change manually in your own project.
54+
See [Upgrades](upgrading.md) for the recommended procedure.
55+
56+
**Q: Which PHP versions does 7.1 support?**
57+
58+
A: PHP 8.3, 8.4 and 8.5.
59+
PHP 8.2 is no longer supported; raise the `php` constraint in your `composer.json` before updating.
60+
61+
**Q: Do I need a database migration?**
62+
63+
A: Yes, if your project has the `AdminLogin` entity from 7.0.
64+
Pull request 513 removes five columns and adds `isCrawler`.
65+
Review it and generate a migration before touching production data.
66+
67+
**Q: Where did `mail.global.php` go?**
68+
69+
A: Pull request 499 removes it, and pull request 511 makes the post-install script copy the `dot-mail` distribution file to `config/autoload/mail.local.php` (and `mail.local.php.dist`).
70+
The script skips files that already exist, so move your mail settings into `mail.local.php` yourself.
71+
72+
**Q: Do I have to regenerate my OAuth2 keys?**
73+
74+
A: No.
75+
The new `bin/generate-oauth2-keys.php` from pull request 506 only generates keys when `data/oauth/encryption.key`, `private.key` or `public.key` is missing.
76+
Test your authentication flow after upgrading to `mezzio-authentication-oauth2` 3.x (pull request 511).
77+
78+
**Q: Do I have to apply the optional updates?**
79+
80+
A: No.
81+
They only concern tooling, CI and documentation.
82+
83+
**Q: Where do I find the complete list of changes?**
84+
85+
A: In the [7.1.0 release notes](https://github.com/dotkernel/api/releases/tag/7.1.0) and the project [CHANGELOG.md](https://github.com/dotkernel/api/blob/7.0/CHANGELOG.md).

‎mkdocs.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ nav:
2727
- "FAQ": v7/installation/faq.md
2828
- Upgrading:
2929
- "Upgrade procedure": v7/upgrading/upgrading.md
30+
- "Upgrading 7.0 to 7.1": v7/upgrading/UPGRADE-7.1.md
3031
- "Upgrading 6.x to 7.0": v7/upgrading/UPGRADE-7.0.md
3132
- "Upgrading 5.x to 6.0": v7/upgrading/UPGRADE-6.0.md
3233
- Flow:

0 commit comments

Comments
 (0)