-
Notifications
You must be signed in to change notification settings - Fork 276
Closed
Labels
Description
Objective
Add enum validation for the scope field in parseCacheMemoryEntry() so invalid values are rejected with a clear error rather than silently treated as "workflow".
Context
From discussion #19383 (MEDIUM-1): The cache-memory scope field accepts only "workflow" and "repo", but:
- The JSON schema (
main_workflow_schema.json) doesn't define these as an enum — any string passes schema validation - The parser (
parseCacheMemoryEntry()) setsentry.Scopefrom any string - Downstream logic at
cache.go:406only checksif scope == "repo", so any other value (e.g.,"organization","global") silently behaves like"workflow"
Approach
-
In the JSON schema (
pkg/parser/schemas/main_workflow_schema.json): Add"enum": ["workflow", "repo"]to thecache-memory[*].scopeproperty definition -
In the parser (
pkg/workflow/— whereverparseCacheMemoryEntry()is defined): After extractingentry.Scope, validate it:validScopes := []string{"workflow", "repo"} if !contains(validScopes, entry.Scope) { return nil, fmt.Errorf("invalid cache-memory scope %q: must be one of [workflow, repo]", entry.Scope) }
-
Run
make buildafter schema changes (schemas are embedded via//go:embed)
Files to Modify
pkg/parser/schemas/main_workflow_schema.json— add enum tocache-memory[].scope- Parser file containing
parseCacheMemoryEntry()— add scope validation
Acceptance Criteria
- Schema defines
scopeasenum: [workflow, repo] - Parser returns a clear error message for invalid scope values
-
"workflow"and"repo"continue to work correctly - Unit tests cover valid and invalid scope values
-
make buildrun after schema changes - Run
make agent-finishbefore committing
Generated by Plan Command for issue #discussion #19383 · ◷
- expires on Mar 5, 2026, 10:49 AM UTC
Reactions are currently unavailable