Run artifact

workspace/targets/FxRates/blueprint/FEATURE-LatestRates.md

FEATURE: Latest Publication Rates

FieldValue
Version20261026 V1
DescriptionRetrieves rates from the latest stored publication.
Depends OnFEATURE-AppServer.md, DATABASE.md
ProvidesGET /rates/latest
Consumescreate_app(), rates repository operations

Purpose

Return all stored rates for the latest publication date, identifying the request as latest.

Trigger and workflow

A caller requests GET /rates/latest. Find the most recent publication date and retrieve its rates. Return 404 if no publication exists.

Database Interface

Programmatic Acceptance

=== AC latest-rates-response ===
Intent: The latest-rates route returns the stored rates for the latest publication.

Requires: python-package=fastapi; scope=test
Requires: python-package=httpx2; scope=test

from app_server.testing import web_client from persistence.testing import db_session

date = "2099-07-02" currency = "QAG" rate = "7.25"

with db_session() as db: db.rates.upsert(date=date, currency=currency, rate=rate)

response = web_client().get("/rates/latest") body = response.json() assert response.status_code == 200 assert body["date"] == date assert body["requested"] == "latest" assert body["base"] == "EUR" assert body["rates"][currency] == rate === END AC latest-rates-response ===

=== AC latest-rates-empty ===
Intent: The latest-rates route returns 404 when there is no publication.

Requires: python-package=fastapi; scope=test
Requires: python-package=httpx2; scope=test

from app_server.testing import web_client

assert web_client().get("/rates/latest").status_code == 404 === END AC latest-rates-empty ===

User Acceptance

Guardrails