The opening writer's marks refuse a re-bound path, a shadowed opened or request, and an unformatted path, and assume good faith (#868, record 0215)

Merged
DO
6d ago
+298-38

Fixes #868

This is the follow-on to #819, record 0215. tools/check_authority.py holds that a configuration names no Role to open pull requests until open_pull_request has its writer, read as three marks in the code's syntax. The check fails closed on what it can't read. Reviewers of #819 found six ways crafted code could pass the marks without a real writer, and reviewers of this PR found seven more. All are refused here. #819 merged first so records 0216 to 0221 kept their approvals. The gaps were unreachable meanwhile, because no opening Role is named.

What is refused now

  • A name counts only when it is bound once, directly in its own scope's body. Not when it is nested in a def, lambda, class or comprehension, under an if, loop, try or with, rebound, augmented, deleted, or used as a target. That holds for the path and the verb alike.
  • The path counts only when it is formatted once, from a function parameter that nothing else binds, or that parameter's attribute: '/repos/%s/pulls' % repo, or an f-string with one plain hole. A bare literal, a literal or computed value, any tuple, a conversion or a format spec are refused.
  • request counts only as adapters.github's: from adapters.github import request [as X], from adapters import github, or import adapters.github as G, at the module's top and bound nowhere else.
  • opened counts the same way. In harness/apply.py it counts only through an undecorated top-level def opened.
  • Attributes: setting, augmenting or deleting an attribute of any of those names counts as rebinding it.
  • The opener: a decorated or rebound opener function is not read.
  • Dynamic names: a module that names globals, locals, vars, setattr, delattr, exec, eval, compile, __import__, importlib, modules, __dict__ or __builtins__ is not read.
  • Live code only: calls count only in the function's own live code, never in nested scopes or after a return or raise.

Record 0215 gains one Boundaries row, and no existing row changes. The row names the test, the check and the mutants. It states what syntax can't hold:

  • a request built and not sent;
  • a parameter that holds a tuple;
  • calls in different flows;
  • the class the Factory Builder ruled out of code on 2026-11-14: "the marks are syntax, and assume code written in good faith; a crafted evasion is for the reviewers and the Maintainer's hand approval of the naming to catch". Its examples are a from-import of importlib, calls in postponed annotations, an alias's attribute rebound, and a method rebound in its class.

Findings of that class are declined with the row cited.

Held by

  • The test: tests/test_tools.py::test_a_role_named_to_open_pull_requests_waits_on_its_writer gains each crafted refusal, plus the accepted forms.
  • Mutants: all 137 of tools/check_authority.py and tools/check_examples.py are killed, and 30 of them are new.
  • make checks: passes on this head, with main merged in.

Second readers

ReaderHeadResult
Kimiaf0bbc292 findings, 2 taken: a nested-scope binding, a tuple behind a name
Astraaf0bbc293 findings, 3 taken: the same two, plus a module's attribute replaced
Claude + securityaf0bbc295 fail-opens taken: scope lookup, the formatted value, attribute replacement, a decorated or rebound opener, dynamic rebinding. Dead and nested code was taken too. "Built but not sent" is written into the limit
Kimi37562b073 findings. One taken: a decorated opened in apply.py. Two declined into the limit: an importlib from-import, postponed annotations
Astra37562b075 findings. The decorated opened taken. The rest declined into the limit as crafted evasions, per the ruling: an importlib from-import, annotations, an alias's attribute, a method rebound in its class
Carbon—not run: this week's quota goes to the S3 stack first. Owed
Muse—not run (quota: the window resets 2026-11-16). Owed

šŸ¤– Generated with Claude Code