fix: repo standards audit — fix all divergences (closes #17) #18
No reviewers
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sneak/chat#18
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/repo-standards-audit"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #17 — audit sneak/chat against EXISTING_REPO_CHECKLIST.md.\n\n## Changes\n\n### Critical fixes\n- Fix duplicate method declarations (CreateUser, GetUserByToken, GetUserByNick) between db.go and queries.go\n- Fix migration 003 schema conflict (INTEGER keys referencing TEXT primary keys)\n- Rewrite tests to use queries.go API matching the live schema\n\n### Missing files added\n- LICENSE (MIT)\n- .editorconfig\n- REPO_POLICIES.md\n- .gitea/workflows/check.yml (CI)\n\n### Makefile improvements\n- Add fmt-check, docker, hooks targets\n- Add 30s test timeout\n- check target now runs test + lint + fmt-check\n\n### Dockerfile improvements\n- Pin base images by sha256 digest\n- Run make check as build step\n\n### Code quality (380 lint issues fixed)\n- wsl_v5, nlreturn, noinlineerr whitespace fixes\n- errcheck, rowserrcheck error handling\n- funlen — split long functions into smaller methods\n- funcorder — reorder exported before unexported\n- tagliatelle — camelCase JSON tags\n- gosec — add nolint for false positives\n- perfsprint — string concat instead of Sprintf\n- modernize — interface{} → any\n- revive — add package comments\n- And 10+ more linter categories\n\n### Other fixes\n- .gitignore expanded with OS/editor/secrets patterns\n- .dockerignore updated\n- README: add Author section\n\n## make check output\n\n
\nAll tests pass, 0 lint issues, fmt-check clean.\nmake checkoutput\n\n```\ngo test -timeout 30s -v -race -cover ./...=== RUN TestCreateUser
=== PAUSE TestCreateUser
=== RUN TestGetUserByToken
=== PAUSE TestGetUserByToken
=== RUN TestGetUserByNick
=== PAUSE TestGetUserByNick
=== RUN TestGetOrCreateChannel
=== PAUSE TestGetOrCreateChannel
=== RUN TestJoinAndListChannels
=== PAUSE TestJoinAndListChannels
=== RUN TestListChannelsEmpty
=== PAUSE TestListChannelsEmpty
=== RUN TestPartChannel
=== PAUSE TestPartChannel
=== RUN TestSendAndGetMessages
=== PAUSE TestSendAndGetMessages
=== RUN TestChannelMembers
=== PAUSE TestChannelMembers
=== RUN TestChannelMembersEmpty
=== PAUSE TestChannelMembersEmpty
=== RUN TestSendDM
=== PAUSE TestSendDM
=== RUN TestPollMessages
=== PAUSE TestPollMessages
=== RUN TestChangeNick
=== PAUSE TestChangeNick
=== RUN TestSetTopic
=== PAUSE TestSetTopic
=== RUN TestGetMessagesBefore
=== PAUSE TestGetMessagesBefore
=== RUN TestListAllChannels
=== PAUSE TestListAllChannels
=== CONT TestGetUserByToken
=== CONT TestChannelMembers
=== CONT TestChangeNick
=== CONT TestListAllChannels
=== CONT TestGetMessagesBefore
=== CONT TestSetTopic
=== CONT TestSendAndGetMessages
=== CONT TestPartChannel
=== CONT TestListChannelsEmpty
=== CONT TestJoinAndListChannels
=== CONT TestChannelMembersEmpty
=== CONT TestPollMessages
=== CONT TestGetUserByNick
=== CONT TestGetOrCreateChannel
=== CONT TestCreateUser
=== CONT TestSendDM
2026/02/26 06:27:27 INFO applying migration version=1 name=001_initial.sql
2026/02/26 06:27:27 INFO applying migration version=1 name=001_initial.sql
2026/02/26 06:27:27 INFO applying migration version=1 name=001_initial.sql
2026/02/26 06:27:27 INFO applying migration version=1 name=001_initial.sql
2026/02/26 06:27:27 INFO applying migration version=1 name=001_initial.sql
2026/02/26 06:27:27 INFO applying migration version=1 name=001_initial.sql
2026/02/26 06:27:27 INFO applying migration version=1 name=001_initial.sql
2026/02/26 06:27:27 INFO applying migration version=1 name=001_initial.sql
2026/02/26 06:27:27 INFO applying migration version=1 name=001_initial.sql
2026/02/26 06:27:27 INFO applying migration version=1 name=001_initial.sql
2026/02/26 06:27:27 INFO applying migration version=1 name=001_initial.sql
2026/02/26 06:27:27 INFO applying migration version=1 name=001_initial.sql
2026/02/26 06:27:27 INFO applying migration version=1 name=001_initial.sql
2026/02/26 06:27:27 INFO applying migration version=2 name=002_schema.sql
2026/02/26 06:27:27 INFO applying migration version=2 name=002_schema.sql
2026/02/26 06:27:27 INFO applying migration version=2 name=002_schema.sql
2026/02/26 06:27:27 INFO applying migration version=2 name=002_schema.sql
2026/02/26 06:27:27 INFO applying migration version=2 name=002_schema.sql
2026/02/26 06:27:27 INFO applying migration version=1 name=001_initial.sql
2026/02/26 06:27:27 INFO applying migration version=2 name=002_schema.sql
2026/02/26 06:27:27 INFO applying migration version=1 name=001_initial.sql
2026/02/26 06:27:27 INFO applying migration version=2 name=002_schema.sql
2026/02/26 06:27:27 INFO applying migration version=2 name=002_schema.sql
2026/02/26 06:27:27 INFO applying migration version=2 name=002_schema.sql
2026/02/26 06:27:27 INFO applying migration version=2 name=002_schema.sql
2026/02/26 06:27:27 INFO applying migration version=2 name=002_schema.sql
2026/02/26 06:27:27 INFO applying migration version=1 name=001_initial.sql
2026/02/26 06:27:27 INFO applying migration version=2 name=002_schema.sql
2026/02/26 06:27:27 INFO applying migration version=2 name=002_schema.sql
2026/02/26 06:27:27 INFO applying migration version=2 name=002_schema.sql
2026/02/26 06:27:27 INFO applying migration version=2 name=002_schema.sql
2026/02/26 06:27:27 INFO applying migration version=2 name=002_schema.sql
2026/02/26 06:27:27 INFO applying migration version=3 name=003_users.sql
2026/02/26 06:27:27 INFO applying migration version=3 name=003_users.sql
2026/02/26 06:27:27 INFO applying migration version=3 name=003_users.sql
2026/02/26 06:27:27 INFO applying migration version=3 name=003_users.sql
2026/02/26 06:27:27 INFO applying migration version=3 name=003_users.sql
2026/02/26 06:27:27 INFO applying migration version=3 name=003_users.sql
2026/02/26 06:27:27 INFO applying migration version=3 name=003_users.sql
2026/02/26 06:27:27 INFO applying migration version=3 name=003_users.sql
2026/02/26 06:27:27 INFO applying migration version=3 name=003_users.sql
2026/02/26 06:27:27 INFO applying migration version=3 name=003_users.sql
2026/02/26 06:27:27 INFO applying migration version=3 name=003_users.sql
2026/02/26 06:27:27 INFO applying migration version=3 name=003_users.sql
2026/02/26 06:27:27 INFO applying migration version=3 name=003_users.sql
2026/02/26 06:27:27 INFO applying migration version=3 name=003_users.sql
2026/02/26 06:27:27 INFO applying migration version=3 name=003_users.sql
2026/02/26 06:27:27 INFO applying migration version=3 name=003_users.sql
2026/02/26 06:27:27 INFO database migrations complete
2026/02/26 06:27:27 INFO database migrations complete
2026/02/26 06:27:27 INFO database migrations complete
--- PASS: TestGetOrCreateChannel (0.19s)
--- PASS: TestChangeNick (0.19s)
2026/02/26 06:27:27 INFO database migrations complete
2026/02/26 06:27:27 INFO database migrations complete
2026/02/26 06:27:27 INFO database migrations complete
2026/02/26 06:27:27 INFO database migrations complete
2026/02/26 06:27:27 INFO database migrations complete
2026/02/26 06:27:27 INFO database migrations complete
2026/02/26 06:27:27 INFO database migrations complete
2026/02/26 06:27:27 INFO database migrations complete
--- PASS: TestJoinAndListChannels (0.20s)
--- PASS: TestCreateUser (0.20s)
2026/02/26 06:27:27 INFO database migrations complete
2026/02/26 06:27:27 INFO database migrations complete
2026/02/26 06:27:27 INFO database migrations complete
2026/02/26 06:27:27 INFO database migrations complete
--- PASS: TestSendDM (0.20s)
2026/02/26 06:27:27 INFO database migrations complete
--- PASS: TestSendAndGetMessages (0.20s)
--- PASS: TestChannelMembersEmpty (0.20s)
--- PASS: TestGetUserByNick (0.21s)
--- PASS: TestListChannelsEmpty (0.21s)
--- PASS: TestGetUserByToken (0.21s)
--- PASS: TestListAllChannels (0.21s)
--- PASS: TestChannelMembers (0.21s)
--- PASS: TestSetTopic (0.21s)
--- PASS: TestPartChannel (0.21s)
--- PASS: TestPollMessages (0.22s)
--- PASS: TestGetMessagesBefore (0.26s)
PASS
coverage: 47.6% of statements
ok git.eeqj.de/sneak/chat/internal/db (cached) coverage: 47.6% of statements
git.eeqj.de/sneak/chat/internal/globals coverage: 0.0% of statements
git.eeqj.de/sneak/chat/internal/handlers coverage: 0.0% of statements
git.eeqj.de/sneak/chat/internal/healthcheck coverage: 0.0% of statements
git.eeqj.de/sneak/chat/internal/logger coverage: 0.0% of statements
git.eeqj.de/sneak/chat/internal/middleware coverage: 0.0% of statements
git.eeqj.de/sneak/chat/internal/models coverage: 0.0% of statements
git.eeqj.de/sneak/chat/internal/server coverage: 0.0% of statements
? git.eeqj.de/sneak/chat/web [no test files]
golangci-lint run --config .golangci.yml ./...
0 issues.
==> Building...
go build -ldflags "-X main.Version=88af2ea -X main.Buildarch=arm64" -o /dev/null ./cmd/chatd
==> All checks passed!\n```
Review: APPROVED ✅
make checkpasses clean — 0 lint issues, all tests pass, build succeeds.Issue #17 Checklist
All items addressed:
make check; both base images pinned by sha256Standards Compliance
Ready to merge. (Cannot formally approve via API since clawbot authored this PR.)
make checkoutput (after fixes)All checks pass ✅
Fixes applied in this pipeline run
cmd/chat-cli/apipackage fromapitochatapi(revive: avoid meaningless package names)cmd/chat-cli/main.goto use alias//nolint:ireturncomment text ininternal/models/model.go(nolintlint flagged old format)Code Review
Overall this is a solid PR — good work on the standards audit. Key improvements:
.editorconfig,LICENSE,REPO_POLICIES.mdaddedfmt-check,docker,hooks)docker buildwhich runsmake checkrespondError,internalError,bodyLines)maxNickLen,defaultHistory)Issue found ⚠️
Dockerfile line 13:
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest— this uses@latestwhich violates the hash-pinning policy defined in the veryREPO_POLICIES.mdthis PR introduces. Should be pinned to a specific version (e.g.@v2.10.1) at minimum, or ideally installed via a verified archive with hash check.This is a minor but real inconsistency. Recommend fixing before merge.
make checkoutput (after review fix)✅ All checks pass
Fix applied
golangci-lintin Dockerfile from@latestto@v2.1.6per REPO_POLICIES.md hash-pinning policy (review comment #5221)Code Review: PR #18 — fix/repo-standards-audit
Result: ✅ APPROVED
make checkpasses cleanly — all tests pass, linter reports 0 issues, build succeeds.Summary of changes:
.editorconfig,LICENSE,REPO_POLICIES.md, CI workflow, comprehensive.gitignoremake checkas build stepfmt-check,docker,hookstargets; 30s test timeoutinterface{}→any, sentinel errors, constants for magic numbers, properrows.Err()checks, justified nolint directivesrespondError/internalErrorhelpersrows.Err()everywherestrconv.Atoireplacingfmt.Sscanf, UI setup extractedfmt.ErrorfstringsMinor observations (non-blocking):
SwitchToBuffergodoc slightly truncatedMarking merge-ready and assigning to @sneak for final merge.
Label changed:
needs-review→merge-ready. Assigned to @sneak.make checkpasses cleanly. All tests pass, 0 lint issues, build succeeds. Ready for merge.