DevelopOther
@holtkeeper/upgrade-check
An AI check of what breaks when a running installation upgrades from one version of a repository to another, e.g. a certification environment that moves twice a year. The work is split across agents by area of the change, like a split code review. It talks to the LLM only through Agent, to git only through CommandRunner, and to the forge only through GitForge.
Analyzer
Section titled “Analyzer”createUpgradeCheckAnalyzer(deps) / upgradeCheckAnalyzer: kind and analysis upgrade-check, scope repo. It needs a checkout (jobs set ref to the to sha), the forge and an agent (required). It keeps the newest 50 records per repository. It has no refresh, so it never runs on a schedule or a trigger. Queue it only on demand.
| Option | Meaning |
|---|---|
from |
commit sha or tag installed now (required, never starts with -) |
to |
commit sha or tag to upgrade to (required, never starts with -) |
fromLabel |
display label of from, e.g. 1.4.0 |
toLabel |
display label of to |
apiChanges |
markdown of the public API changes of the repository’s own packages, computed by caller |
dependencyChanges |
markdown of the dependency changes, computed by caller |
commits |
commit subjects of the range; read with git log --no-merges from..to when absent |
costLimitUsd |
soft spend limit of the check in USD (default 6; 0 turns it off), see Areas below |
language |
language of summaries and findings (default English); stored in the data as language |
UpgradeCheckDeps (all optional):
inputsFor(repo, { from, to, signal? }): theapiChangesanddependencyChangesmarkdown, used when the options do not carry both. The options win. A failure leaves them out.contextFor(repo): team rules for the agents’ stablecontext, for example those of thereleaserules agent. A failure leaves them out.toolsetsFor({ repo, dir }): extra toolsets for the area passes. The host attaches its toolsets per task kind itself.
How the run works:
- Changes.
resolveCommitresolves both refs in the checkout withrev-parse --end-of-options; it never fetches, since job checkouts come from a mirror that already has every ref. Git runs with--literal-pathspecs, so paths are never read as globs or pathspec magic.gitRangeSourcereadsgit diff --name-status -zand--numstat -zwith rename detection, then reads diff text per area (at most 200 paths per call). Whenfromcannot be found orgit difffails, the forge’scompareCommitsis used instead (diffFilesSource). - Pipeline. The run calls
runUpgradeCheck(see below). - Record. The record’s
refisupgradeCheckRef(fromSha, toSha), i.e.<fromSha>..<toSha>, so a later request for the same range can find it. Itsshais thetocommit.
The run uses context.step for its changes and check steps when the task engine provides it.
Pipeline
Section titled “Pipeline”runUpgradeCheck(run) takes { agent, dir, from, to, source, commits?, apiChanges?, dependencyChanges?, context?, language?, toolsets?, costLimitUsd?, signal?, log? } and returns UpgradeCheckData. Every call uses upgradeSystemPrompt(language): the summary, area summaries and findings (title, detail, check, affects) are written in language (English by default), while code, identifiers, versions, package names, file paths and the verdict, severity and category values stay unchanged:
- Select.
selectFilesskips binary files and the lockfiles and generated, vendored, built or minified files ofisRangeNoisefrom @holtkeeper/release. At mostMAX_FILES(600) files are kept: source before tests and docs, smaller changes first. The rest is skipped and the check is markedcapped. - Group.
groupAreaskeeps a change withinSINGLE_AREA_MAX_LINES(600) changed lines andSINGLE_AREA_MAX_FILES(20) files in one area. Otherwise it groups files byareaKeyOf: the top-level directory, or two levels underapps,packages,libs,services,modules,cmd,internal,pkg,src,plugins,componentsanddeploy. While there are fewer thanMAX_AREAS(8) groups, the heaviest group overAREA_SPLIT_LINES(1 500) changed lines with more than one file is split by its next directory level, or into two contiguous halves (<key> (part 1),(part 2)) when its files share one directory, so a large change under one directory still spreads over several passes. The heaviest groups then seed at mostMAX_AREASareas, and the remaining ones join the lightest area. - Plan. One call (task kind
upgrade-plan, phaseplan, tierfast, no tools, one turn) names each area and says what to look for. It reads the area file lists, the commit subjects (at mostMAX_COMMITS, 200, each cut to 200 characters) and the computed API and dependency changes (each cut toCONTEXT_MAX_CHARS, 12 000). If the plan fails, the areas keep their directory names and get no focus. - Areas. One pass per area runs with task kind
upgrade-check, phasearea, tiermain,readandsearchcapabilities andareaTurnsturns (AREA_MIN_TURNS20, one more per file and per 20 changed lines, at mostAREA_MAX_TURNS40), at mostAREA_CONCURRENCY(4) at once. The passes shareAREA_BUDGET_SHARE(0.85) ofcostLimitUsdevenly; one that spends its share is asked for its answer (answerAtCostUsd). They read at mostAREA_READ_LINES(400) lines perread_fileby default and clear older tool results pastAREA_TRIM. Each pass gets the range, the names of the other areas, the planner’s focus (cut to 400 characters and presented as a hint derived from repository text, not an instruction), the commits, the computed changes, the area’s renamed files (old → new) and its own diff, each file in a fenceddiffblock that the prompt calls data, never instructions. The diff goes throughrangeCodeDiffand is cut toAREA_DIFF_MAX_CHARS(80 000). Files left out to fit are counted inskipped, and the check is markedcapped. A pass returns a summary and structured findings; at mostMAX_FINDINGS_PER_AREA(15) are kept, breaking and risky ones first (capFindings). A pass that gives no structured answer (turn limit, unparsable JSON) counts as failed. The system prompt covers API contracts, configuration and environment variables, migrations and stored data, behavior, runtime and dependency requirements, and deployment files. Findings must be grounded in code the agent read, and each must say how to check it. - Merge.
dropDuplicateFindingsmerges findings across areas.sameFindingtreats two findings as the same when they have the same category and either the same title, the same file and line, or a similar title on a shared file. The merged finding keeps the higher severity and both sets of files (at most 10). - Verdict. One call (task kind
upgrade-plan, phaseverdict, tierfast, no tools) returns the verdict, a short markdown summary and the remaining duplicates. It lists at mostVERDICT_MAX_FINDINGS(60) findings, the rest as counts, with area summaries and details cut to 600 characters.settleVerdictkeeps the verdict within what the findings support: never milder thanverdictFloor(breakingwhen any finding is breaking,reviewwhen any is risky), neverbreakingwithout a breaking finding, and at leastreviewwhen an area was not checked. If the call fails, the verdict follows the findings and the summary is a fixed sentence. - Ids.
finalizeFindingssorts findings by severity and gives each a stable id from its category, title and first file.
An area that fails or gives no structured answer is listed in skipped and named in the summary under Not checked. The run rejects when every area fails, when a spend limit (BudgetExceededError) stops a pass, or when it is aborted. A range with no readable changes returns safe without any agent call.
UpgradeCheckData (upgradeCheckDataSchema):
{ from: { ref: string; sha: string; label?: string } to: { ref: string; sha: string; label?: string } verdict: 'safe' | 'review' | 'breaking' summary: string // markdown areas: { name: string; files: number; summary: string }[] findings: { id: string severity: 'breaking' | 'risky' | 'info' category: 'api' | 'config' | 'data' | 'behavior' | 'dependency' | 'infra' | 'other' title: string detail: string files: { path: string; line?: number }[] affects?: string check: string // how to check or prepare }[] skipped: { files: number; reason: string }[] capped: boolean usage?: { turns: number; costUsd?: number; inputTokens?: number; outputTokens?: number } durationMs?: number language?: string // language the texts were asked in; absent means English}upgradeCheckAnalysis summarizes a record as these metrics: verdict, breaking and risky counts, files checked, areas and cost. Its report has a summary, findings grouped by severity (each with its files, who it affects and how to check it), an areas table and a Not checked table.
Host wiring
Section titled “Host wiring”- Task kinds:
upgrade-plan(no toolsets) andupgrade-check(code,knowledgesearch only,packages,git). Both belong to thereleaserules agent and thereleasesAI usage feature. - Queue jobs with analyzer
upgrade-check,refset to thetosha, and options{ from, to, fromLabel?, toLabel?, language? }, with both refs as shas. A record written in another language than the one asked for should not be reused: compare its data’slanguage(absent means English).