Skip to content

[plan] Add cache-memory scope enum validation to schema and parser #19401

@github-actions

Description

@github-actions

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:

  1. The JSON schema (main_workflow_schema.json) doesn't define these as an enum — any string passes schema validation
  2. The parser (parseCacheMemoryEntry()) sets entry.Scope from any string
  3. Downstream logic at cache.go:406 only checks if scope == "repo", so any other value (e.g., "organization", "global") silently behaves like "workflow"

Approach

  1. In the JSON schema (pkg/parser/schemas/main_workflow_schema.json): Add "enum": ["workflow", "repo"] to the cache-memory[*].scope property definition

  2. In the parser (pkg/workflow/ — wherever parseCacheMemoryEntry() is defined): After extracting entry.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)
    }
  3. Run make build after schema changes (schemas are embedded via //go:embed)

Files to Modify

  • pkg/parser/schemas/main_workflow_schema.json — add enum to cache-memory[].scope
  • Parser file containing parseCacheMemoryEntry() — add scope validation

Acceptance Criteria

  • Schema defines scope as enum: [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 build run after schema changes
  • Run make agent-finish before committing

Generated by Plan Command for issue #discussion #19383 ·

  • expires on Mar 5, 2026, 10:49 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