Skip to content

Latest commit

 

History

History
196 lines (150 loc) · 8.99 KB

DEVELOPMENT.md

File metadata and controls

196 lines (150 loc) · 8.99 KB

Development Workflow

For contributing (TDD, quality gates, commit style, how to add a route) see CONTRIBUTING.md. This document covers the internal development process: branching model, PR protocol, e2e gate, and release pipeline. For scenario-based GitHub PR triage, external fork handling, and SonarCloud decisions, see docs/GITHUB.md.


Branching model

feature/* ──┐
fix/*       ├──► develop ──► main
docs/*      ┘
chore/*
Branch Purpose Merges into
main Stable releases only. Tagged. Published to PyPI. —
develop Integration branch. E2e tests run here. main (via release PR)
feature/* New capabilities. develop
fix/* Bug fixes. develop
docs/* Documentation only. develop
chore/* Deps, CI, tooling, refactor. develop

Nothing merges directly to main. All work flows through develop first.


Branch naming

<type>/<short-kebab-description>
<type>/issue-<N>-<short-kebab-description>   # when tracking a GitHub issue

Examples:

feature/issue-16-integration-ergonomics
fix/issue-15-sapisidhash-uploadimage-401
docs/dev-workflow-and-branching-protocol
chore/bump-playwright-1-49

Types mirror Conventional Commits: feature, fix, docs, chore, refactor, test, ci.


PR protocol

Opening a PR

  1. Branch off develop (not main).
  2. Use Conventional Commits for all commit messages.
  3. Open the PR as a draft until all quality gates pass locally.
  4. Target develop as the base branch.
  5. PR title follows Conventional Commits: feat(api): ..., fix(cli): ..., docs: ....

Quality gates (all must pass before merge)

uv run python scripts/ci/check_repo_hygiene.py
uv run python scripts/ci/check_size.py
uv run python scripts/ci/check_doc_links.py
uv run python scripts/ci/check_website_docs_pii.py
uv run python scripts/ci/generate_website_docs.py --check
uv run python scripts/ci/check_council_memory.py
uv run python scripts/ci/generate_plugin_skills.py --check
uv run python scripts/ci/check_commit_trailers.py
uv run ruff check src tests
uv run ruff format --check src tests
uv run pyright src
uv run python -m pytest -q --cov=gflow_cli

CI runs the same twelve (the commit-trailer check on pull requests only; this list is kept identical to AGENTS.md's — /gflow:check runs it plus the CLI↔MCP mirror sweep). Do not bypass with --no-verify. Project pytest defaults exclude e2e and live; run those credit-spending tests only with an explicit marker expression and profile/env setup. Local agents running inside an MCP/context sandbox may need to split the marker-filtered pytest suite by path and omit coverage locally; CI remains the authoritative coverage gate.

A sixth gate runs after the scan: the SonarCloud quality gate (new-code coverage ≥ 80 %, rating A, duplication ≤ 3 %). It blocks merge via sonar.qualitygate.wait=true, so a failed gate turns the SonarCloud analysis check red rather than reporting silently on the dashboard. Browser-automation and live-auth transports are coverage-excluded (e2e-tested, not unit-tested). See docs/GITHUB.md § SonarCloud Quality Gate.

Mutation testing (mutmut)

Mutation testing is a measurement, not a merge gate. mutmut 3.8.1 does not run on Windows; run it in WSL on an ext4 clone (never on /mnt/c), with a .pth file that points site-packages at mutants/src in place of the editable install, and this configuration appended to the clone's pyproject.toml:

[tool.mutmut]
paths_to_mutate = ["src/gflow_cli/api/client.py"]
also_copy = ["src/gflow_cli", "tests", "samples", "skills", "docs", "website", "scripts"]
pytest_add_cli_args = ["--deselect", "tests/api/test_client_facade_contract.py::test_method_set_and_signatures_are_unchanged"]
pytest_add_cli_args_test_selection = ["tests/api"]

The deselected test pins method signatures, which mutmut's trampoline changes.

src/gflow_cli/api/client.py, browser lifecycle (#1249, #1265, #1266). The first run left 222 of 602 mutants alive, all in the lifecycle code (launch, cookies, close, __aenter__/__aexit__, health_check). The tests in tests/api/test_client_lifecycle.py kill the 22 that change behaviour and pin the diagnostic events operators read: the canary keeps the run's structlog lines in its JUnit (E2E_TESTING.md names client.context_cookie_state as the deciding line for an auth 401), and #222 triage reads client.persistent_context_launch. No code parses these events: incident bundles do not embed structlog output and gflow doctor does not read it. The pinned contract is the event name plus these fields:

Event Fields pinned
client.persistent_context_launch channel, chrome_strategy_requested, chrome_executable, user_data_dir, cookies_db_present, cookies_db_path, platform, launch_args, ignore_default_args, password_store_basic, proxy
client.context_cookie_state context_cookie_count, flow_session_cookie_present, flow_session_cookie_expired, google_sapisid_present
client.preread_flow_cookies / client.context_cookies_seeded preread_count, preread_session / seeded_count, seeded_session
client.har_capture_enabled, client.chrome_strategy_downgraded warning level, har_path, a hint that names cookies, a detail that names the remedy
*_failed / *_error cookie events error (the exception type name)
client.relaunch_skipped generation

The remaining survivors are recorded as equivalent and are not tested:

  • Case-only string mutants (upper or lower case of a hint, a detail or an error message): a test would only pin the wording.
  • Literal and argument mutants with no observable effect: the exc_info=True flag and event names of best-effort warning lines in teardown paths (transport_teardown_error, client.har_chmod_failed, client.relaunch_cleanup_error, incident.retention_error, health_check_failed), the explanatory text inside the remediation hints, and the run_teardown_step owner/step labels, which only name a step in a teardown warning. None of them changes control flow, a raised error's type or exit code, or a field listed above.

Merging feature PRs into develop

  • Squash merge preferred — keeps develop history linear.
  • The squash commit message becomes the canonical record; make it clean.
  • Delete the feature branch after merge.

E2e gate before merging develop → main

E2e tests require a live authenticated profile and are not run in CI (video tests spend real Veo credits; image tests cost nothing but draw on a daily image cap). Before opening a develop → main release PR:

export GFLOW_CLI_E2E_PROFILE=<your-profile-name>
uv run pytest -m e2e -v

All @pytest.mark.e2e scenarios must pass. See CONTRIBUTING § E2e tests for the full marker reference.


Version bump protocol

Version bumps belong in the develop → main release PR, not in feature PRs. The sequence:

  1. All feature PRs for a release batch are merged to develop.
  2. E2e gate passes on develop.
  3. Open a release PR: develop → main.
  4. In that PR, bump version in pyproject.toml and finalize CHANGELOG.md [Unreleased] → [vX.Y.Z].
  5. Use the /release skill to automate steps 4 + tagging.
  6. Merge the release PR to main — CI publishes to PyPI automatically.

Alpha releases use the form vX.Y.ZaN (e.g. v0.6.0a7). Ship alphas from develop → main to validate with real users before cutting a stable vX.Y.Z.


AI-assisted development (Claude Code)

This repo is actively developed with Claude Code (see CLAUDE.md). A few conventions that keep the workflow clean:

  • Claude branches are renamed to the appropriate feature/, fix/, docs/ prefix before the PR is opened. The claude/ prefix is internal scaffolding.
  • Claude never bumps the version or cuts a release without explicit instruction — use /release.
  • Claude opens PRs as drafts targeting develop. E2E evidence for any change touching a Flow surface is part of the PR, not something the maintainer supplies afterwards (CONTRIBUTING § Test categories); the maintainer reviews, runs e2e only where the author could not, and merges.
  • Commit messages never carry Co-Authored-By: Claude or any AI attribution — author credit is the human maintainer's only.

See also