Commit 644ab82
feat(ci): PR test plugins ship a patch so they stack on shared files (OS-469) (#2674)
## Summary
Implements
[OS-469](https://linear.app/lime-technology/issue/OS-469/pr-test-plugin-ship-a-diffpatch-so-multiple-pr-plugins-can-stack-on).
The per-PR test plugin used to package changed files as **whole-file
copies**, overwrite them on install, and **abort** if another
`webgui-pr-*` plugin already managed any of the same files — so two PRs
touching one file (e.g.
[#2672](#2672) +
[#2673](#2673), both editing
`CreateDocker.php`) couldn't be tested together.
Now it ships a **unified diff** and `patch`-applies it, so
non-overlapping edits to the same file stack.
## How it works
- **Build** (`pr-plugin-build.yml`): for changed **text** files, stage
base + head versions in system layout and emit `pr.patch` (`diff -ruN`,
paths apply with `patch -p1` at `/`). Changed **binary** files are
copied whole into `binary/` with a `binary_files.txt` list. Both go in
the same tarball.
- **Plugin** (`generate-pr-plugin.sh`): on install, `patch -p1 --dry-run
--forward` first — **abort with a clear message on a real reject**
(overlapping change), otherwise apply and save `applied.patch`. Binaries
are whole-file replaced with a per-binary conflict guard. On remove (and
before update), reverse the patch (`patch -R`) and restore binary
backups.
- **Upload/R2 plumbing unchanged** — still a single tarball with the
same URL/SHA wiring.
## Validation (local simulation)
- Two patches editing the same file at different lines → **both apply,
both changes coexist**.
- Reversing one → **only that change is removed, the other stays**.
- Overlapping edits → **dry-run fails → install aborts** cleanly.
- Generated `.plg` is well-formed XML (all placeholders substituted);
`bash -n` + YAML parse clean.
## Notes / still to verify
- Real validation needs CI + an Unraid box installing two stacked PR
plugins. Conveniently, **this PR touches `.github/**`, so it will itself
build a PR test plugin with the new code** — a live smoke test of the
generator.
- Binary deletions aren't handled (rare); text add/modify/delete are.
- `patch` is present in the Unraid base; uses `--forward`/`--batch` for
non-interactive apply with fuzz.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Chores**
* Improved plugin install/update and uninstall to use a deterministic,
patch-based manifest workflow for safer reversibility.
* Enhanced plugin package generation to build a patch-oriented payload,
distinguishing text changes from full binary replacements.
* Updated the uninstall confirmation flow to reflect the new removal
behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent cc6a800 commit 644ab82
2 files changed
Lines changed: 246 additions & 295 deletions
0 commit comments