A check refuses naming a Role to open pull requests while open_pull_request has no writer (#808, record 0215)

Merged
DO
6d ago
+383-0

Fixes #808

A configuration can no longer name a Role to open pull requests until the Effect open_pull_request has its writer. This holds #295's limit by a check rather than by memory. With the Role null, as config/defaults.json has it today, the check passes, so config/defaults.json is untouched and no hand PR is needed.

What

The check. tools/check_authority.py opening_problems refuses a configuration whose issues.intents["open-pull-request"] is not null unless the code has a writer. The writer is three marks, read from the code's syntax, never by importing it:

  1. An opening adapter. An adapters/ function builds request(...) with method POST and path /repos/%s/pulls and nothing after it. Both the method and the path are read as text. A literal counts, and so does:
    • one formatted with %;
    • an f-string;
    • a name bound once to one of those in the function or at the module's top;
    • an argument given by place or by keyword.
  2. A step that reaches it. A harness/ module that tools/check_writes.py's CALLERS lists as reaching that function. Because check_writes holds CALLERS true, the check can rely on it.
  3. A record of the Run. That same module calls harness/apply.py's opened, which records the Run that opened the pull request (decision 0097). It can be imported in any of these ways:
    • by name, or under another name;
    • relatively;
    • with harness.apply imported whole, as a module or under another name;
    • spelt out as harness.apply.opened, but only where import harness.apply binds it.

The refusal names the first mark missing. #342's writer is the change that makes all three true.

Counter-example. examples/invalid/config.an-opening-role-with-no-writer.json is refused by tools/check_examples.py through the check, and for that alone.

Record 0215, numbered by the Factory Builder, amends decision 0068's row "The Run record" and decision 0047's row "The known limit". It restates #295's limit as "before any Role is named to open pull requests, or any contract is in force". It also names what remains:

  • nothing checks that no contract is in force;
  • the marks are syntax: a step could call opened and reach the opener in separate flows;
  • a writer written in a form the check does not read stays red. It fails closed, and the refusal names the mark it lacks.

Held by

  • The test: tests/test_tools.py::test_a_role_named_to_open_pull_requests_waits_on_its_writer.
    • Today's configuration passes. A named Role is refused in the repo as it stands, and its counter-example is refused.
    • In a scratch tree, the full writer passes, and each mark missing in turn is named.
    • A read of the pulls, a write to them other than POST, a write to one pull request, a call that builds no request, and a method or path not written as text are not an opening. Neither is a name bound twice.
    • A caller outside the Harness, and a step that reaches another writer, do not reach the opening.
    • A step that calls no opened, another module's opened, or harness.apply.opened without the import records nothing.
  • Mutants: 27 new, each killed by the test. All 107 mutants of tools/check_authority.py and tools/check_examples.py are killed.
  • make checks: red on one check alone. Record 0215 opens a gap until records 0212 to 0214 merge. Then I merge main into this branch and push.

Diff: about 36,000 characters.

Second readers

ReaderHeadResult
Carbon (Gemini 4 Carbon)a4eac6c1not run (quota), owed
Musea4eac6c11 major and 2 minors, all fixed in 70cd0b5f. Major: harness.apply.opened counted with nothing importing harness.apply. Minors: the plain from harness.apply import opened form was untested, and any write verb to the pulls counted, though only POST opens
Astra (gpt-6-astra)a4eac6c12 majors, fixed in 70cd0b5f: the same import gap, and the untested plain import
Claude + securitya4eac6c1no blocker and no security finding. 2 minors, fixed in 70cd0b5f: only an inline positional path was read, so a real writer in the style of adapters/effects.py would stay red; and opened by its own name in harness/apply.py had no test

The fixes in 70cd0b5f came after the readers; none of them re-read that head.

šŸ¤– Generated with Claude Code