Repository navigation
Scalability engine foundation: local-first core, JobRunner, FastAPI/SQLAlchemy discovery, scale CLI (Phases 0-2) - #69
Merged
Conversation
Adds the documentation set for the new scalability product line: CLAUDE.md (project rules), docs/PROGRESS.md and docs/ROADMAP.md (status and plan), and docs/architecture/* (overview, current state, decisions ADR-001..018, boundaries, public API, local store, discovery, detection rules, verification, MCP, test strategy, migration plan), plus the Apache-2.0 migration audit (license unchanged). The previous roadmap moves to docs/history/ and docs/architecture.md becomes docs/compatibility-pipeline.md (no content loss). .gitignore excludes the local /private/ directory so private-consumer material can never be committed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FmAjAsRVojgn2Ujwjtny4u
The OpenAI adapter treated an exhausted quota as a transient rate limit, so reviews retried instead of failing with an actionable error. It now reads the structured code (exc.code / exc.type / exc.body, also when the SDK error is still wrapped) with exact matching, keeping the message fallback. Anthropic and Gemini are unchanged. Seven regression tests through the real SDK error mapping; four fail on the previous adapter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FmAjAsRVojgn2Ujwjtny4u
… lazy worker imports (Phase 1.1) - patchfrog.config.core.CoreSettings: settings every process may read, none required. Settings (ServerSettings) subclasses it; the server environment contract (aliases, required fields, defaults, order) is unchanged and pinned by tests/unit/test_core_settings.py (ADR-011). - patchfrog/cli.py imports apps.worker lazily, so every --help path and the DB-free commands start with an empty environment (ADR-011); tests/unit/test_cli_local_startup.py checks this in fresh interpreters. - scripts/safe_pytest.py: a resource-guarded, batched local runner with per-node-id accounting for memory-constrained hosts (CI unchanged). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FmAjAsRVojgn2Ujwjtny4u
…ted re-export (Phase 1.3, M4) The DB-free local code graph moves from patchfrog/upstream/code_graph.py to patchfrog/codegraph/ (implementation byte-identical below the module docstring). patchfrog.upstream.code_graph re-exports the same objects as deprecated aliases, so every existing import keeps working; upstream's workspace and blast-radius modules import the new path. The historical dependency SCC is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FmAjAsRVojgn2Ujwjtny4u
…ery and `scale` CLI (Phases 1.2-2.5) Architecture boundaries (1.2/1.3): tests/architecture enforces R1 (core closure purity), R2/R3 (no dependency-cycle growth, shrink-only baseline) and R4 (adapter direction), plus the Public Engine API contract (PUBLIC_API.md <-> public_api.py, import-time side-effect probe; API 0.6.0). Local application layer (patchfrog.app, all stdlib, no services): - revision: RepositoryRevision, a content identity of the analysed working-tree snapshot; git used for listing only (no filters, hooks or fsmonitor), symlinks never followed; read_revision_file verifies bytes. - store: LocalRunStore, crash-safe content-addressed run artifacts (atomic publish, flock liveness, SIGKILL recovery, dedup, prune, verify). - jobs: in-process JobRunner (idempotency key over revision + config + engine/ruleset version, cooperative cancellation, budgets, typed failure classes, single execution of identical requests). - discovery: run_discovery, application discovery as a JobRunner job. Scalability engine (patchfrog.scalability.project, parse-only stdlib ast): - framework evidence from manifests/lockfiles (never invents a version); - FastAPI apps, routers, include_router prefix composition, aliases and imports, sync/async endpoints, Depends graphs; - SQLAlchemy/SQLModel bases, models, columns, relationships with lazy provenance, inheritance, engines, session factories, session providers and route -> session links; - explicit Unresolved/Limitation entries instead of guesses; bounded by DiscoveryLimits; ApplicationModel schema 2 with a generated JSON Schema (docs/schemas/) and a strict loader. CLI: `python -m patchfrog scale analyze|show|schema` (patchfrog/cli_scale.py, a thin adapter; patchfrog/__main__.py dispatches it without importing the full CLI). Also registered in `python -m patchfrog.cli`. Tests: unit, process and end-to-end CLI tests; two hand-written fixture corpora (FastAPI 14 cases, SQLAlchemy/SQLModel 13 cases) with precision/recall evaluators. pyproject.toml only excludes the new fixture tree from pytest collection, ruff and mypy, like the existing fixtures. No runtime dependency is added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FmAjAsRVojgn2Ujwjtny4u
kombu 5.7.0, released after the last green main CI, refuses redis-py < 6.1 when the Redis transport starts (VersionMismatch), while redis is capped below 6.0 here and by celery[redis] 5.4. pip installs the combination without complaint, so every test that starts a real verifier worker errored in CI (18 errors in test_fix_verification_corpus.py and test_production_execution_corpus.py). Reproduced locally with main's own code (9b9de85), so this is environmental dependency drift, not a change on this branch. Declares kombu>=5.3.4,<5.7 (5.6.x accepts redis 5.x; the floor matches celery's). It narrows resolution back to the previously working family and adds no dependency. Moving to redis-py 6 is a separate upgrade. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FmAjAsRVojgn2Ujwjtny4u
CI run 45092267919 (commit 3f00299, job `test`): ruff, mypy --strict, migrations, pytest with real Postgres 16 and Redis 7 (3,371 passed, 6 by-design skips, 0 failed, 0 errors; equal to the 3,377 collected locally), benchmark sanity, Docker builds and the Celery task check all succeeded. Records the S8 root cause and ADR-015 impact assessment, the commit scope and the hygiene checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FmAjAsRVojgn2Ujwjtny4u
…admap note - config/core.py: the import-boundary test lives in tests/architecture/ (rule R1, CORE_ROOTS), not tests/unit/. - history/roadmap-2026: state that the only edit is the renamed docs/architecture.md reference, instead of "kept unchanged". Documentation only; no behaviour change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kadireren7
marked this pull request as ready for review
November 23, 2026 10:21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds the foundation of the new scalability engine product line (Phases 0–2 in
docs/ROADMAP.md): a local-first core that needs no services, an in-process job runner, static FastAPI and SQLAlchemy/SQLModel application discovery, and a first user-facing CLI,python -m patchfrog scale. It contains no detection rules, scores or MCP tools yet; those come in Phase 3 and later.The existing review and compatibility lines are maintenance-only (ADR-001). Their only changes here are the S1 OpenAI quota fix, a lazy-import change in the CLI, and the code-graph move with a same-object re-export.
Commits
docs:architecture, roadmap and governance:CLAUDE.md,docs/PROGRESS.md,docs/ROADMAP.md,docs/architecture/*, ADR-001..018, and the Apache-2.0 audit (license unchanged).fix(openai):structuredinsufficient_quotaclassification (S1).feat(config):CoreSettings/ServerSettingssplit and lazyapps.workerimports, so every--helpand every DB-free command starts with an empty environment. Alsoscripts/safe_pytest.py.refactor(codegraph):neutralpatchfrog.codegraphwith deprecated same-object re-exports frompatchfrog.upstream.code_graph.feat(scalability):architecture boundary tests and the public API contract,patchfrog.app(revision, store, jobs, discovery),patchfrog.scalability.project(FastAPI + SQLAlchemy/SQLModel discovery, JSON Schema), thescaleCLI, corpora and tests.fix(deps):kombu>=5.3.4,<5.7(S8, see CI result).docs:the CI validation record.Architecture
patchfrog/cli_scale.py).patchfrog.appandpatchfrog.scalabilityimport only approved core modules and the stdlib. They import no persistence, server settings, Celery, Redis, GitHub, web framework or LLM SDK. Enforced bytests/architecture/.Local-first core
RepositoryRevision: a content identity of the analysed working tree (Git or a plain directory).LocalRunStore: content-addressed, crash-safe run artifacts. Liveness usesflock, runs survive a SIGKILL (recovered as interrupted), and prune and verify are available.JobRunner
job-reportartifact for every run, and single execution of identical requests across threads and processes.Discovery
include_routerprefix composition, aliases and imports (src/and monorepo layouts), sync/async endpoints, and the effectiveDependsgraph.lazyprovenance, inheritance, engines, session factories, session providers and route → session links. Only the scheme of a literal URL is kept, never the credentials.Unresolved/DbUnresolvedentries, never guessed.coverage.completeis honest.CLI
python -m patchfrog scale analyze [PATH],scale show RUN_IDandscale schemaprovide text,--detailsand--jsonoutput with documented exit codes (docs/scale-cli.md). The store defaults to user-level locations; it is never configured from a repository's.env.python -m patchfrogskips the eagerly importing full CLI: 0.15 s of startup instead of 3.5 s (measured).Public API and schema
ApplicationModel: schema 2. Version-1 artifacts still load. The JSON Schema is generated from the typed model (docs/schemas/application-model.v2.schema.json) and the loader is strict in the same way.RunNotFoundError,DiscoveryArtifactError.Compatibility
tests/unit/test_core_settings.py).patchfrog.upstream.code_graphnames remain as same-object aliases.pyproject.tomlonly excludes the new fixture tree from pytest collection, ruff and mypy./private/is git-ignored.Test evidence (local, before push)
ruff check .andmypy . --strictpass (874 files).test_ops_doctor.pytests, which fail only without a local Redis.CI result
Run 1 (
45090246711,eff9149): ruff, mypy and migrations passed. pytest failed: 3,353 passed, 6 skipped, 18 errors.verifier worker subprocess did not become ready in time.kombu5.7.0, released after the last greenmainCI, raisesVersionMismatchat worker start with redis-py < 6.1, while redis is capped<6.0here and bycelery[redis]5.4.main's own code (9b9de85), so it is not caused by this branch.kombu>=5.3.4,<5.7(S8). No assertion was changed.Run 2 (
45092267919,3f00299): success. Jobtest: install, ruff, static analyzers,mypy --strict, migrations and head check, pytest (3,371 passed, 6 skipped, 0 failed, 0 errors; Postgres 16 + Redis 7,PATCHFROG_REQUIRE_POSTGRES=1), benchmark sanity, Docker builds (api, worker) and the Celery task registration check (9 tasks).test_ops_doctor.pyand the verifier-worker corpora) ran and passed.Blockers B-2.4-REG and B-2.5-REG are closed by this run.
Remaining limitations
docs/architecture/DISCOVERY.md§4 and §9.3).patchfrogconsole script is ADR-018, still Proposed (recommended for Phase 6 packaging).scalehas the fast path.🤖 Generated with Claude Code
https://claude.ai/code/session_01FmAjAsRVojgn2Ujwjtny4u