docs(installer): review the patched region, not the whole-file hash #89
Reference in New Issue
Block a user
No description provided.
Delete Branch "docs/installer-patch-region-review"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What & why
Plan-stage only — the installer crate does not exist yet (Phase 1 is next), so this changes the design and the operator guide, not code.
The problem. The patch tier refused on a whole-file hash mismatch, which answers the wrong question. The three patches touch three small regions of three large files; an operator who added a custom command to
Logging.cssomewhere else entirely had changed the file's hash without going anywhere near the patched lines, and was handed a manual patch job they did not need. Hand-modified shards are the norm, so that refusal covered most of the audience.The change — a four-rung ladder (
PLAN.md§2.2.1), cheapest and safest first:Rung 2 is the semantic review and needs no new metadata: a unified diff already carries the stock text of the region it edits (context lines + the
-lines are the pre-image). Guardrails keep it from degenerating into a fuzzy apply:patch --fuzz, no context reduction, since dropping context to force a match is how a patch lands in the wrong method;EventSink.csagainst a companion.csexpecting the whole thing cannot happen.install.jsonrecords which rung applied each patch;doctoranduninstallreport it, because aregion-matchapply into a file the operator had already modified is a different support story from a clean apply to a stock tree.The consequence — §2.2.2, and the reason it is its own section. The ladder retires the blanket "skip the tier unless ServUO is stock 57.4" gate, so the plan now states the line the ladder does not draw: content matching is a mechanical guarantee about where text lands, not a support commitment. A hunk can match textually and still be wrong for a tree whose behaviour has diverged, and ServUO's script build reports success even when it failed (§2.1) — so nothing will tell you.
57.4 remains the only supported version. A non-57.4 tree may still attempt the tier, but unsupported, untested and not guaranteed, behind:
--patchesalone is not consent, unattended runs need--patches-unsupported-servuoas well, because a flag you had to look up cannot be hit by accident in a script copied from somewhere else;install.json, every laterdoctorrun, and the uninstall report, so whoever inherits the shard sees it without being told.INSTALL.mdcarries the operator-facing half: a block-quoted ⚠ warning naming the silent-build failure mode and the back-up-first instruction, plus the updated prerequisite row, prompt list, flag table, and a sample run showing all three outcomes (stock file / region-match with the line it landed on / hand-off pointing at the cached.patch).How it was tested
Documentation only — no code, no build. Reviewed for internal consistency: every place that stated the old behaviour was updated with it (§1 decision table, §2.2, Phase 3, the
doctorsample and the uninstall table inPLAN.md; the prerequisites, prompts, flags,doctorsample and §4 inINSTALL.md).Checklist
AI-assisted contributions (required)
Claude Code (Opus 5). I have reviewed and understand every change, and take responsibility for it. AI-authored commits are marked with aCo-Authored-By/Assisted-Bytrailer.License
The patch tier refused on a whole-file hash mismatch, which is the wrong question: the three patches touch three small regions of three large files, so an operator who edited Logging.cs somewhere else entirely was handed a manual patch job they did not need. Hand-modified shards are the norm, so that refusal covered most of the audience. Replace the single hash test with a four-rung ladder (PLAN §2.2.1), cheapest and safest first: 0 post-patch text already present -> no-op, keeps re-runs idempotent 1 whole file matches the pre-image -> apply verbatim 2 file differs, patched region is still byte-identical -> apply at the matched offset 3 anything else -> do not touch the file; print the hunk to apply by hand Rung 2 needs no new metadata: a unified diff already carries the stock text of the region it edits (context lines plus the '-' lines). Guardrails keep it from becoming a fuzzy apply -- exact match with only CRLF/trailing-whitespace normalisation, exactly one occurrence or it fails, line numbers advisory only, and all-or-nothing per patch file so a half-patched EventSink.cs cannot happen. install.json records which rung applied each patch, and doctor and uninstall report it. This retires the blanket 57.4-only version gate, so PLAN gains §2.2.2 to draw the line the ladder does not: content matching is a mechanical guarantee about where text lands, not a support commitment. 57.4 stays the only supported version. A non-57.4 tree may attempt the tier, but unsupported, untested and not guaranteed -- behind a loud banner, a prompt defaulted to no, and its own --patches-unsupported-servuo flag, because a bare --patches can be hit by accident in a copied script. The unsupported marker persists into install.json, every later doctor run, and the uninstall report. INSTALL.md gets the operator-facing half: a block-quoted warning naming the silent-script-build failure mode, the updated prerequisite row, prompts and flag table, and a sample run showing all three outcomes. Co-Authored-By: Claude <noreply@anthropic.com>