Refactor core/domain + config, harden tests/auth, fix CI (ISOLATED_TEST gate) - #16
Merged
Conversation
- Remove hallucinated password-equals-username assertions in authentication_test.go (rule was never implemented; tests passed due to unrelated length/whitespace checks) - Delete two no-op tests that discarded results without asserting - Fix CLI dispatch: "data" -> "fetch" to match documented noun in usage string and README; add regression test Verified: go test ./... and go vet ./... pass.
- Add plain domain types in internal/core/model (Game, Player, Interaction with time.Time OccurredAt, *int64 for nullable refs) with zero infrastructure imports - Add internal/infrastructure/database/mapping package for DB->domain conversion (interaction mapping parses timestamps, fails fast with no partial results on error) - Retype core/port/driver.go and driven.go against domain types - Simplify core/service/shared_data.go: drop timestamp parsing and constant/database imports, compare time.Time directly - Update use cases to map DB->domain on return; fix inconsistent error wrapping so ListInteractions/ListPlayerInteractions match the context-prefix convention used elsewhere - Update adapters (JWT, HTTP DTOs) and tests for domain types; remove dead nullableInt64 helper internal/core now has zero imports of internal/infrastructure. No repository layer introduced; use cases still query *database.Queries directly, unchanged from prior design. Verified: go build, go vet, go test -count=1 ./... all pass.
…ase B) - core/service/authentication_test.go: merge password-validity and hash tests into two table-driven tests (7 -> 2) - usecase/game_management_test.go: collapse CRUD, nil-dependency, invalid-ID, name-validation, and cancelled-context tests into 5 table-driven tests (17 -> 5) - usecase/player_management_test.go: collapse nil-dependency, cancelled-context, and input-validation tests (24 -> 14); also removes a second, previously-unflagged instance of the hallucinated password-equals-username assertions found in TestPlayerManagement_TrimPasswordWhitespaceBeforeStorage - Extract internal/testutil (FindMigrationsDir, NewTestDB, ReadGameNameByAccess) from duplicated helpers in usecase/test_helpers_test.go and database/queries_test.go - Convert database/queries_test.go to package database_test to avoid a database <-> testutil import cycle No production logic changed except by the removals noted above. Verified: go test ./... and go vet ./... pass. Known issue (not fixed here): IsPasswordValid checks only literal space characters, not general whitespace, despite its error message implying broader whitespace rejection. Tracked for follow-up.
- IsPasswordValid now rejects any non-[A-Za-z0-9] byte/rune (spaces, tabs, newlines, punctuation, and multi-byte/Unicode characters) instead of only rejecting a literal space. - Update the error message to "password may only contain letters and digits" and align the boundary test table, adding tab/newline, punctuation, and multi-byte cases that were false-passes under the old check. - Update the use-case test comment/messages to match the real rule.
…dit Phase D) - application/model: JwtPlayerClaims is a plain struct (no jwt embed); JWT (de)serialization moved to the driven adapter (JwtClaims + ParseToken). - httpadapter: echo-jwt now parses into driven.JwtClaims. - usecase: GameCommands returns ErrCannotSaveWhilePaused/ErrCannotPause/ ErrCannotResume sentinels instead of raw SQLite trigger strings. - httpadapter: commandError maps conflicts via errors.Is; conflictStatusFromErr removed.
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.
No description provided.