docs: add a guide for upgrading a repo to a newer template version - #137
Conversation
A repository created with "Use this template" starts a fresh history with no common ancestor, so there is no automatic three-way merge back to the template. UPGRADING.md restores enough of a relationship to make picking up later toolchain changes mechanical. It recommends per-path `git checkout template/<ref> -- <paths>` over a merge: no shared history required, no conflicts, and the file tiering is enforced by which paths you type. The unrelated-histories merge and cherry-picking are documented as alternatives with their costs. Sorts every path into template-owned, hand-merge, and spec-owned, and calls out the exception -- src/<spec>.adoc is owned downstream but shaped by the template, so its ARC compliance surface (the Document State preface, toc::[] and [index] placement, ifndef:: defaults) has to be diffed on every upgrade. Also introduces a .template-version convention. Downstream `v*` tags are spec versions minted by version-bot, so nothing today records which template version a repo tracks; without that baseline every upgrade starts with archaeology. Complements MIGRATION.md, which covers adopting the toolchain once, rather than keeping up with it over time. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Bill Traynor <wmat@riscv.org>
Kersten Richter (kersten1)
left a comment
There was a problem hiding this comment.
Left you lots.... I didn't finish it.
| up later toolchain improvements — new workflows, fixed build scripts, ARC | ||
| compliance changes — without losing their specification content. | ||
|
|
||
| **How this differs from the other guides in this repo:** |
There was a problem hiding this comment.
Not sure why anyone would care about this info in this section. I'd move out to the readme actually.
There was a problem hiding this comment.
Split this. Added a pointer to the README IMPORTANT block alongside the existing MIGRATION.md / ANTORA.md lines, which is where someone actually discovers the guide exists.
The comparison table itself moved to the back of the document as Reference section D rather than into the README — the README block is three sentences and a four-row table would swamp it. If you would rather the table live in the README too, say so and I will move it.
Thanks! Co-authored-by: Kersten Richter <kersten@riscv.org> Signed-off-by: Bill Traynor <wmat@riscv.org>
Co-authored-by: Kersten Richter <kersten@riscv.org> Signed-off-by: Bill Traynor <wmat@riscv.org>
Co-authored-by: Kersten Richter <kersten@riscv.org> Signed-off-by: Bill Traynor <wmat@riscv.org>
Co-authored-by: Kersten Richter <kersten@riscv.org> Signed-off-by: Bill Traynor <wmat@riscv.org>
Co-authored-by: Kersten Richter <kersten@riscv.org> Signed-off-by: Bill Traynor <wmat@riscv.org>
Co-authored-by: Kersten Richter <kersten@riscv.org> Signed-off-by: Bill Traynor <wmat@riscv.org>
Address review comments on #137. The dominant theme was that the procedure buried under explanation, so the document is reordered procedure-first: Before you begin, Upgrade, Verify, Troubleshooting, Rolling back, When to upgrade. The rationale, file-ownership rules, and alternative approaches move to a Reference section at the back, linked from the steps that need them. Fixes found by running the procedure: - git rev-parse now precedes the heredoc that consumes its output - TARGET and BASELINE are defined and explained before first use - drop UPGRADING.md from the checkout list; it does not exist downstream until the template ships it in a release - point the changelog step at the template's CHANGELOG on GitHub and note that a local diff showing nothing is expected - add a step to commit, push, and open a pull request; the procedure previously ended with changes only in the working tree - offer a GitHub compare URL and lead with --stat wherever the guide asks the reader to read a diff Replace jargon flagged as untranslatable: "mechanical instead of archaeological", "transplant", "cheapest first", "ordered by how often they bite", "quietly customized", and the tier 1/2/3 numbering, which becomes template-owned / shared / specification-specific throughout. Trim the alternative strategies to a short unsupported-approaches note, fold src/<spec>.adoc into the shared files table, and add an UPGRADING.md pointer to the README IMPORTANT block. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Bill Traynor <wmat@riscv.org>
|
Thanks — this was exactly the review the document needed. Pushed 2e47414 addressing all 48 comments. Heads up before you pick the review back up: the document is reordered, so your remaining unreviewed comments will not line up with the new line numbers. The procedure now comes first, and the explanation moved to the back. StructureThe procedure-first point came up about six times, so I took it wholesale:
"One-time setup" became "Before you begin" with your framing, and what was step 4 is now step 1. Things you caught by actually running itThese were the most valuable comments in the review:
LanguageDropped everything flagged as not translating: "mechanical instead of archaeological", "transplant", "quietly customized", "cheapest first", "ordered by how often they bite", "the file contract", "tractable", "dispatch". "By hand" is now "manually" throughout. The tier 1/2/3 numbering is gone entirely in favour of template-owned / shared / specification-specific, which also fixed the "why would anyone care" problem with the old section openers. Explanatory comments moved out of the code blocks and into prose. Five threads need your inputI replied inline rather than just editing on these:
No rush on the rest of the review — it is a different document now, so re-reading from the top is probably less work than continuing where you stopped. |
Add a --stat lead and a GitHub compare pointer to the src/ assembler diff in 2.6, matching every other diff step in the guide. Replace the last surviving "mechanical application" phrasing in Reference A, which was flagged as not translating. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Bill Traynor <wmat@riscv.org>
|
Review threads are cleared — all 36 outstanding threads are replied to and resolved, each one naming where the fix landed so you can spot-check rather than re-read. One of them still needed a code change: Two threads left open, because both are yours to call rather than mine to edit:
One thing worth flagging before you pick this back up: your review ran to the end of the old 460-line file, but the restructure made it 619 lines and reordered it. Sections 4–6 (What upgrades tend to break, Rolling back, When to upgrade) and Reference A–D are effectively unreviewed in their current form — the earlier comments on that material were about text that has since moved or been rewritten. That back half is where I would spend the next pass. |
|
|
||
| ```shell | ||
| tests/release-info-test.sh | ||
| ``` |
There was a problem hiding this comment.
This command just sits there. I finally killed it.
There was a problem hiding this comment.
That should not happen and I would like to know what you saw. It runs in about a second here and ends with 64 passed, 0 failed. My guess is that it was blocked on a prompt rather than working: the test does git init on a throwaway repository and commits into it, so a global setting like commit.gpgsign=true can stop it dead waiting for a passphrase. Worth checking git config --global --get commit.gpgsign.
The guide now says what a passing run looks like and how to diagnose an apparent hang (bash -x tests/release-info-test.sh to see the last command). If it turns out to be something else on your machine, tell me what bash -x shows and I will document the real cause instead of my guess.
Fixes found by running the procedure: - Docker must be running, not just installed, for `make build`; note `make build-no-container` as the local-toolchain alternative. - Note the asciidoctor-bibtex failure for specs with no bibliography, and that removing it from REQUIRES is a local Makefile change that has to survive every future merge. - Say what a passing `release-info-test.sh` run looks like, and how to diagnose an apparent hang. - Make the compare URL a printed URL to open in a browser rather than something that looks like a shell command. - Spell out how to merge a shared file, since "hand-merge" was not actionable on its own. - Offer writing diffs to a file in 2.5 and 2.6. - Warn that `git log BASELINE..TARGET` is long from an old baseline. - Clarify that .template-version is created by the reader and read by nobody, and retitle 1.4 so it is about the template's releases rather than the age of the reader's repo. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Bill Traynor <wmat@riscv.org>
|
|
||
| ```shell | ||
| git rev-parse v4.0.0 | ||
| ``` |
There was a problem hiding this comment.
Is this always v4.0.0 or is it whatever version has the fewest differences? The one I'm testing now, v4.0.4 has the fewest so I'm assuming I use that?
There was a problem hiding this comment.
Whichever has the fewest — v4.0.0 was just what the sample output above happened to produce. Made that explicit: "Substitute your own baseline here — the sample output above happened to favour v4.0.0, but yours may be any of the releases, or template/main." So for your repo, v4.0.4.
|
|
||
| The age of your own repository is not a problem here — you can upgrade from any | ||
| baseline, however old. This section is about the other end: the *template's* | ||
| newest numbered release is missing work that is already on its `main` branch. |
There was a problem hiding this comment.
I am not sure what this paragraph is telling me. I understand that I can have a very old repo and all should still be well for upgrading. But how do I know if the template's newest numbered release is missing work?
There was a problem hiding this comment.
I'm assuming that when we get to a point that we can create a version, this para might make more sense?
There was a problem hiding this comment.
It was missing the actual answer to "how do I know". Added it as a How to tell paragraph: open the template's CHANGELOG.md and read the [Unreleased] section — anything listed there is on main but not in any numbered release. If nothing there matters to you, take the newest release and move on.
And yes, your second comment is exactly right. The section closes with: "Once the template's release line catches up with main, this section stops being necessary — [Unreleased] will be empty and the newest release will have everything." It is describing a temporary state of the template, not a permanent part of the procedure.
| TARGET=template/main | ||
| ``` | ||
|
|
||
| Use `template/main` to take the newest template code, or a release name such as |
There was a problem hiding this comment.
Not sure what "take the newest template code" means. maybe apply the latest template code?
There was a problem hiding this comment.
Changed to "applies the latest template code".
|
|
||
| Use `template/main` to take the newest template code, or a release name such as | ||
| `v4.0.4` to move to a specific numbered release. If you are pinning to a commit | ||
| (see 1.4), use the SHA. |
There was a problem hiding this comment.
don't we always want them on the latest? I'd skip this and say if you need to be on a specific version of the template, contact help@riscv and then you can walk them through it. Just muddies the waters else.
There was a problem hiding this comment.
Took it. The paragraph now defaults to the latest and stops explaining the alternatives:
template/mainapplies the latest template code, which is what you normally want. If you pinned to a commit SHA in 1.4, use that SHA here instead. If you need to land on a specific older template version, contacthelp@riscv.orgrather than working it out from this guide.
Kept the SHA line only because 1.4 sends some readers here with one in hand; that is still forward, not older.
|
|
||
| If your baseline is old, expect that list to be long — several hundred commits is | ||
| normal, and you are not meant to read it all. It is there to show you the size of | ||
| the jump. The changelog is the part you actually read. |
There was a problem hiding this comment.
not sure you need the last sentence as the first sentence of the next para says the same thing.
There was a problem hiding this comment.
Dropped.
|
|
||
| Then read the template's changelog for the same range. The commit list tells you | ||
| what moved; the changelog tells you what it means for you, because that is where | ||
| breaking toolchain changes are described in prose. |
There was a problem hiding this comment.
maybe just changes are described? Skip the "in prose".
There was a problem hiding this comment.
Dropped "in prose".
|
|
||
| If a file shows up here that you did change on purpose, stop and read that one | ||
| diff before continuing. See the note in the Reference about local edits to | ||
| template-owned files. |
There was a problem hiding this comment.
Can you link them to it?
There was a problem hiding this comment.
Linked: "See Template-owned in the Reference for what to do about a local edit to a template-owned file."
| git fetch template | ||
| ``` | ||
|
|
||
| Name it `template`, not `upstream`. If your repository is also a fork of |
There was a problem hiding this comment.
while I appreciate this info, it is confusing because I sat and thought for a minute about what I needed to name "template" and then realized that I did that in the last command.
There was a problem hiding this comment.
Right — the sentence was explaining the command above but read like a new instruction. It is now phrased as an explanation: "The remote is named template rather than the more usual upstream because if your repository is also a fork of something else, upstream will already be taken."
| with its own version-bot test tags (`vtest`, `v0.01`, `v1.0_rc1`), and tags can be | ||
| moved to point at a different commit. A SHA cannot. | ||
|
|
||
| ### 1.4 If the newest release does not have what you need |
There was a problem hiding this comment.
I'm not sure this heading is helpful. Would someone know what they need? Maybe call it Optional and Find out what is in the changelog or something like that.
There was a problem hiding this comment.
Retitled to 1.4 Optional: check whether the newest release has what you need, which says up front that it is skippable and what the check is.
| ``` | ||
|
|
||
| ### 2.2 See what changed | ||
|
|
There was a problem hiding this comment.
I'd make this optional too. I mean, it was all gobbledigook to me and I helped with some of it.
There was a problem hiding this comment.
Done — now 2.2 Optional: see what changed, opening with "You can skip this section and go straight to 2.3. It is here for when you want to know what is arriving before you take it."
| ```shell | ||
| git diff --stat "$BASELINE".."$TARGET" -- src/ | ||
| ``` | ||
|
|
There was a problem hiding this comment.
This is slightly confusing because I am comparing the spec-sample.adoc file but the changes need to go into my src/.adoc file. I mean, I can copy them into a spec-sample.adoc file but then I still need to update my src/.adoc file so not sure why I would do that. Am I wrong/
There was a problem hiding this comment.
You are not wrong, and the guide was not saying this clearly. The diff is of the template's spec-sample.adoc because that is the only place the scaffolding changes are visible — but the edits go into your own src/<your-spec>.adoc, by hand. You never touch a spec-sample.adoc in your repo.
Section 2.6 now says that before the first command:
What you are comparing, and why. The file you diff is the template's own sample assembler,
src/spec-sample.adoc, at your two refs. That tells you what scaffolding changed upstream. You then make the same change by hand in your ownsrc/<your-spec>.adoc. You never copyspec-sample.adocover your own file: it carries the sample specification's chapters and its ownspec_shortvalue, not yours.
| `src/<your-spec>.adoc` is the hardest file in this list, because ownership and | ||
| structure point in opposite directions. The file is yours — it names your | ||
| chapters — but everything around the `include::` lines is template scaffolding | ||
| that changes when ARC requirements change: the `[preface] == Document State` |
There was a problem hiding this comment.
Can you put these in a bulleted list to make it easier to scan?
There was a problem hiding this comment.
Done — the scaffolding is now five bullets: the ifndef:: attribute defaults, the [preface] == Document State block, the toc::[] placement, the list-of:: macros, and the [index] position.
|
|
||
| Apply any structural change — a new preface block, a moved `toc::[]` or `[index]`, | ||
| a new `ifndef::` default — to your own assembler, keeping your `include::` lines. | ||
| Never copy `src/spec-sample.adoc` over your own file. |
There was a problem hiding this comment.
I think this is going to need more of a walk-through. Also, it might suck, but you might put in a note saying that you or I will do it for you if you contact help@riscv - or whatever the email is.
There was a problem hiding this comment.
Expanded into a walk-through. It now classifies each hunk of the diff into one of two kinds — scaffolding (attributes, [preface] blocks, toc::[], list-of::, [index]), which you replicate in your own file; or an include:: line, which is the sample's chapters and you ignore — and gives a worked example of a new attribute default landing next to spec_short, with the point that spec_short stays yours.
And added the offer, as a callout at the end of the step:
If this step looks wrong to you, stop and ask rather than guessing. [...] Email
help@riscv.orgor open an issue on the template withtemplate-src.diffand yoursrc/<your-spec>.adocattached, and someone will do this merge with you.
- Reword the remote-naming note so it explains the command above rather than reading as a further instruction. - Say explicitly that the rev-parse baseline is the one picked in 1.2, not always v4.0.0. - Retitle 1.4 as optional and say how to tell whether a release is missing work: read [Unreleased] in the template's CHANGELOG. - Default the target to the latest template code; point readers who need a specific older version at help@riscv.org. - Mark 2.2 optional and drop the duplicated changelog sentence. - Link the template-owned reference note instead of describing it. - Rewrite 2.6 as a walk-through: say that the diff is of the template's sample assembler while the edits go in your own src/<your-spec>.adoc, classify hunks, give a worked example, and offer help@riscv.org. - Break the scaffolding list in the Reference into bullets. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Bill Traynor <wmat@riscv.org>
Why
A repository created with GitHub's Use this template starts a fresh history with no common ancestor shared with
docs-spec-template. Git sees the two as unrelated projects, so there is no automatic three-way merge and no obvious way to pick up later toolchain improvements — new workflows, fixed build scripts, ARC compliance changes.MIGRATION.mdcovers adopting the toolchain once. This covers keeping up with it over time.What it recommends
Per-path
git checkout template/<ref> -- <paths>rather than a merge: no shared history required, no conflicts, and the file tiering is enforced by which paths you type. The unrelated-histories merge and cherry-picking are documented as alternatives with their real costs.Every path is sorted into three tiers:
scripts/,.github/workflows/, reference docs. Take wholesale.Makefile,antora.yml,antora-playbook.yml,package.json. Hand-merge, keep your values.modules/ROOT/,SPEC_STATE.md,MAINTAINERS.md. Never take upstream.Two things worth reviewer attention
The
src/<spec>.adocexception. It is spec-owned by ownership but template-shaped by structure — the[preface] == Document Stateblock,toc::[]and[index]placement, and theifndef::attribute defaults are all ARC compliance surface. It is the one file that must be diffed on every upgrade and never copied wholesale. A repo that skips it upgrades cleanly and then fails ARC on format rather than content.A proposed
.template-versionconvention. Downstreamv*tags are specification versions minted byversion-bot.yml, so nothing today records which template version a repo tracks. Without that baseline, every upgrade starts with archaeology. The guide is explicit that this file does not exist in the template yet — it only pays off if the template adopts it, so it is the main thing to agree or reject here.The guide also notes that the semver release line (
v1.0.0→v4.0.4) currently lagsmain, with the Antora dual build, Pages publish, and PR preview artifact still under[Unreleased], and that the tag namespace is shared with version-bot test tags (vtest,v0.01,v1.0_rc1) — so it tells you to pin to a SHA rather than track a movingmain.Notes
README.adocyet; happy to add a line to itsIMPORTANTblock alongside theMIGRATION.md/ANTORA.mdpointers if reviewers want it here rather than in a follow-up.🤖 Generated with Claude Code