Consumer entry: its protected_paths in the hooks' syntax, held by consumer/1 and read by the one matcher (#141)

Merged
DO
8d ago
+386-4

User description

Closes #141, "Consumer entry: its protected_paths in the hooks' syntax". It applies decision 0020; no new decision (the Factory Builder, 2026-11-11).

What changes

PartChange
schemas/consumer.schema.jsonconsumer/1, the entry of design §3.12, as a data file. Each verify.protected_paths item is hooks.schema.json#/$defs/path, the very path config/hooks.json holds: a final / for a directory and all below it, * within one name, ** as a whole name, case ignored. setup and test are literal paths, never patterns. Every other field is held in its shape and type
tools/check_examples.pyconsumer is a data file in ENVELOPE. _unprotected: an entry's setup and test scripts must each be named by one of its protected paths, by the Kernel's own derive.matches, in an example as in a counter-example, so that an author cannot weaken the tests it is judged by
examples/consumer.jsonThe §3.12 entry, with a ** and a * pattern beside the scripts
examples/invalid/consumer.*.jsonA path from the root, a glob of another syntax (?), a path that climbs out, a script left unprotected, and a script named by a pattern
Design §3.12The example's .github/** becomes .github/, a syntax correction kept as ruled. One paragraph on the syntax, with its two pitfalls (.github/*; CODEOWNERS without .github/CODEOWNERS). §5.3's line says a setup and a test script, which the protected paths name

The test is tests/test_tools.py::Apps::test_a_consumer_entrys_protected_paths_are_in_the_hooks_syntax_and_read_by_one_matcher. It asserts four things:

  • Every counter-example is refused.
  • Each wrong protected-path list is refused: empty, doubled, from the root, ?, .., //, ./, braces, a backslash, or missing.
  • Each other field is refused when wrong, of the wrong type, missing, or extra.
  • Every pattern the schema lets through is one kernel readable_pattern reads, and kernel derive.matches and the session hooks' protected.entries find the same patterns for each path, in any case.

21 mutants under "Issue 141", all killed. The matcher does not move; no model Lens input is touched (schemas/, examples/, tools/ and tests/ are the verify Lens's inputs). Nothing reads an entry until slice 3's readiness check and apply.

Verify

make checks passes at 14914213, and tests.test_tools passes. Full verify is CI's.

Reviews

ReadHeadState
Claude + security855930e5Nothing blocking. A fuzz of 60,000 patterns against 480,000 paths found the two matchers never disagreeing. Its major (an entry could leave its own scripts unprotected), the untested $defs/file, a claim no code held, owner_role's pattern, and the wording on two matchers are fixed in 9804b52f. Left alone: the ring enum's tie to release/rings.json, which fixes the same two Channels; and schemas/acceptance.schema.json's protected_paths, still any string, which is outside this change
Carbon (gemini-4-carbon-high)855930e5One major (the other fields untested): fixed in 4cc48016
Muse (Wonder Full)855930e5A clean read
Astra (gpt-6-astra)4cc48016Two majors (an empty workflow name; the test script's pattern held only through setup): fixed in 68441282
Astra, re-read68441282Two majors (field types; a setup script alone left unprotected): fixed in 14914213

🤖 Generated with Claude Code


CodeAnt-AI Description

Validate Consumer repository protection paths and verification scripts

What Changed

  • Consumer entries now use the same protected-path rules as hooks, including directory paths, wildcards, and case-insensitive matching.
  • Each entry must protect both its setup and test scripts; those scripts must be literal repository paths.
  • Entries with invalid paths, unsupported patterns, or uncovered scripts are rejected.

Impact

✅ Consumer setup and test scripts stay protected
✅ Invalid protection paths rejected
✅ Consistent path matching across checks and hooks

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.