-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor: align codebase with engineering standards #97
Copy link
Copy link
Closed
Description
Summary
Align the gro codebase with engineering standards for consistency, mechanical enforcement, and maintainability. This is a multi-commit refactoring effort covering architecture enforcement, test infrastructure, documentation, and bug fixes.
Changes
Architecture & Enforcement
- Add structural tests (
internal/architecture/architecture_test.go) that mechanically enforce codebase patterns at CI time: client interfaces, ClientFactory DI, NewCommand() factories,--jsonon leaf commands, read-only scopes, dependency direction - Add coverage gate to CI (60% threshold)
Code Standards Alignment
- Propagate
context.Contextthrough all API client methods and command handlers - Relocate interfaces from implementation packages to consumer packages (interface-at-consumer pattern)
- Remove deprecated gmail wrapper functions
- Use present participle in error messages per Go conventions
- Add signal handling with context propagation
Test Infrastructure
- Remove testify dependency, replace with stdlib-based assertion helpers (
internal/testutil/assert.go) - Centralize
CaptureStdoutand genericWithFactory[T]helpers (internal/testutil/helpers.go) - Add
t.Parallel()to safe test files - Add function-field mock structs with compile-time interface checks in each domain
Documentation
- Restructure CLAUDE.md as a concise table of contents (~90 lines, down from ~350)
- Create
docs/architecture.md,docs/golden-principles.md,docs/adding-a-domain.md - Add package doc comments to all packages
Bug Fixes
- Fix
--jsonflag ignored on empty results across all list/search commands (output[]instead of plaintext)
Build & Lint
- Align Makefile targets and CI workflow
- Clean up stale lint suppressions in
.golangci.yml
Verification
make checkpasses (tidy, lint, test, build)make test-cover-checkpasses (63.6% coverage, 60% threshold)- All 12 structural tests pass
- Integration tests pass against live Google APIs
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels