feat(upgrade): honest provenance for partial upgrades - #38
Merged
Conversation
After an --apply that preserves user edits or leaves conflicts, packkit.json no longer implies the project is a fresh scaffold of the new version. The written provenance now records what actually happened: - version (generatedWith) is left at the original scaffold version; - lastUpgradeCheckedWith / lastUpgradeAppliedWith record the upgrade version; - upgradeStatus is 'current' only when nothing was left unresolved, else 'partial' with an unresolvedChanges count. The baseline still advances to the new generated state so preserved edits are correctly recognized as customizations on the next upgrade. Fields are additive, so existing packkit.json files stay valid. Documented in types and README. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
After a partial
packkit upgrade --apply— one that preserves user edits or leaves conflicts unresolved — the writtenpackkit.jsonno longer implies the project is a fresh scaffold of the new version.Why
Previously
buildUpgradeWritecopied the freshly-generatedpackkit.json(new version + new baseline) whenever provenance was outdated, even if changed files/scripts/deps/fields were deliberately left unapplied. A host reading provenance couldn't tell "fully upgraded" from "upgrade ran, but half of it was preserved."How
packkit.jsonnow records what actually happened:version(generatedWith) stays at the original scaffold version — an upgrade is not a re-scaffold.lastUpgradeCheckedWith/lastUpgradeAppliedWithrecord the upgrade version.upgradeStatusiscurrentonly when nothing was left unresolved, otherwisepartialwith anunresolvedChangescount.The baseline still advances to the new generated state, so preserved edits are correctly recognized as customizations on the next upgrade (not re-flagged as template drift). All new fields are additive — existing
packkit.jsonfiles remain valid, and repeated upgrades keep the originalgeneratedWith.Documented in
types/embedded.d.ts(UpgradeStatus,UpgradeProvenance) and README.Tests
versionunchanged,upgradeStatus: 'partial', and a positiveunresolvedChanges.replace-changedeverywhere) test assertsupgradeStatus: 'current'with no count.🤖 Generated with Claude Code