-
Notifications
You must be signed in to change notification settings - Fork 249
Open
Labels
Description
Objective
Introduce semantic types for artifact name constants and rate limit constants in pkg/constants, improving clarity and preventing unit/purpose confusion.
Context
Discussion #17885 (Typist - Go Type Consistency Analysis) identified two groups of low-priority but clear-improvement untyped constants:
Group 1 — Artifact Names (pkg/constants/constants.go ~lines 641–645):
// Current — untyped
const SafeOutputArtifactName = "safe-output"
const AgentOutputArtifactName = "agent-output"
const AgentOutputFilename = "agent_output.json"
// Proposed
type ArtifactName string
const SafeOutputArtifactName ArtifactName = "safe-output"
const AgentOutputArtifactName ArtifactName = "agent-output"
// AgentOutputFilename remains untyped string (it's a filename, not an artifact name)Group 2 — Rate Limit Constants (pkg/constants/constants.go ~lines 694–695):
// Current — untyped ints with comments explaining units
const DefaultRateLimitMax = 5 // Default maximum runs per time window
const DefaultRateLimitWindow = 60 // Default time window in minutes (1 hour)
// Proposed — units encoded in the type name
type RunCount int
type Minutes int
const DefaultRateLimitMax RunCount = 5
const DefaultRateLimitWindow Minutes = 60Approach
- Add
type ArtifactName stringwithString()method, apply to 2 artifact name constants - Add
type RunCount intandtype Minutes int, apply to the 2 rate limit constants - Update all usage sites for the artifact name constants
- Update all usage sites for the rate limit constants (they are used in rate limit validation logic)
Files to Modify
pkg/constants/constants.go— add 3 new types, apply to 4 constants- Any files in
pkg/workflow/orpkg/cli/that reference these constants
Acceptance Criteria
-
type ArtifactName stringdefined withString()method; applied to 2 artifact name constants -
type RunCount intandtype Minutes intdefined; applied to 2 rate limit constants - All usage sites compile correctly
-
make buildandmake test-unitpass -
make fmtandmake lintpass
Generated by Plan Command for issue #discussion #17885
- expires on Feb 25, 2026, 11:40 AM UTC
Reactions are currently unavailable