feat(carwash): review outbox, booth side — plate-blurred vehicle crop + the operator's choice, queued for a trusted remote reviewer
The operator's category choice is a hypothesis, not truth (user, 2026-09-06): each wash order with a vehicle read queues a package for a trusted reviewer over the private overlay (Netbird); the verdict becomes the phase-B training label and the per-operator error rate. wiki/concepts/vision-review-outbox.md. - Boxes: the vision service returns the vehicle bbox; snapshot.ts stores the vehicle and plate boxes on the read as FRACTIONS of the analysed frame (the stored snapshot is a downscaled copy); vehicleForIdentity() returns them. - carwash_review_outbox (migration 0031) + review-outbox.ts: crop = detector box + 8 % margin, ≤ 640 px, plate blurred in place from the plate box; payload carries a pseudonymous booth id and a keyed operator hash — no site name, no plate, no OSD, no bystanders; multipart POST with a per-booth bearer; 2xx → sent (image dropped); 400/404/413/415/422 → abandoned; anything else → backoff 1 min·2^n capped 6 h; voided orders and items older than 14 days abandoned unsent. Nothing queued while unconfigured. - Enqueue is fire-and-forget off the intake path in createOrder; the loop runs every CARWASH_REVIEW_INTERVAL_SEC (60) and stops on close. - GET /api/carwash/review/status (site:read) + a "Remote review" line in Setup → Car wash. - Env CARWASH_REVIEW_URL / _TOKEN / _BOOTH_ID (all three or off) documented in .env.example and forwarded by compose. - Tests: review-outbox.test.ts (crop + blur on a synthetic frame, config/pseudonyms, queue/drain/backoff/abandon, through the app). Wiki: new concept page, index, venue-modules As built, log. The collector is not built. Claude-Session: https://claude.ai/code/session_01FWncR69HgGPuei1dLrW3cU
This commit is contained in:
@@ -140,6 +140,10 @@ export const en: Catalog = {
|
||||
visionSaw: "Camera saw",
|
||||
visionUnmapped: "not mapped to a category",
|
||||
visionClasses: "Camera classes",
|
||||
reviewTitle: "Remote review",
|
||||
reviewOff: "off — no collector configured for this booth",
|
||||
reviewCounts: "{{queued}} waiting · {{sent}} delivered · {{failed}} abandoned",
|
||||
reviewHint: "Each wash order sends the vehicle crop (plate blurred) and the chosen category to a trusted reviewer over the private network. One-way; nothing that names this site leaves.",
|
||||
visionClassesHint: "The camera's fixed vocabulary (set in code, not here). Tick the classes this category covers.",
|
||||
visionThreshold: "Camera confidence to flag a downgrade",
|
||||
visionThresholdHint: "When the camera is at least this sure and the operator picks a cheaper category than the one its class maps to, the order is flagged for review. It is never blocked.",
|
||||
|
||||
@@ -142,6 +142,10 @@ export const sq = {
|
||||
visionSaw: "Kamera pa",
|
||||
visionUnmapped: "pa kategori të lidhur",
|
||||
visionClasses: "Klasat e kamerës",
|
||||
reviewTitle: "Shqyrtim në distancë",
|
||||
reviewOff: "joaktiv — asnjë mbledhës i konfiguruar për këtë kabinë",
|
||||
reviewCounts: "{{queued}} në pritje · {{sent}} të dërguara · {{failed}} të braktisura",
|
||||
reviewHint: "Çdo porosi lavazhi dërgon prerjen e mjetit (targa e turbulluar) dhe kategorinë e zgjedhur te një shqyrtues i besuar përmes rrjetit privat. Njëkahësh; asgjë që emërton këtë vend nuk del.",
|
||||
visionClassesHint: "Fjalori i fiksuar i kamerës (vendoset në kod, jo këtu). Shëno klasat që mbulon kjo kategori.",
|
||||
visionThreshold: "Siguria e kamerës për të shënuar një ulje kategorie",
|
||||
visionThresholdHint: "Kur kamera është të paktën kaq e sigurt dhe operatori zgjedh një kategori më të lirë se ajo ku lidhet klasa, porosia shënohet për shqyrtim. Nuk bllokohet kurrë.",
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next";
|
||||
import { CARWASH_PAY_AT, CARWASH_PROGRAM_ID, CARWASH_VALIDATION_MODES, VEHICLE_CLASSES, type CarWashPayAt, type VehicleClass } from "@parking/shared";
|
||||
import { fetchValidationPrograms, type ValidationProgramView } from "../../api.js";
|
||||
import { StationForm, defaultProgram } from "../../ValidationSetup.js";
|
||||
import { fetchCarwashSettings, saveCarwashSettings, type CarwashSettingsView } from "./api.js";
|
||||
import { fetchCarwashReviewStatus, fetchCarwashSettings, saveCarwashSettings, type CarwashReviewStatus, type CarwashSettingsView } from "./api.js";
|
||||
|
||||
// Setup → Car wash: the master data (vehicle categories, services, the category ×
|
||||
// service price matrix) and the parking SPONSORSHIP a wash grants — the latter is a
|
||||
@@ -113,6 +113,7 @@ export function CarWashSetup({ canEdit }: { canEdit: boolean }) {
|
||||
const [threshold, setThreshold] = useState("80");
|
||||
const [msg, setMsg] = useState<string | null>(null);
|
||||
const [program, setProgram] = useState<ValidationProgramView | null>(null);
|
||||
const [review, setReview] = useState<CarwashReviewStatus | null>(null);
|
||||
|
||||
function load() {
|
||||
fetchCarwashSettings()
|
||||
@@ -127,6 +128,7 @@ export function CarWashSetup({ canEdit }: { canEdit: boolean }) {
|
||||
setThreshold(String(Math.round(s.visionThreshold * 100)));
|
||||
})
|
||||
.catch((e) => setMsg((e as Error).message));
|
||||
fetchCarwashReviewStatus().then(setReview).catch(() => {});
|
||||
fetchValidationPrograms()
|
||||
.then((r) => {
|
||||
const existing = r.programs.find((p) => p.id === CARWASH_PROGRAM_ID);
|
||||
@@ -265,6 +267,18 @@ export function CarWashSetup({ canEdit }: { canEdit: boolean }) {
|
||||
</div>
|
||||
<span className="hint">{t("wash.visionThresholdHint")}</span>
|
||||
</div>
|
||||
{review && (
|
||||
<div className="field">
|
||||
<span className="label">{t("wash.reviewTitle")}</span>
|
||||
<span className="text-[0.75rem] tabular-nums">
|
||||
{review.enabled
|
||||
? t("wash.reviewCounts", { queued: review.queued, sent: review.sent, failed: review.failed })
|
||||
: t("wash.reviewOff")}
|
||||
{review.enabled && review.lastError && <span className="ml-2 text-term-amber">{review.lastError}</span>}
|
||||
</span>
|
||||
<span className="hint">{t("wash.reviewHint")}</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{canEdit && (
|
||||
<div className="flex items-center gap-3">
|
||||
|
||||
@@ -31,6 +31,20 @@ export interface CarwashSettingsBody {
|
||||
visionThreshold?: number;
|
||||
}
|
||||
|
||||
/** The review outbox's health (Setup → Car wash). */
|
||||
export interface CarwashReviewStatus {
|
||||
enabled: boolean;
|
||||
boothId: string | null;
|
||||
queued: number;
|
||||
sent: number;
|
||||
failed: number;
|
||||
lastSentAt: string | null;
|
||||
lastError: string | null;
|
||||
}
|
||||
export function fetchCarwashReviewStatus(): Promise<CarwashReviewStatus> {
|
||||
return apiFetch("/api/carwash/review/status");
|
||||
}
|
||||
|
||||
export function fetchCarwashSettings(): Promise<CarwashSettingsView> {
|
||||
return apiFetch("/api/carwash/settings");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user