feat: Números measures the site and the Prumo (0.12)

The browser records page load, upload speed and bytes, Prumo's check and
the loose-art montage; the quote keeps them and Números shows average and
p95 per period. Print generation and the payment-to-card time come from
the database. The upload bar already estimates its remaining time.
This commit is contained in:
Cauê Faleiros
2026-11-06 11:09:36 -03:00
parent 945c9e366a
commit 6351a094f4
11 changed files with 170 additions and 3 deletions

View File

@@ -240,6 +240,19 @@ class Item(StrictModel):
raise ValueError('Resolution warning must be acknowledged')
return self
class ClientTimings(StrictModel):
"""What the browser measured on the way to a quote (item 0.12).
They are only numbers for Números; a cart may send none of them, and the
server never uses them to price or accept an order.
"""
page_ms: int | None = Field(default=None, ge=0, le=600000)
upload_ms: int | None = Field(default=None, ge=0, le=3600000)
upload_bytes: int | None = Field(default=None, ge=0, le=10**12)
analysis_ms: int | None = Field(default=None, ge=0, le=3600000)
montage_ms: int | None = Field(default=None, ge=0, le=3600000)
class QuoteRequest(StrictModel):
request_key: UUID
customer: Customer
@@ -248,6 +261,8 @@ class QuoteRequest(StrictModel):
destination: Destination | None = None
# "Quero aprovar uma prova antes de imprimir": the order waits for the customer.
proof: bool = False
# What the browser measured while the customer built the cart (item 0.12).
timings: ClientTimings | None = None
@model_validator(mode='after')
def splits_complete(self):