API Spec Verification Pass

Source: ~/ALAI/products/Plock/docs/demo-readiness/06-api-spec-verification-pass.md


PLOCK — API Spec Verification Pass

Date: 2026-03-14
Reviewer: John
Scope: Narrow manual verification of docs/API-SPEC.md against the real Ktor route surface under backend/src/main/kotlin/no/alai/plock/.


1. Verdict

Canonical verdict: FAIL as a canonical API source
Reference verdict: PASS WITH NOTES as API-intent/reference material

Why

docs/API-SPEC.md contains useful product intent, but it does not currently match the real backend route surface closely enough to be treated as canonical.

The biggest problems are:


2. Verification Sources

Primary sources used for this pass:


3. Real Route Surface Snapshot

Routing.kt mounts these main groups under /api/v1 (plus unauthenticated Fortnox OAuth + health/auth):

This is already enough to show that the live API surface is broader in some places and materially different in others than docs/API-SPEC.md suggests.


4. Sections That Are Roughly Aligned

These areas are directionally aligned, even when path or payload details differ:

4.1 Auth

docs/API-SPEC.md documents auth/login concepts, and real routes do include:

4.2 Warehouses / products / users / dashboard

These domains exist in the real backend and in the API spec at a high level.

4.3 Carrier + shipment integrations

The spec correctly signals that carrier and Fortnox integration domains exist, although the actual route design is different.

4.4 Real-time events

The spec includes SSE/event streaming, and the real backend does expose:


5. Major Drift / Mismatch Areas

5.1 Tenancy model drift

Spec problem: org-centric model
Repo reality: warehouse-centric model

Examples in docs/API-SPEC.md:

Repo reality:

Impact: High. This is not a cosmetic difference; it changes the domain model.


5.2 Auth flow drift

Spec says

Actual routes

Mismatch

Real auth routes do not currently expose documented refresh/logout endpoints, and register/login response shapes differ from the org-centric API spec.

Verdict: partial alignment only


5.3 Warehouses and locations path drift

Spec says

Actual routes

Mismatch

The real backend models zones and locations as first-class route groups, not nested warehouse bin endpoints as described in the spec.


5.4 Inventory route drift

Spec says

Actual routes

Mismatch

The real system exposes different operational endpoints and splits stock adjustment and audit trail differently. Inventory transaction history is represented more directly via /stock-movements, not the spec’s /inventory/transactions route.


5.5 Receiving / inbound drift

Spec says

Actual routes

Mismatch

The real backend has a receiving-order workflow, not the purchase-order route structure described in the spec.


5.6 Orders / outbound drift

Spec says

Actual routes

Mismatch

The domain overlaps, but path structure and supported actions differ materially.


5.7 Picking drift

Spec says

Actual routes

Mismatch

The live system is pick-wave/pick-item oriented, not route-assignment oriented in the way the spec describes.


5.8 Carrier / shipment drift

Spec says

Actual routes include

Mismatch

The spec compresses real shipping/carrier behavior into a simplified label-oriented interface that does not match the current route surface.


5.9 Dashboard / reports drift

Spec says

Actual routes

Mismatch

Only dashboard/stats is clearly aligned. The /reports/* route group is not present in the current Ktor app.


5.10 AI route drift

Spec says

Actual routes

Mismatch

This is major product-intent content, not current API reality.


5.11 Integrations drift

Spec says

Actual routes include

Mismatch

The real Fortnox integration surface is more concrete and warehouse-scoped than the generic integration control plane described in the spec.


5.12 Users / RBAC drift

Spec says

Actual routes include

Mismatch

RBAC is present, but it is organized differently and more explicitly in the real backend than in the spec.


6. Important Real Route Groups Missing from the Spec

These live route groups exist in the backend but are not represented well, or at all, in docs/API-SPEC.md:


7. Practical Conclusion

Use docs/API-SPEC.md only for:

Do not use it for:


Do not rewrite the full API spec yet.

Instead, use this sequence:

  1. keep the current warning on docs/API-SPEC.md
  2. use this verification note as the current interpretation layer
  3. later perform a targeted API-spec correction pass section-by-section, starting with:
    • tenancy/auth
    • inventory
    • receiving/orders/picking
    • carriers/integrations

9. Decision

docs/API-SPEC.md is now a verified non-canonical reference.

Until corrected, the canonical API truth for PLOCK remains:


Revision #4
Created 2026-03-14 12:03:45 UTC by John
Updated 2026-07-12 20:01:54 UTC by John