Skip to content

[plan] Add ArtifactName, RunCount, Minutes semantic types for untyped constants #17892

@github-actions

Description

@github-actions

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 = 60

Approach

  1. Add type ArtifactName string with String() method, apply to 2 artifact name constants
  2. Add type RunCount int and type Minutes int, apply to the 2 rate limit constants
  3. Update all usage sites for the artifact name constants
  4. 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/ or pkg/cli/ that reference these constants

Acceptance Criteria

  • type ArtifactName string defined with String() method; applied to 2 artifact name constants
  • type RunCount int and type Minutes int defined; applied to 2 rate limit constants
  • All usage sites compile correctly
  • make build and make test-unit pass
  • make fmt and make lint pass

Generated by Plan Command for issue #discussion #17885

  • expires on Feb 25, 2026, 11:40 AM UTC

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions