Skip to content

fix(tui): confirm before overwriting saved results - #391

Merged
TMHSDigital merged 1 commit into
TMHSDigital:mainfrom
laozhej:codex/360-confirm-save-overwrite
Nov 16, 2026
Merged

TMHSDigital merged 1 commit into
TMHSDigital:mainfrom
laozhej:codex/360-confirm-save-overwrite

Conversation

@laozhej

@laozhej laozhej commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Description

Saving from a finished TUI scan can export only the filtered or retained results. When the destination already exists, the first Enter now leaves it unchanged and displays an overwrite confirmation; a second Enter confirms the save. Editing the path, cancelling or reopening the prompt clears the confirmation. New files keep the existing one-Enter behavior.

The regression exercises both the scan's original output and a different existing file with a filtered result list. It checks that the first Enter, editing and cancellation preserve the original bytes, then verifies an explicit confirmation saves the filtered result. The overwrite action stays before the path in the hint so a long path cannot hide it.

Related Issue

Fixes #360.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvements
  • Test updates

Checklist

  • I have read the CONTRIBUTING document
  • My code follows the code style of this project
  • I have added/updated appropriate comments to the code
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the documentation accordingly (if applicable)

Ethical Considerations

  • This change maintains or improves the security controls in the tool
  • This change follows the educational/legitimate security testing focus of the project
  • I have considered potential misuse cases and taken appropriate steps to prevent them

Additional Information

Validated on macOS arm64 with Go 1.26.11 and golangci-lint 2.15.0:

  • Both existing-file regression cases fail on the unchanged implementation and pass after the fix. The existing TUI save test also passes.
  • go test -race -shuffle=on ./... passes all 21 packages with tests; make lint reports 0 issues; make build, gofmt and git diff --check pass.
  • The new regression uses simulation. The full suite uses local DNS/HTTP fixtures and simulations; no external domain was scanned.

AI assistance: OpenAI Codex investigated and implemented the fix, ran the checks and drafted this PR. No separate human review is claimed.

@TMHSDigital
TMHSDigital merged commit 54d48c5 into TMHSDigital:main Nov 16, 2026
17 checks passed
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.

TUI save prompt defaults to the Output file and overwrites it with a subset

2 participants