Skip to content

Reviewer Phase 2: three-platform endpoint extraction#47

Merged
dadachi merged 1 commit intomainfrom
reviewer-phase2-three-platform-extract
May 2, 2026
Merged

Reviewer Phase 2: three-platform endpoint extraction#47
dadachi merged 1 commit intomainfrom
reviewer-phase2-three-platform-extract

Conversation

@dadachi
Copy link
Copy Markdown
Contributor

@dadachi dadachi commented May 2, 2026

Summary

Extends reviewer beyond Phase 1's Rails-only OpenAPI surface (#46) to extract API endpoints from all three platforms. Phase 3 will diff them; this PR proves rename left every platform's network layer parseable and produces the contract objects.

New module: src/agents/contract-extract.ts

Function What it parses
extractRailsContract(railsDir) docs/openapi.yaml via the new yaml dep. Returns {openapiVersion, title, endpoints[], schemaCount}.
extractAndroidEndpoints(androidDir) Walk app/src/main/kotlin/**/data/**/*Api.kt, regex @METHOD("path") Retrofit annotations.
extractIosEndpoints(iosDir) Walk *Request.swift files. Split on struct ... { boundaries; within each struct, pair var method: HTTPMethod { .METHOD } with var path: String { "..." }.

Endpoint = {method: "GET" \| "POST" \| "PUT" \| "PATCH" \| "DELETE", path: string}.

Reviewer surfaces counts in trace + diffs[]

rails:openapi=3.1.0
rails:title=VetClinicQueue API
rails:endpoints=42
rails:schemas=35
ios:endpoints=24
android:endpoints=23

(Real numbers from out/vet-clinic-queue/. Rails 42 = 23 paths × multiple verbs per path. Mobile clients implementing a subset is expected — Rails has admin endpoints + server-only namespaces.)

Pass/fail policy

Stays "PASS unless extraction fails" for now — count mismatches don't fail the run because iOS/Android legitimately implement a Rails subset. Phase 3 adds path-normalized drift detection with proper coupling to overallPass.

New runtime dep

yaml (^2.8.4) — standard, no transitive deps, MIT. First non-Anthropic-SDK runtime dep.

Test plan

  • npm run ci — 17/17 green.
  • Real-mode smoke against out/vet-clinic-queue/ — all three extractors land sensible numbers.
  • After merge: confirm a fresh npm run dev shows the same metadata in tmp/trace/reviewer.log.

Out of scope (Phase 3+)

  • Path normalization (strip {accountId} prefix, normalize {*} placeholders, handle Rails server base URL).
  • Three-way diff (rails-only / ios-only / android-only / method mismatch).
  • Wire reviewer FAIL into JudgeResult.overallPass.

🤖 Generated with Claude Code

Extends reviewer beyond Phase 1's Rails-only OpenAPI surface (#46)
to extract API endpoints from all three platforms. Phase 3 will
diff them; this PR proves rename left every platform's network
layer parseable and produces the contract objects.

New module: src/agents/contract-extract.ts

  extractRailsContract(railsDir)
    - Parse out/<slug>/rails/docs/openapi.yaml via the new `yaml` dep
    - Return {openapiVersion, title, endpoints, schemaCount}
    - Endpoint = {method: GET|POST|PUT|PATCH|DELETE, path: string}

  extractAndroidEndpoints(androidDir)
    - Walk app/src/main/kotlin/**/data/**/*Api.kt
    - Regex @method("path") Retrofit annotations
    - Return Endpoint[]

  extractIosEndpoints(iosDir)
    - Walk app's *Request.swift files (under Networking/, Login/, etc.)
    - Split each file on `struct ... {` boundaries
    - Within each struct, pair `var method: HTTPMethod { .METHOD }`
      with `var path: String { "..." }`
    - Return Endpoint[]

Reviewer surfaces counts in trace + diffs[]:

  rails:openapi=3.1.0
  rails:title=VetClinicQueue API
  rails:endpoints=42
  rails:schemas=35
  ios:endpoints=24
  android:endpoints=23

Pass/fail policy stays "PASS unless extraction fails" for now —
count mismatches don't fail the run because iOS/Android legitimately
implement a Rails subset (admin endpoints, server-only namespaces).
Phase 3 adds path-normalized drift detection with proper coupling
to overallPass.

Adds `yaml` (^2.8.4) as a runtime dep — first non-Anthropic-SDK
runtime dep in the agent. Standard, no transitive deps, MIT.

Tests: 17/17 npm run ci green.

Real-mode smoke against out/vet-clinic-queue/ confirmed all three
extractors land sensible numbers.

Out of scope (Phase 3+):
  - Path normalization (strip {accountId} prefix, normalize {*}
    placeholders, handle Rails server base url)
  - Three-way diff (rails-only / ios-only / android-only / mismatch)
  - Wire reviewer FAIL into JudgeResult.overallPass

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dadachi dadachi merged commit 2b3f8cb into main May 2, 2026
1 check passed
@dadachi dadachi deleted the reviewer-phase2-three-platform-extract branch May 2, 2026 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant