All checks were successful
Build and deploy / Validate source (push) Successful in 7s
Build and deploy / Integration suite on a real stack (push) Successful in 1m25s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images and notify Portainer (push) Successful in 1m31s
local/ held six unrelated things under a name that stopped being true once it
became the production runtime: the service, the frontend, the tests, the ops
commands, the container definitions and the dependency lock, 65 files with
nothing to tell them apart.
app/ the service: api/ routers, core/ for identity, database, models,
prices and secret loading, and the worker, bootstrap and schema
tests/ the twelve suites, no longer inside the shipped package
ops/ backup, readiness, dependency audit, security summary
infra/ Dockerfiles, gateway templates, ClamAV and storage configuration,
the requirements and their hash lock
web/ the Site, Kanban and portal pages with their scripts
deploy/Dockerfile.api now copies app/ alone, so the tests stop shipping to
production; the local image still carries them, because the suites run inside
the stack's network.
Five kinds of reference had to follow, and each was found by something different
rather than by reading. Imports of the form "from . import db" survived a rewrite
that only matched "from .db import". Tests kept relative imports of modules that
had left the package. A mock.patch target names its module in a string, where no
import rewriting can see it. The browser test resolves a fixture by path. And the
release gate's markers pointed at local/runtime.py and local/worker.py, which is
the decay its new marker test exists to catch — it caught it.
Verified from docker compose down -v: the stack starts, all six integration
suites, both browser suites and the twenty-nine unit tests pass.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
28 lines
1.3 KiB
Python
28 lines
1.3 KiB
Python
"""Exact approved Site DTF price ladders; integer BRL cents at the boundary.
|
|
|
|
Quantity/grade must be supplied by an authenticated commercial reviewer.
|
|
This module does not inspect artwork or perform pre-flight.
|
|
"""
|
|
from decimal import Decimal, ROUND_CEILING
|
|
|
|
TIERS = {
|
|
'file': [(90,1490),(75,1620),(60,1750),(40,1870),(0,1990)],
|
|
'avulsa': [(90,2490),(75,2620),(60,2750),(40,2870),(0,2990)],
|
|
'uvfile': [(90,6990),(75,7390),(60,7790),(40,8190),(0,8590)],
|
|
'uv': [(90,8390),(75,8790),(60,9190),(40,9590),(0,9990)],
|
|
}
|
|
|
|
def price(mode: str, metres: str, grade: int) -> dict:
|
|
length = Decimal(str(metres))
|
|
if mode not in TIERS or not length.is_finite() or not 0 < length <= 12000:
|
|
raise ValueError('Invalid product or length')
|
|
if isinstance(grade, bool) or not isinstance(grade, int) or not 0 <= grade <= 100:
|
|
raise ValueError('Grade must be an integer between 0 and 100')
|
|
billed = max(Decimal('1'), (length * 10).to_integral_value(rounding=ROUND_CEILING) / 10)
|
|
unit = next(cents for minimum, cents in TIERS[mode] if grade >= minimum)
|
|
return {'mode': mode, 'metres': str(length), 'grade': grade,
|
|
'billed_metres': str(billed), 'unit_cents': unit,
|
|
'total_cents': int(billed * unit),
|
|
'discount_cents': int(billed * (TIERS[mode][-1][1] - unit))}
|
|
|