Skip to content

fix: defer permutations after a scan time-budget stop - #390

Merged
TMHSDigital merged 2 commits into
TMHSDigital:mainfrom
laozhej:codex/373-stop-permute-after-budget
Nov 16, 2026
Merged

TMHSDigital merged 2 commits into
TMHSDigital:mainfrom
laozhej:codex/373-stop-permute-after-budget

Conversation

@laozhej

@laozhej laozhej commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Description

When the main scan ends because its time budget is spent, stop without constructing or starting a permutation pass. The CLI now uses its existing unfinished-pass predicate; the TUI checks the expired flag before transitioning to permutation.

The CLI regression limits a single worker to 10 names/s with three names and a 1ms budget, adds an explicit seed, checks that no permutation announcement/report/state is produced, then resumes with an unlimited budget and rate and verifies that the deferred pass completes. The TUI regression sends an expired final event and verifies that the scan ends.

Related Issue

Fixes #373.

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 CLI and TUI regressions fail on the unchanged implementation and pass after the fix.
  • 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 first CI run exposed a Windows clock-resolution assumption in the new test's original 1ns budget. The test now leaves at least a 100ms gap before the third name can be checked; the updated regression passes 20 local race-enabled runs and still fails with the original permutation gate restored. Production logic is unchanged by that follow-up.
  • The new CLI case 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 cf45b5f 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.

The -permute pass starts after -max-duration has already run out

2 participants