El hallazgo mayor confirmado de la auditoría 2026-08-26: ~16 validadores y
429 ficheros de test que nada ejecutaba (sin CI en ninguna rama de la
historia, hooks .sample, eidos-lint sin script npm). Esta fase los cablea:
- `check:gate` (scripts/check-gate.ts): svelte-check con política — src/
debe cero; web/ se mide contra el ledger menguante scripts/check-debt.ts
(34 ficheros, 71 errores congelados; sólo puede bajar, la disciplina de
theming-census-debt). Guard anti-vacío: sin marcador COMPLETED o con
conteo que no cuadra, falla — un gate que no inspeccionó nada no pasa.
- `eidos:lint` deja de ser invocación cruda (exit 1 real en invalid/dead).
- `gate`: check:gate → validadores rápidos → vitest al final. `lint` queda
deliberadamente FUERA: hay ~2.300 ficheros de deuda de formato
preexistente (nunca se formateó el repo entero; el one-shot pendiente es
`npm run format` en árbol quieto y re-añadirlo — documentado en el hook).
- scripts/hooks/pre-push: la fuente del hook, SIN armar. Se armó en
caliente, bloqueó el push legítimo del eje theming (secuencia mal: verde
primero, puerta después) y se desarmó — de paso la puerta demostró que
sabe fallar, que era el requisito de verificación de la fase.
- .prettierrc endOfLine:auto — neutraliza la clase CRLF/autocrlf de
Windows (~350 falsos rojos), sin cambiar formato real.
Verificación: check:gate exit 0 sobre HEAD (71 dentro del ledger, src/ a
cero tras 9d6533cb7 del eje navigation-menu) · sondeo individual del resto
de miembros del gate: verdes salvo los adjudicados en fase A.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
alpha-0.1-background
parent
58fa3021c9
commit
2ec0181079
@ -0,0 +1,48 @@
|
||||
/**
|
||||
* Per-file svelte-check ERROR debt for the demo tree (`web/`).
|
||||
*
|
||||
* The ledger only SHRINKS (the theming-census-debt discipline): an entry
|
||||
* records how many type errors a demo file carried when the gate was armed
|
||||
* (P0 fase A, audit 2026-08-26). `check-gate` fails when a file exceeds its
|
||||
* entry or when a file not named here errors at all; when a file drops below
|
||||
* its entry, lower the entry in the same change. Framework source (`src/`)
|
||||
* has no ledger — it owes zero.
|
||||
*
|
||||
* Populated by fase A from the svelte-check run on alpha-0.1-background.
|
||||
*/
|
||||
export const CHECK_DEBT: Record<string, number> = {
|
||||
'web/routes/alpha/+layout@.svelte': 3,
|
||||
'web/routes/alpha/components/button/+page.svelte': 5,
|
||||
'web/routes/alpha/lib/Playground.svelte': 3,
|
||||
'web/routes/alpha/lib/theme-variants.ts': 4,
|
||||
'web/routes/alpha/sheet/[variant]/+page.svelte': 1,
|
||||
'web/routes/demos/animations/background/balastro/+page.svelte': 1,
|
||||
'web/routes/demos/animations/background/beam/beam.svelte': 2,
|
||||
'web/routes/demos/animations/background/bends/+page.svelte': 1,
|
||||
'web/routes/demos/animations/background/distorsion/distorsion.svelte': 1,
|
||||
'web/routes/demos/animations/background/dither/+page.svelte': 1,
|
||||
'web/routes/demos/animations/background/floating-lines/+page.svelte': 1,
|
||||
'web/routes/demos/animations/background/galaxy/+page.svelte': 1,
|
||||
'web/routes/demos/animations/background/grainient/+page.svelte': 1,
|
||||
'web/routes/demos/animations/background/hyperspeed/+page.svelte': 1,
|
||||
'web/routes/demos/animations/background/letters/+page.svelte': 1,
|
||||
'web/routes/demos/animations/background/line-waves/+page.svelte': 1,
|
||||
'web/routes/demos/animations/background/orb/+page.svelte': 1,
|
||||
'web/routes/demos/animations/background/particles/+page.svelte': 1,
|
||||
'web/routes/demos/animations/background/veil/+page.svelte': 1,
|
||||
'web/routes/demos/animations/text/blur/+page.svelte': 1,
|
||||
'web/routes/demos/animations/text/count/+page.svelte': 1,
|
||||
'web/routes/demos/animations/text/focus/+page.svelte': 1,
|
||||
'web/routes/demos/animations/text/gradient/+page.svelte': 1,
|
||||
'web/routes/demos/heroscrolling/+page.svelte': 11,
|
||||
'web/routes/demos/heroscrolling/hero-scrolling.svelte': 14,
|
||||
'web/routes/otros/players/Giradiscos.svelte': 2,
|
||||
'web/routes/otros/players/SoporteSingle.svelte': 1,
|
||||
'web/routes/temas/_lib/grafito.ts': 2,
|
||||
'web/routes/temas/animations/panel-cascade/+page.svelte': 1,
|
||||
'web/routes/temas/sema/_lib/audition.ts': 1,
|
||||
'web/routes/temas/sema/+page.svelte': 1,
|
||||
'web/routes/temas/tema/+page.svelte': 1,
|
||||
'web/routes/uix/components/aura/+page.svelte': 1,
|
||||
'web/routes/uix/components/slider/+page.svelte': 1
|
||||
};
|
||||
@ -0,0 +1,84 @@
|
||||
/**
|
||||
* check-gate — svelte-check with the debt ledger applied.
|
||||
*
|
||||
* Policy (P0 fase A, audit 2026-08-26):
|
||||
* - Any ERROR under `src/` fails the gate: framework source owes zero.
|
||||
* - ERRORs elsewhere (the demo tree) are measured against the per-file
|
||||
* ledger in `check-debt.ts`. A file above its ledgered count — or an
|
||||
* erroring file the ledger does not name — fails. Counts only shrink:
|
||||
* when a file drops below its entry the gate says so; lower the entry
|
||||
* in the same change.
|
||||
* - The run must end with svelte-check's `COMPLETED` marker and the
|
||||
* parsed error count must match the marker's total — a gate that
|
||||
* inspected nothing must fail, never pass.
|
||||
*
|
||||
* Usage: npm run check:gate
|
||||
*/
|
||||
import { spawnSync } from 'node:child_process';
|
||||
import { CHECK_DEBT } from './check-debt';
|
||||
|
||||
const run = spawnSync('npm', ['run', 'check'], {
|
||||
shell: true,
|
||||
encoding: 'utf8',
|
||||
maxBuffer: 64 * 1024 * 1024
|
||||
});
|
||||
const out = `${run.stdout ?? ''}\n${run.stderr ?? ''}`;
|
||||
|
||||
const completed = /^\d+\s+COMPLETED\s+\d+\s+FILES\s+(\d+)\s+ERRORS\b/m.exec(out);
|
||||
if (!completed) {
|
||||
console.error('check-gate: svelte-check produced no COMPLETED marker — treating as failure.');
|
||||
console.error(out.slice(-2000));
|
||||
process.exit(1);
|
||||
}
|
||||
const reportedErrors = Number(completed[1]);
|
||||
|
||||
const errorsByFile = new Map<string, number>();
|
||||
let parsedErrors = 0;
|
||||
for (const line of out.split('\n')) {
|
||||
const m = /^\d+\s+ERROR\s+"(.+?)"\s+\d+:\d+\s+/.exec(line);
|
||||
if (!m) continue;
|
||||
const file = m[1].replace(/\\+/g, '/');
|
||||
errorsByFile.set(file, (errorsByFile.get(file) ?? 0) + 1);
|
||||
parsedErrors += 1;
|
||||
}
|
||||
if (parsedErrors !== reportedErrors) {
|
||||
console.error(
|
||||
`check-gate: parsed ${parsedErrors} ERROR lines but svelte-check reported ${reportedErrors} — output format drifted, refusing to judge.`
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
let failed = false;
|
||||
|
||||
const srcErrors = [...errorsByFile].filter(([file]) => file.startsWith('src/'));
|
||||
if (srcErrors.length > 0) {
|
||||
failed = true;
|
||||
console.error('check-gate: framework source has type errors (src/ owes zero):');
|
||||
for (const [file, count] of srcErrors) console.error(` ${file}: ${count}`);
|
||||
}
|
||||
|
||||
for (const [file, count] of errorsByFile) {
|
||||
if (file.startsWith('src/')) continue;
|
||||
const allowed = CHECK_DEBT[file];
|
||||
if (allowed === undefined) {
|
||||
failed = true;
|
||||
console.error(`check-gate: NEW debt — ${file} has ${count} error(s) and no ledger entry.`);
|
||||
} else if (count > allowed) {
|
||||
failed = true;
|
||||
console.error(
|
||||
`check-gate: debt GREW — ${file} has ${count} error(s), ledger allows ${allowed}.`
|
||||
);
|
||||
} else if (count < allowed) {
|
||||
console.log(
|
||||
`check-gate: debt shrank — ${file} is at ${count} (ledger says ${allowed}); lower the entry.`
|
||||
);
|
||||
}
|
||||
}
|
||||
for (const file of Object.keys(CHECK_DEBT)) {
|
||||
if (!errorsByFile.has(file)) {
|
||||
console.log(`check-gate: ${file} is clean — remove its ledger entry.`);
|
||||
}
|
||||
}
|
||||
|
||||
if (!failed) console.log(`check-gate: OK — ${reportedErrors} error(s), all within the ledger.`);
|
||||
process.exit(failed ? 1 : 0);
|
||||
@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
# P0 fase B (audit 2026-08-26): the gate runs before anything leaves the
|
||||
# machine. Fast static checks first, the vitest suite last; the
|
||||
# browser-dependent validators (morfo:check, perm:check, smoke, layer:check)
|
||||
# stay manual — they need a dev server.
|
||||
#
|
||||
# NOT ARMED until fase A is green: arm with
|
||||
# cp scripts/hooks/pre-push .git/hooks/pre-push
|
||||
# `lint` is deliberately NOT in the gate yet: the tree carries ~2,300 files
|
||||
# of pre-existing format debt (never formatted repo-wide; no CI ever ran it).
|
||||
# The pending one-shot is: `npm run format` as its own commit on a quiet
|
||||
# tree, then add `npm run lint &&` back to the `gate` script.
|
||||
#
|
||||
# Skipping this hook (--no-verify) is forbidden by CLAUDE.md except when the
|
||||
# user explicitly asks.
|
||||
echo "pre-push: running npm run gate (fast checks + tests)..."
|
||||
npm run gate || {
|
||||
echo "pre-push: gate FAILED — push rejected."
|
||||
exit 1
|
||||
}
|
||||
Loading…
Reference in new issue