-
Notifications
You must be signed in to change notification settings - Fork 190
Closed as not planned
Labels
Description
Objective
Create comprehensive documentation for Go type safety patterns and best practices to guide future development and prevent regression.
Context
The codebase already has excellent type safety examples (semantic type aliases in pkg/constants/constants.go, migration patterns in pkg/workflow/tools_types.go), but these patterns aren't formally documented. This issue ensures best practices are captured and easily accessible to contributors.
Approach
-
Create
specs/go-type-safety.mdwith sections on:- When to use semantic type aliases (following
LineLength,Version,FeatureFlagpatterns) - When
map[string]anyis appropriate vs when to use structs - How to migrate from untyped to typed configurations
- Examples of good and bad patterns
- Type name collision prevention
- When to use semantic type aliases (following
-
Update
AGENTS.mdwith quick reference:- Link to the new spec
- Add to "Type Patterns and Best Practices" section
- Include decision tree for choosing type patterns
-
Add inline documentation to exemplary code:
- Add godoc comments to
pkg/constants/constants.goexplaining semantic types - Add godoc to
pkg/workflow/tools_types.goexplaining migration pattern - Document the
MapToolConfigtransitional pattern
- Add godoc comments to
-
Create a type safety checklist for PR reviews:
- Questions to ask when reviewing new types
- Red flags to watch for
- When to require stronger typing
Files to Create/Modify
- Create:
specs/go-type-safety.md- Comprehensive type safety guide - Update:
AGENTS.md- Add type safety quick reference - Update:
pkg/constants/constants.go- Add godoc explaining semantic types - Update:
pkg/workflow/tools_types.go- Enhance migration documentation - Create:
.github/PULL_REQUEST_TEMPLATE.mdsection on type safety (optional)
Acceptance Criteria
-
specs/go-type-safety.mdcreated with comprehensive guidance -
AGENTS.mdupdated with type safety quick reference - Key code files have enhanced godoc comments
- Documentation includes decision trees and examples
- All examples are tested and accurate
Estimated Effort
3-4 hours
Related to #7369
AI generated by Plan Command for discussion #7368
Reactions are currently unavailable