Skip to content

check_writes: further ways a write could be reached past the check, written to hide it (raised by #587) #596

Closed

Description

@don-petry

Raised by the reads of the pull request for #587. It adds tools/check_writes.py, by which only the callers it lists reach a GitHub write, read from the code's syntax. Its reads found routes round the check in four rounds, and 4e5b288 was the last round of fixes. On the Factory Builder's ruling, the check is "a net for code written plainly; code written to hide a write is the review's to see". The routes below are written to hide a write, and none is used on main. The review Role reads every change, so they are filed here rather than held in that pull request.

Ways still open

Way Example outside adapters/
A module taken from sys.modules by its name sys.modules['adapters.' + 'effects'].role_write(...)
A namespace package: with no adapters/__init__.py, a dotted import adapters.effects is read as no module of the repo import adapters.effects then adapters.effects.approve(...)
A class's attribute set by setattr, or from a function, then called through the class setattr(Port, 'w', effects.approve) in one module, then Port.w(t) in another
gh or git run as a subprocess from Python, which is no request of adapters/github.py's and holds no verb as a whole string subprocess.run(['gh', 'pr', 'merge', '1'])
Any later route a read finds that only code written to hide a write would take

Fixed in the pull request, for the record

These rarer routes were found by the reads and closed in 4e5b288, the last round:

  • __import__ imported from builtins under another name;
  • an adapter's __dict__ imported;
  • a nested function's parameter shadowing the outer function's call;
  • super() in an override of the same name.

Done when

Each way is refused by the check, with a boundary case in tests/test_tools.py and a mutant, or named as not held in the record with its reason. Main still passes.

🤖 Generated with Claude Code

Activity

  1. don-petry commented on Nov 7, 2026

    @don-petry
    ContributorAuthor

    Two more ways, from Astra's read of #597 at e7ab41d, which only code written to hide a write would take:

    Way Example in adapters/
    A query constant set again from a function through global def configure(doc): / global DOC / DOC = doc, then a POST of DOC
    A request's body edited a key deep after it is built r = request("POST", "/graphql", body={...}), then r["body"]["query"] = "mutation …"

    🤖 Generated with Claude Code

  2. don-petry commented on Nov 7, 2026

    @don-petry
    ContributorAuthor

    One more, from Astra's read of #597 at 6e8fae5, which only code written to hide a write would take:

    Way Example in adapters/
    A request copied and the copy changed req = request("GET", path), then out = req.copy() and out.update([("method", "DELETE")])

    🤖 Generated with Claude Code

  3. don-petry commented on Nov 7, 2026

    @don-petry
    ContributorAuthor

    From Astra's read of #597 at 899121b, one more way:

    Way Example in adapters/
    A registry a decorator fills through a local name for it def register(fn): / target = STEPS / target.append(fn), then @register on a writer

    🤖 Generated with Claude Code

  4. don-petry commented on Nov 7, 2026

    @don-petry
    ContributorAuthor

    From Astra's last read of #597, at 2ff8308. By the Factory Builder's ruling, every route through classes, scopes or registries belongs here, however plainly it is written:

    Way Example in adapters/
    super() through a sibling base in a subclass's method resolution order class Client(Forward, Writer), where Forward.act calls super().act(t) and Writer.act writes
    A subclass's callback attribute reached by a base's cls.write class Client(Base): write = staticmethod(drop), where Base.act calls cls.write(t)
    A request copied, then changed (already listed) outgoing = req.copy(), then outgoing.update([...])
    A decorator's registry given as a parameter's default def register(fn, registry=STEPS): registry[fn.__name__] = fn

    🤖 Generated with Claude Code

  5. added 2 commits that reference this issue on Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions