Files
zeekay 1b367e2b62 chore: rebase the tree onto upstream master
The tree was a debranded snapshot of upstream taken around 2026-02-20, and
upstream has moved about five months since. This replaces it with upstream
master, mechanically re-derived: bin/debrand does the rename, and the
pipeline and squashed migrations are restored from the shipped tree.

Not a merge. The previous import replaced the tree wholesale in a single
commit, so there is no shared content history to merge against. Reproducing
the rename on the new tree is what actually converges.

What survives: .hanzo/workflows, the Dockerfiles and bin/docker* entrypoints,
compose files, LLM.md, and insights/migrations. The squashed initial
migration is load-bearing — the live database records it by name, so
upstream's ~918 individual migrations cannot come back.

Nine products are dropped as unreferenced. Twenty-one more that we do not run
are kept anyway because the core app still imports them; unpicking those is a
refactor and does not belong in a rebase.

This base does not build yet, and the reasons are not in the rename:
upstream now wants Python 3.13.13 against our 3.12.12 and Django 5.2 against
our 4.2, and the dependency manifests still name upstream packages that we
republish under our own names. Those are decisions, not renames.
2026-08-01 15:44:40 -07:00

51 lines
2.3 KiB
JavaScript

import fs from 'node:fs'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
const frontendDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..')
// The CI bundle-size job builds the PR branch and then the base branch in the same
// workspace, so the plain report filename holds the LAST build's (the base's) numbers.
// The PR build's report carries its checkout sha in the filename — the PR checks out the
// merge ref (GITHUB_SHA); head sha covers non-merge-ref checkouts. The base build runs
// last, so the plain file doubles as the baseline, but only when its sha differs from the
// PR's (otherwise the base build didn't emit a report — a base branch that predates the
// check — and the plain file is just the PR's own).
export function resolvePrAndBaseReport(basename, label) {
const eventPath = process.env.GITHUB_EVENT_PATH
const event = eventPath ? JSON.parse(fs.readFileSync(eventPath, 'utf-8')) : {}
const shaCandidates = [process.env.GITHUB_SHA, event.pull_request?.head?.sha].filter(Boolean)
const plainPath = path.join(frontendDir, `${basename}.json`)
const shaReportPath = shaCandidates
.map((sha) => path.join(frontendDir, `${basename}-${sha}.json`))
.find((p) => fs.existsSync(p))
const reportPath = shaReportPath ?? plainPath
if (!fs.existsSync(reportPath)) {
console.info(`No ${label} report found — nothing to post (branch may predate the check).`)
return null
}
if (!shaReportPath) {
console.warn(
`No report found for shas [${shaCandidates.join(', ')}]; falling back to ${reportPath} — ` +
`its numbers may be from a different checkout.`
)
}
const report = JSON.parse(fs.readFileSync(reportPath, 'utf-8'))
let baseReport = null
if (fs.existsSync(plainPath)) {
try {
const parsed = JSON.parse(fs.readFileSync(plainPath, 'utf-8'))
if (parsed.sha && report.sha && parsed.sha !== report.sha) {
baseReport = parsed
}
} catch {
baseReport = null
}
}
if (!baseReport) {
console.warn(`No base-branch report found — the ${label} section will not show a vs-base delta.`)
}
return { report, baseReport }
}