Skip to content

Automation: Direction #117

@github-actions

Description

@github-actions

Last generated: 2026-02-12T07:05:08.781Z
Provider: openai
Model: gpt-5.2

Summary

Automate a repeatable “regen + verify” pipeline for generated CDP bindings, tighten CI around formatting/type-checking, and stop committing machine-local artifacts (.bish*, .sqlite, stray backups). This reduces drift between generator/ output and cdp/, prevents noisy diffs, and makes releases/PRs safer.

Direction (what and why)

  1. Make regeneration deterministic and enforced
    • This repo’s core value is generated protocol bindings (generator/generate.pycdp/). CI should be able to regenerate from a pinned input and confirm the working tree is clean. That prevents “forgot to run generator” and accidental manual edits.
  2. Standardize a single CI entrypoint
    • There are many ad-hoc scripts (quick_check.py, basic_check.sh, env_check.sh, minimal_test.py, etc.). Consolidate into a small set of make targets that CI runs. This reduces maintenance and ambiguity about “what is green”.
  3. Remove/ignore non-source artifacts
    • .bish-index, .bish.sqlite, and bfg-1.15.0.jar in-repo are high-risk for churn and supply-chain concerns, and they bloat the repo/CI. They should not be tracked unless there is a strong documented reason.

Plan (next 1–3 steps)

1) Add a generation verification workflow (CI)

Create: .github/workflows/ci.yml (or extend an existing “main” workflow if present) with jobs:

  • Setup Python (matrix e.g. 3.10–3.12, align with pyproject.toml)
  • poetry install (or pip install -e . if you prefer; repo already has poetry.lock)
  • Run:
    • make format-check (or equivalent)
    • make type-check
    • make test
    • make regen-check (new): run generator and assert no git diff

Concrete implementation:

  • Add to Makefile:
    • regen: runs python generator/generate.py (with any required args)
    • regen-check: runs regen then git diff --exit-code -- cdp (and any other generated outputs)
  • In workflow:
    • git config --global --add safe.directory "$GITHUB_WORKSPACE"
    • After make regen-check, also run git status --porcelain and fail if non-empty (optional but useful).

2) Add repo hygiene: ignore and remove local artifacts from version control

  • Update .gitignore to include (at minimum):
    • **/.bish-index
    • **/.bish.sqlite
    • *.sqlite
    • *.jar (or specifically bfg-1.15.0.jar if you must keep other jars)
    • editor backups like *~ (you currently have .github/copilot-instructions.md~)
  • Remove from git history going forward (in a normal PR; don’t rewrite history unless required):
    • Delete tracked files:
      • .bish-index, .bish.sqlite
      • .github/.bish-index, .github/.bish.sqlite
      • .github/workflows/.bish-index, .github/workflows/.bish.sqlite
      • cdp/.bish-index, cdp/.bish.sqlite
      • docs/.bish-index, docs/.bish.sqlite
      • examples/.bish-index, examples/.bish.sqlite
      • generator/.bish-index, generator/.bish.sqlite
      • test/.bish-index, test/.bish.sqlite
      • .github/copilot-instructions.md~
    • Decide on bfg-1.15.0.jar:
      • Prefer removing it and documenting how to obtain it in docs/ or SECURITY_SETUP.md (download link + checksum), or store it as a release asset if truly needed.

3) Consolidate checks into explicit Make targets used by CI

In Makefile, standardize:

  • lint: run ruff (add if not present)
  • format-check: ruff format --check . (or black --check .)
  • type-check: mypy using existing mypy.ini
  • test: pytest -q (if tests are pytest-based; otherwise wrap existing test_*.py scripts)
  • ci: depends on format-check type-check test regen-check

Then update workflows to call only make ci.

Risks/unknowns

  • Generator inputs/pinning: generator/generate.py may download protocol JSON or depend on a local copy. If it fetches “latest”, regen-check will be flaky. If so, pin the protocol revision:
    • Commit the protocol JSON snapshot under e.g. generator/protocol/<version>.json
    • Or add a lockfile/constant in generator/generate.py and cache the download by version.
  • Non-idempotent generation: If generation includes timestamps, random ordering, or environment-dependent formatting, regen-check will fail. Fix by:
    • Sorting keys/collections during emit
    • Removing timestamps from headers
    • Enforcing UTF-8 and newline normalization
  • Existing workflows noise: The repo has many synced “auto-*” workflows. Ensure the new CI workflow is not redundant/conflicting and is marked as required in branch protection (if used).

Suggested tests

  • Local:
    • make regen-check (should produce no diff)
    • make ci
  • CI validation (PR):
    • Confirm workflow runs on pull_request and push to master
    • Add a small “canary” edit: modify a generated file in cdp/ manually; ensure regen-check fails (proves it’s enforced)
  • Repo hygiene:
    • git ls-files | grep -E '\.bish-|\.sqlite|~$' should return nothing after cleanup

Checklist to verify progress:

  • .gitignore updated and tracked .bish*/backup files removed
  • make ci exists and is the only command CI calls
  • make regen-check fails when generated output is out of date
  • CI green on supported Python versions and stable across reruns

Metadata

Metadata

Assignees

No one assigned

    Labels

    automationAutomation-generated direction and planning

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions