Skip to content

Make the GUI say what it actually did - #197

Merged
fstubner merged 1 commit into
mainfrom
fix/gui-result-correctness
Aug 18, 2026
Merged

fstubner merged 1 commit into
mainfrom
fix/gui-result-correctness

Conversation

@fstubner

Copy link
Copy Markdown
Owner

Three result-correctness defects from the independent review, all the same shape: the interface reported something the backend did not do.

1. The command preview claimed five ports and scanned three

buildCommand substituted the GUI's DEFAULT_PORTS placeholder (22,80,443,8080,8443) whenever the Ports field was empty, while execution sent no port list at all and the core fell back to its own default of 22,80,443.

That wrong string is what Ctrl+Shift+C copied, what the History menu recorded, and what was stored with the saved result bundle.

-p is now omitted when the field is empty — which is both accurate and what inspect and sweep in the same function already did.

2. Truncated captures were presented as complete

The core sets packets_truncated on a capture and truncated on a parse. Neither was read anywhere in the GUI.

Opening a 20,000-packet file with the default 1,000 limit showed 1,000 rows under a status bar reading 20000 packets, with nothing saying the view was cut off — and Export CSV then wrote only the loaded rows. The summary now reads 1000 of 20000 packets shown.

3. Three call sites disagreed on which ports an inspect checked

site expression
rows.ts ports?.length ? ports : open_ports
columns.ts, summaries.ts ports ?? open_ports

A backend returning ports: [] with a non-empty open_ports rendered rows from open_ports while the columns came from an empty list — every cell blank. All three now call one inspectPorts helper, keeping the length check: ports is optional for older backends and an empty list carries no more information than a missing one.

Also

Two smaller preview fixes in the same function: the pcap capture branch omitted --json while every other command includes it, and interpolated the BPF filter raw, so a filter containing a quote produced a preview that would not parse if pasted.

Verification

Every new test was confirmed to fail against the previous behaviour:

expected 'netscli scan router.local -p 22,80,44…' to be 'netscli scan router.local --json'
expected '20000 packets' to be '1000 of 20000 packets shown'

The pcap summary cases moved to their own file rather than pushing presentation.test.ts past its size cap — which is the split its transition exception already asked for.

105 GUI tests pass, lint 0 errors, build and file-size guard clean.

Three result-correctness defects from the independent review, all of the
same shape: the interface reported something the backend did not do.

1. The command preview claimed five ports and scanned three.

   `buildCommand` substituted the GUI's DEFAULT_PORTS placeholder
   (22,80,443,8080,8443) whenever the Ports field was empty, while execution
   sent no port list at all and the core fell back to its own default of
   22,80,443. That wrong string is what Ctrl+Shift+C copied, what the
   History menu recorded, and what was stored with the saved result bundle.

   `-p` is now omitted when the field is empty -- which is both accurate and
   what `inspect` and `sweep` in the same function already did.

2. Truncated captures were presented as complete.

   The core sets `packets_truncated` on a capture and `truncated` on a
   parse. Neither was read anywhere in the GUI. Opening a 20,000-packet file
   with the default 1,000 limit showed 1,000 rows under a status bar reading
   "20000 packets", with nothing saying the view was cut off -- and Export
   CSV then wrote only the loaded rows. The summary now reads
   "1000 of 20000 packets shown" when either flag is set.

3. Three call sites disagreed on which ports an inspect checked.

   The row builder used `ports?.length ? ports : open_ports`; the column set
   and the status-bar summary used `ports ?? open_ports`. A backend
   returning `ports: []` with a non-empty `open_ports` rendered rows from
   `open_ports` while the columns came from an empty list, so every cell was
   blank. All three now call one `inspectPorts` helper, keeping the length
   check -- `ports` is optional for older backends and an empty list carries
   no more information than a missing one.

Two smaller preview fixes in the same function: the pcap capture branch
omitted `--json` while every other command includes it, and interpolated the
BPF filter raw, so a filter containing a quote produced a preview that would
not parse if pasted.

Every new test was confirmed to fail against the previous behaviour:
"expected 'netscli scan router.local -p 22,80,44…' to be 'netscli scan
router.local --json'" and "expected '20000 packets' to be '1000 of 20000
packets shown'".

The pcap summary cases moved to their own file rather than pushing
presentation.test.ts past its size cap -- which is the split its transition
exception already asked for.

105 GUI tests pass, lint 0 errors, build and file-size guard clean.
@fstubner
fstubner merged commit f8a3686 into main Aug 18, 2026
15 checks passed
@fstubner
fstubner deleted the fix/gui-result-correctness branch August 18, 2026 09:55
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.

1 participant