Skip to content

fix(types): remove phantom time_pressure field from VulnInputs#22

Open
dmchaledev wants to merge 1 commit into
mainfrom
claude/sleepy-rubin-64cbuk
Open

fix(types): remove phantom time_pressure field from VulnInputs#22
dmchaledev wants to merge 1 commit into
mainfrom
claude/sleepy-rubin-64cbuk

Conversation

@dmchaledev

Copy link
Copy Markdown
Contributor

Problem

The published index.d.ts advertises an optional time_pressure field on the public VulnInputs interface:

export interface VulnInputs {
  target_hosts: number;
  scan_intensity: 'light' | 'medium' | 'aggressive' | 'continuous' | string;
  scan_frequency: 'daily' | 'weekly' | 'monthly' | 'quarterly' | string;
  scan_window?: number;
  time_pressure?: 'light' | 'medium' | 'aggressive' | 'continuous' | string;  // ← does nothing
  scanning_tools: string[];
  ...
}

But the calculation engine never reads time_pressure. All timing is derived from scan_intensity (via TIME_MULT) and scan_window:

const timeMult = TIME_MULT[data.scan_intensity] ?? 1.0;   // hailbytes-vuln-calculator.js:129

time_pressure appears in exactly one place in the whole repo — this type declaration:

$ rg time_pressure
index.d.ts:10:  time_pressure?: 'light' | 'medium' | 'aggressive' | 'continuous' | string;

It was already removed from the test suite in 82e5a30 ("use scan_window instead of non-existent time_pressure field"), and it's absent from the README's Input Schema table. index.d.ts was the last stale reference left behind.

Impact

index.d.ts ships in the npm tarball (it's listed in package.json's files), so this is the type contract every TypeScript/IDE consumer sees. A developer who sets time_pressure — reasonably expecting it to influence scan timing — gets a value that is silently ignored, with green typechecking and no error. The advertised API and the actual behavior disagree.

Fix

Remove the dead time_pressure field so the shipped type matches the engine. No runtime/source/behavior change.

The interface keeps its [extra: string]: unknown index signature, so arbitrary extra fields are still permitted — this isn't a breaking narrowing for any input that actually affects a result.

Verification

$ rg time_pressure          # no matches remain
$ node --test test/*.test.mjs
# tests 65
# suites 9
# pass 65
# fail 0

Self-contained: one-line deletion in index.d.ts, no API or behavior change for existing consumers.

https://claude.ai/code/session_015nnJU8VHsp6tzBjyUS44yH


Generated by Claude Code

The published index.d.ts declared an optional `time_pressure` field on
the `VulnInputs` interface, but the calculation engine never reads it.
All timing is derived from `scan_intensity` (via TIME_MULT) and
`scan_window`. The field was already dropped from the test suite in
82e5a30 ("use scan_window instead of non-existent time_pressure field")
and is absent from the README Input Schema — index.d.ts was the last
stale reference.

A TypeScript consumer setting `time_pressure` would expect it to affect
the result and instead get a silently ignored value. Removing it makes
the shipped type contract match the actual engine behavior. The existing
`[extra: string]: unknown` index signature still permits arbitrary extra
fields, so this is not a breaking narrowing for real inputs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants