mirror of
https://github.com/okieselbach/AutopilotMonitor.git
synced 2026-10-24 04:32:32 +00:00
refactor: move the error-code generator from scripts/ to tools/ (D-225)
scripts/ at the repo root is the customer surface: everything under Bootstrap/ and CustomerSetup/ is published to the download container by Publish-BootstrapScripts.ps1, Authenticode-signed and version-gated. The error-code generator is a maintainer tool no workflow runs, so it diluted that invariant. .github/scripts/ was not the alternative -- it holds only helpers a workflow step invokes, and unlike guardrails-in-sync and shared-manifests-in-sync the catalog has no CI drift gate (the generator needs IME_ENUMS_JSON from operator tooling and live MS Learn fetches). REPO_ROOT stays ../.. at the new depth, so only the documented path moved: the generator header and README, the C# and TypeScript comments, the test summary, and the description header of error-codes.json together with the generator literal that emits it (the two must stay identical or the next regeneration diffs). The web sync re-ran clean at 607 entries with no change to utils/error-codes.json, which drops the header.
This commit is contained in:
+1
-1
Submodule .claude/commands updated: 9b64bee712...d004f83c8a
+1
-1
Submodule internal updated: 76f4fb8492...03329929f0
@@ -9,7 +9,7 @@ using Xunit;
|
||||
namespace AutopilotMonitor.Functions.Tests.Shared;
|
||||
|
||||
/// <summary>
|
||||
/// Pins the schemaVersion-2 catalog contract (generated by scripts/error-codes/generate.mjs):
|
||||
/// Pins the schemaVersion-2 catalog contract (generated by tools/error-codes/generate.mjs):
|
||||
/// key/source/category vocabulary, the HRESULT_FROM_WIN32 derivation, the symbol and
|
||||
/// enforcement-state indexes, and the handful of entries product code and rules rely on.
|
||||
/// </summary>
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace AutopilotMonitor.Shared.Models
|
||||
|
||||
/// <summary>
|
||||
/// One Windows / MSI / Intune error-code catalog entry. Mirrors the structure of
|
||||
/// <c>Resources/error-codes.json</c> (generated by <c>scripts/error-codes/generate.mjs</c>)
|
||||
/// <c>Resources/error-codes.json</c> (generated by <c>tools/error-codes/generate.mjs</c>)
|
||||
/// and the TypeScript <c>ErrorCodeEntry</c> in the web app.
|
||||
/// </summary>
|
||||
public sealed class ErrorCodeEntry
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"schemaVersion": 2,
|
||||
"description": "Single-source catalog of Windows / MSI / Intune error codes, generated by scripts/error-codes/generate.mjs from primary sources — never edit by hand. Consumed by the backend (ErrorCodeCatalog.cs, ErrorCodeEnricher.cs), the web app (utils/errorCodeMap.ts via the sync-error-codes prebuild step) and the MCP server (lookup_error_code). Keys are lowercase 8-digit hex ('0x80070005') or decimal MSI exit codes ('1603'; only 0, 1601-1654, 3010 — other decimal exit codes are installer-defined). Win32 codes live only as 0x8007xxxx entries; HRESULT_FROM_WIN32 values in the MSI range resolve to the decimal entry at lookup time. confidence: high = MS Learn or the IME build named in source; medium = paraphrase of an enum member name or of an analysis rule; low = carried over from the v1 catalog without a primary source. category is one of: msi, win32, com, appx, windows-update, cbs, intune-win32, intune-mobile, mdm-enrollment, autopilot, entra-join, delivery-optimization. imeRetriesDuringEsp marks the MSI return codes the IME retries automatically during the Autopilot ESP. enforcementStates maps the IME app enforcement state numbers to their names.",
|
||||
"description": "Single-source catalog of Windows / MSI / Intune error codes, generated by tools/error-codes/generate.mjs from primary sources — never edit by hand. Consumed by the backend (ErrorCodeCatalog.cs, ErrorCodeEnricher.cs), the web app (utils/errorCodeMap.ts via the sync-error-codes prebuild step) and the MCP server (lookup_error_code). Keys are lowercase 8-digit hex ('0x80070005') or decimal MSI exit codes ('1603'; only 0, 1601-1654, 3010 — other decimal exit codes are installer-defined). Win32 codes live only as 0x8007xxxx entries; HRESULT_FROM_WIN32 values in the MSI range resolve to the decimal entry at lookup time. confidence: high = MS Learn or the IME build named in source; medium = paraphrase of an enum member name or of an analysis rule; low = carried over from the v1 catalog without a primary source. category is one of: msi, win32, com, appx, windows-update, cbs, intune-win32, intune-mobile, mdm-enrollment, autopilot, entra-join, delivery-optimization. imeRetriesDuringEsp marks the MSI return codes the IME retries automatically during the Autopilot ESP. enforcementStates maps the IME app enforcement state numbers to their names.",
|
||||
"entries": {
|
||||
"0": {"description":"The action completed successfully","confidence":"high","source":"msdoc:https://learn.microsoft.com/en-us/windows/win32/msi/error-codes","category":"msi","symbol":"ERROR_SUCCESS"},
|
||||
"1601": {"description":"The Windows Installer service couldn't be accessed. Contact your support personnel to verify that the Windows Installer service is properly registered","confidence":"high","source":"msdoc:https://learn.microsoft.com/en-us/windows/win32/msi/error-codes","category":"msi","symbol":"ERROR_INSTALL_SERVICE_FAILURE"},
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace AutopilotMonitor.Shared.Services
|
||||
/// <summary>
|
||||
/// Single-source-of-truth lookup for Windows / MSI / Intune error codes. Loaded once
|
||||
/// from the embedded <c>Resources/error-codes.json</c> resource (schemaVersion 2,
|
||||
/// generated by <c>scripts/error-codes/generate.mjs</c>) and exposed via dictionaries
|
||||
/// generated by <c>tools/error-codes/generate.mjs</c>) and exposed via dictionaries
|
||||
/// keyed by normalised code string (lowercase hex, e.g. <c>0x80070005</c>, or decimal MSI
|
||||
/// exit code, e.g. <c>1603</c>), by symbol and by enforcement state.
|
||||
/// <para>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* The authoritative copy lives at:
|
||||
* src/Shared/AutopilotMonitor.Shared/Resources/error-codes.json
|
||||
* (generated by scripts/error-codes/generate.mjs at the repo root; never edited by hand).
|
||||
* (generated by tools/error-codes/generate.mjs at the repo root; never edited by hand).
|
||||
*
|
||||
* The backend (ErrorCodeCatalog.cs) embeds that file; the web app (utils/errorCodeMap.ts)
|
||||
* imports the copy this script writes to utils/error-codes.json. The copy is validated,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Wrapper around the shared error-codes catalog (schemaVersion 2).
|
||||
*
|
||||
* The catalog lives at `src/Shared/AutopilotMonitor.Shared/Resources/error-codes.json`
|
||||
* (generated by `scripts/error-codes/generate.mjs` at the repo root) and is synced into
|
||||
* (generated by `tools/error-codes/generate.mjs` at the repo root) and is synced into
|
||||
* `utils/error-codes.json` at build time (`scripts/sync-error-codes.js`, wired into the
|
||||
* `prebuild` npm script). The sync validates the catalog, shortens `source` to its kind and
|
||||
* drops the enforcement-state map; backend, MCP and web resolve from the same entries.
|
||||
|
||||
@@ -7,7 +7,7 @@ hand: a wrong or missing entry is fixed in the generator (a source, a pin, a fam
|
||||
regenerated, so the next regeneration cannot lose the fix.
|
||||
|
||||
```
|
||||
IME_ENUMS_JSON=<path> node scripts/error-codes/generate.mjs [--cache-dir DIR] [--check]
|
||||
IME_ENUMS_JSON=<path> node tools/error-codes/generate.mjs [--cache-dir DIR] [--check]
|
||||
```
|
||||
|
||||
- `IME_ENUMS_JSON` — enum extract of one Intune Management Extension build (`imeVersion`,
|
||||
@@ -6,7 +6,7 @@
|
||||
* sources and writes the web copy through the web sync script. Every entry carries the
|
||||
* source it was taken from; nothing is typed in from memory.
|
||||
*
|
||||
* node scripts/error-codes/generate.mjs [--cache-dir DIR] [--check]
|
||||
* node tools/error-codes/generate.mjs [--cache-dir DIR] [--check]
|
||||
*
|
||||
* IME_ENUMS_JSON required — path to the enum extract of one Intune Management Extension
|
||||
* build (customErrorCodes, enforcementStates, msiRetriableErrorCodes,
|
||||
@@ -492,7 +492,7 @@ async function main() {
|
||||
const header = {
|
||||
schemaVersion: 2,
|
||||
description:
|
||||
"Single-source catalog of Windows / MSI / Intune error codes, generated by scripts/error-codes/generate.mjs from primary sources — " +
|
||||
"Single-source catalog of Windows / MSI / Intune error codes, generated by tools/error-codes/generate.mjs from primary sources — " +
|
||||
"never edit by hand. Consumed by the backend (ErrorCodeCatalog.cs, ErrorCodeEnricher.cs), the web app (utils/errorCodeMap.ts via the " +
|
||||
"sync-error-codes prebuild step) and the MCP server (lookup_error_code). Keys are lowercase 8-digit hex ('0x80070005') or decimal MSI exit " +
|
||||
"codes ('1603'; only 0, 1601-1654, 3010 — other decimal exit codes are installer-defined). Win32 codes live only as 0x8007xxxx entries; " +
|
||||
Reference in New Issue
Block a user