Skip to content

Fix hookify enabled boolean parsing#57108

Open
parasol-aser wants to merge 1 commit intoanthropics:mainfrom
parasol-aser:fix/hookify-enabled-boolean
Open

Fix hookify enabled boolean parsing#57108
parasol-aser wants to merge 1 commit intoanthropics:mainfrom
parasol-aser:fix/hookify-enabled-boolean

Conversation

@parasol-aser
Copy link
Copy Markdown

Summary

  • parse Hookify enabled frontmatter as a strict boolean
  • accept common YAML boolean spellings: true/false, yes/no, on/off, and 1/0
  • reject invalid enabled values instead of letting truthy strings activate rules
  • add focused unittest coverage for boolean spellings and disabled-rule loading

Fixes #57107.

Tests

python3 -B -m unittest discover -s plugins/hookify/tests
PYTHONPATH=plugins python3 -B - <<'PY'
from hookify.core.config_loader import extract_frontmatter, Rule
fm, msg = extract_frontmatter("---\nname: r\nenabled: no\nevent: bash\npattern: rm -rf\n---\nmsg\n")
r = Rule.from_dict(fm, msg)
print(repr(fm["enabled"]), bool(r.enabled))
PY

The reproduction now prints False False.

Parse the enabled frontmatter field as a strict boolean so YAML-style values such as no, off, and 0 cannot remain truthy strings.\n\nAdd focused unittest coverage for enabled boolean spellings and disabled-rule loading.\n\nFixes anthropics#57107
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.

Hookify treats enabled: no as enabled

1 participant