Interim Solution: Local Patch Tracking + Upstream Monitoring #923
Replies: 5 comments 2 replies
-
|
Oh my gosh, you are such a genius. This is so needed. Thank you for posting; I really appreciate you. Because of the problem you have just solved, I basically just stopped with any upgrades because it's just too painful. Ill go from a patched working system, and then I upgrade and basically spend hours and hours and hours trying to get the new "non patched" system to work. This is an elegant solution to that problem. I really wish I had started with it from the get-go because I truly have no idea what all I've patched. |
Beta Was this translation helpful? Give feedback.
-
|
@jlacour-git Thanks from me too; I've just implemented your mods. |
Beta Was this translation helpful? Give feedback.
-
|
gonna try it today. Not waiting to get slammed with a 5hr needle in a haystack install of the next release |
Beta Was this translation helpful? Give feedback.
-
|
Thanks, glad to hear it's working for you both! If you hit any rough edges during setup or on your next upgrade, just ping me here. The tracking system is pretty battle-tested at this point — been through two major PAI version upgrades without losing any local modifications. |
Beta Was this translation helpful? Give feedback.
-
Update: Fix for Missed Discussion CommentsFound a bug in The ProblemGitHub Discussions have threaded replies — comments can have sub-comments. The Example: a discussion shows 5 comments in the scan report, but manual fetching only returns 2 (the top-level ones). The other 3 are replies to those comments. The FixAdded a discussion-specific GraphQL template to Step 3 that includes discussion(number: NNN) {
comments(first: 20) {
totalCount
nodes {
author { login } body createdAt
replies(first: 10) {
totalCount
nodes { author { login } body createdAt }
}
}
}
}Plus a warning: "Always include Gist updated — |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Interim Solution: Local Patch Tracking + Upstream Monitoring
Following up on the contribution pipeline discussion in #909. While Daniel and @ksylvan work on the staging repo and formal process, here's a system I've been using to manage local fixes between releases.
The Problem
Every PAI user who fixes bugs locally faces the same cycle:
Multiply that by 20+ patches across 3 version upgrades and it gets messy fast.
What This Is
Three tools that work together:
1. LOCAL_PATCHES.md — A structured registry for every local modification to SYSTEM files. Each patch has: files modified, linked issue/PR, problem description, and fix description. Patches are tracked as ACTIVE or RETIRED with clear lifecycle rules.
2. UpgradeCheck.ts — Run before upgrading. It parses your LOCAL_PATCHES.md, diffs each patched file against the target release, checks linked GitHub issues, and classifies every patch as SAFE (carries forward), CONFLICT (merge needed), or RETIRE (upstream fixed it). Turns a scary upgrade into a checklist.
3. UpstreamScan.ts — Monitors the repo for new issues, PRs, and discussions. Uses a digest file (JSON) that tracks what you've seen and what you decided about each item. Disposition-based filtering means you only see new stuff or items with new activity. Detects when you've participated in a thread.
The scan outputs structured JSON that your assistant then deep-dives — fetching comments, reading PR diffs, cross-referencing against your local patches.
How I Use It
"Check upstream" triggers a scan. The assistant runs UpstreamScan.ts, gets the JSON, then does the analysis work: classifying new items, checking for overlap with my patches, fetching relevant comments, and producing a report with concrete actions per item.
Before upgrading to a new version, I run UpgradeCheck.ts. It tells me exactly which patches need attention and which carry forward cleanly. Has worked well across 4.0.0 through 4.0.3.
Files
All files are in this gist: https://gist.github.com/jlacour-git/0e2ab62014dc5bcc3977be82ba26e68a
LOCAL_PATCHES-TEMPLATE.mdUpstreamScan.tsUpgradeCheck.tsUPSTREAM-DIGEST-TEMPLATE.jsonScanWorkflow.mdSetup
LOCAL_PATCHES-TEMPLATE.mdto~/.claude/LOCAL_PATCHES.mdUPSTREAM-DIGEST-TEMPLATE.jsonto wherever you want (the tools default to~/.claude/skills/_UPSTREAMWATCH/)UpstreamScan.tsandUpgradeCheck.tsin~/.claude/PAI/Tools/~/PAI/) — UpgradeCheck needs it for git diffsThe scan workflow is meant to be read by your assistant. You can put it in a skill, or just reference it manually.
Limitations
Releases/vX.Y/.claude/directory structure that PAI uses.Happy to answer questions or help adapt it to your setup!
Beta Was this translation helpful? Give feedback.
All reactions