feat: service skeleton, Core wiring, and the /v1/day endpoint #133

Merged
manlycucumber merged 1 commit from feature/3-service-skeleton into develop 2026-07-03 05:31:16 +00:00
manlycucumber commented 2026-07-03 05:29:34 +00:00 (Migrated from github.com)

Brings the API online as a thin, cache-first HTTP layer over Core — the foundation of the R2 / 3mi.org release vehicle (Api v0.1). Delivers epic #3 (service skeleton & /v1 routing) and proves the whole path end-to-end against the vendored engine.

What's here

  • Core wiring (#6): introibo/core as a Composer VCS dependency, pinned by composer.lock. A single Engine\CoreGateway boundary calls Core; the API adds zero liturgical logic. Verified: ?calendar=sspx elevates St Pius X (Sep 3) from rank 3 → 1, and the calendar.particular block + overlaid corpusVersion travel through untouched.
  • HTTP layer: hand-rolled front controller → Router (404 vs 405) → Handler, with immutable Request/Response. No framework; runtime deps are Core + ext-json only.
  • Envelope + error shape (#5): the {data, meta} success envelope (data = Core's frozen #52 contract, verbatim; meta.dataVersion = service-wide stamp + echoed request) and one {error:{code,message,status}} shape with stable machine codes.
  • Request validation (#7): date (a real calendar date in 1583–2200, Core's golden-fixture range), system, calendar (universal or a particular-calendar slug), language — each checked against what Core actually supports.
  • Endpoints: GET /v1/day/{date} (?system / &calendar / &lang) and GET /v1/health.
  • Tooling + CI: PSR-12 (phpcs), PHPStan, PHPUnit; the check job now runs the full gate on PHP 8.2/8.3.
  • docs/design/api-architecture.md: the decision record — the public contract, the cache-first model, the additive REST-migration path (CDN-friendly now, resource-oriented layout added later with no client breakage), and the built-in-repo vs maintainer-infra boundary.

Verification

  • composer check green locally: phpcs 22/22, PHPStan [OK], PHPUnit 33 tests / 130 assertions.
  • Real HTTP smoke (php -S … public/index.php): /v1/health 200, /v1/day/2026-09-03?calendar=sspxpius-x rank 1, malformed date → 400, unknown route → 404.

Scope notes

The calendar endpoints proper (month/year/meta discovery) are epic #8 (next PR); static generation (#13), caching/ETags (#17), keys/quotas (#21), and admin/purge (#27) follow. Live MySQL + Cloudflare + DreamHost deploy are maintainer infrastructure steps, tracked for the R2 cutover.

Refs #3 #4 #5 #6 #7

Brings the API online as a thin, **cache-first HTTP layer over Core** — the foundation of the R2 / 3mi.org release vehicle (Api v0.1). Delivers epic #3 (service skeleton & `/v1` routing) and proves the whole path end-to-end against the vendored engine. ## What's here - **Core wiring (#6):** `introibo/core` as a Composer VCS dependency, pinned by `composer.lock`. A single `Engine\CoreGateway` boundary calls Core; the API adds **zero** liturgical logic. Verified: `?calendar=sspx` elevates St Pius X (Sep 3) from rank 3 → 1, and the `calendar.particular` block + overlaid `corpusVersion` travel through untouched. - **HTTP layer:** hand-rolled front controller → `Router` (404 vs 405) → `Handler`, with immutable `Request`/`Response`. No framework; runtime deps are Core + `ext-json` only. - **Envelope + error shape (#5):** the `{data, meta}` success envelope (data = Core's frozen #52 contract, verbatim; `meta.dataVersion` = service-wide stamp + echoed request) and one `{error:{code,message,status}}` shape with stable machine codes. - **Request validation (#7):** date (a real calendar date in **1583–2200**, Core's golden-fixture range), system, calendar (`universal` or a particular-calendar slug), language — each checked against what Core actually supports. - **Endpoints:** `GET /v1/day/{date}` (`?system` / `&calendar` / `&lang`) and `GET /v1/health`. - **Tooling + CI:** PSR-12 (phpcs), PHPStan, PHPUnit; the `check` job now runs the full gate on PHP 8.2/8.3. - **`docs/design/api-architecture.md`:** the decision record — the public contract, the cache-first model, the **additive REST-migration path** (CDN-friendly now, resource-oriented layout added later with no client breakage), and the built-in-repo vs maintainer-infra boundary. ## Verification - `composer check` green locally: phpcs 22/22, PHPStan `[OK]`, **PHPUnit 33 tests / 130 assertions**. - Real HTTP smoke (`php -S … public/index.php`): `/v1/health` 200, `/v1/day/2026-09-03?calendar=sspx` → `pius-x` rank 1, malformed date → 400, unknown route → 404. ## Scope notes The calendar endpoints proper (month/year/`meta` discovery) are epic #8 (next PR); static generation (#13), caching/ETags (#17), keys/quotas (#21), and admin/purge (#27) follow. Live MySQL + Cloudflare + DreamHost deploy are maintainer infrastructure steps, tracked for the R2 cutover. Refs #3 #4 #5 #6 #7
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Directorium/Api!133
No description provided.