Skip to content

project status and doctor crash with a traceback (exit 1) on hostile manifest values: a decimal number over 4,300 digits, or a lone surrogate in a printed name #39

Open

Description

@brettheap

Lane: openRepoProject-1

Filed on Brett Heap's word "all recommended" (2026-10-23T13:30:24Z), which adopted lane openRepoProject-1's recommendation to file this as one issue linked to #38. Probe agent P1 (lane openRepoProject-1) found it on 2026-10-23, while building the project status parity table for the design of change add-project-overview-family-relationships (draft PR #37, governing issue #36). That change does not touch status or doctor; this issue reports the existing path. Related: #38 (the same hole in main(), for a looping member link).

Defect

project status (and doctor, through the same snapshot()) ends in a Python traceback, with exit status 1, when a manifest holds a value that Python cannot convert. Two triggers, found by probing:

  • A. A decimal integer of more than 4,300 digits in a manifest. yaml.safe_load raises ValueError while loading, in read_yaml(). Standard output is empty even under --json.
  • B. A lone surrogate in a manifest string that the human report prints. The string is written as the YAML escape for U+D800 inside double quotes. The human report cannot encode it, and print() raises UnicodeEncodeError. --json is not affected.

Reproduction (main at 15504f1; Python 3.12.3 and 3.10.18 alike)

A. Decimal integer over 4,300 digits

A projects directory P holding one family:

P/dec/dec/family.yaml     # kind: family-manifest, name: dec, members: [{project: web}]
P/dec/web/project.yaml    # kind: project-manifest, name: web, id: <a decimal integer of 5,000 digits>
PROJECTS_DIR=P project status dec --json

Observed: exit status 1, standard output empty, and on standard error (Python 3.12.3):

  File ".../project", line 1142, in main
  File ".../project", line 937, in inspect_project
  File ".../project", line 854, in snapshot
  File ".../project", line 827, in snapshot
  File ".../project", line 426, in manifest
  File ".../project", line 43, in read_yaml
  File ".../yaml/constructor.py", line 263, in construct_yaml_int
    return sign*int(value)
ValueError: Exceeds the limit (4300 digits) for integer string conversion: value has 5000 digits; use sys.set_int_max_str_digits() to increase the limit

Python 3.10.18 prints the same chain; its last line says "Exceeds the limit (4300) for integer string conversion". The same happens:

  • without --json, and for project doctor dec, doctor dec --json;
  • when the number is in the holder's own family.yaml under an unknown key (note: <5,000 digits>), and when it is the id of a single project's project.yaml with no family. So the key does not matter, and the family does not matter.

For contrast, in the same fixture shape a hexadecimal id of 5,000 digits (0x...) and a sexagesimal id of 3,000 parts (1:2:3:...) load as large integers and status and doctor exit 0 with the same output as a normal member, on both Pythons: project never reads id.

B. Lone surrogate in a printed manifest string

P/mname/mname/family.yaml   # kind: family-manifest, name: mname, members: [{project: web}]
P/mname/web/project.yaml    # kind: project-manifest, name: "\ud800"   (the YAML escape, written with a backslash)
PROJECTS_DIR=P project status mname

Observed: exit status 1. Standard output holds the holder's four lines and stops before the member's line; standard error ends:

  File ".../project", line 915, in walk
    print(f"{indent}{item['name']} ({item['kind']}) — {item['root']}")
UnicodeEncodeError: 'utf-8' codec can't encode character '\ud800' in position 2: surrogates not allowed

The same with the same escape in:

  • the holder's own name: in family.yaml (project:915, position 0, standard output empty);
  • a leg's role: in a member's project.yaml (project:928).

project doctor fails the same way, because it prints through the same print_report(). The run used LC_ALL=C.UTF-8. status --json and doctor --json exit 0 with the name written as "\ud800", because json.dumps escapes non-ASCII. (doctor --json exits 1 for the leg case only because its own check row reports a missing leg checkout.)

A member list entry project: "\ud800" does not reach the print: the name test at project:850 refuses it first, exit 2, "Invalid family member name in ", with or without --json.

Cause

  • A. read_yaml() catches only (OSError, UnicodeError, yaml.YAMLError) (project:44). PyYAML builds a decimal integer with int(value) (yaml/constructor.py:263), and CPython's integer-string-conversion limit (4,300 digits on both Pythons run) makes that raise a plain ValueError, which is none of the three. main() catches only Refused and OSError (project:1143), so the error escapes as a traceback. yaml.YAMLError, UnicodeError and OSError were each tested with isinstance on the caught exception: all false.
  • B. print_report() prints item['name'] (project:915) and a leg's role (project:928) with no guard. The UTF-8 encoder of standard output rejects a lone surrogate, and UnicodeEncodeError is a ValueError, not an OSError, so main() does not catch it either.

Expected

A clean refusal, as the other bad-manifest cases already give: exit 2 with a one-line message, and under --json the JSON error object the other refusals print.

  • A. read_yaml() turns a ValueError from loading into a Refused ("Cannot read : ...").
  • B. The human report writes the string in an escaped form instead of printing it raw, or the manifest reader refuses a name that standard output cannot carry. The choice is Brett Heap's.

Notes

Activity

  1. brettheap commented on Oct 23, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoProject-1, session a0e10447-aab0-411d-8015-359674fb42ea@Eagle, 2026-10-23T13:34:36Z, for #39

    Logged in lanes/log/openRepoProject-1.md at c1bd2a73c200436059ffeae497345c74bfb996bd.

    The three reads (lane-collision-protocol Rule 1):

    1. existing `CLAIMED —` comments on opensoft/openRepoProject#39:
       none
    2. `gh pr list --repo opensoft/openRepoProject --state all --search "#39"`, kept where the row or its body names `#39`:
       none
    3. `git ls-remote --heads [email protected]:opensoft/openRepoProject` branches naming `39` as a whole token:
       none
    
  2. brettheap commented on Oct 23, 2026

    @brettheap
    ContributorAuthor

    Lane: openRepoProject-1

    A third trigger (C): a deeply nested manifest. It is in the same family as A and B, and has the same hole in main().

    A projects directory P holding one family, whose member's manifest nests a YAML sequence 1,000 levels deep:

    P/deep/deep/family.yaml    # kind: family-manifest, name: deep, members: [{project: web, id: web, path: members/web}]
    P/deep/web/project.yaml    # kind: project-manifest, ... a value nested 1,000 levels deep: [[[[ ... ]]]]
    
    PROJECTS_DIR=P project status deep --json
    

    Observed on main at 15504f1, on Python 3.12.3 and on 3.10.18: exit 1, standard output empty, and standard error ending

      File ".../project", line 937, in inspect_project
      File ".../project", line 854, in snapshot
      File ".../project", line 827, in snapshot
      File ".../project", line 426, in manifest
      ...
    RecursionError: maximum recursion depth exceeded
    

    Cause. PyYAML's composer recurses once per nesting level, while read_yaml() is loading the file. RecursionError is a RuntimeError; it is not one of the (OSError, UnicodeError, yaml.YAMLError) that read_yaml() catches (project:44), and main() catches only Refused and OSError (project:1143). So, as with A, it ends as a traceback.

    Expected. The same as A: read_yaml() turns it into a Refused ("Cannot read : ..."), so the run gives exit 2 with a one-line message, and under --json the JSON error object.

    Evidence. The lane scratch fixture is /workspace/projects/.scratch/openRepoProject-1-wave10-20261023/fx-w3/: the build script is in scripts/, the 3.12 output in out/p1-312.err, and the 3.10 output in ../p1-310.err. Both were run under env -i with fake owner tools first on PATH and every discovery root in the fixture. The fixture's digest was unchanged by the run, and no fake tool was called. It was found by review R4 of #37's design (R4-11) and confirmed by agent W3 (3.12) and by the lane lead (3.10).

    🤖 Generated with Claude Code

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