mirror of
https://github.com/garrytan/gstack.git
synced 2026-08-31 18:30:39 +02:00
New 8th Review Army specialist (DIFF_LINES > 100, --simplification force flag) hunting unrequested STRUCTURE only: delete/stdlib/native/speculative/shrink closed tags, one-line findings, lines_removable field. speculative: replaces ponytail's yagni: tag — we import the lens, not the posture; coverage stays sacred (Completeness Gaps owns it, suppressions inlined, shrink needs >=5 lines). Advisory carve-out in the merge step: advisory findings are excluded from quality_score and the findings-count header, render with an [ADVISORY] label, and are ASK-only in Fix-First. Zero-findings case prints the lens-scoped 'Simplification: lean already — nothing to cut.' from the PARENT (the specialist keeps the exact NO FINDINGS contract); with findings, the parent prints 'net: -N lines possible' summed from lines_removable. Tests: static pins for the carve-out + early-out contract (gen-skill-docs), two periodic e2e cases with planted fixtures — activation (over-build traps: hand-rolled Intl, one-impl abstract, dead config) and false-flag precision (a lean ETHOS 'choose A' diff must yield NO FINDINGS). Inspired by dietrichgebert/ponytail's /ponytail-review. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
29 lines
1.1 KiB
JavaScript
29 lines
1.1 KiB
JavaScript
// Lean-and-complete fixture: the false-flag precision case for the
|
|
// simplification specialist. This is an ETHOS "choose A" diff — small,
|
|
// covers the error path and edge cases, carries its own check. There is
|
|
// nothing here to cut; a correct simplification pass returns NO FINDINGS.
|
|
|
|
function parsePort(value) {
|
|
if (value === null || value === undefined || value === '') {
|
|
throw new Error(`parsePort: missing value`);
|
|
}
|
|
const port = Number(value);
|
|
if (!Number.isInteger(port) || port < 1 || port > 65535) {
|
|
throw new Error(`parsePort: expected integer in 1-65535, got ${JSON.stringify(value)}`);
|
|
}
|
|
return port;
|
|
}
|
|
|
|
// Self-check: the smallest thing that fails if the logic breaks.
|
|
function testParsePort() {
|
|
const assert = require('node:assert');
|
|
assert.strictEqual(parsePort('8080'), 8080);
|
|
assert.strictEqual(parsePort(443), 443);
|
|
assert.throws(() => parsePort(''), /missing value/);
|
|
assert.throws(() => parsePort('0'), /1-65535/);
|
|
assert.throws(() => parsePort('65536'), /1-65535/);
|
|
assert.throws(() => parsePort('abc'), /1-65535/);
|
|
}
|
|
|
|
module.exports = { parsePort, testParsePort };
|