Skip to content

fix: resolve README disk_usage constraint failures (CEL cross-type numerics + YAML regex escaping)#48

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-readme-invalid-constraints
Draft

fix: resolve README disk_usage constraint failures (CEL cross-type numerics + YAML regex escaping)#48
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-readme-invalid-constraints

Conversation

Copilot AI commented Jun 14, 2026

Copy link
Copy Markdown

Two bugs in the README disk_usage example caused constraint compilation/evaluation errors for anyone following the quickstart.

Changes

  • pkg/common/constraints.go — Add cel.CrossTypeNumericComparisons(true) to the CEL env options. number-typed params are bound as double, so comparing them against integer literals (e.g. max_depth >= 1) failed without this option.

  • README.md — Fix YAML quoting on the regex constraint. The double-quoted YAML string "directory.matches('^[\\w\\s./\\-_]+$')" has its backslashes consumed by the YAML parser (\\w\w), leaving invalid escape sequences in the CEL string literal. Changed to YAML single-quoted form which passes backslashes through verbatim:

    # Before (broken: YAML strips one layer of backslashes)
    - "directory.matches('^[\\w\\s./\\-_]+$')"
    
    # After (YAML single-quotes are literal; CEL then resolves \\w → \w for the regex)
    - 'directory.matches("^[\\w\\s./\\-_]+$")'
  • pkg/common/constraints_test.go — Added test cases covering pass/fail for double params compared against integer literals (max_depth >= 1 && max_depth <= 3).

Copilot AI changed the title [WIP] Fix invalid constraints in README example fix: resolve README disk_usage constraint failures (CEL cross-type numerics + YAML regex escaping) Jun 14, 2026
Copilot AI requested a review from inercia June 14, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants