Ai slop cleanup#82
Merged
Merged
Conversation
Bugs / Race conditions fixed internal/tui/output.go — InfoBox/WarnBox/ErrorBox now acquire the write mutex before writing, eliminating a real data race with concurrent Info/Error/etc. calls. internal/tui/output.go — defer o.buffer.Reset() replaced with a plain o.buffer.Reset() after the write; the deferred form left the buffer populated until function exit and would have skipped cleanup on panic. Exported type typo corrected internal/contracts/http.go — ReqestData → RequestData (missing 'u'). Propagated across all 13 callers: contracts/output.go, helpers/request_data.go, server/tracker.go, tui/output.go, tui/printresponse.go, both tui tests, server tests, uncors_app tests, and the regenerated testing/mocks/output_mock.go. Other typos fixed internal/tui/output.go — ouputType → outputType (unexported type) internal/handler/mock/handler.go — waiteDelay → waitDelay Dead / redundant code removed internal/config/mapping.go — Deleted ValidateCacheGlob, which was a one-line alias for ValidateGlobPattern. Call sites updated to call ValidateGlobPattern directly. internal/handler/uncors_handler.go — Removed the log.Printf duplicate that fired right after output.Errorf for the same message. Performance fix internal/urlreplacer/replacer.go — Built a subexpIndex map[string]int once at construction. Eliminated the O(n²) SubexpIndex call (linear scan per group per request) in Replace, replacing it with a O(1) map lookup. Correctness / efficiency improvements internal/handler/mock/handler.go — Simplified waitDelay: removed unnecessary for/break waitingLoop (the select fires exactly once), removed log.Printf calls. Also capped content-type sniffing to the first 512 bytes to avoid converting the full mock body to []byte. internal/handler/rewrite/helpers.go — RewriteHostKey changed from var to const (prevents mutation; correct for a string context key). Consistency internal/config/cache_config.go — CacheGlobs.Clone() and CacheConfig.Methods clone now use slices.Clone instead of make+append. internal/config/rewrite.go — RewriteOptions.Clone() now uses slices.Clone (all fields are value types); RewritingOption.Clone() simplified to return r.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Type of Change
Related Issues
Motivation and Context
How Has This Been Tested?
Test Configuration:
Screenshots (if applicable)
Checklist
Code Quality
make formatto format my codegolangci-lint runand resolved all issuesTesting
make testand all tests passmake test-coverand maintained or improved code coverageDocumentation
Dependencies
go mod tidyto clean up dependenciesBreaking Changes
Additional Notes
For Reviewers
Areas that need special attention:
Known issues or limitations:
By submitting this pull request, I confirm that my contribution is made under the terms of the MIT License and I have read and followed the Contributing Guidelines.