Skip to content

Refactor code and improve test assertions - #120

Merged
kazeburo merged 12 commits into
mainfrom
feat/small-refactors
Jul 27, 2026
Merged

Refactor code and improve test assertions#120
kazeburo merged 12 commits into
mainfrom
feat/small-refactors

Conversation

@kazeburo

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings July 26, 2026 13:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors several core paths (worker execution, log loading, TOML defaults) and modernizes tests to make assertions clearer and to exercise concurrency behavior more reliably.

Changes:

  • Extracted worker command execution-with-timeout into a helper and cleaned up category variable naming.
  • Centralized TOML defaulting logic into small helper functions and expanded default fields (e.g., favicon).
  • Improved tests by switching to testify/assert, adding coverage for If-Modified-Since, and refactoring the race scenario test into helper loops.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
worker.go Refactors per-service timeout execution into a dedicated helper called from the worker pool.
tomp_test.go Replaces manual assertions with testify/assert for clearer test failures.
toml.go Extracts repeated “set default if empty” logic into helper functions and applies them during TOML load.
scenario_race_test.go Refactors concurrent scenario test into helper loops to reduce duplication.
logs.go Refactors log initialization/status computations into smaller methods and improves naming/comment clarity.
handlers.go Simplifies ifModifiedSince condition expression.
handlers_test.go Adds a focused unit test for ifModifiedSince.
go.mod Adds testify (and related transitive deps) to support new test assertions.
go.sum Updates sums for newly added/updated module dependencies.
Comments suppressed due to low confidence (1)

toml.go:155

  • stringDefault has the same nil-guard issue as markdownDefault: when s == nil the function will still dereference *s and panic. If nil pointers are not expected, drop the check; otherwise return early when s is nil.
func stringDefault(s *string, defaultValue string) {
	if s == nil || *s == "" {
		*s = defaultValue
	}
}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread toml.go
Comment thread logs.go
kazeburo and others added 4 commits July 26, 2026 22:37
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

This comment was marked as off-topic.

@sonarqubecloud

Copy link
Copy Markdown

@kazeburo
kazeburo merged commit 9877559 into main Jul 27, 2026
2 of 3 checks passed
@kazeburo
kazeburo deleted the feat/small-refactors branch July 27, 2026 00:16
@github-actions github-actions Bot mentioned this pull request Jul 26, 2026
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