Skip to content

Python: arch_io misses Path I/O and over-counts os.path / sys.exit (recall 0.25, precision 0.43) #8860

Closed

Description

@squid-protocol

What is wrong

arch_io ("File & Network I/O") has recall 0.25 and precision 0.43 against ast over 72,044 functions. Two opposite problems:

  • Misses Path-object I/O. The rule matches the word pathlib, so Path(p).read_text() scores 0 unless the word pathlib is in the function. Missed in the engine's own code: read_text 1,746 functions, rglob 713, glob 691, write_text 135, read 154.
  • Over-counts non-I/O. os.path.join(a, b) and sys.exit(2) both score 1. The rosetta[python]: cross-language consistency — 5 red / 3 amber metrics, 5 ledgered shapes #2593 note says plain process state (os.environ, sys.argv, sys.path) was excluded, but other os. / sys. members (path string work, exiting the process) still count.

Reproduce

import os, sys
from pathlib import Path

def pather(p):
    return Path(p).read_text()      # arch_io == 0, should be > 0

def ospath(a, b):
    return os.path.join(a, b)       # arch_io == 1, should be 0

def exiter():
    sys.exit(2)                     # arch_io == 1, should be 0

Expected

I/O is a boundary crossing: open/read/write of files and sockets, network clients, Path read/write/glob/iter. Path string manipulation and process exit are not. Tighten the os. / sys. alternatives to the I/O members (os.walk|listdir|scandir|remove|rename|makedirs|open|read|write, sys.stdin|stdout|stderr) and add the Path method forms.

How this was found

A pilot that compares each function_data signal with what Python's own ast says the function does (72,044 functions of GitGalaxy's own code; see the pilot note, with corrections and one-function-per-case reproductions in temporal-crucible PR #188). This is part of the keyword-family validity epic (linked below once filed).

Rules for the fix

  • Any change to a keyword list adds or removes regex work, so time it: CPU seconds on keyword-rosetta and language-crucible before and after, and say the number in the PR.
  • If keyword-rosetta counts move, label the PR rosetta:rebless-owed and rebless as usual.
  • Add the case below as a test (one function per case, so a regression names itself).

Activity

  1. added
    bug
    python
    core-engine
    on Nov 21, 2026
  2. squid-protocol commented on Nov 21, 2026

    @squid-protocol
    OwnerAuthor

    Part of #8863 (keyword-family validity epic).

  3. squid-protocol commented on Nov 21, 2026

    @squid-protocol
    OwnerAuthor

    Claimed by promoter-bot host melek, lease renewed 2026-11-22T18:12Z. It lapses after 6 h without a renewal. To take it back, assign someone or remove the claim:melek label.

  4. squid-protocol commented on Nov 21, 2026

    @squid-protocol
    OwnerAuthor

    Churn run 8860-20261121T1441Z (host melek) ended without a PR. plan-held: real overlap with 8861; requeued behind it

  5. added a commit that references this issue on Nov 27, 2026
    298a06c
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

    bugclaim:melekcore-enginepriority: mediumpython

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions