Skip to content

refactor: one reader for repos.yaml instead of about ten #708

Closed

Description

@Jammy2211

Overview

The body map (PyAutoMind/repos.yaml) is parsed about ten separate ways in PyAutoBrain: five hand-written line scanners of the repos: block and four regex readers. This adds one stdlib-only reader in agents/_repo_paths.py that walks the repos: block and returns a field's raw value per repo, and moves each reader onto it, keeping each reader's own value handling (quoting, comments) so its result is unchanged.

Plan

  • Add manifest_field(text, key) (raw value per repo, in file order) and manifest_repos(text) to agents/_repo_paths.py, stdlib only: the repos: block, two-space repo keys, four-space fields, comment/blank lines skipped, ended by the next top-level key.
  • Move the five line scanners (manifest_paths, package_paths, project_discovery.manifest_categories, _hygiene_repos.parse_minimal, public_names.body_map_packages) and the four regex readers (_docs.known_repos, _intake._mind_home, _board.repo_homes, _hygiene_ci.derive_org) onto it; _hygiene_ci.derive_org and _board.derive_org share one owner vote.
  • Keep every PyYAML-free reader PyYAML-free; keep each reader's value normalisation so its output does not change.
  • Witness: compare every old and new reader on the real repos.yaml and on fixtures with quoted values, trailing comments and a block ended by a new top-level key; run the five named test files and the full suite.
  • PyAutoMind is listed in the prompt but needs no change (its repos_sync.py reads YAML with PyYAML).
  • Tier + merge mode: effective level: supervised; merge mode: auto-merge on green (this session: PR opened, merge left to the human).
Detailed implementation plan

Affected Repositories

  • PyAutoBrain (primary)

Branch Survey

Repository Current Branch Dirty?
./organs/PyAutoBrain main clean

Suggested branch: feature/one-repos-yaml-reader

Implementation Steps

  1. agents/_repo_paths.py: manifest_text(root), manifest_repos(text), manifest_field(text, key); rewrite manifest_paths and package_paths on them (docstrings untouched, see docs: --help docstrings and messages still carry incident history #705).
  2. bin/project_discovery.py, agents/conductors/hygiene/_hygiene_repos.py, bin/public_names.py: replace the scanner loops.
  3. agents/conductors/docs/_docs.py, agents/conductors/intake/_intake.py, board/_board.py, agents/conductors/hygiene/_hygiene_ci.py: replace the regexes; one owner vote.
  4. Equivalence harness (old vs new) on real + fixture files; tests/test_repo_paths.py gains fixture tests for the shared reader.
  5. Check the branch merges cleanly with fix: agent --help text rotted in feature, build and bug #703, docs: --help docstrings and messages still carry incident history #705, refactor: remove what batch collect left behind in the planner and status box #707.

Key Files

  • agents/_repo_paths.py and the eight caller files above

Original Prompt

Click to expand starting prompt

One reader for repos.yaml instead of about ten

Type: refactor
Target: PyAutoBrain
Repos:

  • PyAutoBrain
  • PyAutoMind
    Difficulty: medium
    Autonomy: supervised
    Priority: normal
    Status: formalised
    Consequence: notify
    Witness: for the real repos.yaml and for fixtures with quoted values, trailing comments and a block ended by a new top-level key, every replaced reader returns the same value before and after; tests/test_repo_paths.py, tests/test_public_names.py, tests/test_hygiene_conductor.py, tests/test_grouped_organ_consumers.py and tests/test_docs_conductor.py pass.
    Review-minutes: 0
    Unattended: ready
    Lane: any

One reader for repos.yaml instead of about ten

Type: refactor
Target: PyAutoBrain
Lane: any

The body map (PyAutoMind/repos.yaml) is parsed about ten separate ways in @PyAutoBrain. Five hand-written line scanners of the repos: block: agents/_repo_paths.py manifest_paths and package_paths, bin/project_discovery.py manifest_categories, agents/conductors/hygiene/_hygiene_repos.py parse_minimal, bin/public_names.py body_map_packages. Four regex readers: _docs.known_repos, _intake._mind_home, _board.repo_homes, _hygiene_ci.derive_org (whose owner vote _board.derive_org repeats). One manifest_field(root, key) in agents/_repo_paths.py could serve them. The scanners differ on quoting, comments and block termination, so each must be matched exactly; some are PyYAML-free on purpose and must stay so. Found in the 2026-11-22 refactor review (PyAutoBrain#700); estimated 60-80 lines.

Witness: for the real repos.yaml and for fixtures with quoted values, trailing comments and a block ended by a new top-level key, every replaced reader returns the same value before and after; tests/test_repo_paths.py, tests/test_public_names.py, tests/test_hygiene_conductor.py, tests/test_grouped_organ_consumers.py and tests/test_docs_conductor.py pass.

Activity

  1. Jammy2211 commented on Nov 22, 2026

    @Jammy2211
    ContributorAuthor

    Library PR opened: #709. Witness met: all ten readers identical before/after on the real repos.yaml and on quoted / trailing-comment / block-ended fixtures; the five named test files pass; full suite 2453 passed, 1 skipped. On comments on the repos: line or a repo-key line (not in the real map) the old readers disagreed with each other; the shared reader reads both — see PR. Trial merge with #703/#705/#707 clean. Heart: door YELLOW (unrelated); dev-ship STALE only from a TLS timeout in Heart's CI poll, main green by gh. Merge left to the human (/prm).

  2. Jammy2211 commented on Nov 22, 2026

    @Jammy2211
    ContributorAuthor

    Shipped

    Merged in #709 (2026-11-22). PyAutoMind/repos.yaml now has one stdlib-only reader in agents/_repo_paths.py (manifest_entries plus manifest_repos, manifest_field, manifest_text, manifest_homes, majority_owner), and the five line scanners and four regex readers that parsed it separately now use it. Callers keep their own value handling, so behaviour is unchanged.

    Note: the shared reader reads comments on the repos: line and on a repo key line (the old readers disagreed there; the real map has neither). Heart STALE at ship time was this network's TLS timeouts only; accepted by the human.

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