Skip to content

docs enterprise decisions

AlexandreZanata edited this page Nov 21, 2026 · 1 revision

Decisions, conflicts, assumptions and open questions

ADR-025 records the private Abastevo Empresas organization boundary.

1. Decisions

ID Decision Why Alternatives considered Accepted through
EDR-001 The organization is the isolation boundary and the owner of private Abastevo Empresas records. A CNPJ, an establishment and a unit are within it. One company may have several CNPJs and units; one CNPJ root may belong to unrelated franchises; access must follow an explicit relation, not a registry coincidence. Tenant = CNPJ root (breaks groups and farms run by natural persons); tenant = unit (no consolidated view). EMP-GOV-001, accepted in ADR-025
EDR-002 The customer entity is called organization; the fleet product Abastevo Empresas. No plan or tier of this suite is named ENTERPRISE. The word already names an account tier (ADR-023), a data offering (ESP) and a payment candidate, each explicitly without organization rights. Reuse ENTERPRISE and redefine it (would contradict three accepted texts and migration 000130). EMP-GOV-001
EDR-003 Extend the existing Go modular monolith and PostgreSQL/PostGIS. No new service, broker, cache or database for this suite. Matches ADR-005 and the measured-need rule; every requirement here fits the existing job queue, storage and API. Separate enterprise service (operational cost, second deployment, no measured need). EMP-GOV-001
EDR-004 The plan lives in docs/enterprise/ on a branch created from origin/dev, with its own identifier namespaces (00-conventions). The request suggested the folder; the wiki mirror picks up any docs/**/*.md; the primary checkout was 1 069 commits stale. Spread across docs/planning, docs/product, docs/backend as other fronts do (harder to keep one canonical source for a suite this size). EMP-GOV-012
EDR-005 Tenant isolation uses four layers: an organization scope required by every repository method; org_id with composite foreign keys; PostgreSQL row-level security as defence in depth; and a two-organization test harness on every surface. A missed filter must not leak data. Row-level security catches what a code review misses; the harness proves each surface. Scoped queries only (one mistake leaks); schema or database per organization (migrations and pool cost grow with customers). EMP-GOV-001, built in EMP-PLAT-001/002
EDR-006 Organization routes are path-scoped: /v1/orgs/{org_id}/…. The app authenticates with the existing account session plus device proof. The business web uses a separate cookie session (HttpOnly, __Host-, CSRF token, origin check). The path makes the organization explicit and loggable without body parsing; the app keeps its existing proof; cookies keep tokens out of page scripts. Organization in a header (invisible in logs and caches); body tokens in the browser (exposed to scripts). EMP-GOV-003, company panel accepted; EMP-PLAT-004/007 implement
EDR-007 Two ways to give an employee access. (a) Invitation: an existing Abastevo account accepts a single-use invitation. (b) Managed access: the organization issues a single-use activation code; the employee activates on a device, which enrols a device key and creates an account usable only in that organization. No password is ever known to a manager; recovery is a new activation code. Many field employees have no corporate e-mail; shared or known passwords cannot be audited; device keys already exist in the product. Manager sets a password (shared secret); login by registration number and company code (guessable). EMP-GOV-013
EDR-008 Fixed system roles and permission keys first; custom roles as bundles of the same keys later. A fixed matrix can be tested exhaustively while the product is piloted. Customer-defined permissions from day one (untestable surface). EMP-GOV-001
EDR-009 Organization operations reuse the existing protocol's identifiers, replay and acknowledgement rules, but each operation is its own transaction and field facts are kept for review instead of refused. One conflicting record must not block the rest of a day's field work; a fact recorded in the field has evidential value even when its authority is in doubt. Reuse the atomic personal batch as is (one conflict blocks all); last-write-wins (silent loss). EMP-GOV-001, 10-offline-sync
EDR-010 Adopt the existing exact-value conventions: centavos, milli-units, metres, seconds, milli-BRL unit price, half-up rounding at display, shared vectors. Personal and organization figures must agree; the conventions are implemented and tested in two languages. Decimal columns (two rounding behaviours in one product). EMP-PLAT-009
EDR-011 Consumption uses the existing full-to-full method. When its conditions are not met the result is INSUFFICIENT_DATA. Dividing distance by a partial fueling is wrong; the method and vectors already exist. Distance since last fueling over litres (misleading). modules/fuelings
EDR-012 One review lifecycle (BR-REV) and one approval engine serve trips, fuelings, expenses and work orders. Managers learn one flow; rules such as no self-approval are enforced once. A lifecycle per module (drift). modules/expenses-finance
EDR-013 One economic fact, one cost. A fueling creates exactly one expense. Payments, reimbursements, card statements and stock purchases settle or move money; they never create a second cost. Prevents the double counting the request names. Treat each payment as an expense (double counting). modules/expenses-finance
EDR-014 Private C1 receipts have separate receipt, human review and fiscal status. The document design describes additional processing stages. Real-receipt retention and original preservation require category-specific review. A single "validated" flag would claim more than was checked. One status field (false assurance). EMP-GOV-002, C1 synthetic path accepted
EDR-015 Location is recorded only inside a tracking session of an organization trip, started from the visible trip screen in a location foreground service with a persistent notification. ACCESS_BACKGROUND_LOCATION is not requested. Android treats a foreground service started from a visible activity as foreground location (developer.android.com, location permissions and foreground-service restrictions, read 2026-11-10); this avoids the background-location review and matches the existing guard. Background location (store review, weaker privacy position); always-on tracking (collects personal trips). EMP-GOV-005, EMP-GOV-006
EDR-016 In-app navigation for trips reuses the existing CoMaps-derived engine: route computation and voice guidance on the device, offline. The server stores the route plan and the distance the device computed. The engine, routing and guidance already exist (ADR-022); no per-request provider cost; works offline. Google Navigation SDK (paid per destination, cannot be combined with other maps, 30-day storage limits per its service terms read 2026-11-10); Mapbox Navigation (in-vehicle use needs a separate commercial licence per its terms). EMP-GOV-007
EDR-017 The panel shows maps with an open web map library and vector tiles hosted by the project, built from the same OpenStreetMap basis as the app's packages. Recommended: MapLibre GL JS with a single-file Brazil tile archive in the project's storage. This is a new dependency and needs the recorded review. The native engine does not run in a browser; the public OpenStreetMap tile service forbids heavy and commercial-critical use (operations.osmfoundation.org tile policy); self-hosting matches ADR-022's rule of no upstream CDN dependency. Google Maps JavaScript (terms forbid storing and mixing with other maps); no map in the panel (list only, kept as the fallback). EMP-GOV-007
EDR-018 Tracks are stored as one row per uploaded batch with arrays of fixes, plus one live-position row per trip in progress and one simplified geometry per finished trip. Far fewer rows and index entries than one row per fix; retention is a delete by trip; no new database. One row per fix (about five to seven times the storage with indexes); a time-series extension (new dependency, no measured need). modules/gps-navigation
EDR-019 The company panel is a static, framework-free TypeScript site served by Caddy at /empresas/ on the configured API origin. It has its own build and session. Any station portal needs separate approval. Same-origin company requests use the existing build and security patterns. Admin sessions remain isolated. A framework single-page app or a separate rendering path. EMP-GOV-003, company panel accepted
EDR-020 The back office extends the admin suite: staff roles station_reviewer and support_agent get their first enforced powers; review queues and support sessions are added; ops remains for repair. The session, CSRF, idempotency and audit machinery exists; the role catalog already names these roles. A separate internal tool (duplicate machinery). EMP-GOV-004
EDR-021 A station authority may be held by an organization. The claim keeps its frozen states and ceremony; the requesting member acts for the organization; station roles are role assignments scoped to that authority. Networks and teams need shared, revocable, auditable access that survives a person leaving. Keep per-account grants only (authority leaves with the person). EMP-GOV-015, EMP-CLAIM-001
EDR-022 A station-announced price is its own source with author, validity and conditions. It never feeds community consensus and never changes ranking by plan. Keeps sources distinct and payment neutral. Treat as a community observation with extra weight (purchased trust). EMP-CLAIM-001
EDR-023 An agreement shares only the fields of each contracted transaction between the two organizations. The request forbids general access to the fleet's data. Shared workspace (leaks routes and people). modules/station-commerce
EDR-024 Organization plans are separate from individual Premium. Entitlements are capabilities plus measurable limits, evaluated on the server as a new source beside Play, web and admin grants. Plans are sold on the web by contract or invoice; the Play build shows no price and no purchase link for them. Google Play's payments policy lists cloud and business software among services that must use Play billing when sold in the app, has no enterprise exemption, and allows consumption-only apps (support.google.com/googleplay/android-developer/answer/9858738, read 2026-11-10). Sell in the app (store fee and policy exposure); reuse account tiers (cannot express per-organization limits). EMP-GOV-009
EDR-025 Data products build on the enterprise export module and are sold only for sources with recorded redistribution rights. No private organization data enters any dataset. Source admission is already RIGHTS_PENDING for prices and registry; the ANP site states a no-derivatives licence for its content, and no dataset-specific licence was found (gov.br/anp open-data page, read 2026-11-10). Sell first and clarify later (legal exposure). EMP-GOV-016
EDR-026 The panel refreshes by polling: 15 seconds for the live map, 60 seconds for queues, on demand elsewhere. Server-sent events are considered only when measurements show polling is the bottleneck. Tracks arrive in batches every 30 to 60 seconds, so a faster channel would show nothing sooner; polling needs no connection state on one host. WebSocket (connection state, proxy configuration, no user-visible gain at this freshness). 09-architecture
EDR-027 Nine phases F0–F8 and one first operational cut C1 that pulls a minimal trip, fueling and receipt forward. A complete, reviewable flow early; later modules still specified. Module by module (no usable flow until late). EMP-GOV-012
EDR-028 The logbook is an operational record. It computes no working hours and produces no labour file. Lei 13.103/2015 names "diário de bordo" among journey-control instruments and Portaria MTP 671/2021 regulates electronic time registration (planalto.gov.br and gov.br/trabalho-e-emprego, read 2026-11-10). Offer journey control (needs its own legal validation and product). EMP-GOV-005
EDR-029 Internal fuel stock is valued at moving weighted average cost; cost is recognised when fuel is dispensed to an asset. Simple, deterministic, and avoids counting the purchase and the consumption. FIFO layers (more state for little gain at this scale). modules/fuel-stock
EDR-030 Findings state a difference and its evidence, never fraud. Every price comparison stores the reference and method version it used. The request's own example: a difference to review, not proven loss. Risk scores without evidence (not reviewable). modules/intelligence
EDR-031 A managed account has no personal mode content: no personal vehicles, Premium, or community posting. It can read public data. The organization provisioned it and can reset it; mixing personal data into it would give the employer a path to personal data. Full account (ownership confusion at offboarding). EMP-GOV-013
EDR-032 Notifications are in-app first (inbox plus local notifications at sync). E-mail and push are added only after a delivery decision. No e-mail or push provider is configured today. Build on a provider now (unapproved dependency). EMP-GOV-014

| EDR-033 | Managed-account origin is immutable account metadata set at insertion; existing accounts stay personal. Membership descriptors cannot convert that origin. | Creation and OWNER eligibility must use an authoritative fact rather than a caller-selected descriptor. | Infer origin from any membership (would convert legitimate personal accounts); writable origin flag (would let managed access shed its boundary). | EMP-ORG-003, recommended choice adopted under autonomous construction authorization; evidence | | EDR-034 | Synthetic organization creation and setup activation use PANEL's dedicated fresh cookie/CSRF plane and the source-pinned synthetic terms version/hash. All new IDs are server-selected and returned in a durable acknowledgement. | UC-ORG-01/02 are PANEL flows; no new login/provider or actual legal approval is available. | Account IDs/credentials in the business DTO; silently accept unreviewed real terms. | EMP-ORG-003, same authorization; real-data/legal gates retained | | EDR-035 | Serialize pending ownership on the account and reserve slots for every non-ended potentially effective OWNER period, including future/invited/suspended reservations. | Counting current authority alone would let scheduled grants bypass the three-pending cap. | Active-only count; unlocked per-request count (both race or postpone the bypass). | EMP-ORG-003, same authorization; concurrent PostGIS evidence | | EDR-036 | Synthetic org.setup admission explicitly inherits identity v1's 200/hour on each organization/account/web-or-device axis. Live use still requires measured source budgets and quota-cleanup activation. | Bounds the first synthetic configuration command using an existing versioned allowance without claiming production capacity. | Unbounded activation; invent a measured production default. | EMP-ORG-003, same authorization; source decision only | | EDR-037 | Adopt only the proposed OWNER/ADMIN org.legal_entity.manage row as explicit ORG-scoped coverage in org-permissions-v2. All other matrix cells, roles, scopes and restrictions retain their previous values. | The declaration task needs a real guarded entry; the v1 catalog deliberately denied this unassigned key. This is the module's recommended row, adopted under the unattended decision authorization. | Implicit OWNER inheritance; ship an unusable always-denied declaration route; grant verification or station powers. | EMP-ORG-004; B-BR-EMP-55..58; autonomous construction authorization | | EDR-038 | Permit lower-case snake_case segments in the bounded, source-registered audit/event vocabulary so specified names such as org.legal_entity.declared are representable. Keep exact source registration, immutable events and all scope/proof checks. Retained revoked declarations may coexist with a new explicit current declaration of the same identifier, as §6 requires. | The first legal producer exposed an existing grammar mismatch; historical references need stable identities while correction can create a new record. | Invent an action alias; silently weaken registration; forbid the specified correction flow. | EMP-ORG-004; B-BR-EMP-58; autonomous construction authorization | | EDR-039 | Unit metadata may be edited while archived to resolve restoration collisions; only active names/codes are unique. An omitted zone captures the current organization zone at the new revision. New establishment links require a current declared parent; retained historical links survive withdrawal. Archive uses a scoped source-owned SQL usage guard under the root lock; unknown referencing consumers fail closed until their owning migration installs actual counts/admission guards. | Supports the specified restoration and prospective reporting rules without inventing current operational records or silently assuming an unknown source is empty. Current consumers are immutable onboarding/command receipts, not active work. | Delete archived units; dynamically inherit zones; count all historical references as active; install a speculative usage ledger or ignore future consumers. | EMP-ORG-005; B-BR-EMP-59/60; autonomous construction authorization | | EDR-040 | A cost-centre code correction may select a new current code, while every old normalized code remains an immutable scoped reservation of the same centre. Historical lookup resolves the stable ID; names need not be unique. Current-usage/admission guards follow the root-locking structure contract and reject unknown consumers. | UC-ORG-03 permits code changes while BR-ORG-007 and historical exports require permanent code meaning, including archived records. This preserves both requirements instead of freezing corrections or reassigning old codes. | Make all codes immutable; release a previous/archived code; remap prior exports; infer empty usage for a new source. | EMP-ORG-006; B-BR-EMP-61/62; autonomous construction authorization | | EDR-041 | Keep employee descriptive profiles/revisions separate from identity lifecycle and access. Existing identities have an explicit pending profile until a manager supplies it. Compare trimmed case-insensitive registration across all states; warn only on normalized name plus a matching nonempty work contact and require explicit create-anyway acknowledgement. Use bounded unverified work contacts, never infer account ownership. Home-unit archival clears current nonactive links with causal immutable evidence. | IDN-002 precedes ORG-007 and must provide a real register without provisioning access or weakening last-owner/offboarding guards. The pending creator cannot be assigned an invented name. | Placeholder employee rows for teams; copy account aliases; automatic merge/account linking; conceal archived home links and silently restore them later. | EMP-IDN-002; B-BR-EMP-63/64; BUC-EMP-32; autonomous construction authorization | | EDR-042 | Model team membership as retained link periods with at most one current employee/team link, independent of account access. Consume employee inactivation/termination and membership suspension/end atomically, retaining causal source facts and never restoring links on reactivation. Count distinct active employees across home-unit and team-unit assignments. Retain an empty team's archived unit reference, but require an active unit for new links or restoration; archived metadata may be corrected. | BR-ORG-008/009/011/012 and the consumed IDN events require history, immediate reductions and no implicit grants. Empty structural labels are not active employees. Existing pending employee profiles are honest references, not fabricated names. | Delete links; dynamically hide links then resurrect them; infer team roles; count empty teams as employees; double count one employee across teams; attribute a synthetic manager audit to an unknown actor. | EMP-ORG-007; B-BR-EMP-65/66; BUC-EMP-33; autonomous construction authorization | | EDR-043 | Adopt the proposed org.settings.read row for OWNER, ADMIN, FLEET_MANAGER, SUPERVISOR, FINANCE, APPROVER and AUDITOR as explicit ORG coverage in org-permissions-v3. Preserve every other matrix cell, including the recorded legal-management amendment. | ORG-008 must provide the readable settings contract to the roles named by the module; the prior catalog deliberately denied unassigned keys. | Infer read inheritance from management; grant DRIVER/OPS access to the private settings document; leave the required read endpoint always denied. | EMP-ORG-008; B-BR-EMP-67/68; autonomous construction authorization | | EDR-044 | Capture immutable typed settings at serialized server intake under the root lock. Initialize older authentic roots lazily at the actual system bootstrap time, without an unscoped migration inventory. Keep initialization/cleanup sources honest, preserve unaffected substitute slots and store pending notification facts until NOTIF-001 consumes them. Settings owns the root default zone; captured unit zones stay explicit. Store only frozen source policy parameters, with real-retention admission left to its owner. | This implements prospective revisions, safe defaults and routing without inventing past authoring, a delivery provider or authority from designation. | Device-selected policy revision; mutate old settings/records; silently update every unit; fabricate a manager for cleanup or delivered notices; accept arbitrary policy JSON. | EMP-ORG-008; B-BR-EMP-67/68; BUC-EMP-34; autonomous construction authorization | | EDR-045 | Implement ORG-009 through the existing ADR-023 admin cookie/key plane with fresh transactional proof on new commands and replays, separate from company roles and public staff badges. Retain actual suspension periods and pending owner notices, including archived causes. Use seven-day inclusive server-received grace and an explicit owning-transaction assessment port; keep field facts under review after reactivation. | BR-ORG-029..032 and UC-ORG-08 require actual operator authority and historical intake without inventing subscription/device/notification providers. | Give OWNER/ADMIN self-suspension power; fabricate an account for an operator audit; trust device time or silently promote held work; activate billing or delivery without its owning workflow. | EMP-ORG-009; B-BR-EMP-69/70; BUC-EMP-35; resumed task authorization 2026-11-12 | | EDR-046 | Audited role management endpoints (assign, end, change, read, list) under /v1/orgs/{org_id}/roles with immediate effect and exact replay idempotency. Enforce BR-AUTH-003, BR-AUTH-006, BR-AUTH-007, BR-AUTH-010, BR-AUTH-014: root state checks (writes refused on SUSPENDED, reductions allowed, all refused on ARCHIVED), target member active/invited employee check, separation-of-duties (ADMIN cannot assign OWNER; self-assignment and self-modification forbidden; only OWNER can end self if another active owner exists), last-owner invariant (maps P7501 to ErrLastOrgOwner), fresh session proof, and atomic single audit entry per command (auth.assignment.created / auth.assignment.ended). | Enforces core role assignment lifecycle without privilege escalation, preserves last-owner invariant under concurrent contention, maintains exact idempotency replay, and ensures immediate authority revocation. | Let ADMIN grant OWNER; allow self-assignment/self-promotion; emit multiple audit events for atomic role change; bypass fresh auth check; ignore organization suspension/archival. | EMP-AUTH-005; BR-AUTH-003/006/007/010/014; UC-AUTH-01/02; resumed task authorization 2026-11-12 | | EDR-047 | Two-party organization ownership transfer protocol (propose, read, accept, cancel) under /v1/orgs/{org_id}/ownership-transfer with 7-day validity and last-owner protection. Propose is initiated by an existing OWNER (fresh session, org.ownership.transfer permission), targeting an ACTIVE member bound to a personal account (rejecting managed accounts per BR-ORG-026). At most one PENDING transfer exists per organization (enforced by DB partial unique index). Acceptance requires a fresh session from the target member (UC-ORG-09); atomically assigns OWNER to target, and if step_down_to_admin is requested, steps down initiator to ADMIN, never leaving the organization ownerless (BR-AUTH-006). Initiator can cancel; target can decline. Automatic cancellation triggers fire when target membership is SUSPENDED/ENDED or organization is ARCHIVED/CLOSED. | Guarantees non-repudiable two-party consent for legal control transfer, upholds the personal account invariant for top-level enterprise liability, and enforces the last-owner invariant at database and application levels without race conditions. | Single-party unilateral transfer; allowing enterprise-managed accounts to hold ownership; allowing multiple concurrent pending transfer proposals; dropping initiator owner role before target is granted owner; silently expiring transfers without audit. | EMP-ORG-010; BR-ORG-026/034/035; BR-AUTH-006; UC-ORG-09; resumed task authorization 2026-11-12 | | EDR-048 | Correct AUTH-005 and ORG-010 from source review: bind every read/command/retry to current company proof inside its transaction; use immutable command receipts; enforce literal permission union/coverage/restrictions without OWNER bypass; allow safe OWNER self-reductions and archived authorized reads/reductions. Add only org.ownership.respond in catalog v4 for all fixed roles, with server-bound SELF attempt facts and mandatory transaction participant checks. Use forward migrations186/187, account-before-root locks, actual account audit actors, 168-hour server validity, both-participant reduction projection, and pending notification facts. | The original commits845d1d94/ca9df3cd had exploitable replay/source-authority gaps, unguarded HTTP routes and contract/evidence drift. A nominated non-OWNER needs explicit consent permission, not OWNER privileges. Original evidence remains historical and is superseded by the tested review record. | Implicit permission inheritance; bypass current proof on retry; use membership IDs as audit actors; mutate published migrations; fabricate legacy receipts/notices; claim notification delivery or exceptional recovery. | User-directed Antigravity review2026-11-12; B-BR-EMP-71/72/73; BUC-EMP-36/37; review evidence. | | EDR-049 | Membership owns invitation reservations. Require current fresh company authority and literal ORG/SELF grant containment. Capture settings validity; use explicit CAS resend. Generate 256 random bits, store only a domain-separated keyed verifier, and deliver code/fragment-only link/QR payload once. Metadata-only receipts never reconstruct secrets; lost delivery requires resend. Consume actual source reductions, retain pending notices and materialize expiry on management access. | BR-IDN-008/010/013..015/018 require private manager-mediated delivery with one usable invitation and no implicit access. IDN-005 separately owns redemption, attempts and consent. Derive a distinct verifier key from the configured enterprise server secret; rotation requires reissue. | Recoverable secret or encrypted replay; secret in a URL query/event/log; accidental replacement without CAS; public redemption/email/device/account provisioning in IDN-004; implicit role grants. | EMP-IDN-004; B-BR-EMP-74/75; BUC-EMP-38; existing maintainer authorization to record recommended decisions; source parent 587fb6eb. | | EDR-050 | Existing personal accounts redeem through the current company-cookie bootstrap, with fresh current proof, an account-bound HMAC of the current preview and explicit consent. Keep the AIN1 256-bit invitation format of EDR-049. Resolve only an opaque locator to scope under forced RLS. Lock affected accounts in UUID order before capability/root; revalidate issuer/grants. Require confirmation for privileged grants or the optional prospective settings policy. Bind without roles while waiting; expire at seven days on access, never promise a scheduled worker. | BR-IDN-009/011/012/015..017/033 and UC-IDN-03/04 require single-use, private informed acceptance and current grant authority. Existing settings default false remains backward compatible. Browser-session identity is the available device axis; direct socket IP is keyed, never trusted from forwarded headers. Native enrolment and UI are owned separately. | Trusting a token as account proof; public organization discovery; recoverable secret/replay; roles while awaiting confirmation; trusting a forwarded/client-selected device/address; pretending native enrolment or notification transport exists. | EMP-IDN-005; B-BR-EMP-76/77; BUC-EMP-39; maintained autonomy authorization; source parent ed603f34. | | EDR-051 | Implement the next unblocked F1 backend task IDN-009; keep managed006..008 behind GOV-013. Current fresh idn.membership.manage is the literal OWNER/ADMIN matrix. Use sorted account/proof/capability/root locking, CAS, immutable original outcomes and actual audit/notice facts. Preserve role periods; reactivation requires a current original assignment and active employee/account. Existing source reductions stay consumed. | BR-IDN-026/030/036, BR-AUTH-014 and UC-IDN-08 require immediate scoped denial and historical cause preservation. Self-suspension is refused; last-owner/future coverage remains enforced by actual SQL policy. No-role reactivation fails closed instead of fabricating a grant. | Advancing managed credentials without review; revoking personal families; resetting assignment clocks; restoring teams/designations/tokens/proposals automatically; claiming native locking or external notice delivery. | EMP-IDN-009; B-BR-EMP-78/79; BUC-EMP-40; maintained autonomy authorization; source parent621b6767. | | EDR-052 | Implement IDN-010 for the actual existing-account organization runtime: reviewed settings/team flags, retain/terminate employee, manager offboarding and fresh account-bound self-leave including suspended/no-role members. Use a narrow self-entry descriptor, not a fabricated catalog permission. Current proof and original binding govern ended retries. | BR-IDN-025/027..031 and UC-IDN-09/10 protect personal authority and preserve work. Existing optional settings can stay flagged; a source digest prevents stale handover. Managed/device/delegation/operational producers are not installed and must integrate before activation; unsupported managed provenance fails closed. | Revoking personal families; requiring an organization role to leave; fabricating empty live device/trip inventories; silently accepting missing successor review; automatically closing work; claiming late intake/native delivery. | EMP-IDN-010; B-BR-EMP-80/81; BUC-EMP-41; maintainer recommended-decision authorization; source63b9365a. | | EDR-053 | IDN-011 reopens the same unmerged TERMINATED employee under fresh current idn.membership.manage and configuration-write gating. Require no live period, exact identity revision and immutable original actor/intent-bound audit acknowledgement. New access remains a separate invitation with a distinct membership ID. | BR-IDN-002/032/033 and UC-IDN-11 preserve identity/history without restoring authority. Existing guarded employee reads and invitation provisioning already supply the adjacent steps. | Reopening INACTIVE as rehire; reviving ended roles/memberships; rewriting historical account bindings; implicit invitation/account/device creation; managed provisioning without GOV-013. | EMP-IDN-011; B-BR-EMP-82; BUC-EMP-42; recommended-decision authorization; source b721691a. | | EDR-054 | IDN-012 uses explicit fresh organization-scoped employee management, a version/digest-bound review and immutable source-to-survivor pointers. Keep any live membership holder as survivor; refuse a live source instead of rewriting its binding or ending access. Transfer team periods through owning-module guards and one actual merge audit, deduplicating existing survivor links. Resolve chained history with bounded scope/cycle/depth checks. | BR-IDN-033..035 and UC-IDN-12/13 preserve historical identity, accounts and unrelated access. Current membership employee IDs are immutable; explicit survivor orientation reconciles the merge with that invariant. Existing duplicate matches remain warnings. | Automatic survivor/profile choice; changing membership or personal-account bindings; silently offboarding; destructive unmerge/path rewriting; dropping team periods; accepting stale review or partial failure. | EMP-IDN-012; B-BR-EMP-83/84; BUC-EMP-43; recommended-decision authorization; source054eacf0. | | EDR-055 | IDN-013 finishes the existing exact-revision full profile replacement and invitation/admission contact-source projection. Reuse the guarded employee change route, canonical contact comparison, immutable receipts and existing migrations; revalidate fresh source authority after projection and before acknowledgement. | BR-IDN-013/018/025 and UC-IDN-14 require atomic invalidation without touching active or personal access. Current source SQL already consumes PENDING/WAITING admissions. Canonical-equivalent contact or unrelated metadata is not a contact change. Managed code producers remain gated and must integrate this source before activation. | A parallel contact route/store; resetting credentials or active memberships; replaying revocations onto a newer invitation; fabricating an installed activation-code inventory; claiming provider delivery or managed activation. | EMP-IDN-013; B-BR-EMP-85/86; BUC-EMP-44; recommended-decision authorization; source cce39312. | | EDR-056 | IDN-015 installs an existing-account signed enrollment/check plane separately from unchanged company-only routes, plus fresh account-bound self and manager list/revoke. Default3 and server-owned deployment configuration1..5 supply the current limit; no unowned settings key is introduced. Use scoped immutable periods, original receipts and source-ending revocation. Lost/compromised keys remain barred throughout the organization; ACCESS_ENDED is terminal for the old membership but permits a new enrolment after a distinct explicit invitation/ACTIVE membership. | BR-IDN-025/037..039, UC-IDN-16, the terminal-device transition table and BR-PRIV-018 require actual key possession, current membership, slot serialization, new periods and personal independence. Managed producers remain behind GOV-013. Last-sync has no installed producer and stays null; offline erasure/intake retain their owning gates. | Reusing personal cloud device/session tables as corporate inventory; manager access to personal families; client-chosen proof/count/limit; metadata-only revocation; silently granting intake or promising remote wipe; re-enrolling a lost key with a surviving personal session; permanently banning a valid personal key merely because an earlier membership ended. | EMP-IDN-015; B-BR-EMP-87..89; BUC-EMP-45; recommended-decision authorization; source f1ad43ac. |

| EDR-057 | Supply the C1 panel with narrowly account-bound context discovery under ordinary forced RLS, per-organization current source revalidation and literal grantable options. Use existing guarded employee/invitation commands, ephemeral code/link delivery and scope-fenced UI state. | PLAT-008 deliberately has no production membership provider. Current account/organization authority and BR-IDN-003/008/013/016/039 require a real source before business UI. An additive source policy replaces the original no-migration estimate. | Global organization enumeration; cached UI authority; guessed endpoints; secret persistence/history; managed activation; a new QR dependency. | EMP-IDN-016; B-BR-EMP-90/91; BUC-EMP-46; standing recommended-decision authorization; source6b0921ce. |

| EDR-058 | IDN-017 reuses the current personal account proof and dedicated memory-only company cookie transport. Fence preview/decisions by account, origin, family and epoch; accept only supported notice/version semantics and explicit online consent, retaining immutable uncertain-decision retries. Add an explicit fresh key-entry route. | BR-IDN-005/012/017/033 and BR-PRIV-015 require informed, current, server-confirmed existing-account acceptance. Physical ADB validation is explicitly requested; preserve existing device applications through an isolated package and conventional test-only Hilt bindings. | Persisted invitation/consent secrets; optimistic ACTIVE; treating WAITING as access; managed activation; personal family revocation; device/offline authority from acceptance; emulator use or clearing existing phone data. | EMP-IDN-017; B-BR-EMP-92/93; BUC-EMP-47; source ae5defcd; standing recommended-decision authorization. |

| EDR-059 | IDN-018 uses the installed current-account contexts/list and exact contexts/read source, bounded current-page metadata and a memory-only selector/home. A source read precedes local selection; background/network loss withdraws confirmation, identity changes and definitive denial clear it, and a fresh process starts personal. A local atomic generation synchronously invalidates old handles before network/I/O waits. | BR-AUTH-012/014, BR-IDN-033, BR-TEN-004 and BR-PRIV-016 require explicit separation without moving held work or inventing authority. The existing protected-store/contact composition remains closed. A bottom-sheet selector preserves selected context on system back and exposes no future business actions/counts. | Cached authority; persistent organization catalog/selection; global fence recursion; retagged or erased queues; pretending an in-flight committed write rolled back; opening the unavailable vault; inferred revocation reasons or operational modules. | EMP-IDN-018; B-BR-EMP-94/95; BUC-EMP-48; source8728dff6; standing recommended-decision authorization; physical ADB phone only. |

| EDR-060 | Execute the requested entire F2/C1 construction from tested dev fac002e7 in the owned worktree, with one bounded task at a time and atomic local checkpoints. Include actual unfinished dependency closure; keep formal M1/M2, C1 source acceptance and external activation evidence distinct. Reuse the cumulative dev → main delivery at final batch publication. | The phase has34 F2 tasks plus25 unfinished transitive prerequisites; formal M1 adds GOV-013/IDN-006..008/REL-003. Pure domains may start under roadmap §5 while those gates remain open. The maintainer requests the whole phase and already authorizes recommended recorded decisions. | Declaring F1/M1 complete from context UI tests; implementing only fleet CRUD and calling it full F2; per-task PR fragmentation; enabling real-data pilot or fabricating legal/provider/manual acceptance. | F2 execution; source fac002e7; standing publication/decision authorization; physical ADB only. | | EDR-061 | FLEET-001 uses explicit category/product catalogs and typed organization asset references. Freeze ASCII plate/fleet-number comparison for cross-language parity; retain Unicode for bounded descriptive text. Unknown categories/products refuse. Use synthetic catalog descriptors until the initial runtime catalog is recorded with persistence. | BR-FLEET-001..007 require separate assets, exact units and activation facts but define no category vocabulary. JVM full uppercase and Go simple uppercase differ; a literal identifier profile avoids silent divergence without constraining display names. A UUID alone cannot identify its origin table. | Copying personal vehicle/product enums or the three-vehicle ceiling; arbitrary categories; locale-dependent Unicode folding; claiming a raw UUID reveals provenance; faking meter presence to activate a vehicle before METER-002. | EMP-FLEET-001; B-BR-EMP-96/97; BUC-EMP-49; source fac002e7; recommended decision for later review. |

| EDR-062 | Freeze OFFL-001 as typed v1 orgsync operation/result models, an exact canonical JSON/hash profile, shared Go/Kotlin bytes/digest vectors and OpenAPI components only. Bind owner/origin/org/member/enrollment, resolving enrollment to actual signed proof later; keep replaceable family/token/signature/receipt outside immutable intent. Derive finality, preserve independent operation semantics and reserve future policy codes without activating them. | The example in offline §10.1 is provisional. Generic orgapi Command requires one outer operation_id and SignedDeviceRule is confined to enroll/check; neither describes a batch. Standard JSON decoders alone can lose integer/duplicate/Unicode identity. Reject ambiguous numeric-only DNS hosts unless valid IPv4, keeping Go/Kotlin origin identity equal without DNS lookup. Explicit small-profile encoding avoids a new dependency and false RFC8785 claims. | An active stub endpoint; personal-cloudsync reuse; payload-only digests; caller-selected final/authority; floats; ambiguous device_id; overwriting final ACKs after review; invented F4 grace or feature handlers. | EMP-OFFL-001; B-BR-EMP-98/99; BUC-EMP-50; tested FLEET-001 source2daea515; recommended engineering decision. | | EDR-063 | Complete AUTH-009 against the existing v4 independent matrix, actual guarded route inventory and ordinary real-PostGIS request authority; preserve explicit not-yet-routed obligations. Reuse the full-router contract and AuthorityCompletion gate. | The validation plan still describes the proposed v1 fixture and old counts although source has85 keys/13 roles; static descriptors alone do not prove current-source authorization. | Generating expected decisions from the tested catalog; replacing real source with overprivileged mocks; new registry/feature stubs; claiming absent feature/scopes are accepted; changing policy to fit tests. | EMP-AUTH-009; B-BR-EMP-100; BUC-EMP-51; source1cc9a7b3; recommended engineering decision. | | EDR-064 | ORG-014 extends the existing settings read model with persisted profile/state/checklist, current account/org/member binding, source-derived settings hints and distinct settings/root revisions. Edit name/kinds only in the creation draft; persisted name/kinds remain read-only and timezone uses existing versioned settings. Use an isolated setup route that rechecks current server session and scoped settings reads; a URL or creation ACK is only a selector. Keep native context metadata and operational CanSelect unchanged. | Current context metadata has no state/checklist and only identity hints. Settings reads already preserve authorized visibility with capability off, while discovery/operational selection deliberately require the capability. The panel must show saved pending setup without inventing activation or authority. | Inferring setup from a draft or historical ACK; copying employee/invitation hints into settings authority; weakening context admission; auto-enabling the operator capability; browser-side checklist or policy decisions; adding a pending/active name or kind mutation endpoint in this web task. | EMP-ORG-014; B-BR-EMP-101/102; BUC-EMP-52; tested source 4743e0b9; standing recommended-decision authorization. | | EDR-065 | Keep immutable within-view creation retries and add bounded own-account created-setup/receipt discovery in the existing onboarding module for reload/lost-ACK recovery, with current scoped settings-read checks per item. Supply named eligible membership choices for all responsibility references; expose current settings/history and explicit conflict/incomplete/read-only states. | Browser private storage stays unused, capability-off creations are absent from operational discovery, and employee DTOs do not identify memberships. Existing commands already own idempotency, audit, freshness, synthetic terms and revisions; reuse those boundaries with ordinary PostGIS and real HTTPS acceptance. | LocalStorage recovery; silent fresh operation IDs after an uncertain submit; generic unscoped account/organization lookup; editable UUID pickers or employee/member ID conversion; changing terms/capabilities or inventing a parallel runtime service; fake browser/SQL acceptance. | EMP-ORG-014; B-BR-EMP-101/102; BUC-EMP-52; source 4743e0b9; phase tracker 215 and cumulative PR203. | | EDR-066 | Correct the pre-existing settings command digest omission of RequireInvitationConfirmation using a versioned complete intent. Legacy receipt compatibility requires the original immutable settings revision to prove complete values/reason/operation/expected revision, not the legacy hash alone. Keep receipts and original ACKs unchanged. | ORG-014 exposes the existing confirmation setting; review found its codec/persistence included the flag but SettingsWrite.Digest did not, allowing changed intent to collide. | Breaking all historical retries; accepting matching old hashes without complete recorded evidence; mutating applied receipts or weakening current proof/CAS; omitting a current settings field. | EMP-ORG-014; B-BR-EMP-103; BUC-EMP-53; independently found source defect; recommended compatibility decision before correction. | | EDR-067 | Keep a fresh resolved OpenAPI document per test caller while caching canonical self-validation by exact source bytes for the process. Preserve default timeouts, every negative assertion and changed-input invalidation. | The ORG-014 affected race package exhausted600 seconds in repeated meta-validation of unchanged canonical input, not a deadlock; cmd/api separately needs normal loopback execution permission. | Increasing deadlines, removing validation/counterexamples, sharing mutated documents or marking a timed-out run passed. | EMP-ORG-014 final harness recovery; no product policy change; preserve proof strength. | | EDR-068 | Complete PRIV-003 with a separate exact signed device contact action, DB-time30-day existing-account lease and source-verified ERASE versus LOCK verdicts. Keep check/native cookie metadata and managed/suspended/archived/F4 gates unchanged. | Current check cannot issue a lease or inspect an owned ended enrollment; current native lease omits membership/enrollment and may otherwise renew old content under rehire. | Cookie/device selectors as authority; destructive generic errors; relabeling another tombstone; shortening lease to access-token TTL; invented managed timeout or F4 intake. | EMP-PRIV-003; B-BR-EMP-104; BUC-EMP-54; source efd7e886. | | EDR-069 | Use versioned encrypted generations with an opaque Keystore committed head, ordered durable data/maintenance writes before marker and local acknowledgement, and no fallback/reuse of stale or prepared generations. | V1 same-key ciphertext rollback is unprotected; delete-before-write loses committed work and post-rename old-key deletion alone has a crash window. | Plaintext journals/IDs, file-only monotonic authority, silent rebind/rekey/migration, early local success, eviction or a new unreviewed dependency. | EMP-PRIV-003; B-BR-EMP-105; BUC-EMP-55; record ordering before behavior. | | EDR-070 | Add encrypted head-bound maintenance discovery, durable denial/cleanup intent, scoped startup/periodic retry and expiry; preserve existing explicit security erasure versus ordinary retention rules. Use exact one-use E→E+1 local-owner handoff before opening the new source metadata channel. | Current cleanup is memory-only/lazy and confirm advances a fence that otherwise makes context selection stale; opaque filenames cannot recover scope alone. | Worker plaintext identifiers/credentials; generic denial wipe; old flow adopting current epoch; disabling background fences; false cleanup/remote-wipe/native-policy acceptance. | EMP-PRIV-003; B-BR-EMP-106/107; BUC-EMP-54/55; emulator now authorized. | | EDR-071 | Add a dedicated signed sync intake boundary with complete frozen-codec whole-body preflight and independently resolved current tuple, followed by per-operation source admission/transactions and current protected replay. Keep current proof denials outside final ACKs and F4 inactive. | Prefix effects cannot precede a malformed trailing item; custody/check metadata is not business authority and current-only sources cannot manufacture historical/grace decisions. | Correlation-only digest trust, mutable caller scope, generic current-role denial as permanent business refusal, stale replay disclosure or synthetic runtime handlers. | EMP-OFFL-002; B-BR-EMP-108/111/112; BUC-EMP-56/57; source 51c25146. | | EDR-072 | Append minimal scoped immutable claim, final-ACK and effect-readiness storage. Dependency retry can keep an authorized claim; review alone is not effect readiness. Preserve company provenance through personal unlink without raw payload/credential storage or new TTL/cascades. | Final receipts, dependency reservations and real applied effects are different facts; existing audit/job consumer receipts cannot substitute for operation effects. | Marking review accepted as applied, overwriting an ACK after resolution, cross-scope receipt/dependency reads, retry as final, personal-export expansion or destructive rollback. | EMP-OFFL-002; B-BR-EMP-109/110/111; migration196 and actual populated/erasure rehearsal required. | | EDR-073 | Reuse existing audit/catalog/outbox and DB limiter with explicit source-owned intake admission units. Require real registered owning policy/effect/review/follow-up producers; unconfigured runtime remains unavailable. | Audit allows one event per operation; event binding changes the audit hash; per-request metering alone permits50-fold batch expansion. No measured production intake budget or business producer is installed yet. | New permission/queue service, borrowed credential budget, fabricated no-op production consumer, early ACK, invented entity revision or treating fixture acceptance as runtime readiness. | EMP-OFFL-002; B-BR-EMP-113/114; recommended fail-closed construction decision under standing authority. | | EDR-074 | Persist the logical needs-review follow-up as offl.operation.review, alongside offl.operation.accepted/refused, under the existing audit/event identifier vocabulary. | Applied migrations165/168 reject underscores in action/event names; no needs_review producer or consumer exists yet. Preserve those historical constraints and explicitly map the planned logical event. | Editing applied migrations, widening unrelated constraints, changing frozen wire results/codes or silently omitting the required review follow-up. | EMP-OFFL-002; B-BR-EMP-114; recorded before catalog/SQL behavior under standing recommended-decision authority. | | EDR-075 | Require actual owning parent-record read coverage before treating a same-organization dependency effect as ready. After base command/target admission, an owning dependency-coverage refusal rolls back the operation and returns the same nonfinal DEPENDENCY_PENDING as a missing dependency, without a new claim or private parent data. | Organization equality and receipt existence do not prove current record visibility; valid cross-device dependencies must remain possible when the owning source covers their real records. | A dependency-existence oracle, locking foreign pending claims, a blanket device/author restriction, committing partial failed admission, or treating missing historical/feature producers as authority. | EMP-OFFL-002; clarifies B-BR-EMP-110; recommended source-bound dependency decision recorded before behavior. | | EDR-076 | Extend the accepted protected generation store with a versioned typed queue kind, preserving old ordinals/V1/V2 reads and retaining opaque legacy operations unsent. Commit operation/local projection and per-operation ACK/projection atomically through a borrowed local unit-of-work. | Existing opaque enqueue is durable storage but cannot safely identify full operations or consume ACKs; a second Room outbox would escape the accepted private generation boundary. | Plaintext journals, reinterpreting legacy bytes, early local success, duplicate projection, silent format downgrade/owner rebind or APK downgrade claims. | EMP-OFFL-003; B-BR-EMP-115/116; source d24b0d4f; record before code. | | EDR-077 | Capture new exact per-attempt source leases for local/sign/network/ACK work; never adopt replacement epochs/families or take over the UI's selection owner. Keep SENT transient and preflight the entire strict response before local receipt writes. | The existing UI selection lease cannot authorize another worker/partition, and durable SENDING creates crash-stuck work. Earlier scope commits must remain honest while stale private results are withheld. | Selected-context dispatch, network under storage locks, late ACK projection into a new flow, generic-denial wipe or treating transport success as acceptance. | EMP-OFFL-003; B-BR-EMP-117/118; recommended use of current identity-v1 and fences. | | EDR-078 | Use trusted30-second base/6-hour capped exponential equal-jitter retry, saturating counters/no attempt cap, valid Retry-After, and80% pressure warnings against existing32MiB/10000-entry safety bounds. Retain final receipts pending an explicit future dismissal policy. | Queue retry/pressure need concrete operational defaults without inventing business quotas, silently deleting work or weakening custody clock/unlock policy. | Request-selected policies, guessed deadlines, attempt exhaustion, eviction/TTL, replacing newer-flow retry state or unmeasured commercial/production limits. | EMP-OFFL-003; B-BR-EMP-120; recommended reversible configuration recorded for later review. | | EDR-079 | Topologically order local pending parents, retain/report cycles and allow unrelated work. Keep children retryable after missing/external/review parents because actual server readiness can change without rewriting the original ACK. | A final ACCEPTED_FOR_REVIEW receipt never turns into ACCEPTED; waiting forever for its local ACK to change would strand legitimate later server effects. | Local receipt labels as effect proof, cycle deletion/intent rewrite, unbounded batches or one blocked record holding unrelated work. | EMP-OFFL-003; B-BR-EMP-119; source server effect ledger accepted in OFFL-002. | | EDR-080 | Require explicit real owning offline eligibility/save/ACK projectors; leave production registry empty until actual business integration. Reuse WorkManager with opaque input and current-account protected discovery plus independent scoped attempt ownership. | Custody is not business authority and current context is not a background dispatcher. Typed queue acceptance may use named synthetic real-effect fixtures without shipping them. | No-op/probe runtime producer, fictitious cached permission, readable worker identifiers/cursors, personal/other-partition I/O or a new scheduling service. | EMP-OFFL-003; B-BR-EMP-121/122; existing-account synthetic construction only; emulator authorized. | | EDR-081 | Keep delta-seconds Retry-After as the actual API's primary form. Accept optional HTTP-date only with a unique valid Date from that same authenticated HTTPS response, waiting full target-minus-Date without subtracting transit. An unusable Date hint falls back to ordinary retained retry. | A device wall clock already20s fast at valid custody contact can shorten a120s HTTP-date delay to100s; custody validity does not make that wall clock server authority. | Shortening server floors, local wall time as trusted timing, overflow, generic-denial erasure or changing the existing server delta-seconds profile. | EMP-OFFL-003; B-BR-EMP-120; recorded before the skewed-Date RED/fix under unattended recommended-decision authority. | | EDR-082 | Present only durable original intent, immutable receipt and actual memory-only attempt evidence. Keep declared time, unknown local save time, latest retained retry and confirmed server receipt distinct; no business approval or invented history. | V1 does not store complete attempt history; transport success and connectivity cannot prove acceptance. | Fabricated SENT/save timestamps, inferred approval, review ACK mutation, false successful emptiness or attachment acceptance. | EMP-OFFL-004; B-BR-EMP-123/125/126; recommended evidence-based presentation before code. | | EDR-083 | Add sanitized protected pages of at most50 items plus full-snapshot totals, digest-bound detail and generation-bound memory cursors. Keep pending and retained history distinct, with accepted-but-unconfirmed attachments still visible. | Delivery pending excludes review/refused/final receipts, and raw entries expose private business payload. | Mixed-generation pages, payload/proof in UI, cross-source cursors, double counting or claiming global delivery from local emptiness. | EMP-OFFL-004; B-BR-EMP-124/130; same protected store and actual source guards. | | EDR-084 | Extend inner queue framing toV2 only for explicit dismissedRejected metadata; readV1 as false. Hide only current final refusals without changing intent, ACK, retry, business projection or files; retain local history. | The task needs explicit dismissal while accepted receipts and unsent data must remain durable. | TTL/eviction, dismissing pending/review/accepted work, changed ACKs, wrong digest/source or silent upgrade/downgrade repair. | EMP-OFFL-004; B-BR-EMP-127; additive reader/recovery acceptance required. | | EDR-085 | Keep pending list/detail within the existing context destination and owner; read offline through fresh actual source/custody, with independent view generation and rendered epoch. Clear on lifecycle/source/selection changes. | A separate route would dispose/unconfirm the context and inject another transient context flow; connectivity is not local read authority. | IDs in routes/SavedState, taking over LocalContext selection, late callbacks adopting another scope, offline-only reads becoming network-dependent. | EMP-OFFL-004; B-BR-EMP-128; recommended smaller integration, no new route/service. | | EDR-086 | Observe only actual selected delivery IDs through a passive bounded scoped memory port; end after durable ACK/retry processing. Manual checking respects the complete existing combined retry delay. | Activity-end refresh must observe committed receipt state; V1 does not distinguish client backoff from server Retry-After. | Durable SENDING, generic busy as send proof, premature refresh, resetting server floors, global selected-context dispatch or fake owning actions/producers. | EMP-OFFL-004; B-BR-EMP-129; no new dependency, legal/provider gate or business permission. | | EDR-087 | Use strict canonical ASCII decimal entry and separate whole hours/minutes for pure meter conversion, with existing documented integer bounds and exact arithmetic. | Locale normalization is an adapter concern; permissive personal-ledger parsing would admit unsupported precision. | Rounding, negative/overflow values, invented localized grammar or treating missing as zero. | EMP-METER-001; B-BR-EMP-131; recommended before behavior. | | EDR-088 | Preserve immutable observed readings and append pure reason-bearing void/supersession facts; derive current state and keep the original chain. | Insert-only evidence must coexist with terminal void and at-most-once supersession. | Overwriting history, reused IDs/operations, cycles, foreign references or granting correction authority. | EMP-METER-001; B-BR-EMP-132..134; no persistence or authorization in this checkpoint. | | EDR-089 | Use exact single-segment latest-valid anchors and typed independent distance/hour usage; represent missing anchors explicitly. | Replacement/reset/rollover and plausibility are later owning tasks. | Cross-segment subtraction, interpolation, fake meter presence, calculated suspect/confirmation policy or combined distance/hour figures. | EMP-METER-001; B-BR-EMP-133/135/136; supplied SUSPECT is representation only. | | EDR-090 | Share one strict synthetic versioned vector corpus across pure Go/Kotlin domains and retain adversarial/property checks in each. | Meter values are financial denominators; cross-language agreement and retained evidence need direct proof. | Compile-only acceptance, permissive vector loading, runtime activation or new dependencies. | EMP-METER-001; BUC-EMP-65..68; actual routes/intake/persistence remain METER-002 and later. | | EDR-091 | Complete FUEL-001 as an actual C1/F2 prerequisite before runtime fleet persistence, with the owned code-defined nine-product catalog. | Fleet's accepted domain requires real descriptors; the public kernel also contains unsupported cylinder gas and lacks electricity/additive. | CAT_A/B fixtures or permissive per-request fabricated product descriptors as production data; starting/accepting the whole F3 early. | EMP-FUEL-001; B-BR-EMP-137; actual completed PLAT-009/FLEET-001 dependencies, METER-001 available. | | EDR-092 | Keep a pure submit-ready immutable candidate with exact integers, required explicit fill/payer/payment, and a scoped meter reference or explicit missing reason. | Client draft readiness is distinct from actual server receipt, authorization, reading classification, payment and approval. | Invented server times, default VALID/FULL/company payer, inferred reimbursement, duplicate meter truth or arithmetic/review scope expansion. | EMP-FUEL-001; B-BR-EMP-138..141; synthetic construction only. | | EDR-093 | Represent establishment and contracted supplier independently; document issuer remains a separate source-document/revision read projection owned by DOC. Sum purchased quantities only by compatible category/unit using exact widening. | Sharing units or commercial names does not make roles/products interchangeable. | Copied issuer truth, automatic supplier replacement, additive fuel volume, mixed units or ratios from purchased totals. | EMP-FUEL-001; B-BR-EMP-142/143; no new service, provider or dependency. | | EDR-094 | Extract the existing declaration-only validation into the accepted time kernel and reuse it from Capture, preserving receipt/reporting behavior. | An offline candidate cannot truthfully supply server received_at merely to reuse validation. | Dummy receipt/calendar proof, new time rules, entry zone used as org zone, clock acquisition or unrelated time refactor. | EMP-FUEL-001; B-BR-EMP-140; actual declaration/Capture regression required. | | EDR-095 | Register private category identity/label explicitly within an authorized asset command, choosing existing ID or declaring a new label, and resolve real rows through the accepted catalog port. | No canonical category vocabulary exists; the real product catalog is now provided by FUEL-001. | CAT_A/B fixtures, fabricated per-request descriptors, guessed enum/kind/case rules or a new standalone configuration service. | EMP-FLEET-002; B-BR-EMP-144; unattended recommended source model before behavior. | | EDR-096 | Use append-only schema changes with forced RLS, exact identifier indexes, actual initial allocation and current usage, preserving migration177 employee/team counts and unknown-consumer guards. | Asset admission must serialize with unit archival, while history and other organizations stay unchanged. | Reset counters, bypass roles, changed published migrations, personal vehicle storage or fake zero usage. | EMP-FLEET-002; B-BR-EMP-145/147/149; ordinary populated recovery/concurrency acceptance required. | | EDR-097 | Reuse the actual organizations C1 capability and source-owned fresh fleet policies through a narrow transaction authority port. SELF remains unproven until actual assignments integrate. | Only the current base capability has an implemented activation path; plan-specific scopes/flags/limits belong to their owners. | New unowned fleet gate, arbitrary permission helper, creator as SELF, cached membership/proof or production-readiness inference. | EMP-FLEET-002; B-BR-EMP-146; current enterprise flag/capability and AUTH semantics retained. | | EDR-098 | Keep FLEET-002 in progress until real powered activation is tested after METER-002 integration. A tested fleet foundation may be backed up first, then the sole active dependency task proceeds from that head. | Meter installation needs real persisted assets, while powered activation needs real meters; unavailable ports must not impersonate presence. | Fake meter facts/always-none runtime producer, IMPLEMENT-only whole-task PASS, cyclic planning fiction or PR/CI wait. | EMP-FLEET-002; B-BR-EMP-147/151; one bounded implementation at a time, actual dependency source completion. | | EDR-099 | Retain original command receipts independently of live draft asset FK and audit each successful parent command once, including category declaration. | Draft deletion must not erase ACK history or make replay recreate its target. | Cascaded immutable receipts, replay without current authority, duplicate categories/effects/audit or silent deletion of accepted work. | EMP-FLEET-002; B-BR-EMP-148/149; real replay/CAS/fault tests before acceptance. | | EDR-100 | Add explicit scoped WEB_SESSION/ENROLLED_DEVICE reading capture provenance, preserving accepted enrolled shorthand without manufacturing a web device. | Panel installation has a verified real company session, not an Android enrollment; history survives session cleanup. | Cookie ID disguised as physical device, fake enrollment, persisted proof secrets or dropped provenance. | EMP-METER-002; B-BR-EMP-152; recommended unattended decision before behavior. | | EDR-101 | Install a real meter, initial segment and explicitly observed opening reading atomically; preserve insert-only evidence and real source-use guards. | Persisted fleet foundation6e3dde65 now provides the actual asset source. | Zero defaults, editable evidence, cascaded readings, always-empty use checks or changed applied migration197. | EMP-METER-002; B-BR-EMP-153..155; ordinary populated PostGIS/concurrency acceptance. | | EDR-102 | Permit only explicitly source-owned terminal outcomes requiring no asynchronous business effect, keeping default missing plans closed and real required-consumer plans unchanged. | Immutable reading/audit/effect/ACK commit atomically; there is no current meter consumer and METER-006 owns maintained projection. | No-op consumer, invented projection, empty catalog as readiness or undeclared review outcome. | EMP-METER-002 bounded OFFL-002 contract amendment; B-BR-EMP-157; immediate RED/regression before activation. | | EDR-103 | Keep SELF and changed-history review unavailable until actual assignment/history/review producers integrate, and retain precise unfinished acceptance. | Current source cannot assert a historic assignment or construct a real held review item yet. | Creator-as-SELF, fixture as provider, dummy review ID or partial whole-task PASS. | EMP-METER-002; B-BR-EMP-156/159; FLEET-006 and actual review gates retained. SELF clause superseded by EDR-173 (2026-11-14). | | EDR-104 | Derive latest valid reading by ordered SQL and bind powered Fleet activation to actual in-service meters, without a new maintained value table. | METER-002 owns query/persistence; METER-006 separately owns maintained projection/rebuild. | Arrival-order current value, fake MeterFact or INSTALLATION-only whole F2 acceptance. | EMP-METER-002/FLEET-002; B-BR-EMP-155/159; actual missing/present powered route acceptance. | | EDR-105 | Preserve exact declared instants using a microsecond-floored PostgreSQL timestamp plus a0..999 nanosecond remainder, and compare/order both fields. | The accepted time contract permits9 fractional digits while PostgreSQL timestamp precision is6; direct persistence can round or reorder evidence. | Silent rounding, string order, fabricated precision or an arbitrary new microsecond-only input restriction. | EMP-METER-002; B-BR-EMP-155; exact observation/service-boundary RED before persistence behavior. | | EDR-106 | Factor current identity/role/capability checks through narrow query-only borrowed transaction helpers while preserving existing full-Tx entry points and the source lock order. | A real signed intake handler receives no transaction lifecycle, yet must use the actual current source in that same transaction. | Secondary connection authority, pgx.Tx assertion for a borrowed device transaction, copied proof rules or capability-after-root lock inversion. | EMP-METER-002; B-BR-EMP-156; actual source negative/concurrency regressions immediately. | | EDR-107 | Register the first real meter intake owner in the enabled synthetic enterprise runtime with its exact atomic outcome plans and an explicit transport allowance inherited from identity v1 at200/hour on every axis. | There is now an actual immutable business producer; signed transport still needs a reviewed weighted budget and actual current source. | Empty registry as completion, implicit unbounded transport, no-op consumer, Android producer before its own dependencies or production-readiness inference. | EMP-METER-002; B-BR-EMP-156..159; synthetic quota requires later production measurement/cleanup evidence. | | EDR-108 | Lock the actual capability snapshot before the intake source root without requiring enabled state; record writes separately enforce the real enabled capability. | Actual composition confirms current source before handler admission. Deferred audit-root FK permits a capability update/root-lock cycle unless that outer confirmation also follows the source order. | Root-before-capability inversion, invented enabled state, rejecting permitted cached reads when writes are disabled or a second authority connection. | EMP-METER-002; B-BR-EMP-156/157; actual contention RED and ordinary capability-off read/write acceptance. | | EDR-109 | Keep full METER-002 IN_PROGRESS after its tested source foundation until actual assignment/history/review acceptance, while closing FLEET-002 independently after real powered activation and all own routes pass. Implement OFFL-008 before FLEET-003, then FLEET-005, AUTH-006 and FLEET-006 before the remaining meter closure. | Actual meter persistence resolves Fleet activation; both changed-rights HELD and post-disposal ASSET_UNAVAILABLE require real review. AUTH-005 already retains role periods. | Whole Meter PASS from current ORG-only cases, fake SELF/history/review, OFFL-007 clock as authority or a formal dependency cycle on whole Meter completion. | EMP-METER-002/FLEET-002; B-BR-EMP-159; tested source consumption under ADR-018, one implementation task at a time and truthful retained parent status. | | EDR-110 | Build actual OFFL-008 review before lifecycle, starting with the real Meter owner and complete AUTH-005 ORG permission history. | Changed-rights and post-disposal facts need a real held outcome; current signed proof remains mandatory. | Fake review IDs, currentCandidates as history, clock-as-authority, inferred SELF or F4 exception. | EMP-OFFL-008; B-BR-EMP-160/161/169; recommended unattended source order after71b995ae. | | EDR-111 | Keep original ACK bytes immutable and introduce a separate immutable resolution plus explicit real atomic-review proof/source constraints. | Existing V1 server/client ACK and retry rules forbid replacing final REVIEW with a new ACK. | Mutable ACK/result rewrite, Review as readiness, empty/no-op consumer or silent batch protocol change. | EMP-OFFL-008; B-BR-EMP-162/164; actual database/source proof before review acceptance. | | EDR-112 | Use fresh current Meter reviewer proof, record-owned permission, revision-targeted one-time decision and canonical account/member/employee self-review checks. | Rehire/merge must not bypass no self-approval; first owner supports unchanged accept or reasoned refusal. | Caller-selected authority, stale decision, edited observation without an owning command or automatic accepted cost. | EMP-OFFL-008; B-BR-EMP-163; current ACTIVE capability/root and real races. | | EDR-113 | Add a review-bound append path preserving original observed source and server receipt, with a separate resolver audit actor. | Schema198's ordinary insert requires live original source and stamps current receipt; resolution cannot impersonate that source. | Fake original device/session, retagged author/receipt or weakening ordinary insertion checks. | EMP-OFFL-008; B-BR-EMP-164; exact held/accepted-resolution/reading references. | | EDR-114 | Give the current original author a minimal separate signed result read, fully correlated and bounded50 selectors/64KiB request/128KiB response/4KiB resolution. | A legitimate author may have lost record permissions; complete Unicode outcomes may exceed the old64KiB batch response. | Restored record read/write permission, foreign selector disclosure, silent truncation or changed V1 limits. | EMP-OFFL-008; B-BR-EMP-165; source tuple and all-response preflight. | | EDR-115 | Extend protected queue to V3 with an independent terminal resolution and review-only polling, retaining V1/V2, ACK and source leases. | Existing final REVIEW is excluded from delivery; author-next-sync needs actual durable client handling. | Resending final operations, replacing ACK, fake projector/SENDING or API-only app acceptance. | EMP-OFFL-008; B-BR-EMP-166/167; real Go HTTPS and owned emulator acceptance. | | EDR-116 | Stamp review-expiry-v1/default60days and derive expired-unresolved listing, permitting late resolution. | The plan specifies60days, while current editable settings only own the distinct intake window. | Reusing intake days, invented editable configuration, deletion, fabricated notification or scheduled worker. | EMP-OFFL-008; B-BR-EMP-168; actual rule/visibility with retained notification obligations. | | EDR-117 | Preserve historical review ACKs with NULL legacy proof version and a validated MATCH SIMPLE composite FK; all newly inserted REVIEW ACKs must acquire proof version1 and actual typed held source. | Schema196 can retain unsupported/custom review history without enough fact evidence to reconstruct a new core item. | Fabricated backfill, erased/rewritten ACKs, NOT VALID treated as complete or arbitrary new review UUID/type accepted as proof. | EMP-OFFL-008; B-BR-EMP-161/162/169; default SQL source validator knows only real Meter, named test-only owner extensions must query actual held rows and preserve production guard. | | EDR-118 | Apply only with current actual ORG coverage continuous across receipt and declaration; hold a proven formerly effective grant after a gap, removal or regrant, even if the client declares a later time. | The client clock cannot prove never-held authority. Complete server history with no ever-effective ORG grant by receipt is forbidden; unresolved SELF history stays unavailable. | Scheduled grants as present authority, client time proving historical absence or current candidates replacing complete history. | EMP-OFFL-008; B-BR-EMP-160; recommended unattended boundary before temporal algorithm implementation. | | EDR-119 | Define review-expiry-v1 as elapsed60×86400seconds from the original server receipt. | No review calendar zone exists; SQL session TimeZone/DST must not change the Go/API60day duration. | Session-dependent civil-day intervals, client clock, invented editable zone or changed original receipt. | EMP-OFFL-008; B-BR-EMP-168; actual non-UTC/DST SQL RED precedes correction; exact deadline remains visible and late-resolvable. | | EDR-120 | Keep a separate immutable V3 resolution and review retry state; poll under a fresh exact-source attempt after operation delivery, including an empty delivery queue. Chosen client ports: EnterpriseReviewQueue (unresolved list, resolve CAS, review-retry CAS), EnterpriseReviewTransport (signed review-results POST returning only a fully parsed/correlated response) and EnterpriseReviewService.poll, called by the existing worker after each partition's dispatch and by manual check. Chunks hold at most50 due selectors; the first failed chunk stops that partition's poll and keeps its own retry/Retry-After floor. Review failures never change delivery counts or the worker's delivery retry result; a ticketless scoped completion hint triggers the UI reread. | A final REVIEW cannot be resent or rewritten. The existing15minute worker supplies normal unresolved polling; real failures persist independent bounded retry/Retry-After state. | SENDING for reads, mixed delivery/review counters, a new scheduler, retagged partitions or fake business projection. | EMP-OFFL-008; B-BR-EMP-166/167; recommended client ports frozen before Android behavior, production DI binds the real review service. | | EDR-121 | Bind review resolution CAS to exact source, operation, payload digest, original ACK fingerprint and original ReviewID; bind dismissal to the current effective outcome fingerprint. Frame V3 is written only when a resolution or non-initial review retry exists; V1/V2 decode unchanged and other rewrites keep the minimal version. V3 stores dismissal as its outcome kind (1 REJECTED receipt, 2 REFUSED resolution), verified against the retained bytes on every decode; the dismissal command carries the effective outcome digest. | Equal resolution replay is harmless; a conflicting terminal outcome must remain closed. Dismissing the old REVIEW must not hide a later decision. | Mutable ACKs, response-prefix writes before complete validation, stale attempt writes or a blanket persistent dismissed flag. | EMP-OFFL-008; B-BR-EMP-166/167; real durable V1/V2→V3 recovery and native acceptance required. | | EDR-122 | Keep background custody and delivery scheduling quiet and bounded. (1) Only a newly created durable reconfirmation requirement advances the session fence; an existing requirement is a quiet wait checked before any RECONFIRM side effect (proven expiry still erases first) and is delivery-worker attention, not failure. A key-provider failure while latching still fences conservatively. (2) A bare account lock file is coordination, not prior data: discovering an account without protected material or durable denial creates nothing, and revocation ignores a lock-only footprint. (3) The operation worker succeeds without reschedule when no session exists; the existing 15-minute periodic work and app start resume delivery. It drains at most 10 fully acknowledged 50-operation batches per partition per invocation, then continues immediately in a unique one-time continuation; a known due time (stored backoff or authenticated Retry-After) becomes a delayed continuation; unknown failures and stalled batches keep system backoff. (4) The shared signed-plane Retry-After (operation delivery and review lookup) is honored without shortening up to 6 hours, the existing QueueRetryPolicy cap (EDR-078), and clamped there; negative or malformed hints stay unusable. | Every RECONFIRM observation advanced the global epoch: after a reboot the worker invalidated its own lease and retried forever while open company, invitation and context flows went stale and in-flight reconfirmation failed. Discovery left a lock file for every signed-in account, so a later revoked session showed a false unrecoverable-data warning. Signed-out runs retried forever, Retry-After was ignored, queues over 50 drained only through backoff and an unbounded server hint could park work permanently. | Fencing on every observation; dropping the durable latch; treating lock files as data; a new scheduler, service or sign-in hook; unbounded draining; unbounded Retry-After; changing the domain retry policy. | Enterprise suite code review findings M3/L7/L8/L9; B-BR-EMP-120/122; host RED→GREEN before behavior change; bounds the EDR-081 hint without changing its Date rules. | | EDR-123 | Unlink invitation acceptances inside the existing account-erasure definer, per organization scope after the membership tombstone: NULL account reference and empty copied alias through a narrow owner-only guard branch for an actually deleted account, unchanged revision and no notice; 000200 applies it to accounts deleted before the upgrade. Retain actor attribution in immutable person/manager command receipts and organization audit events; mask the alias copied into a manager receipt at projection when its acceptance is unlinked. | The acceptance kept the person's alias and account after deletion, readable by managers. Receipts and append-only audit events record who performed an operation the organization keeps (BR-PRIV-014); unlinking only the receipt would not unlink anything because the audit event holds the same actor and target, and no manager read exposes either. | Rewriting immutable receipts or append-only audit events; deleting acceptance history; a fixed alias marker that could equal a real alias; a new definer or GUC-enabled runtime path. | Enterprise backend code review M1; B-BR-EMP-170/BUC-EMP-89; real deletion service with an ordinary definer, guard negatives and populated199→200 recovery. Retained: the separately reviewed audit retention procedure owns the eventual lifecycle of actor attribution. | | EDR-124 | Keep SUSPENDED and ARCHIVED organizations as account contexts with additive optional state and suspension_reason, reading hints only, and exclude CLOSED. Read the capability with a plain non-locking query after the current membership is bound; a disabled capability stays ENTITLEMENT_REQUIRED for current members only. | BR-ORG-030/033 and SCR-ORG-12 require members to keep reading with a notice, matching company authority reads. The previous capability FOR SHARE read ran first, serialized reads with capability changes and let a non-member tell capability state from NOT_FOUND. | A new notice endpoint; required response fields that break strict clients; showing write hints in read-only states; dropping the capability gate. | Enterprise backend code review M2; B-BR-EMP-171/BUC-EMP-90; Android and business-web parsers ignore unknown context fields (additive). | | EDR-125 | Make the deferred invitation reservation cleanup reinstall its invitation row's own organization scope and restore the caller's scope, as 000171/000178 deferred checks already do. | Account erasure restores an empty scope before COMMIT, so the deferred UPDATE matched nothing under forced RLS and the invitee's reservation stayed INVITED. The insert/update already proved that row's scope. Suspension also restores its prior scope, but SUSPENDED queues no invitation event; the row-scope cleanup covers any caller. | An immediate trigger (breaks resend's same-transaction replacement); SET CONSTRAINTS IMMEDIATE inside erasure (fires other queued events under the wrong scope); a definer or RLS bypass. | Enterprise backend code review L1; B-BR-EMP-172/BUC-EMP-91; real PostGIS issuer erasure. | | EDR-126 | Treat any unended, unexpired OWNER period of the recipient, current or scheduled, as already-owner at propose and accept, and map an assignment conflict to 409. Materialize admission expiry org-wide in invitation issue, list and personal redemption, like the existing invitation expiry. | A scheduled OWNER overlaps the handover's open-ended period; accept returned 503 on every retry. An expired admission kept its INVITED reservation until a manager reopened that invitation, blocking re-invitation and new acceptance. | Silently ending or shortening another member's scheduled plan; a retryable outage; a scheduled expiry worker or client clock. | Enterprise backend code review L3/L4; B-BR-EMP-173/174/BUC-EMP-91. | | EDR-127 | Open F3 with its dependency-ready pure domains (APPR-001, EXP-001, DOC-001, PLAT-016, then FIN-001/BUDG-001), each built in an isolated owner worktree and integrated as one atomic task commit, while the open F2 chain (FLEET-003, FLEET-005, AUTH-006, FLEET-006, METER-002 closure) stays the gate of every F3 persistence task from FUEL-002 onward. | These domains have no open dependency and pin the review, one-cost, settlement, capacity and amendment invariants that REL-004 later proves at persistence level; METER-002 cannot close before its own F2 chain. | Starting FUEL-002/EXP-002 before METER-002 closure, fake meter/assignment/scope adapters, or counting pure-domain checkpoints as M3/F3 acceptance. | F3 execution ledger; ADR-018 local checkpoints; one bounded task per commit. | | EDR-128 | Accept APPROVE, RETURN and REJECT only from IN_REVIEW, after an explicit OPEN that has the same eligibility as a decision; CANCEL only from DRAFT, SUBMITTED or RETURNED; IN_REVIEW assigns no particular reviewer. | Follows the frozen BR-REV diagram exactly; an owner use case may compose OPEN and a decision in one transaction, each checked. Once a reviewer opened it, the author cannot withdraw the record under review. | Implicit open from SUBMITTED; cancel from IN_REVIEW; a reviewer claim or lock; reopening RETURNED by the reviewer. | EMP-APPR-001; B-BR-EMP-175/176; levels stay with EMP-APPR-002/004. | | EDR-129 | Use the closed vocabulary INVALID, REASON_REQUIRED, FORBIDDEN, SELF_APPROVAL, CONFLICT and INVALID_TRANSITION, first failure in that order. Identities are server-resolved canonical account/membership/employee sets compared on any shared identifier; permission is an explicit receipt fact whose absence means not granted. | Matches the 07-permissions order (permission before record rules), the wire codes FORBIDDEN/SELF_APPROVAL/CONFLICT and EDR-112 canonical self-review without trusting roles. | A separate STALE_REVISION code; per-kind or role-based self checks; identities captured only at creation; a default-granted permission. | EMP-APPR-001; B-BR-EMP-177/178; an HTTP owner maps INVALID_TRANSITION to CONFLICT. | | EDR-130 | Place the pure component in Go review/domain and Kotlin enterprise.review with one versioned review-v1 oracle. It holds no organization scope or actor (the owner record and audit do), includes the BR-REV-009 basis and the local presentation, and reuses the B-BR-EMP-163 reason bound. | Follows the proposed review module of 09-architecture; owners bind tenancy and persistence; one oracle serves both languages; levels and partial amounts extend as review-v2 without rewriting v1 rows. | A lifecycle per module; importing or duplicating orgamend; persistence or routes now; a new reason bound. | EMP-APPR-001; B-BR-EMP-175..179; APPR-002/004/006, EXP-001 and PLAT-016 own their parts. | | EDR-131 | Close cost origins to FUELING (the FUEL-001 FuelingRef), WORK_ORDER (a scoped local reference) and DIRECT (keyed by its own expense identity). Recognize PAYMENT, REIMBURSEMENT, CARD_STATEMENT, ADVANCE, PAYABLE, DOCUMENT, STOCK_PURCHASE and STOCK_TRANSFER only to refuse them as NOT_COST_ORIGIN. Key one cost by (organization, kind, source). | EDR-013, BR-EXP-001 and BR-FUEL-010 name fuelings and maintenance as cost sources and settlement, statements, documents and stock moves as never a second cost; a typed refusal makes that misuse visible instead of an unknown token. | An open or configurable origin list; payment, reimbursement, statement or advance origins; a fabricated source ID for direct costs; re-modelling fueling; importing the unbuilt maintenance module. | EMP-EXP-001; B-BR-EMP-180; database uniqueness, the fueling projection and work-order binding remain EMP-EXP-002 and MAINT. | | EDR-132 | Require both paid and company amounts as canonical orgvalue centavos with 0 ≤ company ≤ paid, allowing an explicit known zero and refusing absence. Validate the category only by the ^[A-Z][A-Z0-9_]{0,63}$ key profile. Take the competence as a validated declaration and attribute its reporting day through a receipt-free time-kernel entry extracted from Capture. | BR-MONEY-001/004/010 and BR-TRUTH-003: unknown is absence, not zero, while FUEL-001 already accepts a zero paid total that still yields exactly one expense. EXP-003 owns the catalogue. EDR-094 extracted declaration validation the same way. | Rounding or decimal input; defaulting company to paid; a positive floor that would drop a zero-paid fueling's expense; hard-coded REQ-11.1 categories; a dummy receipt; the entry zone as reporting zone; duplicated zone logic. | EMP-EXP-001; B-BR-EMP-181..183; the time-v1 corpus and Capture regressions must pass unchanged. | | EDR-133 | Compute totals for one organization, one half-open reporting-day period and an explicit basis (APPROVED or INCLUDES_PENDING). Count APPROVED, report SUBMITTED/IN_REVIEW as a separate pending part and exclude the rest with a count. Use widened exact sums. Fail closed with SCOPE, OUT_OF_PERIOD or DUPLICATE_COST. Take the review state as a closed input enum (BR-REV plus VOIDED) without importing the parallel review package. | BR-REV-009 and BR-EXP-002 count approved records by default with an identified pending part; BR-TRUTH-004 shows period and inputs; BR-TEN-007 forbids mixing organizations; int64 holds one record but is not proven for an unbounded selection. | Silently filtering foreign or out-of-period rows; counting pending as approved; a label that depends on data rather than the declared basis; int64 or capped sums; a partial total on error; a dependency on the unfinished review package. | EMP-EXP-001; B-BR-EMP-184; binding to the review package and persisted selections remains EMP-APPR and EMP-EXP-002; EMP-FIN-001 and EMP-BUDG-001 import these types. | | EDR-134 | Fix the document transition tables of B-BR-EMP-187: commands carry the expected current state; FAILED/DELETED storage is terminal and REPLACED is entered only by replacing with an already STORED same-organization successor; a quarantined original is never released to STORED (a clean copy is a replacement); extraction and structure may retry only from FAILED/STRUCTURE_INVALID; conference decisions are reversible to UNCONFERRED; fiscal results are time-ordered observations that never return to NOT_CONSULTED. No cross-dimension guards: workflow preconditions (readable content, authority, revisions) stay with EMP-DOC-002/005/006/011. | BR-TRUTH-001, EDR-014 and the state-model rules (closed lists, commands, terminal states, conflict on concurrent transitions) need one testable table, and a guard between dimensions would itself derive one check from another. | One "validated" flag; free "set state"; overwriting an original on replacement; quarantine release without a reviewed policy; fiscal status inferred from hash, structure or extraction. | EMP-DOC-001; B-BR-EMP-185..187; documents.md §6; 08-state-model §§3–4. | | EDR-135 | Link target kinds are the closed set FUELING, EXPENSE, WORK_ORDER, TRIP, ASSET, EMPLOYEE (06-domain-model §3) plus METER_READING (EMP-DOC-003 meter evidence). Only EXPENSE is allocatable. | The ER diagram allocates to expenses, EMP-DOC-007 links item amounts to expense allocations, and under EDR-013 a fueling or work order cost is exactly one expense, so allocating to both a fueling and its expense would count one fact twice. | An open target string; a MAINTENANCE umbrella kind; allocating to fuelings, work orders, trips, assets or employees directly. | EMP-DOC-001; B-BR-EMP-188/189; EDR-013; widened only by a later owning task. | | EDR-136 | Reconciliation is computed, never stored or commanded, from the exact recorded amount and the current allocation set with zero tolerance; OVER_ALLOCATED is only an observation after a downward amount correction. An allocation set replaces the previous one; lines are 1..MaxTotalCentavos, at most orgvalue MaxAllocationLines; an even split reuses orgvalue Allocate / EnterpriseValues.allocate with equal weights in target order and omits zero shares. | BR-MONEY-007 exact parts and the state-model rule that derived states are computed; the glossary's "within tolerance" has no reviewed tolerance, so exact equality is the only truthful basis. Reusing the accepted allocator and bounds avoids a second rounding rule or invented ceiling. | A stored or manually set reconciliation; a tolerance; rejecting amount corrections; a new allocator; zero-centavo allocation rows; a new link-count ceiling. | EMP-DOC-001; B-BR-EMP-189; BR-MONEY-007; orgvalue; locking/races stay with EMP-DOC-007/010. | | EDR-137 | Place the amendment kernel as the pure server-side Go package orgamend/domain with the shared oracle contracts/testdata/enterprise/amendment/amendment-v1.psv, and build no Kotlin mirror now. Accept review facts as canonical BR-REV state tokens instead of importing the review package built in parallel. | Platform kernels use the org* prefix (orgvalue, orgtime, orgaudit). Approval, period locks and receipt-time authority are server decisions, so a client mirror would have no consumer; the vectors remain the single oracle for any future client. Importing review now would couple two unfinished tasks. | A Kotlin mirror without a consumer; per-module copies in fueling, expense or trip; importing review before EMP-APPR-001 lands; persistence, routes, jobs or period commands here. | EMP-PLAT-016; B-BR-EMP-190..193; binding to EMP-APPR-001 and consumption by EMP-FUEL-015/EMP-APPR-006 retained. | | EDR-138 | Verify explicit EDIT/AMEND/VOID/ADJUST intents against facts in a fixed order (INVALID, CONFLICT, ALREADY_VOIDED, state, LOST_ORIGINAL, reason, UNAUTHORIZED, period). Allow one pending amendment at a time; derive "pending" from revisions and state; adjust only from a LOCKED record period to a later writable day; require a proven, reasoned reopening for REOPENED; gate the period again when an amendment is approved; make the consumer state its append plan and verify it. | VAL-19 and UC-FUEL-08 require PERIOD_LOCKED for a direct amendment in a locked period and a separate adjustment path. A second amendment or a void beside a pending one would leave two candidate effective revisions. Approving after a relock would change locked figures. A stated append plan makes overwriting or detaching history detectable. | Silent reclassification (amend to edit or to adjustment); superseding a pending amendment; inferring a reopening from the state token; a separate pending flag that can contradict the revisions; renumbering or reusing revisions; adjustments from writable periods. | EMP-PLAT-016; BR-AMD-001..006, BR-TIME-003/004, BR-REV-007; B-BR-EMP-190..193; VAL-19, VAL-20, VAL-26. | | EDR-139 | Place the payable domain as the pure server-side Go subpackage expense/domain/payable with the shared oracle contracts/testdata/enterprise/payable/payable-v1.psv and no Kotlin mirror. Close obligation kinds to SUPPLIER, REIMBURSEMENT and CARD_STATEMENT with one typed counterparty each and leave ADVANCE to EMP-FIN-003. Recognize obligations only from APPROVED EMP-EXP-001 expenses with an explicit payer (EMPLOYEE paid by the beneficiary for a reimbursement, COMPANY otherwise). Reuse the expense values and review-state vocabulary, the FUEL-001 payer and employee/supplier/document references, the orgvalue centavos parser and line bound, the financial-v1 total ceiling and the review reason bound. | 09-architecture puts FIN inside expense. Payables, settlement and payment records are panel/server-only and online-only (expenses-finance §8), so a client mirror has no consumer and the vectors stay the single oracle (EDR-137 precedent). An advance is money given before expenses with its own REQUESTED..ACCOUNTED lifecycle (08-state-model), not an amount owed. BR-REV-009 counts approved records, and a pending company amount can still shrink by partial approval. The payer decides who is owed, so one expense cannot be both reimbursed and owed to a supplier or card issuer. | A Kotlin mirror without a consumer; ADVANCE or PAYMENT as a payable kind; obligations from pending or excluded expenses; inferring the payer from the payment method; new reference types, money ceilings or reason bounds; changing the expense, review or orgvalue packages. | EMP-FIN-001; B-BR-EMP-194, B-BR-EMP-195; EMP-FIN-002 (reimbursement command, persisted duplicate obligation), EMP-FIN-003 (advances), EMP-FIN-004 (payment records), EMP-FIN-005 (statement grouping, supplier consistency) and EMP-FIN-007 (panel) retained. | | EDR-140 | Model an obligation as source lines whose exact sum is the obligation (each line from 1 to its source's company amount, a reimbursement exactly that amount, total at most 10^12). Derive OPEN, PARTIALLY_SETTLED and SETTLED from distinct positive settlement entries; refuse overpayment and settlement of a CANCELLED payable; cancel only from OPEN with a reason, never after a settlement; derive the remaining amount (0 when cancelled) and check any asserted state against the derived one. Compute cost and settlement views separately with the unchanged EMP-EXP-001 totals, keep payable, settlement and statement identities disjoint from cost identities, and allow one live obligation per source expense. | EDR-013, BR-FIN-001 and REQ-11.2: payments, reimbursements and statements settle and never re-recognize a cost. 08-state-model rule 5 computes derived states. BR-MONEY-007/010 keep exact wholes and bounds. Per-source lines keep each obligation traceable and expose a second live obligation of one expense. The approval already fixed the reimbursable company amount, and installments are partial settlements. | A stored remaining amount or free state field; partial reimbursement obligations; zero, negative or reversal settlements; cancelling a settled or partially settled payable; a combined cost-plus-settlement figure; silently skipping a payable that poses as a cost; int64 sums over unbounded selections. | EMP-FIN-001; B-BR-EMP-196, B-BR-EMP-197; payment reversal, dates and cash views (FIN-004, FIN-006), rebinding after an amendment or void of a source (FIN-004 with PLAT-016) and the database single-cost invariant (FIN-004, REL-004) retained. | | EDR-141 | Place the pure budget domain as the Go package budget/domain with the shared oracle contracts/testdata/enterprise/budget/budget-v1.psv, and build no Kotlin mirror now. Model a line as one organization, an explicit half-open reporting-day period built by the EMP-EXP-001 ReportingPeriod, exactly one dimension from ORGANIZATION, UNIT, COST_CENTRE, ASSET and EMPLOYEE with an optional category filter, and a required exact limit. Facts carry caller-supplied recorded tags and their own reporting day; a hold's day is that of its server reservation instant. | Budgets, holds and capacity are panel/server decisions, reservations needing concurrent limits are online-only (expenses-finance §8) and driver/asset limits at submission belong to EMP-BUDG-006, so a client mirror would have no consumer; the vectors stay the single oracle for any future client (EDR-137 precedent). REQ-11.3 names period, unit, cost centre, vehicle and driver; explicit days serve VAL-14's month and other spans; one target keeps matching exact; BR-AUTH-005 fixes coverage on stored values and EXP-001 expenses carry no unit, cost centre or asset. | A Kotlin mirror without a consumer; calendar-month-only periods; an open or configurable dimension list; multi-target intersections or wildcard targets; tags inferred from current allocations; a default, zero-as-unlimited or infinite limit; the device or entry zone deciding a hold's day; persistence, routes or jobs here. | EMP-BUDG-001; B-BR-EMP-198..199; EMP-BUDG-006 owns driver/asset limits at submission and after sync; EMP-EXP-006 owns allocation parts; EMP-BUDG-002 owns overlap constraints. | | EDR-142 | Derive available = limit − APPROVED company amounts − ACTIVE holds with exact big-integer sums, report the SUBMITTED/IN_REVIEW part separately without deducting it, report a negative result as over-commitment, compare (never trust) a claimed available, and decide reservations (ACTIVATE/EXCEEDS, positive amounts only) and approved postings (POST/EXCEEDS, optionally converting one ACTIVE hold) with no overrun policy. Holds move only ACTIVE → CONSUMED/RELEASED/EXPIRED. | BR-BUDG-001 names committed consumption and active holds; BR-EXP-002 and BR-REV-009 count approved company amounts; a hold is the reservation for spending not yet approved, so also deducting pending amounts would count a pending expense and its hold twice, while posting at approval rechecks the line; 06-domain-model §5 forbids a stored available; VAL-14 needs serialized holds and a release that restores capacity once; EMP-BUDG-004 owns exceptions. | Pending counted as consumption or a basis switch for decisions; int64, clamped or wrapped availability; a supplied available used as input; implicit approval without a line or limit; overrun by default; zero-amount holds; reviving, re-releasing or re-consuming holds; refusing a zero posting on an over-committed line. | EMP-BUDG-001; B-BR-EMP-200..201; row locks, posting at approval and the concurrency proof are EMP-BUDG-002, reservation commands, owners and expiry bounds EMP-BUDG-003, exception routing EMP-BUDG-004. | | EDR-143 | Store the current acquisition instant and current disposal (kind, instant, reason) as additive nullable columns on org_assets (instants as microsecond timestamptz plus 0..999 sub-microsecond digits, no backfill), keep every lifecycle transition in an append-only org_asset_lifecycle_events table keyed by the asset revision it produced (FKs to the revision, the command receipt and the audit event), extend the existing org_asset_commands receipt kinds instead of a second receipt table, and expose verb routes under /v1/orgs/{org_id}/fleet/assets/{asset_id}/ (acquisition/record, deactivate, reactivate, dispose, disposal/revert, archive, lifecycle/list) with the FLEET-002 revision CAS as the expected-state proof. Acquisition is its own command; activation history stays in its existing revision/receipt/audit/allocation. | History must survive revert while the asset row answers "is it disposed now" with one indexed read; one receipt namespace keeps cross-kind reuse OPERATION_ID_REUSED; revision CAS is stricter than a state name and is already the FLEET-002 contract. | Disposal only on the row (revert loses history); history-only disposal (every intake read scans history); a second receipt table; adding acquisition to create/change (changes historical request digests); amounts, counterparts or an acquisition kind not defined by the specification; backfilling activation rows. | EMP-FLEET-003; B-BR-EMP-202..204; fleet.md §3, §6.1, §8; migration 000201. | | EDR-144 | Declare AssetOpenWork (kinds TRIP, WORK_ORDER) as an explicit port asked inside the command transaction by deactivate/dispose/archive, wire the named NoOpenWork adapter until trips and work orders exist (nil port fails closed), and map a non-empty answer to ASSET_HAS_OPEN_OPERATIONS details naming each kind. Record the §9 lifecycle facts as the exact audit actions (fleet.asset.deactivated, fleet.asset.disposed with the disposal kind as registered reason code, fleet.asset.archived, plus fleet.asset.reactivated, fleet.asset.disposal_reverted, fleet.asset.acquisition_recorded) and the immutable history row; do not enqueue an orgevent envelope because the asset owner does not use orgevent and no consumer exists. Leave allocation periods, assignments and reservations untouched. | BR-FLEET-010 is only as complete as its adapters (task risk); orgevent requires a declared consumer and FLEET-006 is the first real consumer of the disposal; FLEET-005/006/007 own periods, assignments and reservations. | A fake trip/work-order table or always-open test adapter in production; an invented consumer or unconsumed outbox rows; closing allocation periods or ending assignments here. | EMP-FLEET-003; B-BR-EMP-205; BR-FLEET-010/023; fleet.md §9; retained FLEET-005/006/007, trip and maintenance obligations. | | EDR-145 | Hold a signed meter reading declared at or after the current disposal instant as ASSET_UNAVAILABLE through the existing OFFL-008 held store, decided after the retained-authority APPLY classification under the organization root and asset row locks; PERMISSION_CHANGED keeps precedence. Defend it in SQL: the live reading guard refuses an observation at or after the disposal and the held-source guard requires an actual disposal for an ASSET_UNAVAILABLE fact. Keep current normal handling for DRAFT/INACTIVE assets and after a revert. | BR-FLEET-009/027 and the fleet.md §8 disposal row require a held, never silently refused or accepted, operation; the exact nanosecond boundary matches meter instants; locks give a single outcome against a concurrent disposal. | A new review mechanism, refusing or accepting post-disposal readings, holding by asset state without an instant, holding INACTIVE/DRAFT before derived availability exists, re-evaluating already accepted readings. | EMP-FLEET-003 / EMP-OFFL-008 / EMP-METER-002; B-BR-EMP-206; BR-FLEET-009, BR-FLEET-027; retained derived-availability obligation. | | EDR-146 | Add the sensitive-access contract to the existing organization audit module: a closed four-category domain value, an AccessRecorder port and an AccessLog adapter that writes the existing generic audit event plus one append-only detail row (category, membership, grant UUID) in the same audit-runner transaction through additive migration 000202, guarded in the database against category/action mismatch, unlinked grants, foreign scope and a sensitive event committed without its detail. A replayed request UUID is stored once and refused. | BR-AUD-003 needs the actor's membership and the grant behind each read, which the generic event only hashes; the generic event and its readers stay unchanged for every other module. Server-generated request UUIDs are unique per actual access, so a replay is a collision or an unknown earlier outcome; serving under it would be an unrecorded second access. | A separate access-log table duplicating actor, target and time; widening the generic event for all modules; storing permission keys, binding digests, filters, row counts or file metadata; idempotent re-serving on replay; a membership foreign key that would couple the trail to membership lifecycle. | EMP-PRIV-005; B-BR-EMP-207/209/210; BUC-EMP-107; migration 000202, compatibility floor unchanged. | | EDR-147 | Route EMP-PLAT-006 private document issue/read through AccessRecorder with the existing action names; record the issuance before the capability is minted; map a member without doc.document.view_content to a distinct FORBIDDEN; declare EXPORT_FILE, LOCATION_LIVE and LOCATION_TRACK in the contract without any producer; register no operator or support reason. | One recorder for every sensitive category keeps EMP-DOC-002, EMP-RPT-001 and EMP-GPS-012 on the same audited path; a capability that is never minted cannot leak; BR-AUTH-013 separates a missing permission from not-found. | New export or location routes or producers before their owning tasks; a separate document-only audit; recording after content release; treating a support session or staff status as permission; adding an audit read route in this task. | EMP-PRIV-005; B-BR-EMP-207/208; BUC-EMP-106. Retained: live AUTH/DOC authority binding (EMP-DOC-002, EMP-AUTH-003), export producer (EMP-RPT-001), location producers (EMP-GPS-012, F4), support sessions (EMP-BACK-003), audit viewer route (UC-RPT-05). | | EDR-148 | Model a period as the organization-wide calendar month YYYY-MM of BR-TIME-004 reporting days (half-open first day to first day of the next month), with an implicit unstored OPEN at revision 1 and append-only transitions LOCK (OPEN→LOCKED), REOPEN (LOCKED→REOPENED, reason required) and RELOCK (REOPENED→LOCKED), so a revision is even exactly when LOCKED. Persist org_finance_period_transitions (immutable history and command receipt) and the trigger-maintained head org_finance_periods in migration 000203, under the review module (review/domain/period, review/application, review/adapters). | VAL-19 states periods as calendar months with half-open dates; a reporting day is already zone-attributed, so a month of days is zone-independent. The implicit revision 1 lets every command carry an expected revision (orgapi refuses revision 0) without materializing every month. Database guards keep history and receipts immutable and the head consistent. 06-domain-model places Period in the review module. | Arbitrary custom date ranges; per-unit or cost-centre locks now (structural scopes belong to EMP-AUTH-006); storing OPEN rows for every month; an un-revisioned toggle; deleting or rewriting a lock on reopening; a "period must have ended" rule that no source states. | EMP-APPR-006; B-BR-EMP-211/212; BR-TIME-004, BR-AMD-004, BR-AUD-001; VAL-19; scoped periods retained for EMP-AUTH-006 and the finance policy. | | EDR-149 | Authorize close/reopen with fin.period.close/fin.period.reopen as fresh ConfigurationWrite policies on the organization target (ORG-scope grants only) and require an ACTIVE root; gate list/read with fin.period.close because no read key exists. Serialize period commands against record writes on the organization root: commands hold it FOR UPDATE, the gate takes FOR KEY SHARE inside the owning record transaction and then reads the head; the gate attributes days with the published organization zone (organizations.time_zone) or the unit zone and maps facts to orgamend (REOPENED carries authority proven only from a stored fin.period.reopen transition with its reason). | BR-TIME-003 evaluates locks at receipt, so the fact must be read under a lock that a concurrent close cannot pass; the root row always exists, unlike a never-locked period row, and FOR KEY SHARE conflicts only with the exclusive lock that every company write already takes. Reopening affects approved financial figures, so fresh proof matches other sensitive decisions. Reading the reopening from history keeps "proven" a server fact, not a client claim. | A new permission key or catalog version; letting AUDITOR or record writers read the list now; reading the state outside the record transaction or with a lock on a possibly missing period row; trusting a device or entry zone for attribution. | EMP-APPR-006; B-BR-EMP-213/214; BR-TIME-003, BR-AUTH, BR-AMD-004; 07-permissions §7.3; orgamend Reopening; real consumers retained for EMP-FUEL/EXP/TRIP. | | EDR-150 | Place the notification core in the new module orgnotify (domain, application, adapters, adapters/http) with additive migration 000204: forced-RLS tables for immutable requests and recipients (request PENDING until its single dispatch claim), notices (only read state changes), append-only delivery history (IN_APP, DELIVERED/SUPPRESSED with INELIGIBLE, MUTED or LIMITED), per-member preferences with revisions, fixed-hour budgets and append-only member command receipts. Producers call the producer port inside their orgevent/audit transaction and list the notif.dispatch consumer; the composition-registered kind catalog fixes template keys, typed parameters (UUID, enumerated code, count, date), an optional relative link template, an optional required permission and the mandatory flag. Bounds: 50 recipients per request, 10 requests per event, 8 parameters, 20 notices per recipient and kind per UTC hour. | REQ-17.2 and UC-NOTIF-01 require scoped de-duplicated delivery with preferences, limits, attempts and history; EMP-PLAT-010 is the established transactional follow-up on the existing queue, so no broker or worker is added; BR-PRIV-008 and the module §10 forbid content and secrets in notices, which typed references enforce structurally; BR-NOTIF-001 and BR-AUTH-014 require current recipient checks at dispatch; the bounds reuse the orgevent 50-consumer precedent and the identity fixed-window limiter style. | Free-text titles or bodies; producer-supplied links or URLs; dispatch inside the producer transaction; trusting the event payload for recipients; stored-and-mutated delivery state; silent drop at the limit; per-channel preferences or recorded external attempts before EMP-NOTIF-002; a production producer or worker registration now; a guessed global kind list. | EMP-NOTIF-001; B-BR-EMP-215..217; producers (EMP-RPT-004, approvals, alerts) register kinds and compose notif.dispatch in the existing Dispatcher; EMP-NOTIF-002 owns channels/FAILED; EMP-NOTIF-003 owns alert rules; retention/erasure of inbox rows and budgets retained. | | EDR-151 | Expose four self routes under /v1/orgs/{org_id}/memberships/{membership_id} (notifications/self/list, notifications/self/{notice_id}/read, notification-preferences/self/read, notification-preferences/self/update) through a new special SELF_NOTICE boundary on the company cookie plane (cookie, CSRF, account binding, not fresh), with current AUTH-003 authority loaded in the same scoped transaction; no catalog permission is added. Member commands use own operation receipts with a request digest (replay returns the original result, a different digest is OPERATION_ID_REUSED) and a dedicated notif.self write-admission class that inherits the identity v1 write allowance; organization audit events are not written for personal read state or preferences. Organization SUSPENDED/ARCHIVED still admits these personal routes; CLOSED does not. | Every member reads only their own notices, so a resource permission would grant nothing; the permission catalog belongs to parallel AUTH work and the existing SELF_DEVICE boundary is the precedent for account-bound self routes; managed-access drivers have no web session, so their app entry belongs to EMP-NOTIF-004; read state and mute flags are personal settings, not organization business facts, yet need replay safety and bounded admission. | A new notif.inbox.read catalog key in this task; reusing an unrelated permission; fresh-auth for reading an inbox; Android signed entry now; audit rows per read mark; last-write-wins preferences without revision; exposing delivery history or other members' notices on member routes. | EMP-NOTIF-001; B-BR-EMP-218; BUC-EMP-111; a catalog permission for inbox access (AUTH owner), the Android signed inbox and lock-screen rules (EMP-NOTIF-004), operator history views and production quota measurement retained. | | EDR-152 | Persist the DOC container as table org_documents (migration 000205) keyed by (org_id, id) with the declared original, creator membership, creating operation and one state column per dimension (five commanded with their own revision, reconciliation derived), and make it the sole owner of the private original's identity: the orgmedia object is projected from the row (document UUID, digest, size, type, storage revision, ready iff STORED). The database guard enforces scope, initial states, immutable identity and the EMP-DOC-001 graph per dimension; a test compares it with the Go domain. The client declares the document UUID; creation and the stored transition are audited events (document.upload.created, document.upload.stored) and the operation UUID is the idempotency key. | UC-OFFL-03 seals the declared attachment identity before bytes exist, so a replay must name the same document; one identity keeps storage keys, audit targets and later links on the same UUID; independent revisions let EMP-DOC-005/006/009 command their own dimension without touching storage; the database repeats the domain graph as a second layer (BR-PRIV-001). | A parallel media-object table or a second identity; a JSON status blob or one shared revision; a server-generated document UUID; a membership foreign key that couples the record to membership lifecycle (EDR-146 precedent); deleting rows or physical cleanup here. | EMP-DOC-002; B-BR-EMP-219..220; BUC-EMP-112. Other dimension commands retained by EMP-DOC-005/006/009/010, links by EMP-DOC-003, retention/deletion by EMP-DOC-012. | | EDR-153 | Deliver bytes through one capability-bound binary ingress POST /v1/orgs/{org_id}/documents/{document_id}/content/upload (special authorization boundary DOCUMENT_INGRESS), verified before the body is read and rechecking creator and current doc.document.attach authority, and deliver content through the guarded company routes content/access (capability) and content/read (base64 in no-store JSON). Accept only image/jpeg in C1; orgmedia's synchronous inspection decides type by content, so RECEIVED and STORED commit together after a verified snapshot, and refused transfers stay UPLOADING. Authority rechecks reuse orgaccess Authorization.Prepare inside the document transaction. Storage is an optional composition input: without it the routes stay mounted and refuse bytes and content as unavailable. | BR-PRIV-004 and UC-OFFL-03 name the short member-bound capability and the API ingress; checking the capability and a transfer slot before reading avoids unauthenticated multi-megabyte JSON bodies; the existing private route gate requires JSON responses, so base64 avoids a second binary response boundary and cannot be sniffed as active content; only the JPEG inspector exists, and a budget alone must not enable a format (EMP-PLAT-006); reusing Prepare avoids a second copy of membership, organization-state and coverage rules. | Raising the shared 64 KiB JSON limit for base64 uploads; a bearer storage URL or query-string token; enabling PNG, PDF or XML by budget; marking FAILED or QUARANTINED without the reviewed safety job; reusing the community R2 bucket for organization documents; an Android signed upload path before EMP-DOC-004/EMP-OFFL-005. | EMP-DOC-002; B-BR-EMP-220..222; BUC-EMP-113. Retained: active-content inspectors and safety job (EMP-DOC-014), Android producer (EMP-DOC-004), provider qualification and runtime configuration of the private bucket. | | EDR-154 | Store allocations in two new forced-RLS tables org_asset_unit_periods and org_asset_cost_centre_periods (valid_from, nullable valid_to, recorded_at; primary key (org_id, asset_id, valid_from); composite same-organization foreign keys) with EXCLUDE USING gist (org_id WITH =, asset_id WITH =, tstzrange(valid_from, valid_to, ')') WITH &&), which needs the btree_gist contrib extension (PostgreSQL License, shipped in the pinned postgis/postgis:18-3.6 image, trusted, no network or new service). The first unit period is opened by the database from the FLEET-002 initial allocation row (an after-insert trigger copies its unit and exact started_at); migration 000206 applies the same rule to existing rows (start = recording instant = started_at, DRAFT none, no cost centre) after a consistency check that aborts the whole migration, lifting forced RLS only inside the atomic migration. Guards: admit ACTIVE unit/cost centre under the root lock, asset not DRAFT, no start before the first unit period, never delete, close once; a deferred trigger keeps the unit chain gap-free with one open period starting at activation. org_assets.unit_id and org_asset_unit_allocations stay unchanged as the rollback image. | BR-FLEET-015 and fleet.md §8 require period invariants as exclusion constraints; uuid equality inside a GiST exclusion needs btree_gist; deriving the first period from the existing activation fact keeps one start rule for old and new rows and keeps the previous binary's activation valid during the expand/contract window. | Evolving the immutable legacy table in place (its statement trigger, partial open index and clock-forced insert guard block closing and successor periods); a trigger-only overlap check (races without the root lock); start at asset creation or receipt time (not when the unit took effect); deriving a cost centre from the unit; changing the Go activation path (breaks the previous image); ON DELETE CASCADE. | EMP-FLEET-005; B-BR-EMP-223..225; BR-FLEET-015; fleet.md §3, §8; migration 000206. | | EDR-155 | The snapshot port UnitAndCostCentreAt / UnitAndCostCentreAtTx reads both histories in one statement without locks (a caller needing serialization against a reallocation holds the organization root lock first, the established order), floors the instant to the microsecond, returns not-found for a missing or foreign asset, ErrUnallocated without a covering unit period and an empty cost centre when none covers it. History routes are POST .../fleet/assets/{asset_id}/unit-allocations/list and .../cost-centre-allocations/list (current fleet.asset.read, start keyset, omitted valid_to while open). Lifecycle commands never open or close periods. Unit and cost-centre usage guards count ACTIVE assets whose period for the structure is open-ended or ends after the database clock and allow-list the new foreign keys; asset usage allow-lists them as non-use. No public reallocation command is added: the example-3 change is test-only SQL through the real guards; the transfer with effective instant, scheduling and cancellation, the asset view's current allocation and the retirement of the legacy column are EMP-FLEET-008. | BR-FLEET-016/017 and BR-AUTH-005 make the stored record snapshot authoritative, so the port answers by period, not by current state; every boundary is a database microsecond so flooring is exact; an out-of-service asset still belongs to its unit and readings on INACTIVE assets are still applied (FLEET-003), so closing periods at deactivation would leave accepted records unallocated. | Closing the unit period at deactivation/disposal; answering from org_assets.unit_id; a nanosecond (timestamptz, submicro) boundary (no GiST range support); an internal transfer command before FLEET-008 defines effective-instant, scope and cancellation rules; row locks in the port (lock-order inversion with root-first commands). | EMP-FLEET-005; B-BR-EMP-224, B-BR-EMP-226; BR-FLEET-016/017; BR-AUTH-005; 07-permissions §10 example 3; retained EMP-FLEET-008, EMP-AUTH-006. | | EDR-156 | Implement exports in a new module orgexport (backend/internal/modules/orgexport/{domain,application,adapters,adapters/http}), unrelated to the public-portal enterpriseexport. Migration 000207 adds org_export_jobs (forced RLS, append-only metadata, transition/immutability guard, deferred FK to the request audit event, requester membership checked ACTIVE at insert). States QUEUED/RUNNING/READY/EXPIRED/FAILED, with RUNNING→QUEUED only as a fenced lease release; closed failure codes EXPORT_TOO_LARGE, EXPORT_RIGHTS_LOST, EXPORT_FORMAT_UNAVAILABLE, EXPORT_ATTEMPTS_EXHAUSTED. Infrastructure ceilings 500 000 rows (BR-RPT-009), 16 MiB and 120 s; three attempts; open-job limit 3; retention fixed at 7 days per job (CHECK 1–30 days). Queue kinds org-export-build and org-export-cleanup (enqueued at READY with not_before = expiry, and at FAILED when a provisional object exists) each run on their own serial worker slot, are excluded from the general dispatcher (so they wait without charging attempts while the worker composition is off) and carry {version, org_id, export_id} only. Object key org/<org_id>/export/<export_id>/<sha256>, create-only, provisional digest recorded before upload, READY only after read-back verification under the same lease; cleanup deletes and confirms absence, then records object_deleted_at. Formats are a closed Registry of Format ports (kind, media type, ceilings, canonical parameters, bounded producer); production registers none, so every kind is EXPORT_FORMAT_UNAVAILABLE until EMP-RPT-002 admits one; tests register a synthetic kind. | BR-RPT-001/002/004/005/009/010 and BR-PRIV-004/009 need a durable, scoped, bounded job with private delivery, and the existing queue gives at-least-once SKIP LOCKED delivery and not_before; a row lease adds the per-export fencing the queue cannot give after a lost queue lease. A per-job delayed cleanup avoids an unscoped cross-organization sweep under forced RLS. A digest-named create-only key makes duplicate work converge and lets a stale object be identified. The byte ceiling follows from buffered, base64 JSON delivery (EDR-157). | Reusing enterpriseexport or orgmedia objects (document-bound keys and types); a cross-organization sweep; overwriting a fixed key; marking READY before verification; truncating at a ceiling; inline CSV in the request and cancellation now; an organization retention setting now; inventing a real format. | EMP-RPT-001; B-BR-EMP-227/228/229; BR-RPT-001/002/004/009/010; BR-PRIV-003/009; 09-architecture §§7, 9; formats retained for EMP-RPT-002, inline CSV/cancel/retention setting retained. | | EDR-157 | All five routes POST /v1/orgs/{org_id}/reports/exports/{request,list} and .../{export_id}/{read,access,content} are CompanyOnly and use rpt.export.run with fresh proof (the catalog requires fresh proof for that key); request is a ConfigurationWrite (operation ID, quota class rpt.export, organizations capability on, ACTIVE root, 202), the others are reads. The organization is the resource target; requester binding is enforced in the repository, so a non-requester gets NOT_FOUND. The worker uses a separate authority port without a session (account, membership, root, covering role) implemented in organization/adapters beside the company pipeline. Delivery is two steps: access records EXPORT_FILE/ISSUED through the EMP-PRIV-005 AccessRecorder and returns a capability sealed with httpapi.Seal in the domain orgexport.access.v1 (origin, organization, account, membership, job, digest, size, rows, media type; 5-minute inner deadline); content takes it in the body, records SERVED against that grant and returns the verified bytes base64-encoded in the JSON no-store envelope. Codes EXPORT_QUEUE_FULL 429, EXPORT_NOT_READY 409, EXPORT_EXPIRED 410 and EXPORT_FORMAT_UNAVAILABLE 422 join the organization error registry. | Every organization route is POST + JSON + no-store by the route gate, so the capability stays in an authenticated body and no storage URL is emitted (BR-PRIV-004). Recording before minting or releasing follows EMP-PLAT-006/PRIV-005. A session-free worker check is the only way to re-evaluate rights when the requester is offline (BR-RPT-002). Opaque NOT_FOUND avoids revealing other members' jobs. | Presigned storage URLs; a raw-byte response outside the guarded gateway; a token in a query string; reusing the document capability domain; authorizing downloads from the job ID alone; per-kind read permissions now (EMP-AUTH-011/RPT-002 extend the authority port with the kind). | EMP-RPT-001; B-BR-EMP-227/230; BR-RPT-004/005, BR-PRIV-004/008, BR-AUTH-010; orgaudit EXPORT_FILE; authorization inventory and matrix. | | EDR-158 | Model fiscal structure as the pure Go package document/domain/fiscal (Kotlin enterprise.document.fiscal) returning one result: outcome STRUCTURE_OK, STRUCTURE_INVALID or UNSUPPORTED, one closed reason and the ordered checks that ran; it feeds only Structure UNCHECKED→STRUCTURE_OK/STRUCTURE_INVALID and UNSUPPORTED commands nothing. Accept the alphanumeric issuer layout of NT 2025.001 recorded in 18-references §3 (AS-10) and do not check the issuer's own check digits inside a key. Support QR version 2 (online and offline) and version 3 online, hosts under .gov.br and exactly one p parameter. Whatever is not identified as a handled layout, version, variant, host or model is UNSUPPORTED; STRUCTURE_INVALID is reserved for a violated pinned layout or bound. | BR-TRUTH-001/002 and EDR-014 need a result that names what was checked and offers no path to an authorized status; 18-references §3 pins the key layout, the ASCII−48 values and the p prefix (version-2 field details beyond that prefix are prior knowledge, marked UNVERIFIED like the precedents there); unknown versions, the version-3 contingency variant, other document models and unknown hosts must not be called invalid by guess; model-55 keys of CPF issuers carry a zero-padded CPF in the issuer field, so CNPJ digits inside the key would be a guessed rule. | A boolean "valid"/"validated" flag; mapping UNSUPPORTED to STRUCTURE_INVALID; exposing protNFe cStat or any authorization/cancellation field; fetching the QR URL or consulting a provider; verifying the QR hash (needs the issuer's secret CSC); a per-state URL allowlist without a pinned source; a digits-only key after AS-10. | EMP-DOC-006; B-BR-EMP-231..233; BUC-EMP-118; EDR-014, EDR-134, AS-10; 18-references §3. Retained: authorized consultation port (EMP-INTEG-004), app capture (EMP-DOC-009). | | EDR-159 | Check the XML envelope only on the server with Go encoding/xml (strict tokens, no entity map, no charset reader) behind explicit limits — 1 MiB (BR-PRIV-020) before parsing, depth 32, 100 000 elements — refusing any <! declaration at its first token; mirror only the access-key, QR and comparison checks in Kotlin, and mark the XML rows of the shared oracle Go-only with their count asserted by the Kotlin consumer. Add no dependency and no XSD validation; convert an exact total to centavos only with the existing exact parser. | The standard decoder never resolves external entities and returns DOCTYPE as a token, so refusal needs no new library; Android's XmlPullParser and the JDK SAX/StAX stacks differ in DOCTYPE and entity handling, so a client XML mirror could disagree with the server verdict; the app reads QR codes (EMP-DOC-009) while XML originals reach the server (EMP-DOC-014); the bounds keep a legitimate document (depth about 10, well under 100 000 elements at 1 MiB) far inside the limits. | A Kotlin XML parser mirror; a third-party XML or XSD library (would need the AGENTS.md dependency, licence and security review); expanding or ignoring DTDs; trimming or normalizing values; floats or rounding for totals. | EMP-DOC-006; B-BR-EMP-234; BUC-EMP-119; BR-PRIV-020. Retained: upload safety job (EMP-DOC-014), fiscal items (EMP-DOC-007), duplicate signal (EMP-DOC-008). | | EDR-160 | Widen org_role_assignments additively in migration 000208: the scope_type check admits UNIT, COST_CENTRE, TEAM, ASSET; four stored generated columns (scope_unit_id, scope_cost_centre_id, scope_team_id, scope_asset_id = scope_target when the type matches) carry composite same-organization foreign keys to org_units, org_cost_centres, org_teams, org_assets; a BEFORE INSERT trigger that fires after the existing revision guard (which already holds the account and root locks) refuses a missing/foreign target as 23503 and a non-admissible one (unit/cost centre/team not ACTIVE; asset DRAFT or ARCHIVED) as 23514. The four structure usage sources (unit, cost centre, team, asset; latest 206/177 bodies) only allow-list the new keys; assignments are never counted as use, archiving ends no assignment. | BR-AUTH-004 and §3 require a same-organization target; a generated column per type gives a real foreign key without changing the insert, the previous binary or existing rows (their structural columns stay NULL); every structure archive and the assignment guard already serialize on the root row, so admission cannot race an archive; the usage sources fail closed on any unknown key and must recognise the new ones; BR-ORG-009 lists assets, employees, budgets and operations, not grants, and BR-ORG-012 keeps history readable after archive. | A polymorphic target checked only by trigger (no referential guarantee); separate nullable target columns written by the application (changes the previous image and every insert); counting grants as structure use (would block archives on rights, not work); ending grants on archive (would hide history); admitting DRAFT assets (discard deletes them). | EMP-AUTH-006; B-BR-EMP-235, B-BR-EMP-238; BR-AUTH-004/007, BR-ORG-008/009/012; migration 000208; rollback: route acceptance of the new scopes can be withdrawn while stored assignments are retained. | | EDR-161 | Resolve structural facts only when needed: ResourceFacts gains server-owned UnitID, CostCentreID, AssetID and Teams; CoveringRules matches UNIT/COST_CENTRE/ASSET by equality and TEAM by membership in Teams, intersected with own-records for S descriptors. Authorization gets an optional Structure source consulted by Prepare (application clock) and the company authority re-check consults the same lookup in the owning transaction (database clock), both only when the member holds a current structural assignment with a positive rule for the permission, and a source may set only the four structural fields. Delivered sources: assets (fleet asset, lifecycle, allocation-history and meter routes) through the FLEET-005 port; held meter readings (review read/resolve) from their stored asset and unit, no cost centre, and the author employee's team links containing the acknowledgement receipt instant. | BR-AUTH-005 and example 3 require the stored snapshot, and an asset has no stored snapshot other than its periods; resolving lazily keeps every existing ORG/SELF request byte-for-byte on its previous queries, refusal order and error codes; recomputing inside the owning transaction keeps the authority → visible → authority order; the held reading is the only delivered record that stores a unit, so it is the honest example-3 entry point; team links are retained server periods, so the record instant gives a deterministic, non-widening answer. | Resolving facts on every request (changes NOT_FOUND/FORBIDDEN order for existing roles and adds queries); the asset's current unit for stored records; current team membership; assets covered by a team (no storage; pool by team is out of FLEET-006); deriving a cost centre from the unit; a caller-asserted scope; filtering organization lists by scope in this task. | EMP-AUTH-006; B-BR-EMP-236, B-BR-EMP-237; BUC-EMP-121; consumers adopt a source when their record stores a snapshot (fueling, expense, trip, documents, periods; EMP-APPR-002 routing; FLEET-006 SELF/assignee). | | EDR-162 | Persist links as insert-only org_document_links (migration 000209) keyed by (org_id, document_id, target_kind, target_id), with a unique creating operation (deferred FK to its document.link.created audit event) and one nullable typed reference column per registered binding — asset_id → org_assets, employee_id → org_employee_identities, reading_id → org_meter_readings, held_reading_id → org_meter_held_readings(org_id, reading_id) — all composite same-organization foreign keys, tied to the kind by a CHECK so exactly the kind's column carries target_id. Accept only kinds with a target resolver registered by their owning module (closed registry: C1 ASSET, EMPLOYEE, METER_READING); refuse FUELING, EXPENSE, WORK_ORDER and TRIP until their owning task adds a table, a column with its foreign key in a new migration and a resolver. Extend the asset usage source's foreign-key allow-list with the new reference and refuse links to DRAFT assets so a physically discardable draft never gains a reference. Unlink is not offered. | BR-TEN-001/005 and §5 of the domain model require composite same-organization references; a polymorphic UUID without a foreign key cannot prove the target exists or stays in the organization, and storing unregistered kinds would create dangling references the owner never validated; held and stored readings share one identity, so one target_id keeps duplicates out across both; the 206 usage source refuses unknown foreign keys to assets, and counting a link as use would change the discard and kind-fixing semantics owned by fleet. | A polymorphic target without foreign keys; accepting unresolved kinds for later validation; a JSON link list on org_documents; counting links as asset use or rewriting the asset guard; deleting links or an unlink command before reviewed retention (EMP-DOC-012); a per-kind link table. | EMP-DOC-003; B-BR-EMP-239, B-BR-EMP-241, B-BR-EMP-242; BUC-EMP-122. Retained: FUELING (EMP-FUEL-002), EXPENSE (EMP-EXP), WORK_ORDER (EMP-MAINT), TRIP (EMP-TRIP) resolvers and columns; unlink/correction and retention (EMP-DOC-011/012). | | EDR-163 | Check both endpoints inside the link transaction with orgaccess Authorization.Prepare (the existing CurrentAuthority over the borrowed transaction): the document side with doc.document.attach over the document's facts, the target side with the permission its owner resolver declares (OperationalWrite to create, Read to list; capability organizations; not fresh, because a link is an operational association and the guarded entry already confirmed the session), resolving the target only after a positive permission. Expose three company routes under doc.document.attach with a link-specific record gate — POST .../documents/{document_id}/links/create (201), .../documents/{document_id}/links/list and .../documents/links/by-target (200, sealed keyset cursors) — and the Go port Linker.LinkTx(ctx, tx, scope, actor, link) that consumers call in their own scoped transaction. Lists show link metadata and the document's storage status only; content stays behind doc.document.view_content. | Each consumer owns its record's permissions (task risk; documents §7) while the document module owns the association; Prepare reuses membership, organization-state and coverage rules instead of a second copy; one inventory permission per route keeps the existing matrix representative; a port in the consumer's transaction lets FUEL-002 commit a fueling and its receipt link atomically (UC-OFFL-03). | Granting content or metadata from the target permission; a fresh-proof target policy; per-kind owner read routes now (asset detail, fueling review and DOC-015 viewer embed links in their own read surfaces later); routing under doc.document.read, which no role holds; resolving targets before checking permission. | EMP-DOC-003; B-BR-EMP-240..242; BUC-EMP-123. Retained: owner read surfaces (SCR-FLEET-02, SCR-FUEL-05, EMP-DOC-015), Android link producer (EMP-DOC-004, EMP-FUEL-011). | | EDR-164 | Store assignments in a forced-RLS append-only org_asset_assignments table (id, asset_id, employee_id, kind, valid_from, nullable valid_to, optional reason, creating operation and actor, server recorded_at; end cause ENDED, REPLACED, EMPLOYEE_TERMINATED or ASSET_DISPOSED with ended_at, the ending operation/actor/reason for commands and the source revision for system causes; composite same-organization foreign keys to org_assets and org_employee_identities) with EXCLUDE USING gist (org_id WITH =, asset_id WITH =, tstzrange(valid_from, valid_to, '[)') WITH &&) WHERE (kind = 'PRIMARY'); an ended-before-start assignment keeps an empty period (the empty range overlaps nothing). Receipts live in a new org_asset_assignment_commands table (kinds CREATE, END; the created/ended identifiers and the replaced one) with deferred audit and receipt foreign keys; the audit namespace keeps one operation identifier per command organization-wide. Routes under /v1/orgs/{org_id}/fleet/assets/{asset_id}/assignments/ (create, {assignment_id}/end, list) and /v1/orgs/{org_id}/fleet/assignments/mine/list; writes use fresh fleet.asset.assign (configuration write, organizations capability, its own fleet.assignment admission class), reads current fleet.asset.read; no asset revision is required. Codes: ASSIGNMENT_OVERLAP (409, fleet.md §10.5), CONFLICT for ending an ended assignment, VALIDATION_FAILED for a non-ACTIVE employee, a non-assignable asset, a past start, a missing TEMPORARY end, duplicates or more than 100 employees, NOT_FOUND for a foreign or unknown employee/assignment. A bulk command is bounded to 100 employees (the page bound) and is atomic. Notifications to assignees are retained: recipients are memberships while assignments name employee records, and "notify when an assignment starts" needs a scheduled producer that NOTIF-001 does not provide. | BR-FLEET-018..022 need per-employee rows, server-derived states and a database guarantee against concurrent primaries (fleet.md §8: period invariants are exclusion constraints); the FLEET-005 tables are the precedent for half-open microsecond periods and btree_gist; an empty period represents §6.3 "end before the start" without a stored state; a separate receipt table carries a set of results that org_asset_commands (revision/state results) cannot; the employee may have no app access, so a notification kind cannot be registered cleanly yet. | A stored state column (drifts from time); deleting or rewriting a scheduled assignment; an application-only overlap check; reusing org_asset_commands; requiring the asset revision (assignments do not change the asset); a partial bulk; inventing per-employee overlap rules, a cancellation state or a notification without recipients. | EMP-FLEET-006; B-BR-EMP-243, B-BR-EMP-244; BR-FLEET-018..022/024; fleet.md §6.3, §8, §10.5; migration 000210; rollback: capability flag off, tables remain. | | EDR-165 | End assignments on employee termination and asset disposal inside the source transaction with two AFTER UPDATE OF state row triggers (org_employee_identities → TERMINATED; org_assets → DISPOSED), as the 177 team-link reductions do, with the row guard proving the cause against the source row (state and revision; for disposal the exact disposed_at floor) instead of enqueuing an orgevent envelope for an asynchronous consumer. Resolve the assignee fact lazily like EDR-161: orgaccess gains SelfCandidate and an optional Authorization.Assignee source consulted by Prepare (application clock) and by the company authority re-check (database clock, in the owning transaction) only when the member holds a current SELF grant with a positive rule for the permission; the source answers through the Fleet AssignedAssetsPort (AssignedAtTx, AssetsAssignedAtTx: membership period and assignment period both containing the instant), which is the query EMP-METER-002 and EMP-OFFL-006 consume. The own list targets the requesting membership itself (assignee = member) and consults no structure. | BR-FLEET-023 says "at that instant"; a same-transaction trigger cannot be skipped by any current or future producer (offboarding, merge, disposal), needs no worker, no retry and no orphan consumer, and the 177 precedent already reduces team links this way; the orgevent path would add an asynchronous window where a terminated employee or disposed asset still counts as assigned. Lazy resolution keeps every existing ORG and structural request on its previous queries and refusal order; the membership period stops an ended membership from being listed even when its employee record keeps assignments. | An orgevent consumer or worker job (asynchronous gap, retry and ordering obligations); ending assignments in the Go lifecycle/offboarding code only (misses the merge and future producers); resolving assignee facts on every request; treating any assignment of the employee as the member's after the membership ended; widening the signed meter intake here. | EMP-FLEET-006; B-BR-EMP-245, B-BR-EMP-246; BR-FLEET-023, BR-AUTH-004; fleet.md §7, §9; retained EMP-METER-002/OFFL-006/FLEET-013 consumers. | | EDR-166 | Keep org-roles-v1/org-permissions-v4 unchanged: AUDITOR already holds exactly the twelve documented keys and no write key, so no catalog version, vector or consumer changes. Retain org.ownership.respond for AUDITOR as the personal consent key of EDR-048, classified "personal consent" in the auditor matrix: the transaction participant check confines read/accept/cancel to a proposal addressed to the auditor (others NOT_FOUND). Keep finance period list/read under fin.period.close (EDR-149): no fin.period.read key now. Prove the role on the actual composed company HTTP entry: every routed normal route (22 positive, 81 FORBIDDEN with the route key and an unchanged private-state snapshot at this head), request bodies taken from the OpenAPI examples, real records for every positive route, write routes refused except the export request and the own consent, foreign record/organization NOT_FOUND, and the own-inbox, own-device and self-leave boundaries refusing another member. | The task makes the auditor exactly the documented read-only set; 07-permissions §7.4 requires an explicit matrix revision for any new grant, and a period read key would widen the documented auditor column and every 85-key consumer. A nominated member needs consent authority that is not an owner privilege (EDR-048); removing it would make transfer to an auditor impossible without first granting another role. A route-by-route walk proves what the one-representative-per-permission matrix (200 cells) cannot: no second route under a granted read key writes. Prepare refuses before resolving records, so example bodies and synthetic IDs reach the real refusal. | A v5 catalog or a period read key in this task; removing the consent key from AUDITOR; sampling only representatives; inventing routes or accepting unrouted reads (trips, fuelings, expenses, indicators, audit trail, tracks) as proven. | EMP-AUTH-011; B-BR-EMP-247/250; BUC-EMP-126; BR-AUTH-001/003/011/013, BR-TEN-006; EDR-048, EDR-149; unrouted auditor reads retained by their owning tasks. | | EDR-167 | Add the per-kind data permission to the export ports: Format.ReadPermission(); ExportableRead admits only a registered <module>.<resource>.read key outside gps.* and NewRegistry refuses any other declaration; Registry.ReadPermission(kind); Command.ReadPermission(). A new Authority.CheckDataTx(actor, member, read) runs in the request transaction after CheckExportTx (before and after the insert, and on replay) and in the delivery transaction after the requester-bound row read (permission resolved from the registry by the stored kind; a retired kind is EXPORT_FORMAT_UNAVAILABLE); CheckRequesterTx(requester, kind, read) adds it to each worker attempt, after the format lookup. Coverage is the organization target only (ORG grants; structural and SELF read grants cover nothing here, fail closed). A denial is the bounded PermissionDenial of the read key, mapped to FORBIDDEN with that key; in the worker it is EXPORT_RIGHTS_LOST. No migration: the job's immutable kind is the binding and the code-frozen registry maps it to the permission; the request digest is unchanged. | UC-RPT-01 and intelligence §5 need rpt.export.run and "the read permission of the list"; BR-RPT-002 and BR-AUTH-014 forbid a queued or ready file from extending a removed right. One closed declaration per kind keeps the gate testable and lets EMP-RPT-002 plug real formats in without a new port. Content and location are separate permissions with per-item audit categories (BR-AUTH-011, BR-RPT-003), so a kind cannot use them as its basis. | Inferring the permission from the kind's name; a free-form or multi-key declaration now; checking only at request time; recording the permission in a new column (migration 000211) while the registry is code-frozen; admitting content or location kinds before their column-omission and per-item audit design (EMP-RPT-002, F6 full export BR-RPT-012); letting a UNIT- or SELF-scoped read cover an organization export before row scoping exists. | EMP-AUTH-011; B-BR-EMP-248/249/250; BUC-EMP-127; BR-RPT-002/003, BR-AUTH-010/014; EDR-156/157; real formats, sensitive columns and scoped rows retained for EMP-RPT-002. | | EDR-168 | Raise the backend race integration package bound from 30 to 45 minutes for the F3 batch, keeping every case. | organization/adapters took 1121.7 s on the hosted runner at 43b21389 (≈1.8× its ~620 s local race time); F3 adds period, document, export, notification, scope, allocation, assignment and auditor suites that raise its local time to ~800–900 s alone (1221 s under load), projecting ~27 min, too close to 30 min given the variance that already timed out PR #219. | Skipping or shortening suites, splitting the package in this batch, or letting CI fail by timeout. | [F3 execution ledger; .github/workflows/backend.yml integration job. | | EDR-169 | Place the safety check in two stages around one durable RECEIVED state. The ingress keeps integrity first (exact size and SHA-256 before anything else; a mismatch stays UPLOADING) and runs the reviewed inspector in memory before any write, so refused bytes never reach the bucket; clean bytes are stored create-only and recorded RECEIVED, and STORED is set only by the check over the stored object (bounded read, digest, type by content equal to the declared type, active content, unchanged snapshot). A content verdict on bytes that match the declared digest is terminal: unsafe → QUARANTINED UNSAFE_CONTENT, inadmissible → FAILED UNSUPPORTED_CONTENT, stored copy differing → FAILED INTEGRITY_MISMATCH; a nullable storage_reason column (migration 000212) holds one closed reason per transition under the existing row guard. The JPEG inspector gains orgmedia ErrUnsafe: bytes after the end-of-image marker and markup, script, entity, PDF, archive or executable signatures (all signatures inside the pre-scan metadata segments, only long markup tokens over the whole stream) are unsafe; non-JPEG magic, structure, pixel caps and decoding stay unsupported. A quarantined stored object is retained isolated; a failed one is removed with confirmed absence. C1 stays JPEG-only. | UC-OFFL-03 says the server verifies size and hash and queues the safety checks before STORED; checking the stored object (not only the request buffer) closes the gap between write and readiness and lets a job finish an interrupted check without the client; a digest-pinned declaration can never be retried into success, so leaving it UPLOADING would be untruthful; BR-PRIV-020 refuses active content and archives/executables, and the existing strict structure walk already finds the end-of-image marker; short signatures over entropy-coded data would quarantine honest photos by chance, while metadata segments are where markup polyglots live; DOC-006 left the XML inspector here, but admitting XML needs its own producer, declaration type and retention review. | Inspecting only the request buffer; leaving content refusals UPLOADING; storing refused bytes to quarantine them asynchronously; a separate quarantine prefix with copy-on-promote; sanitising or re-encoding originals (BR-PRIV-020 keeps originals unmodified); admitting PNG/PDF/XML by budget; a whole-stream scan for 4–5-byte signatures; deleting quarantined evidence before reviewed retention. | EMP-DOC-014; B-BR-EMP-251, B-BR-EMP-252; BUC-EMP-128; BR-PRIV-004/020, BR-OFFL-015, UC-OFFL-03; amends B-BR-EMP-220 and the "refused transfers stay UPLOADING" part of EDR-153 for content verdicts. Retained: XML inspector and admission, PNG/PDF inspectors, reviewed deletion of quarantined objects (EMP-DOC-012). | | EDR-170 | One queue kind org-document-safety (payload {version, org_id, document_id}, 10 attempts) runs on its own serial worker slot and is excluded from the general dispatcher; it is queued in the creating transaction (de-duplication …:expiry:<org>:<document>, not_before = session close + grace) and in the RECEIVED transaction (…:check:<org>:<document>, one minute later), so every document has a per-document delayed job and no cross-organization sweep exists. The handler converges the current row: RECEIVED → check, due UPLOADING → FAILED UPLOAD_ABANDONED, FAILED → remove the object, otherwise nothing. No row lease: every settlement is a compare-and-set on (state, storage revision) under FOR UPDATE, attempts and fencing are the queue's, and the final attempt settles CHECK_ATTEMPTS_EXHAUSTED. The upload session lasts 24 hours from created_at with a five-minute grace; the database guard refuses UPLOAD_ABANDONED before created_at + 24 h 5 min and capabilities are minted only if they expire by the close. System settlements are audited with the creating account as actor (taken from the creation event, the only account the creator-bound upload can involve) and a closed reason code. Migration 000212 queues the closure job for documents still UPLOADING or RECEIVED. The worker composes the handler only with a configured private document bucket; production configures none (as cmd/api), so queued jobs wait without charging attempts. | The verdict is deterministic over immutable inputs, so concurrent checkers can only disagree on whether they finished, never on the answer; a row lease (EDR-156) is needed there because export production is not deterministic and writes provisional objects; the export precedent avoids an unscoped sweep under forced RLS; two de-duplication keys keep the one-minute recovery of a crashed check independent of the 24-hour closure; a window bounded at declaration needs no write on declaration replays; the audit schema has no system actor and requires an account UUID. | A row lease and attempt columns on org_documents; one shared de-duplication key (would delay crash recovery to the session close); an hourly cross-organization sweep; closing at the five-minute capability expiry (panel retries would need a new declaration); recording each capability issuance; a synthetic system account; running document jobs on the general dispatcher. | EMP-DOC-014; B-BR-EMP-253, B-BR-EMP-254; BUC-EMP-129; BR-PRIV-003/008/009, BR-OFFL-015; EDR-156 (job precedent), EDR-152/153. Retained: Android capability path and its session window (EMP-DOC-004, EMP-OFFL-005), provider qualification and runtime grants (operator gate). | | EDR-171 | A CSV list is delivered as a ZIP package (application/zip, standard archive/zip, deflate, entries timed at the job's "as of" instant, no comment) holding <list>.csv and manifest.json (orgexport.list.v1). The CSV is written with Go encoding/csv: comma, LF line ends (UseCRLF off), UTF-8 with a byte-order mark as §10.10 documents, a header of stable lower-snake names with the unit suffix (_m, _s). Cells are typed: integer cells are formatted from server integers only and never prefixed; every other cell is text and gets one leading apostrophe when it begins with =, +, -, @, tab, CR, LF or an apostrophe (lossless: readers strip exactly one); text must be valid UTF-8; absent is empty. The pure writer lives in orgexport/domain (ListWriter), streams through the bounded Sink, counts each data row with a new Sink.CountRow (row ceiling) while the compressed bytes go through Sink.Write (byte ceiling), and computes the CSV's SHA-256, bytes and rows for the manifest. Spreadsheet (XLSX) kinds are not admitted: no reviewed dependency exists and the proposed minimal in-repository writer is not built here, so they stay EXPORT_FORMAT_UNAVAILABLE. | BR-RPT-007 asks for a manifest that accompanies a CSV and the job holds one object, so the standard ZIP package is the only standard-library way to deliver both (portal precedent: CSV plus JSON manifest with digests). UseCRLF would silently drop a lone CR and rewrite LF inside quoted text, so LF keeps the text exact. encoding/csv quotes only when a field needs it; the apostrophe, not the quotes, is what makes a cell inert, so BR-RPT-006's "quoted" is met by RFC 4180 quoting where needed (clarification proposed below). Prefixing original apostrophes makes the scheme reversible. Counting rows apart from bytes is needed because packaged bytes cannot be attributed to rows. A spreadsheet format needs the recorded review of CX-10 that this task does not complete. | A bare CSV with a comment preamble (breaks machine reading); the basis only in the job API (does not travel with the file); CRLF; a custom always-quoting writer instead of encoding/csv; neutralising integer cells (would turn exact negative offsets into text); a ; separator; adding an XLSX dependency or offering XLSX before review. | EMP-RPT-002; B-BR-EMP-256/257/258; BR-RPT-006/007/008/010/011; §10.10; CX-10 retained for XLSX; rollback: remove the three kinds from the composition (every request becomes EXPORT_FORMAT_UNAVAILABLE). | | EDR-172 | Admit fleet.asset_list.csv and fleet.meter_reading_list.csv under fleet.asset.read and idn.employee_list.csv under idn.employee.read; no document-metadata kind (its doc.document.read key is granted to no role). The scoped readers live in orgexport/adapters/lists and are composed by enterprisesuite for both the API and the worker beside any test-only kinds. Each production opens database.WithOrgTx for the job's organization, calls the export authority's CheckRequesterTx for the recorded requester, kind and permission in that transaction, sets SET TRANSACTION READ ONLY, reads the generation instant (transaction_timestamp()) and the organization's name and time zone, and streams one parametrized pgx statement (explicit org_id, forced RLS, LIMIT = row ceiling + 1) row by row into the writer — not a sqlc :many slice, which would hold up to 500 000 decoded rows in memory. Worker.Build now maps ErrRightsLost returned by a format to FAILED/EXPORT_RIGHTS_LOST. Registers (assets with the unit and cost-centre periods valid at the generation instant; employees with the current non-ended membership state) reflect the generation instant; readings are filtered by received_at ≤ "as of". Employee work contact and meter capture locators are omitted with reasons; only organization-wide grants export. | BR-RPT-002 wants the rows the requester may read at the worker; checking inside the reading transaction closes the gap between the worker's check and the read, and read-only mode makes the reader unable to write whatever its SQL. One statement is one READ COMMITTED snapshot (WithOrgTx pins READ COMMITTED for the authority). Readings are immutable observations, so "as of" bounds them exactly; registers have no as-of history short of replaying revisions. Contact data has no export purpose (identity field table) and capture locators are session/device provenance (BR-PRIV-008). Row scoping for UNIT/TEAM/SELF grants is not built (EMP-AUTH-011 decided organization-wide grants only). | sqlc :many slices or keyset pages across statements (memory, or inconsistent snapshots); REPEATABLE READ (refused by the shared transaction guard); reconstructing registers at "as of" from revision snapshots; exporting work contact, capture locators or tank/consumption details; a meter.reading.read key or a document kind without a catalog decision; filtering rows by structural scope now. | EMP-RPT-002; B-BR-EMP-255/256/257; BUC-EMP-130/131; BR-RPT-002/003/007/010, BR-PRIV-005/008, BR-AUTH-011; EMP-AUTH-011 (EDR-167); runtime grants proposed below. | | EDR-173 | Resolve SELF in the signed meter intake from the retained assignment periods: add AssignmentPeriodsDBTX(ctx, db, scope, member, asset) to the FLEET-006 AssignedAssetsPort (the non-empty intersections of the asset's assignments of the member's employee record with the membership period, in start order, flagging an end caused by ASSET_DISPOSED; one sqlc query, no migration), intersect them in the pure classifier with the recorded SELF grant periods and unite them with the ORG intervals under the EDR-118 continuity rule; the device path of CheckMeterTx (record and read) adds the assignee fact through AssignedAtDBTX at the database receipt instant on the borrowed intake transaction, only for a current SELF candidate, as the web re-check does. Formerly effective coverage is held even when it ended before the declared instant; never-effective coverage is FORBIDDEN. | Point answers at the declared instant and the receipt cannot see a gap between two assignments, so continuity needs the periods; the periods use exactly the membership-bounded semantics of AssignedAtDBTX, so history and the current answer agree; the declared instant is client-supplied and cannot prove that the member never held the right (EDR-118); assignment commands, disposal and intake already serialize on the organization root lock. | Two point checks; current candidates or current assigned assets as history; refusing an assignment that ended before the declared instant as never authorized; resolving ORG-scoped own-records cells (changes ORG behaviour and differs from the FLEET-006 web rule); a migration or a stored coverage table; a new review mechanism. | EMP-METER-002; B-BR-EMP-259, B-BR-EMP-260; BUC-EMP-132, BUC-EMP-133; supersedes the SELF clauses of EDR-103 and EDR-118 where the assigned-asset source is composed; rollback: compose the meter authority without Assignee (SELF returns to unavailable). | | EDR-174 | Label a hold caused only by an ASSET_DISPOSED assignment end ASSET_UNAVAILABLE when the reading is declared at or after the current disposal, else PERMISSION_CHANGED (disposition HOLD_DISPOSAL_ENDED, decided by re-evaluating with such ends opened, which can only label a hold and never apply); keep UNIT/COST_CENTRE/TEAM/ASSET grants and ORG-scoped own-records cells unsupported in signed intake (503 when they are the only effective grant); retire the SELF-only 503 when the assigned-asset source is composed. | The disposal, not a change of the member's right, ended the assignment, and B-BR-EMP-206 already holds post-disposal readings as ASSET_UNAVAILABLE; opening the end only to choose a label keeps every authority decision on the real periods; structural intake needs the asset allocation and the structural fact on the device path across the declared span (EDR-161 covers web records only), a separate bounded change. | PERMISSION_CHANGED for every SELF hold after a disposal (loses the availability fact); applying a pre-disposal SELF reading received after the assignment ended (no review); changing the precedence for ORG holds; structural intake in this task; client-clock or current-allocation shortcuts. | EMP-METER-002; B-BR-EMP-261, B-BR-EMP-262; B-BR-EMP-206, B-BR-EMP-245; retained: structural grants in signed intake, SELF malformed admission (10-offline-sync §10.2), native client confirmation of the SELF 503 → 403 change. | | EDR-175 | Name the operation fueling.submit schema 1 (entity fueling) with an exact 17-key payload of canonical integer strings; admit only a NOT_FOUND typed place; keep trip, contracted supplier, other place kinds, attachments, dependencies and soft references recognised but RETRY/UNAVAILABLE; declare NO_ASYNC_FOLLOWUP for ACCEPTED/REJECTED and no ACCEPTED_FOR_REVIEW; register the owner in the enterprise runtime with no read route. | The protocol catalog (10-offline-sync §3, fuelings §8, UC-FUEL-01) names fueling.submit; those references need owners (trips, suppliers, directory read port, fuel stock, DOC-004 receipt bytes) that do not exist; the held-review owner for fuelings does not exist; EXP-002 owns the expense projection; tests read the database directly so FUEL-012 keeps the panel reads. | fueling.record; accepting unverifiable references as facts; MALFORMED for recognised future fields; a fake review item or empty consumer; read routes without a consumer. | EMP-FUEL-002; B-BR-EMP-263/266/267; FUEL-003/011/012, EXP-002, DOC-004 retained. | | EDR-176 | Store the original fact in insert-only org_fuelings with composite same-organization foreign keys (asset, employees, membership, enrollment, product/unit catalog, reading, unit, cost centre, sync operation), warning rows in org_fueling_warnings and the first APPR-001 entry in org_fueling_review_entries; take the unit/cost centre from a new borrowed-DBTX form of the FLEET-005 port at the declared instant; reconcile through orgvalue.Reconcile with an absent discount as zero and KWH on the same integer formula; store PRODUCT_NOT_ACCEPTED; count fuelings as asset operations and list the new keys in the 000210/000208 usage sources. | BR-AUTH-005 and the 07-permissions example 3 attribute a fueling to the unit holding the asset at its instant; §10.2 and BR-MONEY-005 examples compute with "no discount" and with kWh; BR-FUEL-016/017 warn and never refuse; the usage sources fail closed on unknown keys. | Recomputing or overwriting the paid total; a current-allocation snapshot; a pgx.Tx leak to the signed path; changing the shared exact-values vectors for KWH; capacity tolerance (FUEL-005); ACK warning codes beyond CLOCK_SKEW. | EMP-FUEL-002; B-BR-EMP-263/264/265; FUEL-005 keeps capacity, FUEL-006 duplicates. | | EDR-177 | Generalise the METER-002 history classifier by permission key and ORG coverage predicate (meter unchanged: O cells); classify fuel.fueling.record with any positive ORG rule or SELF on assigned periods with own responsibility; keep changed-rights and post-disposal fuelings fail-closed UNAVAILABLE; do not consult the period gate at intake; retain the receipt link because LinkTx is a web-session port. | fuel.fueling.record is an S cell for owners too, so the meter's O-only test would deny every role; spec §7 lets scoped roles name another responsible while SELF records own fuelings; storing a held fueling needs a review owner that can resolve it (FUEL-003); APPR-006 period locks govern edits (FUEL-015); the signed path never exposes pgx.Tx (EDR-106). | Evaluating SELF as "authored" (would cover every asset); a second copy of the EDR-118 algorithm; a held fueling without a resolution path; refusing accepted field facts by period; a device actor forged for LinkTx. | EMP-FUEL-002; B-BR-EMP-266; EDR-118/173/174; FUEL-003/015, DOC-004 retained. | | EDR-178 | Model the C1 driver-initiated trip as START creating IN_PROGRESS directly and FINISH moving it to COMPLETED. Keep all seven catalog states and the commands START, FINISH, PAUSE, RESUME and CANCEL closed; answer any command on a terminal state INVALID_TRANSITION first, then PAUSE/RESUME/CANCEL and every command on PLANNED, ASSIGNED, ACCEPTED or PAUSED UNSUPPORTED_COMMAND, and START on an existing trip INVALID_TRANSITION. | trips.md §2 makes C1 driver-initiated with missions, planned work and pause/resume/cancel in F4 (EMP-TRIP-008/009/011/021); 08-state-model §3/§4 forbids new state names and keeps terminal states terminal, so a typed refusal keeps the full catalog without freezing an answer that its later owner must decide. | Implementing pause, resume or cancel now; a DRAFT or STARTED operational state (not in the catalog); passing through PLANNED/ASSIGNED/ACCEPTED for a driver trip; treating PAUSE as an unknown token; reopening COMPLETED. | EMP-TRIP-001; B-BR-EMP-268; EMP-TRIP-011 replaces the refusal with its transitions in a new oracle version. | | EDR-179 | Define start eligibility as a complete, same-organization supplied context (asset, driver employee, departure reading or missing reason, validated declaration) and report every absent part at once as INCOMPLETE with an ordered missing list, after validating the present parts. Let only the starting member finish a C1 trip (FORBIDDEN otherwise). | The FLEET-001 activation check already names missing facts with INCOMPLETE and a list; offline the app must show everything the driver still has to record; trip.trip.start is a SELF permission while closing for another is trip.trip.close_for_other (EMP-TRIP-014) and handover is EMP-TRIP-012. | Failing on the first absent part; treating absence as INVALID; a domain authority or assignment check (owned by the intake and cached-grant ports, BR-TIME-003); any member finishing any trip. | EMP-TRIP-001; B-BR-EMP-269/272; TRIP-002/005 check authority, availability and one active trip. | | EDR-180 | Carry departure and final evidence as the METER-001 ReadingRef plus its exact meter.Value (or a METER-001 missing reason), not a full meter.Reading, and report trip usage MEASURED only for two readings on one meter segment with a non-decreasing value, else NOT_MEASURED with NOT_FINISHED, READING_ABSENT, DIFFERENT_SEGMENT or DECREASING; never refuse a finish for plausibility. | A full reading needs the server received_at, which an offline trip cannot truthfully supply (EDR-094); B-BR-EMP-135 forbids cross-segment subtraction and leaves rollover and reset to later tasks; the offline matrix puts final-reading plausibility on the server, and a refused finish would drop a field fact. | A dummy receipt to build a meter.Reading; refusing a decreasing reading; zero or interpolated distance; GPS or planned distance; modulus rollover arithmetic. | EMP-TRIP-001; B-BR-EMP-273; the persistence owner records the readings with origins TRIP_START/TRIP_END (TRIP-002). | | EDR-181 | Place the pure trip in Go trip/domain and Kotlin enterprise.trip with one trip-v1 oracle and its own trip, employee and membership references; take the review state as a closed input enum (BR-REV states plus VOIDED) and a free operational/review standing, without importing the review package; keep device delivery state out of the domain. | Follows EDR-130/133 (closed review input without the parallel package) and the module table of 09-architecture; the app executes trips offline in EMP-TRIP-005, so a Kotlin mirror is required; delivery state is device presentation owned by EMP-OFFL-004, and a receipt-free trip already shows independence from delivery. | Importing review or fueling for their types; a delivery or sync field on the trip; deriving a review state from completion; constraining which review states may accompany IN_PROGRESS (EMP-TRIP-004 decides submission). | EMP-TRIP-001; B-BR-EMP-274/275; EMP-TRIP-004 binds the review lifecycle. | | EDR-182 | Keep the start reporting attribution for the trip's whole life and give FINISH no zone input; compute an informational end day of the finish instant in the stored reporting zone; report entry-zone and device-offset changes as two separate flags; refuse a finish whose local day in that zone is unattributable as INVALID after FINISH_BEFORE_START. | BR-TIME-004 says a trip belongs to the day it started, trips.md §10 that crossing midnight does not split the trip and §8 that reporting days use the context stored with the fact; a zone supplied at finish would let a device or a later context rewrite the basis; one flag would mix daylight saving with travel. | Splitting the trip at local midnight; one reporting day per event counted as trip days; re-resolving zones at finish; the device entry zone deciding a day; a single zone-changed flag; letting the end day decide period membership. | EMP-TRIP-017; B-BR-EMP-276/277; EMP-TRIP-016 locks by the start day. | | EDR-183 | Derive elapsed time only from the two declared instants (exact seconds and nanoseconds, big-integer comparison), confirm it with an optional per-event run clock (boot identity ^[A-Za-z0-9._-]{1,64}$ as the driver shift, monotonic milliseconds) against an explicit caller tolerance with no domain default, and report CONFIRMED, DECLARED, GAP (BOOT_CHANGED, CLOCK_DISCONTINUITY) or NOT_FINISHED; keep the witness in the trip package. | BR-TIME-005 and B-BR-DRV-07 require monotonic time with a boot identity and a flagged gap instead of an invented duration; the task fixes durations to instants; BR-TIME-006 skew is a separate receipt-time measure; a single owner does not justify a kernel change (EDR-094 extracted only shared behaviour). | The monotonic count as the duration; subtracting local wall times; an invented default tolerance; refusing the finish on a gap; a saturating time.Duration; adding the witness to orgtime now. | EMP-TRIP-017; B-BR-EMP-278/279; EMP-TRIP-005 supplies the Android run clock and the organization policy owner the tolerance. | | EDR-184 | Keep each reading's classification history in an append-only, forced-RLS org_meter_reading_states table (migration 000216): one row per reading revision with state (VALID, SUSPECT, VOIDED), flags in canonical order, the RETROACTIVE note, cause (INTAKE, REEVALUATION, CONFIRMED, VOIDED, SUPERSEDED), the operation, and for person decisions the acting membership, reason and the superseding reading. The reading row keeps its immutable recorded classification (VALID/SUSPECT), equal to revision 1; the current state is the latest revision, or the recorded classification when no history exists (readings before 000216). An insert guard serialises on the organization root and the meter, requires revision = previous + 1, revision 1 INTAKE equal to the recorded classification, and only the §6.5 transitions (SUSPECT → VALID/SUSPECT/VOIDED, VALID → VOIDED, VOIDED terminal, no confirmation over a monotonicity flag, supersession by a reading of the same meter created in the same operation). The reviewed-reading branch of the observation guard admits a SUSPECT classification. The person causes are part of the same table so that EMP-METER-004 needs no further migration. | Readings are insert-only evidence (BR-METER-001), so a state that changes after insertion needs its own history; one history table answers the current state, the full chain (BR-METER-026) and the as-of state of exports from stored rows; the recorded classification keeps the original intake verdict visible even after later decisions; the guard is defence in depth for the rules the application already applies. | Updating the reading row (breaks immutability); a mutable current-state projection (that is EMP-METER-006's projection, and it would not keep history); a flags column on readings only (cannot express later transitions); a separate correction-fact table in a later migration (the coordinator allows one migration for both tasks). | EMP-METER-003, EMP-METER-004; B-BR-EMP-280, B-BR-EMP-284, B-BR-EMP-285; BR-METER-001/006/009/011/012/017/026; rollback: the configuration of EDR-185 stops new classifications; the table and its rows remain. | | EDR-185 | Validate with one server plausibility configuration: 150 000 m/h for every asset category and a 300 s clock-skew limit (the documented defaults), with the 1 000 m display and 300 s hour-meter tolerances as constants of the rule; ANPFUEL_ENTERPRISE_METER_PLAUSIBILITY (boolean, default true) turns the wiring off. The pure validator (meter.Plausibility.Check / Reevaluate in Go, MeterValidation in Kotlin) takes the policy, the segment series with current states and the candidate, compares with arbitrary-width integers over nanosecond elapsed time, checks both new pairs, and returns state, flags, note and the neighbour identifiers. The server classifies under the root, asset and meter locks with the database clock read just before the insertion; FUTURE_INSTANT is kept by re-evaluation. The whole segment series is read for each new reading. | No per-category limit or organization skew value has a runtime source yet (the category registry and the versioned clock-skew setting have no consumer), so the defaults are the honest configuration; the backlog's rollback is a configuration switch; the formula of fleet §10.2 multiplies seconds, and nanosecond instants need exact wide integers to stay faithful; a retroactive reading creates two new pairs and either can be the implausible one; the stored received_at is set by the observation guard a few microseconds later than the classification read, so keeping the intake verdict for FUTURE_INSTANT keeps re-evaluation a function of stored data. | Reading the organization settings now (no consumer contract for the key); floating point or whole-second rounding; checking only the predecessor pair; recomputing FUTURE_INSTANT from the stored receipt; a bounded-window neighbour query instead of the series (premature without a measurement; EMP-METER-006 owns the projection). | EMP-METER-003; B-BR-EMP-282, B-BR-EMP-283, B-BR-EMP-285; BR-METER-010, BR-TIME-006; retained: per-category limits, the organization skew setting, capacity measurement. | | EDR-186 | Answer a SUSPECT standalone or fueling reading ACCEPTED (entity revision 1) and keep the decision in the suspect list of EMP-METER-004, instead of ACCEPTED_FOR_REVIEW with the flag as code (fleet §8); validate readings recorded through the signed intake, the embedded fueling path and an accepted held review; record the installation opening reading VALID without checks; leave meter.usage.recalculated for intake re-evaluations to the projection and consumers that will use it. | The closed sync protocol admits only the OFFL-008 review codes with a held review item and its proof, and a suspect reading is applied evidence, not a held operation, so a review item would create a second queue for the same decision and would dangle after an automatic re-evaluation; the opening reading defines the segment and has no predecessor; the signed intake declares an exact no-async outcome plan and no consumer of the event exists before EMP-METER-006. | A review item per suspect reading; new review codes in the closed protocol and the Android client; refusing suspect readings (BR-OFFL-006); validating the opening reading against nothing; emitting an event nobody consumes from the intake. | EMP-METER-003; B-BR-EMP-284; BR-METER-011, BR-OFFL-006; retained: the review-ACK form for suspect standalone readings, rollover detection (EMP-METER-005), the recalculation event for intake (EMP-METER-006). | | EDR-187 | Decide one reading through one company command POST …/fleet/assets/{asset_id}/meters/{meter_id}/readings/{reading_id}/decide with decision SUPERSEDE, VOID or CONFIRM, the expected history revision of the reading (0 without history) and a reason; persist every effect in the 000216 history (VOIDED/SUPERSEDED with the link, VOIDED, CONFIRMED, the new reading's INTAKE, REEVALUATION) and the new reading in org_meter_readings, with no new migration; detect a replay by the operation's history rows and prove it with the audit event (same actor, target and digest, else OPERATION_ID_REUSED), rebuilding the first result from stored rows only; refuse in this order: foreign or missing → NOT_FOUND, VOIDED → READING_ALREADY_SUPERSEDED (409, fleet §10.5), installation opening → VALIDATION_FAILED, approved parent → AMENDMENT_REQUIRED, stale revision → CONFLICT, confirm of a non-suspect → CONFLICT, confirm over a monotonicity flag → VALIDATION_FAILED. | The review precedent (OFFL-008 resolve with an outcome) keeps one audited decision route; the 000216 causes were designed for these decisions (EDR-184) and the coordinator allows one migration for both tasks; the history rows hold the reason and the links, so the audit event needs no free text (its vocabulary is codes only); VOIDED first lets the loser of a race see what happened; the opening anchors the segment that EMP-METER-005 replaces or resets; a precondition on a referenced record is VALIDATION_FAILED in the fleet module (UC-FLEET-04). | Three routes; a correction-fact table or a receipt table in a new migration; storing reasons in the audit event; correcting the opening reading in place; CONFLICT for every refusal; a dedicated non-confirmable code. | EMP-METER-004; B-BR-EMP-286, B-BR-EMP-287, B-BR-EMP-288, B-BR-EMP-289; BR-METER-012/013/014/026, BR-AUD-001; EDR-184; rollback: unmount the routes (enterprisesuite); existing decisions stay. | | EDR-188 | Authorise the decision with meter.reading.correct (configuration write, fresh proof) and the suspect list with meter.reading.correct (read), both on the reading's asset; let UNIT, COST_CENTRE and ASSET grants cover that asset through its current allocation by admitting meter.reading.correct in the AUTH-006 asset structure resolver; serve the history with fleet.asset.read (SELF on an assigned asset included); list per meter, keyset by series order with the last reading as cursor, 1..100 items. | The catalog v4 grants meter.reading.correct to OWNER, ADMIN, FLEET_MANAGER and SUPERVISOR only, so DRIVER is FORBIDDEN; fleet §7 covers register actions through the current allocation; SCR-METER-02 reads the history with fleet.asset.read; a per-meter list is what SCR-METER-02/05 open and needs no cross-asset structural filter. | An organization-wide suspect queue filtered by structural scope (retained for the panel, EMP-METER-007); history under meter.reading.correct; offset pagination. | EMP-METER-004; B-BR-EMP-286, B-BR-EMP-291; BR-AUTH-005, EDR-160/161 (AUTH-006). | | EDR-189 | Route a decision on a reading whose parent record is APPROVED to an amendment by refusing it AMENDMENT_REQUIRED (409) through a parent-record port answered by the fueling store (review state of the fueling that carries the reading), until an amendment consumer of the EMP-PLAT-016 kernel exists; publish meter.usage.recalculated (target the decided reading, revision its new history revision, identifiers only) through the PLAT-010 outbox in the decision transaction only when the composition supplies its consumers; production composes none, so the recalculation stays identifiable by the operation and the history revisions. | The backlog risk asks for a clear refusal rather than an in-place change; no consumer can apply an amendment and fuelings cannot be approved yet; PLAT-010 requires every producer to compose real consumers before publishing, and no projection or consumption consumer exists before EMP-METER-006 and the fueling epic. | Changing an approved record in place; a fake amendment or a no-op consumer; skipping the hook because nothing is approved today; an unconsumed queue. | EMP-METER-004; B-BR-EMP-289, B-BR-EMP-290; BR-METER-015/016, BR-AMD-001/005; EMP-PLAT-010, EMP-PLAT-016; retained: amendment consumer, recalculation consumers (EMP-METER-006). | | EDR-190 | Adopt org-permissions-v5 with exactly eleven new O cells on three registered but unassigned keys: fleet.reservation.manage takes the fleet.asset.assign column (OWNER, ADMIN, FLEET_MANAGER, SUPERVISOR); check.template.manage takes the maint.workorder.manage column (OWNER, ADMIN, FLEET_MANAGER), which is also the maintenance §7 proposal; check.incident.manage takes the maintenance §7 proposal (OWNER, ADMIN, FLEET_MANAGER, SUPERVISOR in scope). Each new descriptor carries only the four BR-AUTH-001 conditions; every other v4 cell is preserved; AUDITOR, FINANCE, APPROVER, DRIVER, OPERATIONS_STAFF and the station/data roles gain nothing. | EMP-FLEET-007, EMP-CHECK-001 and EMP-CHECK-003/004 need these keys and 07-permissions §7.4 requires an explicit matrix revision and catalog version for any grant; fleet.md §7 already assumes the assignment roles for reservations and blocks (UC-FLEET-06/07), and maintenance.md §7 names the same roles the recommended routine decision proposes (BR-CHECK-011, UC-CHECK-04/05/06), so no module text is overridden. OWNER and ADMIN receive every new key, so no role becomes newly assignable or unassignable (BR-AUTH-007 containment unchanged). | Granting AUDITOR any key (EDR-166 keeps it read-only); a SUPERVISOR row for templates (no source proposes it); S or footnoted cells; inheriting from fleet.asset.manage; also deciding fleet.supplier.manage or other unassigned keys here; routing any key in this amendment. | EMP-FLEET-007, EMP-CHECK-001, EMP-CHECK-003, EMP-CHECK-004; B-BR-EMP-292; BR-AUTH-001/007, BR-FLEET-029/032, BR-CHECK-011; fleet.md §7, maintenance.md §7; evidence. | | EDR-191 | Version the amendment like EDR-043/EDR-048: a new independent authorization-catalog-v5.psv beside v1–v4 (same 86 lines and row order, eleven cells changed), PermissionsVersion = "org-permissions-v5", the compiled source rows, a v4→v5 cell-retention test, the v1 retention test extended by the v5 cells, and every consumer of the version (route inventory permissions_version, HTTP authorization matrix oracle, export gating, auditor column and catalog tests) moved to v5. No migration and no data change: org_role_assignments (000171) stores the role key and scope only, no permission set and no catalog version, and no migration or SQL function embeds a role-to-permission mapping, so an existing assignment gains the grants at its next request evaluation. Inventory statuses are unchanged (NOT_YET_ROUTED until the owning route exists). | The catalog is evaluated at request time from code-frozen source, so persisting a version would only create drift; keeping the historical files lets each earlier amendment remain provable; consumers that pin the version are the guard that forces a review when the matrix changes. | Editing v4 in place; a migration or backfill of assignments; persisting a per-assignment catalog version; routing or marking the keys ROUTED before their tasks deliver routes; changing the AUTH-011 auditor walk beyond its version pin. | B-BR-EMP-293; EDR-043, EDR-048, EDR-063, EDR-166; evidence. | | EDR-192 | Store reservations in forced-RLS org_asset_reservations (migration 000217) whose stored state moves only through a row guard implementing fleet.md §6.4 (identity and window immutable, revision +1 per change; REQUESTED→CONFIRMED and →CANCELLED by command under the ACTIVE root lock with their command data; REQUESTED→EXPIRED from the start and CONFIRMED→NO_SHOW from org_asset_reservation_deadline = earlier of start + tolerance and end, cause TIME, no command data; CANCELLED with cause ASSET_LEFT_SERVICE proven by the asset state and revision; FULFILLED refused), with EXCLUDE USING gist(org_id WITH =, asset_id WITH =, tstzrange(starts_at, ends_at, ')') WITH &&) WHERE state IN ('CONFIRMED','FULFILLED') and a confirmation over an unremoved overlapping block refused (23P01 org_asset_reservations_block_overlap); blocks in append-only org_asset_blocks (removal sets the end once, with command and reason); one receipt table org_asset_reservation_commands (kinds REQUEST, CONFIRM, CANCEL, BLOCK, UNBLOCK, target and resulting state); an AFTER UPDATE OF state trigger on org_assets cancels open reservations when an asset leaves ACTIVE; composite same-organization foreign keys to assets and employee records; the two asset keys allow-listed in org_asset_current_usage from the 215 body (counts unchanged: neither names a draft). Availability is not stored. Commands pre-check windows under the root lock and report the conflicting window; the exclusion is the backstop. | BR-FLEET-025/029/030/032 need a database guarantee against concurrent confirmations (fleet.md §8: period invariants are exclusion constraints) and an honest stored history of transitions; storing the state with guarded transitions keeps the exclusion exact while time-driven rows release windows; a separate block table keeps open-ended periods and removal facts; the 000210 FLEET-006 trigger is the precedent for same-transaction consequences of an asset leaving service (fleet.md §6.1 "future reservations cancelled"). | A stored availability column; an application-only overlap check; deleting or rewriting windows; cancelling reservations in Go lifecycle code only; one table for blocks and reservations; reporting the conflicting record's identity. | EMP-FLEET-007; B-BR-EMP-294/295/297/298; BR-FLEET-014/025/029/032; fleet.md §6.1, §6.4, §8; migration 000217; rollback: capability flag off, tables remain. | | EDR-193 | Time-driven outcomes three ways: (1) every read derives the effective state at its instant (Reservation.StateAt), with ended_at the instant the outcome happened; (2) a per-reservation queue job org-asset-reservation-outcome (payload {version, org_id, reservation_id, outcome}, de-duplication …:expire|miss:<org>:<id>, not_before = the due instant, 10 attempts, general dispatcher) queued in the request/confirm transaction settles the expected outcome with a compare-and-set on state and revision (not due → retry; reached or moot → complete); (3) every reservation command settles the asset's due outcomes under the root lock before checking windows. A settlement records one audit event (fleet.reservation.expired / fleet.reservation.missed, actor = requesting account, request hash bound to reservation, revision and outcome). The no-show tolerance is the 60-minute default stored per reservation (no organization setting key exists; the 15–240 configuration is retained); the deadline is the earlier of start + tolerance and end. | 08-state-model §4.6 requires expiry at read time so a stopped job cannot leave a stale state; the exclusion constraint sees stored states, so commands must settle before checking; a per-record delayed job avoids an unscoped sweep under forced RLS (EDR-170); the audit log has no system actor (EDR-170 precedent); with no trip source a confirmed window cannot be fulfilled, and a deadline after the end would hold a window no one can use. | A periodic cross-organization sweep; read-time only (stale exclusion); job only (stale reads); a synthetic system account; inventing an organization setting; settling inside blocks or reads. | EMP-FLEET-007; B-BR-EMP-296; BR-FLEET-030; 08-state-model §4; EDR-170; retained: notifications of expired/missed reservations (NOTIF), configurable tolerance (organization settings). | | EDR-194 | Answer availability rows 2 and 3 through two Fleet ports, ActiveUsePort and MaintenanceHoldPort (borrowed organization transaction, instant), composed with explicit adapters NoActiveUse and NoMaintenanceHolds that answer "no source" (like FLEET-003 NoOpenWork), so the read lists missing_sources = ACTIVE_USE, MAINTENANCE_HOLD; a nil port fails closed. Expose the pure DecideStart (holds ASSET_UNAVAILABLE / ASSET_BUSY, B-BR-EMP-300) and StartAvailabilityPort.StartDecisionDBTX (current lifecycle, blocks and reservations holding the declared instant, the member's employee record and assignment at that instant) for EMP-TRIP-002; no start intake is built. | No trip or maintenance hold exists before EMP-TRIP-002 and the maintenance epic; fleet.md §12 says their ports answer "no hold" until then and the screen must not suggest more certainty than the cut has; the decision is pure and testable now, and the port is the hook the trip intake will call on its transaction. | Inferring absence of trips; a fake trip table; building a start intake here; evaluating the lifecycle at the declared instant before the trip intake defines its disposal/held rule. | EMP-FLEET-007; B-BR-EMP-299/300; BR-FLEET-025/026/027/031; fleet.md §6.2, §12; EDR-144; retained: EMP-TRIP-002 replaces NoActiveUse and calls the start port, maintenance replaces NoMaintenanceHolds, lifecycle-at-declared-instant refinement, mission linkage (EMP-TRIP-023). | | EDR-195 | Eight routes under /v1/orgs/{org_id}/fleet/assets/{asset_id}/: reservations/request (201; confirm flag), reservations/{reservation_id}/confirm, reservations/{reservation_id}/cancel, blocks/create (201), blocks/{block_id}/remove with fresh fleet.reservation.manage (configuration write, organizations capability, admission class fleet.reservation); reservations/list, blocks/list, availability/read with current fleet.asset.read. Structural grants resolve the asset's allocation for the new key; the company authority admits the policy. RESERVATION_CONFLICT (409) carries two details conflict_window STARTS_AT/ENDS_AT with a new optional instant detail field. Requesting through trip.mission.manage alone is retained for the mission linkage (EMP-TRIP-023): both keys hold the same roles in v5. Availability, reservations and blocks are server-only: no Kotlin mirror and no shared PSV; the domain tables are frozen as Go tests. | The asset detail (SCR-FLEET-02, fleet.asset.read) shows reservations and blocks; the calendar (SCR-FLEET-06) is EMP-TRIP-022; a mission-based request needs missions; an instant is the only faithful way to state a window without free text; the app reads availability from the server (BR-FLEET-025), so a device mirror would be a second source of truth. | Reads under fleet.reservation.manage; a free-text window message; a request route keyed by mission; a Kotlin derivation of availability; routes keyed by reservation without the asset. | EMP-FLEET-007; B-BR-EMP-295/299/301; UC-FLEET-06/07; fleet.md §7, §11; org-permissions-v5 (EDR-190); route inventory, matrix, auditor walk, OpenAPI. | | EDR-196 | Open F4 with its dependency-ready work and the open C1 trip chain, each task a bounded commit built in an isolated owner worktree and integrated on codex/enterprise-f4: wave 1 TRIP-001 → TRIP-017, METER-003 → METER-004 and the org-permissions-v5 grant amendment → FLEET-007; then TRIP-002 → TRIP-003 → TRIP-004 and the F4 trip API tasks in dependency order with OFFL-009/012, CHECK-001, FLEET-011 and OFFL-006; Android and panel tasks after their backend owners on the owned emulator only. GPS-001..015 and REL-005 stay blocked behind EMP-GOV-005 (legal review pending with human reviewers) and EMP-GOV-006 (tracking spike on target devices). | Every TRIP task depends on the unfinished C1 chain TRIP-001..005; TRIP-014 needs METER-004; FLEET-007/CHECK-001/CHECK-003 need keys no role holds in v4; the legal review and the target-device spike decide what tracking may collect, and the physical phone is excluded while an emulator is not a target device. | Starting persistence before its domain; a tracking domain, intake or service ahead of GOV-005/006; fake trip/tracking/maintenance adapters instead of explicit tested "no source" ports; pushing F4 to dev while PR #221 is open; counting pure-domain or partial checkpoints as M4. | [F4 execution ledger; ADR-018 local checkpoints; ADR-020 single open dev → main PR; EDR-127 precedent. | | EDR-197 | Decide late intake only from server history: the access end instant E is the membership's ended_at for an enrollment revoked by its membership end, else the enrollment's revoked_at (an ACCESS_ENDED revocation command); the window W is policies.intake_window_days of the settings version in force at E (latest effective_at ≤ E, ties by revision; default 15 when none) and is never re-read from later settings; receipt R is the database clock of the final acknowledgement. R > E + W × 86 400 s (elapsed seconds, the end instant included like ORG-009's grace) is INTAKE_WINDOW_CLOSED; otherwise a claim the server already holds with claimed_at < E, or else a declared instant < E, is held ACCESS_ENDED_BEFORE_RECEIPT; otherwise MEMBERSHIP_ENDED (membership end) or DEVICE_REVOKED (device command end). | BR-OFFL-008/009/011 make device time evidence, never proof: the declared instant may only choose review over refusal, never application, a window or a read. The enrollment's last contact is not recorded (194 forces last_sync_at NULL; ContactDevice persists nothing), so it cannot be evidence; an earlier server claim is stronger than the device clock. Reading the window at E keeps a later administrator change from reopening or shortening an ended member's window, and one inclusive convention matches the existing suspension grace. | The current settings head (retroactive reopen); the device clock for the window or eligibility alone; a last-sync heuristic with no recorded source; calendar-day intervals (DST/time-zone dependent, EDR-119); a half-open window diverging from AssessSuspension. | EMP-OFFL-009; B-BR-EMP-302..307; BR-OFFL-006/008/009/011/012, BR-IDN-029; EDR-118/119; ORG-008 settings, ORG-009 grace. | | EDR-198 | Implement late intake as a framework-owned restricted path in orgsync: the signed route enters it only when the current device check refuses the signing key as revoked/ended (or the batch's sealed period differs from the current one) and the exact owned period is ACCESS_ENDED; the pure DecideLate and the SQL function org_sync_late_disposition share one Go+SQL vector file; refusals are generic final ACKs; a held fact needs an installed owner implementing LateHolder with a real review path — today only meter.reading.record, which validates payload and target without current authority (unknown/foreign target or outside the service window is MALFORMED); fuelings keep EDR-177 (eligible work RETRY/UNAVAILABLE, no claim) until FUEL-003 owns a held fueling; hard dependencies keep BR-OFFL-007 (DEPENDENCY_PENDING, claim kept). Migration 000218 adds the immutable forced-RLS org_sync_late_intakes decision row re-derived by the database, a deferred guard so late codes exist only with their row, and redefines the 201 held-meter source guard so a late hold needs an ACCESS_ENDED period and a pre-end declaration or claim. No Kotlin mirror: the decision is server-only and the client already presents these ACK codes. | One decision owner keeps the evidence rule identical for every type and lets OFFL-012 reuse the path; a typed held fact without a resolution path would be fake (FUEL-002); recording E, W, the settings revision, the declaration, receipt and disposition makes each quarantine auditable and lets the database refuse a fabricated late row or late code; a target unknown before the end cannot be a pending dependency of a pre-end reading. | Per-owner late classifiers; holding fuelings without FUEL-003; reusing the normal handler authority (it must deny an ended member); a code-only replay distinction without a recorded row; storing no evidence; a Kotlin copy of a server-only rule. | EMP-OFFL-009; EDR-074/106/117/177; OFFL-002/008, METER-002, FUEL-002 evidence. | | EDR-199 | Keep three refusals whole and reads closed: a key revoked LOST_OR_COMPROMISED anywhere in the organization (or an unknown, foreign or still-enrolled period) is refused before any claim, budget-free of effects, with the existing transport codes; a late resend of an operation finalized through the normal path before the end is RETRY/UNAVAILABLE (no receipt read reopened) while a late decision's own ACK replays byte for byte; the late source requires an ACTIVE organization with the base capability enabled, leaving suspended/archived organizations and disabled capabilities to their existing refusals until EMP-OFFL-012 decides them. | BR-OFFL-012 refuses lost devices entirely, and per-operation refusal rows from a compromised key would let it write audit and ledger rows; replaying a normal ACK needs current read coverage (OFFL-002), which an ended member never has; deciding organization-state disposition here would pre-empt OFFL-012's own rule. | Per-operation DEVICE_REVOKED rows for lost devices; replaying any stored ACK to an ended member; accepting late work in a suspended organization or with the capability off. | EMP-OFFL-009; BR-OFFL-004/006/012; EDR-071..075; EMP-OFFL-012 retained. | | EDR-200 | Decide organization state before the owner for every new signed operation of a current member: run ORG-009's AssessSuspensionTx (recorded periods, database receipt, 7-day inclusive grace) inside the intake transaction, then the plan rule (EDR-201). Suspension REVIEW holds ORG_SUSPENDED_GRACE and a plan hold PLAN_CHANGED through the owner's typed held path (EMP-OFFL-009 LateHolder, given the code; owners without one stay RETRY/UNAVAILABLE with no claim); REFUSE ORG_SUSPENDED is a final per-operation refusal; other refusals keep their whole-response codes. While SUSPENDED, a non-empty batch from the current member's enrolled device is admitted only to this assessment through a suspended-organization source (never owner write or read authority); an empty batch keeps ORG_SUSPENDED. State decisions are recorded in migration 000219's immutable org_sync_state_intakes, re-derived by the database (a SQL mirror of AssessSuspension and of the plan rule), and replay through their own row. State holds precede the owner's permission classification: a reviewer, never the device, settles them. | ORG-009 owns the suspension rule and its port; BR-ORG-031 forbids stranding field work and VAL-22 requires per-operation outcomes; one quarantine mechanism with OFFL-009; owner authority cannot be evaluated in a suspended organization, and a held fact is never applied. | A second Go suspension classifier; whole-batch ORG_SUSPENDED for all work; applying work declared before the suspension; a suspended source that grants reads; replaying refusals through owner reads the suspension denies. | EMP-OFFL-012; B-BR-EMP-308/310/311; BR-ORG-030/031, BR-OFFL-006/008/009, VAL-22; EDR-197..199; ORG-009 evidence. | | EDR-201 | Model a plan change only through the existing capability state (no billing exists): the operation's write capability row (org_capabilities: enabled, revision, updated_at). Enabled at receipt applies. Disabled at receipt after a change (revision > 1) makes updated_at the downgrade instant C: work declared before C is held PLAN_CHANGED (no window; a reviewer decides); work declared at or after C, a capability created disabled (revision 1) or absent is new forbidden work left to the owner's ENTITLEMENT_REQUIRED. Shared Go+SQL vectors state-intake-v1.psv pin the rule; no Kotlin mirror (server-only). | VAL-24/35 keep pre-change work for review while BR-AUTH-009 keeps plans away from roles; the row is the only recorded plan state; a same-state update moves C later, which can only hold more work for review, never apply it. | Reading capability audit events (they do not name the capability); an invented history table or backfill; a billing model; per-operation FORBIDDEN for a downgrade; reconstructing a restored capability's past off interval (retained). | EMP-OFFL-012; B-BR-EMP-309; BR-AUTH-009, VAL-35; PLAT-005 and AUTH-004 evidence. | | EDR-202 | Name the operations trip.start and trip.finish schema 1 (entity trip, id = the trip UUID) with exact payloads of canonical strings; let a finish carry at most one dependency (the framework answers DEPENDENCY_PENDING until it is accepted); map the EMP-TRIP-001 refusals onto the frozen ACK vocabulary: a finish before its start and identity reuse are MALFORMED, another member's finish is a whole-response FORBIDDEN, a finish whose trip is not stored here is DEPENDENCY_PENDING. | The OFFL-001 rejection and review codes are frozen; BR-OFFL-007 makes an unknown target a pending dependency; EDR-179 lets only the starting member finish, so another member is an authority refusal like FUEL-002; a finish before its start cannot become a trip fact. | New wire codes (FINISH_BEFORE_START); refusing a finish of an undelivered or held trip permanently; one generic trip.update operation; mandatory dependencies. | EMP-TRIP-002; B-BR-EMP-312/315; EMP-TRIP-014 adds closing for another member. | | EDR-203 | Store the start fact in org_trips whose only permitted update is IN_PROGRESS → COMPLETED performed by the insert of its one insert-only org_trip_finishes row, with a partial unique index on IN_PROGRESS per asset; keep held starts and finishes in insert-only org_trip_held_starts and org_trip_held_finishes linked to OFFL-008 review items, extending org_sync_review_source_valid with the two trip owners while keeping the meter branch; redefine the 000215 asset, unit and cost-centre usage sources keeping every line. | VAL-07 requires that two trips never count as in progress; a database invariant survives any handler defect; finishing is a real state change but its fact must stay immutable; OFFL-008 already defines review items, the ACK proof and the codes ASSET_BUSY and TRIP_ALREADY_CLOSED. | Fully insert-only trips with the active set derived (no unique invariant); a mutable trip row; a separate active-asset lock table; storing held starts as trips with a flag; a new review mechanism. | EMP-TRIP-002; B-BR-EMP-312..315/319; migration 000220. | | EDR-204 | Hold the second admissible start (ASSET_BUSY, ASSET_UNAVAILABLE, PERMISSION_CHANGED) and the finish of a completed trip (TRIP_ALREADY_CLOSED) as real review items now, and retain their resolution commands, company queue listing and author own-result read to EMP-TRIP-007 (the OFFL-008 queue, decision trigger and own-result read stay meter-typed, so a trip item is invisible there and any decision on it fails closed). | The acceptance requires the second fact held for review, never dropped or retried (BR-OFFL-006); TRIP-007 owns the asset-overlap resolution and its audited outcome; extending the meter-typed decision path would invent a resolution TRIP-007 must define. | Retrying held starts (FUEL-002 precedent, rejected by the acceptance); a resolution or own-result path now; listing trip items in the meter queue. | EMP-TRIP-002; B-BR-EMP-313/315; EMP-TRIP-007 resolves, EMP-TRIP-005 shows the held outcome. | | EDR-205 | Begin every stored trip's review case as the APPR-001 draft (DRAFT, revision 1, no stored entry) and let neither start nor finish submit it. | BR-REV-002 makes a record SUBMITTED only when the server accepts the submitting operation, and VAL-01 marks the finished trip "ready to send" as a separate author action; the 08-state-model §1 table shows the finished trip as DRAFT until then; EMP-TRIP-004 owns submission, return and approval. | Submitting at start or at finish; storing a SUBMIT entry now; a review column on the start fact. | EMP-TRIP-002; B-BR-EMP-318; EMP-TRIP-004 appends SUBMIT. | | EDR-206 | Replace the FLEET-003 NoOpenWork adapter in the runtime with a trip-backed AssetOpenWork (an IN_PROGRESS trip is TRIP open work), replace the FLEET-007 NoActiveUse adapter with the trip-backed ActiveUse (trips holding the asset at the instant), consult StartDecisionDBTX in the start intake after the history and lifecycle checks and before the current-busy check, and add TripAuthority sharing the meter authority's real sources with a trip.trip.start history rule on the generalised classifier. The held-start trigger re-proves only ASSET_BUSY; ASSET_UNAVAILABLE and PERMISSION_CHANGED are decided by their owning ports in the same transaction. | FLEET-003 and EDR-144 required each epic to replace the explicit none source; FLEET-007 (EDR-194) left NoActiveUse and the start decision for this owner; reservation, block and assignment rules live in the FLEET-007 port, so SQL re-derivation would duplicate them; the meter/fueling authority already implements EDR-118 continuity and current device checks. | Keeping NoOpenWork or NoActiveUse; duplicating DecideStart in SQL or in the trip module; a second copy of the history algorithm. | EMP-TRIP-002; B-BR-EMP-316/318; FLEET-007 integration wires the port. | | EDR-207 | Name the logbook operation trip.event.record schema 1 (entity trip_event, id = the device event UUID, at most one dependency, no soft reference or attachment) with the exact payload trip_id, type, text; fix the closed trip-logbook-v1 vocabulary: NOTE (text required), STOP, ARRIVAL, DEPARTURE supported; FUELING, TOLL, PARKING, INCIDENT, DAMAGE, HANDOVER, PAUSE, RESUME, CANCEL reserved for their owners; every other token unknown. Map the outcomes onto the frozen ACK vocabulary: unknown type, event identity reuse and an event before the trip's start are MALFORMED; a reserved type is RETRY UNAVAILABLE (recognised future form); another member is a whole-response FORBIDDEN; a trip not stored here (undelivered, held or another organization's) is DEPENDENCY_PENDING; an event after a completed trip's finish is held TRIP_ALREADY_CLOSED; an event at or before the finish of a completed trip is accepted. | The glossary and 12-ux-app §4.8 list the kinds; REQ-07.3 asks for typed facts with source time and actor; the offline matrix makes events offline with "trip not closed by someone else" as the only online check; the owners of fuelings, expenses, incidents, handover and pause/resume define those payloads and effects, so v1 must not freeze them; EDR-202 already maps a finish before its start to MALFORMED and an unknown trip to DEPENDENCY_PENDING (forced RLS cannot tell another organization's trip from an undelivered one, and BR-OFFL-007 forbids refusing a reordered child); BR-OFFL-006 keeps a well-formed conflicting fact for review, never drops it. | One operation per type; free-form types; MALFORMED for reserved types (would permanently refuse facts a later app sends before its server owner ships); NOT_FOUND for an unknown trip (breaks reordering); accepting events after a completed trip's finish; holding events before the start; a new wire code. | EMP-TRIP-003; B-BR-EMP-320..323; REQ-07.3; BR-OFFL-001/006/007; EMP-TRIP-010/011/012, EMP-CHECK-003, EMP-EXP-004 own the reserved types. | | EDR-208 | Store accepted events in insert-only, forced-RLS org_trip_events and held ones in insert-only org_trip_held_events (migration 000225; 000221 stays unused), with same-organization composite foreign keys to the trip, the operation, the author membership and its employee record and the enrollment only — no asset, unit or cost-centre key, so no usage source changes. A BEFORE trigger takes the organization root and the trip row locks and re-proves the operation (type, schema, entity, digest, active enrolled author whose employee record is the trip author's), the trip author, the entry zone, the time window against the stored start and finish and the identity across both tables; a deferred constraint trigger publishes an event only with its ACCEPTED acknowledgement and effect at revision 1; held events re-prove TRIP_ALREADY_CLOSED (completed trip, instant after its finish) and extend org_sync_review_source_valid with a trip.event.record branch keeping the meter, start and finish branches. Events carry no run clock and no day column. | VAL-23 and BR-OFFL-004 need one effect per operation even under handler defects; a database guard on the window survives a race with the finish; TRIP-017 keeps the trip's start day for every fact and elapsed time only between start and finish, so an event day or clock has no consumer and is derivable from the instant and the trip's stored zone; keys to assets or units would redefine three usage sources for no new information (the trip already holds them). | A mutable timeline row; storing events inside the trip row; an asset key on events; a run clock or local day column; a new review mechanism. | EMP-TRIP-003; B-BR-EMP-321/323/324; migration 000225; rollback: unregister the owner, tables remain. | | EDR-209 | Add no read route now: the timeline is a store read (TimelineTx: start, accepted events, finish, each with fact type, actor, declared instant and zone, and server receipt) ordered by one pure rule shared by Go and Kotlin (original instant; equal instants start, events by identity, finish) and frozen in the logbook-v1.psv oracle with the vocabulary and the event validation (the Android producer EMP-TRIP-005 appends events offline). The owner declares NO_ASYNC_FOLLOWUP for ACCEPTED/REJECTED and ATOMIC_REVIEW for ACCEPTED_FOR_REVIEW; no job, event-catalog entry or consumer. | EDR-175 precedent: no consumer reads trips yet and the panel timeline is EMP-TRIP-006; the app must show the same order before any receipt exists, so receipt cannot be an ordering key; a shared oracle keeps both languages honest. | A panel or own-result route now; ordering by receipt; a server-only domain without a Kotlin mirror; a follow-up event without a consumer. | EMP-TRIP-003; B-BR-EMP-324; EMP-TRIP-005/006 consume; EDR-175. | | EDR-210 | Store implement attachments in forced-RLS org_asset_implement_attachments (migration 000222): composite same-organization foreign keys to the implement and the powered asset, whole-microsecond half-open periods, EXCLUDE USING gist(org_id WITH =, implement_id WITH =, tstzrange(valid_from, valid_to, '[)') WITH &&), an empty period only when detached before its start; a row guard (insert under the ACTIVE root lock: implement kind IMPLEMENT, powered kind VEHICLE/MACHINE, both ACTIVE/INACTIVE, start not before the transaction; update: only detaching, end moved earlier, not before the transaction except to the start, with command data); receipts in org_asset_attachment_commands (ATTACH, DETACH); DELETE/TRUNCATE refused. Redefine org_asset_current_usage from the 217 body with the two new keys allow-listed and attachments counted as operations of both assets (kind fixed, BR-FLEET-002). No lifecycle consumer: deactivation or disposal of either asset ends nothing (a manager detaches; a disposed powered asset can have no trip). | BR-FLEET-033 and AC1 need a database guarantee against an implement in two places, also concurrently; FLEET-006 periods are the precedent; the kind is what makes an attachment valid, so it must not change underneath it; inventing automatic endings has no rule behind it. | An application-only overlap check; storing the implement list on the powered asset; deleting or rewriting periods; retroactive attachments; ending attachments on lifecycle changes without a rule. | EMP-FLEET-011; B-BR-EMP-325/326/328; BR-FLEET-002/033; fleet.md §3, §8; migration 000222 (usage lines: org_asset_implement_attachments_implement_fkey, ..._powered_fkey, the attachment count); rollback: capability flag off, tables remain. | | EDR-211 | Manage attachments under fresh fleet.asset.manage (configuration write, admission class fleet.asset), as UC-FLEET-10 and fleet.md §7 ("implements" under fleet.asset.manage) state; check the path asset through the route decision and the other asset inside the transaction with the same authority (structural grants through each asset's allocation); read the list under fleet.asset.read. Routes under /v1/orgs/{org_id}/fleet/assets/{asset_id}/attachments/: attach (path asset = implement, 201), {attachment_id}/detach (through either asset), list (either role). Overlap and ended attachments answer CONFLICT (UC-FLEET-10), not a new code. No catalog change. | The module text names fleet.asset.manage for implements; fleet.asset.assign (suggested for this task) is the employee-assignment key and would let a SUPERVISOR change asset composition that §7 reserves to managers; both assets carry structure, so a scoped manager must cover both. | fleet.asset.assign; checking only the path asset; a new error code; implement-only or powered-only list routes. | EMP-FLEET-011; B-BR-EMP-329; UC-FLEET-10; fleet.md §7; EDR-161/164; route inventory, auditor walk, OpenAPI. | | EDR-212 | Expose AttachedImplementsPort on the Fleet store (AttachedImplementsDBTX(powered, at), PoweredAssetDBTX(implement, at), borrowed organization transaction, no locks) for the trip start (EMP-TRIP-002) to record the implements attached at its instant (AC2); extend the FLEET-007 availability read so an attached implement takes the active-use answer of its powered asset at the instant as IN_USE causes naming the powered asset (AC3), with nothing else transferred; expose the pure MainAssetAllowed(kind) (AC4) for the trip-start eligibility. On this branch AC2/AC3 are proven through the ports with a test active-use source, because NoActiveUse answers no trips; the trip-side listing and the eligibility call site are retained for TRIP-002 integration. Server-only: no Kotlin mirror. | Trips are built in parallel (TRIP-002, migration 000220) and will replace NoActiveUse; a port keeps Fleet the owner of attachment periods without a dependency on trips; row 2 of fleet.md §6.2 names attached implements explicitly. | Writing a trip table here; copying attachments into trips now; transferring blocks or reservations of the powered asset; a device-side derivation. | EMP-FLEET-011; B-BR-EMP-327/328; BR-FLEET-025/026/033; fleet.md §6.2; EDR-194; retained: TRIP-002 calls the port and the eligibility check. | | EDR-213 | Place checklist templates in a new maintenance backend module (maintenance/domain/checklist, application, adapters, adapters/http) and the pure rule's Kotlin mirror in com.anpfuel.domain.enterprise.maintenance.checklist, sharing one oracle contracts/testdata/enterprise/checklist/checklist-v1.psv with the operations TEMPLATE, POLICY, EVALUATE, RESOLVE and POLICY_AT. Identify an item by its position inside the version; refuse a critical item marked optional; bound names to 80, labels to 120 and notes to 140 characters; express the run validity in seconds (3 600–259 200, default 43 200) with the policy mode (BLOCK default); require acknowledgement only when a critical item is NOT_OK under WARN; report answer errors in the fixed order INVALID, ANSWER_NOT_ALLOWED, PHOTO_REQUIRED, INCOMPLETE; take the policy in force as the latest effective instant not after the instant, ties by the higher revision. | 09-architecture §2 names maintenance as the CHECK and MAINT owner and maintenance.md proposes com.anpfuel.*.enterprise.maintenance; the fiscal precedent nests a sub-domain package in both languages. The run pins a version, so a position is stable for its life; NOT_APPLICABLE on a critical item would let an author avoid a block (maintenance.md §12 risk "answered mechanically"); BR-CHECK-005 asks for the confirmation only where BLOCK would block; EMP-CHECK-002 evaluates offline (BR-CHECK-006) and on the server (BR-CHECK-007), so the outcome, resolution and policy lookup must be one rule in two languages; the tie rule follows EDR-197. | A separate checklist backend module or a top-level Kotlin enterprise.checklist package; client-supplied item keys; critical optional items; acknowledgement for every issue under WARN; validity in whole hours; a server-only validator. | EMP-CHECK-001; B-BR-EMP-330/333/334; BR-CHECK-001..005/012/015; EMP-CHECK-002 consumes the shared rule. | | EDR-214 | Persist templates in migration 000223 with six forced-RLS tables: a template head org_checklist_templates (fixed context, ACTIVE/ARCHIVED, current version, current policy revision, template revision) changed only by a row guard admitting exactly one of publish (version +1), policy (policy revision +1) or archive, each with revision +1 under the ACTIVE organization root lock; insert-only org_checklist_template_versions, org_checklist_template_items, org_checklist_template_targets (composite same-organization keys to org_asset_categories and org_assets), org_checklist_policy_revisions and the receipts org_checklist_template_commands bound to the audit event. Guards number versions and policy revisions consecutively from 1, close a committed version (its item and target counts are stored and checked by a deferred completeness trigger, so nothing can be added later), admit only ACTIVE/INACTIVE assets as targets and refuse a target already named by another ACTIVE template of the context; the asset-use source keeps every 217 allow-list line and adds org_checklist_template_targets_asset_fkey. | BR-CHECK-001 requires immutable versions and history the server recheck reads (BR-CHECK-007); the deferred count check closes a version without depending on clocks or transaction identifiers; the root lock already serialises organization configuration writes (FLEET-007), so exclusivity is decided once and concurrent publications cannot both pass; asset targets never name a discardable draft, so the asset-use counts are unchanged (the 217 precedent). | Mutable versions with an updated_at; items and targets as JSON without foreign keys; a unique index on a mutable "current targets" table (needs deletes); counting templates as asset use; per-template locks only (would let two templates take one target). | EMP-CHECK-001; B-BR-EMP-330..333/335; FLEET-011 (000222) and TRIP-002 (000220) also redefine org_asset_current_usage, reconciled by the coordinator. | | EDR-215 | Seven company routes under /v1/orgs/{org_id}/checklists/: templates/create (201), templates/{template_id}/publish, templates/{template_id}/policy and templates/{template_id}/archive with fresh check.template.manage (configuration write, organizations capability, revision required except on create, admission class check.template); templates/list and templates/{template_id}/read (optional version) with current check.template.manage (read); all six on the organization target only. assets/{asset_id}/applicable with current fleet.asset.read on the asset (AUTH-006 structure and FLEET-006 SELF). A taken target, a stale revision and an archived template answer CONFLICT; no new error code. The matrix representative of the key is the template list; AUDITOR holds no check.* key, so the six template routes are FORBIDDEN to it while the applicable read is positive with its fleet.asset.read. Template events (check.template.published), the reference-feed extension (EMP-OFFL-006), policy history reads and runs stay retained. | Templates and their policy are organization configuration (maintenance.md §7, SCR-CHECK-06) and the catalog grants check.template.manage only O cells; a driver needs the applicable template of an assigned asset, which maintenance.md §7 reads through fleet.asset.read, while check.checklist.execute is S even for owners; a read representative avoids target conflicts between matrix roles; no consumer of template events exists yet and OFFL-006 is built in parallel. | The applicable read under check.checklist.execute; a dedicated CHECKLIST_TARGET_TAKEN code; returning every target to the driver; routes under fleet/assets/{asset_id}; publishing events without a consumer. | EMP-CHECK-001; B-BR-EMP-332/335; org-permissions-v5 (EDR-190); route inventory, matrix, auditor walk, OpenAPI; OFFL-006 retained. | | EDR-216 | Scope the F2 reference feed to its offline purpose ("my assets", 10-offline-sync §10.3): the assets currently assigned to the requesting member (FLEET-006 periods at the server instant), each delivered only while the member's current fleet.asset.read grants cover it (ORG, SELF through the assignment, UNIT/ASSET through its allocation); one minimised asset entity per asset — identity, revision, kind, usage basis, state, name, fleet number, plate, the accepted products of its tanks under the fuel-products-v1 catalog name, its in-service meters with their open segment, and the covering assignment's kind and end. No serial number, unit, cost centre, acquisition, value, other drivers, reservations or readings. Organization-wide asset lists stay on the online panel. Entity types are a closed, versioned set (asset now); checklist templates (EMP-CHECK-001) and availability join as new entity types by their owners. | BR-PRIV-003 limits a cached copy to what the purpose needs; BR-OFFL-016 makes the cache a read copy whose age is shown, never authority; a SELF driver must not learn other assignments and an ORG member's offline work is recorded against assigned assets; a closed entity set lets a client refuse unknown kinds instead of guessing. | Every asset the member can read (unbounded, beyond the purpose); embedding readings or other drivers; caching role grants as authority; free-form extension payloads. | EMP-OFFL-006; B-BR-EMP-336/337/341; BR-OFFL-003/016, BR-PRIV-003, BR-AUTH-014; FLEET-006, AUTH-006. | | EDR-217 | Serve the feed on a signed device route POST /v1/orgs/{org_id}/sync/reference (boundary SIGNED_REFERENCE_FEED) with the OFFL-008 review-results proof model: account proof, signature over the exact body, the current exact enrollment, request id echoed, strict whole-body preflight, private no-store response; ended, revoked or foreign sources keep their existing refusals. The cursor is opaque, HMAC-SHA256-signed with the deployment cursor secret, and binds organization, membership, enrollment, feed epoch and revision; any cursor that does not verify for the exact requesting period is NOT_FOUND with nothing revealed. | The Android enterprise client already polls signed routes offline-first with its enrollment (OFFL-003/004/008) and has no company cookie; a signed bound cursor makes a foreign or tampered cursor indistinguishable from an unknown one. | A company-cookie panel route; an unsigned cursor or a client-chosen revision; a cursor that is valid across members, devices or organizations. | EMP-OFFL-006; B-BR-EMP-338/340; OFFL-002/008 evidence. | | EDR-218 | Persist a per-membership change log derived on each pull (migration 000224): forced-RLS org_reference_feed_heads (epoch, monotonic revision) and append-only org_reference_feed_entries (revision, entity, UPSERT/DELETE, SHA-256 digest of the minimised projection, server time). Each pull locks the head, compares the current authorized set with the last logged state and appends one entry per change, so a DELETE tombstone outlives its source row and is delivered to every older cursor; a delta returns the latest entry per entity after the cursor with current content. No cursor, another epoch or a revision ahead of the head answers RESET; no current read authority answers RESET/FORBIDDEN with nothing. confirmed_at is the database clock after the final source check. The log stores digests, never content; no trigger is added to fleet tables. Server-only codec: the client parser belongs to FLEET-013 (retained). | Existing histories have no single ordered sequence across assets, assignments, meters and tanks and an assignment end does not record when a client last saw it; a derived log gives real monotonic revisions and durable tombstones without touching other modules' tables, and digests avoid duplicating personal data. | Time-watermark deltas (commit-order races miss changes); full snapshots without tombstones; triggers on fleet tables; storing projections in the log; a client-held list of seen entities. | EMP-OFFL-006; B-BR-EMP-339/340; BR-OFFL-004/016. | | EDR-219 | Wire EMP-FLEET-011 into the EMP-TRIP-002 start: (1) the start intake reads the asset kind with its admission facts under the organization root and asset locks and applies the pure MainAssetAllowed; an IMPLEMENT main asset is a final REJECTED MALFORMED with nothing stored (no trip, reading, held start or review item), checked with the DRAFT asset and before every held condition, so a start that could never become a trip is not kept for review; no database guard is added in this integration commit (no migration), the kind being locked by the asset row lock at receipt and fixed by the usage source once any trip or reading exists. (2) The implements of a trip are derived at read time, not stored: StartImplements.ImplementsAtStartDBTX(trip) reads the stored trip's asset and declared start instant and asks AttachedImplementsDBTX(asset, instant); no snapshot column or table is added. (3) An attached implement's IN_USE through its powered asset's trip needs no new code: the runtime ActiveUse is already the trip-backed source (EDR-206) and the availability read already follows the attachment (EDR-212); it is proven with real signed trips. | BR-FLEET-033 makes an implement attachable, never driven; the frozen ACK vocabulary has no kind code and EDR-202 already maps a start that cannot be a trip (DRAFT asset, inactive driver) to MALFORMED; BR-OFFL-006 keeps business conflicts for review, but an implement start is not a conflict a reviewer could resolve. Attachment periods are append-only toward the past (no retroactive attach, a detach never ends before its transaction instant except a never-started period at its own start), so the set at a past start instant never changes and a copy would duplicate the Fleet-owned fact. | ASSET_UNAVAILABLE held for review; a new wire code (IMPLEMENT_NOT_MAIN_ASSET); a trigger guard in this commit (needs a migration); storing the attached implements on the trip at receipt (a second copy that can drift from Fleet); a new active-use adapter for implements. | EMP-FLEET-011 AC2–AC4 × EMP-TRIP-002; B-BR-EMP-312/318/327/328; BR-FLEET-033; EDR-202/206/210/212; retained: the panel/report consumer of the start listing (EMP-TRIP-006), an optional database kind guard. | | EDR-220 | Submit through a signed device operation, not a member-session route: trip.submit schema 1 on the existing OFFL-002 intake, entity trip_review with id = the trip UUID and expected_revision = the review revision submitted (the case revision, not the start/finish entity revision), at most one dependency (the finish), exact empty payload {}; terminal results ACCEPTED and REJECTED with NO_ASYNC_FOLLOWUP and no held path. Map refusals onto the frozen ACK vocabulary like the finish: another member FORBIDDEN (whole response), a trip not stored here or still IN_PROGRESS DEPENDENCY_PENDING, an envelope or payload outside the shape MALFORMED; a case no longer DRAFT at the named revision and changed rights store nothing and stay RETRY/UNAVAILABLE. Authority reuses TripAuthority (trip.trip.start over the stored own trip, EDR-118 continuity) unchanged. | The C1 flow and 12-ux-app §4 make "Encerrar e enviar" an offline action that becomes SUBMITTED only on server receipt (BR-REV-002, 08-state-model §1, offline matrix "Fueling … Offline (submit)"), so the Android producer (EMP-TRIP-005) must queue it behind the finish; a separate entity type keeps the review revision distinct from the operational ACK revisions 1/2; the 10-offline-sync table maps a stale revision to a held STALE_REVISION, but a held fact needs an owner that can resolve it (EDR-177), which is EMP-TRIP-015's resubmission and late-duplicate scope. | A member-session submit route (online only, contradicts the offline matrix); submitting at finish (EDR-205); entity trip with revision 3; a held STALE_REVISION submit without a resolution owner; a payload repeating the trip id or revision. | EMP-TRIP-004; B-BR-EMP-342, B-BR-EMP-343; BR-REV-002, BR-OFFL-004/006/007; EDR-177, EDR-202, EDR-205; EMP-TRIP-005 producer, EMP-TRIP-015 retained. | | EDR-221 | Store the review history in one append-only, forced-RLS org_trip_review_entries (migration 000226): (org, trip, sequence) key, kind (SUBMIT, OPEN, APPROVE, RETURN, REJECT in this cut), revision, resulting state, exact reason ('' when none), actor membership and its employee record, operation, receipt; same-organization composite foreign keys only to the trip, the membership and the employee record (no asset, unit or cost-centre key, so no usage source changes); partial unique indexes for one SUBMIT per trip and one OPEN and one decision per revision, and UNIQUE(org, operation, kind). A BEFORE trigger takes the organization root and the trip row locks and re-proves the APPR-001 transition from the latest entry, the reason policy, a COMPLETED trip, the author (SUBMIT: the trip's author membership through a trip.submit operation on entity trip_review) or the reviewer's separation from author and driver (canonical merge chain); deferred constraint triggers publish a SUBMIT only with its ACCEPTED acknowledgement and effect at the entry revision and a decision only with its trip.trip.* audit event. The current state is derived from the latest entry, never stored separately. | 06-domain-model and the APPR-001 retained note ask for an append-only history unique per revision; FUEL-002's org_fueling_review_entries is the precedent shape; a head table would be a second truth; the trip row lock serializes competing decisions without the asset; database guards keep a defective handler from writing an impossible or self-approved history. | A mutable review column on org_trips (the row is guarded insert-only except completion); a head table; foreign keys to the asset/unit/cost centre (redefining three usage sources for no new fact); trusting the application alone. | EMP-TRIP-004; B-BR-EMP-342, B-BR-EMP-345; BR-REV-003/005/007, BR-AUD-001/002; migration 000226; rollback: stop registering the owner and routes, entries are retained. | | EDR-222 | Decide on POST /v1/orgs/{org_id}/trips/{trip_id}/review/decide under trip.trip.review (configuration write, fresh proof, expected revision, admission class trip.review) and read the decision context on …/review/read and the organization queue on /v1/orgs/{org_id}/trips/review/list (trips whose latest entry is SUBMITTED or IN_REVIEW, keyset by submission) under trip.trip.review (read); the queue is an organization-level resource, so only ORG grants cover it and structural reviewers open each trip through its read. The decision composes OPEN and the decision in one transaction for a SUBMITTED case. A TripStructure resource kind resolves the trip to its asset, its stored unit and cost centre and the teams whose links covered its author or driver at the start receipt, for UNIT, COST_CENTRE, TEAM and ASSET grants (Prepare and the in-transaction company re-check); a TripReviewAuthority reuses the company authority and returns the reviewer's membership and employee record; audit actions trip.trip.approved, trip.trip.returned, trip.trip.rejected on target type trip. Error mapping: SELF_APPROVAL and FORBIDDEN as is, CONFLICT and INVALID_TRANSITION → CONFLICT, INVALID/REASON_REQUIRED → VALIDATION_FAILED. | The catalog v5 cell grants trip.trip.review to OWNER, ADMIN, FLEET_MANAGER, SUPERVISOR and APPROVER (DRIVER, FINANCE, AUDITOR denied); decisions are online only (offline matrix); BR-AUTH-005 needs the stored snapshot and EDR-161 named trips as a consumer; VAL-01 step 6 is one reviewer action, so a separate open step adds nothing in C1; the panel screens and scoped lists (structural list filtering) are EMP-TRIP-006. | A separate open route; filtering the queue by structural scope now (EDR-161 retained list filtering); reading the review under trip.trip.read (it would give AUDITOR the decision context before the panel defines what auditors see); the asset's current allocation instead of the stored snapshot; current team membership. | EMP-TRIP-004; B-BR-EMP-344..346; BR-AUTH-004/005, BR-REV-004; EDR-160/161, EDR-188; route inventory, matrix, auditor walk, OpenAPI. | | EDR-223 | Bind the trip review to the integrated APPR-001 review/domain in trip/application (server-only): ReviewCase replays the stored entries with review.Replay, trip.ReviewState is derived from it (DRAFT when there is no entry), commands go through Case.Apply with server facts (actor, author, beneficiary = driver, permission already proven), and the submission gate admits only an operational COMPLETED trip whose case is DRAFT. RETURNED only records the reason now; CANCEL, RESUBMIT, void and amendments are not produced. No new shared oracle or Kotlin mirror: the lifecycle vectors stay review-v1.psv and the operational vectors trip-v1.psv, both already consumed by Go and Kotlin. | EDR-181 kept the trip domain free of the review package; the gate is a server receipt rule over stored facts that a device never decides (the producer only queues trip.submit behind its finish, using the existing TripStanding); budget and payable precedents record server-only bindings as an EDR; a correction loop needs EMP-TRIP-015's revision source. | A new trip-review-v1.psv with a Kotlin mirror for a mapping the device does not evaluate; importing review into trip/domain; submitting a non-completed trip with a later completion check; automatic approval on completion. | EMP-TRIP-004; B-BR-EMP-343, B-BR-EMP-347; EDR-128..130, EDR-181, EDR-205; EMP-TRIP-005/015 retained. | | EDR-224 | Keep the FLEET-013 "local tables" for assigned assets, accepted products and meters as one typed, versioned reference cache inside the accepted EMP-PRIV-003 protected generation of the exact account/origin/organization (one sealed CACHE entry with a fixed identifier per partition), bound to membership and enrollment, never as new plaintext Room tables. The backlog's "schema migration test" becomes the versioned cache codec (reference-cache v1, canonical JSON pinned by the shared vectors) with tests that a generation written before this task opens with an empty cache, that an unknown version or another enrollment reads as absent and is overwritten by the next full pull, and that process death around the commit leaves either the old or the new cache. | EDR-076 already rejected a second Room store because it would escape the protected generation boundary; the enterprise Room database is a synthetic foundation absent from production DI and PRIV-003 forbids any plaintext Room/WAL/journal fallback; the existing CACHE kind is already sealed and decodable by older builds, so no vault format change is needed. | Room tables in EnterpriseDatabase v2 (plaintext, outside custody); a new vault kind ordinal (no benefit, unreadable by an older APK); a cache keyed by organization only (cross-account leak). | EMP-FLEET-013; B-BR-EMP-348; EMP-GOV-008, EMP-PRIV-003, EMP-OFFL-003; record before code. | | EDR-225 | Apply the signed reference feed in a strict Kotlin client: whole-response preflight against the frozen OpenAPI shape (exact keys, closed enums, bounds, canonical UTC instants, entity_types exactly ["asset"]), correlation to the request and to the held revision, then RESET replaces / DELTA patches / tombstones remove / FORBIDDEN empties, committed in one compare-and-set protected write with the new cursor, revision, server confirmed_at and the device commit clock; any violation changes nothing. A NOT_FOUND on a request with a cursor is retried once without a cursor (a rotated cursor key or lost head must not lock a device out); responses up to 2 MiB are read (200 assets at their OpenAPI maxima fit). Pulls run when "Meus ativos" opens while connected and on an explicit refresh; no background pull is added. | B-BR-EMP-339/340 define ordered, gap-detectable deltas and resets; a client that guessed past a gap or kept data after FORBIDDEN would turn a read copy into stale authority; the protected generation commit is the only atomic unit; one bounded retry is enough to self-heal a cursor the server no longer verifies. | Applying partial responses; trusting the device clock to drop assets; unbounded retries; a periodic worker pull before an owner measures cost. | EMP-FLEET-013; B-BR-EMP-349; EDR-216..218; record before code. | | EDR-226 | Present the cache honestly: show the server confirmed_at; mark the list "não confirmado" after 24 hours by device elapsed time in one boot (wall clock after a reboot, unconfirmed if it went backwards), mark an asset not confirmed when its cached assignment end has passed, show a separate notice when a refresh fails; never hide or disable an asset on the device clock. Lifecycle state is the only availability fact in the feed: a state other than ACTIVE is shown as not available with its state, and nothing else is claimed. The picker lets a not available or not confirmed asset be chosen after a review warning (SCR-FLEET-09, BR-FLEET-027, task AC3), which supersedes "listed disabled" in 12-ux-app §4.5 step 3 for this task; preselection of a single asset and search stay with the calling flows. A build flag enterpriseFleetUiEnabled (default on) hides the entry as the rollback switch. | BR-OFFL-016 and 12-ux-app §3 fix the 24-hour default; the device cannot know a server-side unassignment, so it may warn but never decide (BR-FLEET-027); the feed carries no availability, reading or tank capacity (EDR-216), so showing them would be invented; the existing QUALITY_UI_ENABLED/OCCURRENCE_UI_ENABLED flags are the app's rollback pattern. | Disabled rows for unavailable assets; dropping assets whose end passed; a wall-clock-only age; showing a derived availability. | EMP-FLEET-013; B-BR-EMP-350..352; UC-FLEET-08; SCR-FLEET-08/09/10; record before code. | | EDR-227 | Pin the wire with contracts/testdata/enterprise/sync/reference-feed-v1.psv (REQUEST, RESPONSE, APPLY rows; SHA-256, counts, unique IDs and every operation/outcome asserted by both consumers): the Go consumer runs REQUEST rows through the real server request parser and proves every RESPONSE/APPLY response the client accepts is exactly what the server's wire struct re-encodes and satisfies the server delta invariants, while every response the client refuses as INVALID is not server-producible; the Kotlin consumer runs the request builder/parser, the response parser and the APPLY reducer (cache canonical bytes). APPLY semantics are client-only and have no Go mirror. Native acceptance uses an opt-in ordinary-PostGIS signed HTTPS fixture (integration && nativefixture) and an Android data instrumentation test on the owned API 36 emulator only. Last known readings and tank capacity are not in the feed and stay retained with a readings/tank entity-type owner. | OFFL-006 retained the Kotlin client and shared wire vectors to this task; only the client applies changes, so a Go APPLY mirror would be fabricated; the OFFL-003/OFFL-008 native fixtures are the accepted pattern for signed device acceptance. | Kotlin-only vectors; a Go apply mirror; a mock server for native acceptance; adding readings to the feed in an Android task. | EMP-FLEET-013; BUC-EMP-177; EDR-062, EDR-216..218; record before code. | | EDR-228 | Model missions as a pure domain in trip/domain/mission.go mirrored by Kotlin com.anpfuel.domain.enterprise.trip.TripMission over one shared oracle contracts/testdata/enterprise/trip/mission-v1.psv: the closed 8-state and 7-command vocabularies, the 8×7 transition table (terminal INVALID_TRANSITION; PLAN, START, COMPLETE and any IN_PROGRESS change UNSUPPORTED_COMMAND; ACCEPT/DECLINE from ASSIGNED only; ASSIGN and CANCEL from DRAFT, PLANNED, ASSIGNED, ACCEPTED, DECLINED), NewMission (DRAFT, revision 1), RestoreMission (stored invariants: DRAFT only at revision 1 without assignee; ASSIGNED with an assignee and no response; ACCEPTED/DECLINED with the assignee's own response), and Assign/Respond/Cancel on a restored mission with a fixed failure order (inputs, then for a response FORBIDDEN unless the member is the current assignee, then a stale expected revision CONFLICT, then the table, then reassignment to the same member INVALID_TRANSITION). Decline and cancel need a reason and accept none; title and reasons use the METER-001 text profile (org_asset_text_valid(…,280,true)); the window is half-open with whole-microsecond bounds and no maximum span. | The app executes accepted missions (EMP-TRIP-021), so device and server must agree on states and refusals; the restored-mission form is exactly what the store applies; checking authority before the revision keeps a non-assignee from learning anything; reasons make a decline or cancellation actionable; inventing a span limit or a time-of-command rule would be an unrequested product rule. | A server-only domain (the app needs it); a free set state; letting a member withdraw an acceptance (a second, different response is a conflict, the manager reassigns); creating as PLANNED (leaves no state for EMP-TRIP-009 planning); a maximum window. | EMP-TRIP-008; B-BR-EMP-353..356; 08-state-model §3/§4; trips.md §6; retained: PLAN and planning edits (EMP-TRIP-009), START/COMPLETE (EMP-TRIP-021/023), vehicle change (EMP-TRIP-013). | | EDR-229 | Carry the assignee's response as the signed intake operation trip.mission.respond schema 1 (entity mission, id = mission, expected_revision required, no dependency, soft reference or attachment; exact payload response ∈ {ACCEPT,DECLINE} and reason), registered with ACCEPTED/REJECTED terminal results and no asynchronous follow-up. Decide it only on current facts at receipt (no EDR-118 history classification, no held fact, no late holder): write policy trip.trip.start (operational write) through TripAuthority.CheckMissionTx with the stored current assignee as AssignedTo and the stored unit and asset as structure; the domain Respond then the head update under the mission row lock. Map onto the frozen vocabulary: ACCEPTED with the new revision; REJECTED MALFORMED (admitted by the ORG root selector, as for trips); transport denials that store nothing: FORBIDDEN (not the current assignee or no current coverage), NOT_FOUND (no mission here, including another organization's), CONFLICT (stale revision or a mission no longer ASSIGNED). Receipt replays need current trip.trip.start (read) over the member's own stored response. An ended membership is decided by EMP-OFFL-009 before the owner (no late holder: RETRY/UNAVAILABLE inside the window, else MEMBERSHIP_ENDED/INTAKE_WINDOW_CLOSED); EMP-OFFL-012 organization states apply unchanged. | The offline matrix (10-offline-sync §10.3) makes accept/decline an offline action whose server check is "mission still assigned to me", and only the signed queue is offline on Android; a response is a commitment about future work, not a field fact, so BR-OFFL-009 review holds would leave items nobody can resolve and a late response must not apply on the strength of the device clock; 08-state-model §4.7 gives the concurrency loser CONFLICT with nothing changed, which the frozen ACK vocabulary can only express as a registered transport denial (the TRIP-002 FORBIDDEN/NOT_FOUND precedent). | A member-session HTTP route (online only, contradicts the matrix); holding stale or late responses STALE_REVISION/PERMISSION_CHANGED for review (no resolver; TRIP-021 may revisit); new ACK codes (frozen OFFL-001 profile); accepting on the declared instant; a late holder for ended members. | EMP-TRIP-008; B-BR-EMP-356, B-BR-EMP-358; BR-OFFL-004/006/008/009, 10-offline-sync §8, §10.2, §10.3; EDR-202, EDR-206; retained: device handling of a whole-batch CONFLICT/FORBIDDEN and the inbox (EMP-TRIP-021). | | EDR-230 | Persist missions in migration 000227 with three forced-RLS tables: the head org_trip_missions (unit, optional asset, title, window, state, revision, current assignee employee and membership, creation facts) whose rows change only by the guarded +1 update that matches the already-inserted transition of the new revision; insert-only org_trip_mission_transitions (one per revision: kind, from/to state, actor membership and account, the web command or the device operation and enrollment, assignee, response, reason) whose BEFORE INSERT trigger re-proves the table, the current revision, the assignee's ACTIVE membership of an ACTIVE unmerged employee and, for a response, the exact trip.mission.respond operation of the assignee; a deferred check publishes a response only with its ACCEPTED receipt at that revision; insert-only receipts org_trip_mission_commands (kind, request hash, resulting revision and state, warning). Composite same-organization foreign keys to unit, asset, employee, membership, enrollment and operation; the unit (000220 body) and asset (000223 body) usage sources keep every line and recognise the two new keys as associations (counts unchanged: a mission names only ACTIVE units and assets). Queries live in a separate sqlc package db/queries/mission owned by the trip module. No link to trips is stored now: a trip.start schema 2 with an optional mission_id checked at receipt, and the IN_PROGRESS/COMPLETED mission states it produces, belong to EMP-TRIP-021/023; no reference-feed entity is added (EMP-TRIP-021). | The history must survive reassignment and decline (trips.md §6, BR-AUD-001) and concurrent commands must serialize on one row with an exact revision; proving the transition inside the database keeps any future producer honest; associations, not use, keep archive and discard behaviour unchanged (EDR-203/214 precedent); a separate query package avoids regenerating the shared trip models that another F4 task changes in parallel; changing the trip.start payload here would break TRIP-002's exact schema 1 without its executing consumer. | A free-form state column; event-sourced reads; deleting or rewriting transitions; counting missions as unit/asset use; adding mission_id to trip.start schema 1; storing the availability warning on the mission. | EMP-TRIP-008; B-BR-EMP-353..355, B-BR-EMP-358; migration 000227; EDR-203/214/219; rollback: routes and the intake owner can be withdrawn while tables remain. | | EDR-231 | Six company routes under /v1/orgs/{org_id}/missions/ (beside the EMP-TRIP-004 /trips/ routes): create (201) and list on the organization target, {mission_id}/read, {mission_id}/assign and {mission_id}/cancel on the mission target (new AUTH-006 structure kind MissionStructure: the stored unit and asset), all under trip.mission.manage (commands fresh configuration writes with revision, admission class trip.mission), and mine/list under trip.trip.start (read) targeting the membership itself like the FLEET-006 own list. Errors: unknown/foreign unit, asset, employee or mission NOT_FOUND; invalid content, an ineligible asset or assignee VALIDATION_FAILED; stale revision, disallowed transition or same-assignee reassignment CONFLICT. Inventory: trip.mission.manage ROUTED (5 routes, representative the list) and trip.trip.start ROUTED (the own list; its signed producers stay described in the sync contract); matrix representatives trip.mission.manage → /missions/list and trip.trip.start → /missions/mine/list (its S cells cover the member's own list, like the SELF document attach); AUDITOR is FORBIDDEN on all six. | trip.mission.manage is the planner key of 07-permissions §7.3 and SCR-TRIP-03; organization-level actions carry no structure (EDR-161), as asset registration does; the own list is the inbox source the app reads online (EMP-TRIP-021) and trip.trip.start is exactly the right to respond; AUDITOR has neither key, and an auditor mission read under trip.trip.read belongs to the trip panel reads. | Mission reads under trip.trip.read (couples the planner board to EMP-TRIP-004/006 reads); unit-filtered organization lists (EDR-161); a per-unit create path; an AUDITOR-positive mission read in this task; marking trip.trip.start SIGNED_OPERATION. | EMP-TRIP-008; B-BR-EMP-357; 07-permissions §7.3; EDR-161, EDR-165, EDR-215; route inventory, matrix, AUTH-011 auditor walk, OpenAPI. | | EDR-232 | Gate trip review decisions with the APPR-006 PeriodGate.StateForDayTx on the trip's stored start reporting_day inside the decision transaction (after the company authority's organization root lock, the trip row lock, the replay lookup and the APPR-001 lifecycle checks; before any entry or audit write): OPEN, or REOPENED with its stored reasoned fin.period.reopen transition (PeriodFact.Writable), admits; LOCKED refuses PERIOD_LOCKED (409). Replays and reads are not gated. Field intake (trip.start, trip.finish, trip.event.record, trip.submit) never consults the gate: a late fact of a locked month is an accepted fact and its trip's decision waits for an authorised reopening. Trips have no adjustment form: BR-AMD-004's adjustment branch is refused until an owner posts trip amounts to periods. | BR-TIME-004 and EDR-182 fix the trip to its start day attributed with the stored context, so the stored day is the only admissible key; BR-TIME-003 evaluates the lock at receipt, which the root lock makes current; orgamend orders the period check last, so lifecycle refusals keep their codes; B-BR-EMP-266 already keeps field facts unblocked (BR-OFFL-006), a held PERIOD_LOCKED intake item would need a resolution owner (EDR-177) and would hide an accepted start from active use, and the review queue already is the place where the submitted trip waits; an adjustment needs a posted amount, which a trip does not have. | StateForOccurrenceTx with the current unit zone (re-attributes with a later context); the device entry zone, the UTC day, the finish day or the receipt day; gating replays (a recorded approval must keep answering); a held PERIOD_LOCKED ACK for intake; an adjustment record for trip distance; gating reads. | EMP-TRIP-016; B-BR-EMP-359..361; BR-TIME-003/004, BR-AMD-004, BR-OFFL-006; EDR-149, EDR-177, EDR-182; JRN-09. | | EDR-233 | Migration 000228 replaces org_trip_review_entry_source() with the complete 000226 body plus one clause: an OPEN, APPROVE, RETURN or REJECT entry whose trip's start reporting month (date_trunc('month', reporting_day)) has a LOCKED head in org_finance_periods is refused (55000, "trip reporting period locked"); the check runs after the existing transition, author and reviewer checks under the organization root FOR UPDATE that the trigger already takes, which every period command also takes. No table, column, index or usage source changes; the runtime role needs SELECT on org_finance_periods (already needed by the gate). Rollback: replace the function with the 000226 body; recorded entries are unaffected. | A defective or bypassing handler must not record a decision in a locked month (the EDR-221 defence-in-depth precedent); the root lock makes the head read current against concurrent period commands; reading the head table is enough because a REOPENED head always has its reasoned transition (000203 guards). | A new decision-period column or table (the order is already the root-serialized order of two append-only histories); trusting the application gate alone; a SUBMIT check (field intake is not gated, EDR-232). | EMP-TRIP-016; B-BR-EMP-362; EDR-148/149, EDR-221; migration 000228. | | EDR-234 | Read a trip's append-only review history as record revisions: the field segment (SUBMIT, the author's RESUBMIT and their APPR-001 decisions) and one segment per AMEND entry, each replayed as an APPR-001 case (an amendment segment starts SUBMITTED at its own absolute revision); the effective revision is the latest APPROVE. Migration 000229 widens org_trip_review_entries (kinds RESUBMIT, AMEND; AMEND requires a reason; one submission-producing entry per revision) and replaces the 228 entry guard (RESUBMIT only of a returned never-approved field revision by the trip's author through trip.submit; AMEND only after an approval, a rejected or a returned amendment, beside its content row; reviewer separation from the amendment's author; period lock on AMEND) and the 226 publication guard (RESUBMIT with its ACK; AMEND with its audit event; an approved amendment with its supersession). The resubmission is the existing trip.submit naming the returned revision (ACK entity revision = the new revision); logbook events are edits only while the case is DRAFT or a returned field revision. | BR-AMD-006/BR-REV-005 make the author's correction of a returned record a new revision of the same record and VAL-01 step 6 needs exactly that loop offline; APPR-001 makes APPROVED terminal, so an amendment needs a new reviewed case that keeps the same revision numbering for orgamend (Latest, Effective); one history keeps one truth (EDR-221). | A second history table for amendments; reopening the APPR-001 case after approval; a new resubmit operation type; changing review/domain and its shared vectors; letting events after submission silently join the revision under review. | EMP-TRIP-015; B-BR-EMP-363, B-BR-EMP-368; BR-AMD-001/002/006, BR-REV-005; EDR-128, EDR-221..223; migration 000229. | | EDR-235 | Keep late and duplicate field facts after submission as OFFL-008 held facts with the frozen code STALE_REVISION: a supported event at or before the finish of a trip whose revision is submitted, decided or amended (the 225 held-event guard widened; a direct event fact on such a revision refused by the 225 event guard replaced), and a trip.submit naming a revision that is no longer the current draft or returned field revision (new insert-only org_trip_held_submissions, its guard re-proving the author source and the stale condition, the review-source hook extended from its 225 body, the owner's descriptor and suite plan adding ACCEPTED_FOR_REVIEW/ATOMIC_REVIEW). Exact resends replay; another digest is OPERATION_ID_REUSED; a used event identity stays MALFORMED. Resolution stays with EMP-TRIP-007; changed rights stay RETRY/UNAVAILABLE. | 10-offline-sync maps a stale expected revision to a held STALE_REVISION with both versions kept and VAL-26 (a)/(b) asks for a late event that is not dropped, does not change the approved revision and is stored once; a held fact needs an owner, and the trip's held facts already have one (EMP-TRIP-007, EDR-177); a submit that retries forever (RETRY until TRIP-015) is no final answer. | Accepting late events into a submitted or approved revision; refusing them (MALFORMED) or dropping them; answering a duplicate submission ACCEPTED without an entry; TRIP_ALREADY_CLOSED for an event inside the trip; holding changed rights here (authority resolution belongs to EMP-TRIP-007). | EMP-TRIP-015; B-BR-EMP-364; BR-OFFL-004/005/006, BR-AMD-001; EDR-177, EDR-207..209, EDR-220; VAL-26 (a)/(b). | | EDR-236 | Amend an approved trip through the company route POST /v1/orgs/{org_id}/trips/{trip_id}/amendments/propose under meter.reading.correct (configuration write, fresh proof, admission class meter.review, structure resolved by the TripStructure kind) with a required reason and a corrected start and/or end reading (kind, exact base units); decide it with the orgamend kernel on server facts (AMEND from the approved or rejected-amendment state with base = effective, EDIT of a returned pending amendment with base = that revision; Authority.Amend = the proven permission; the period of the stored start day from the EMP-TRIP-016 gate, EDIT gated as well); store one insert-only org_trip_amendments row (each corrected reading of the effective revision with its stored value, the corrected value and a pre-allocated superseding reading id) beside the AMEND entry and one trip.trip.amended audit event. Server-only: no Kotlin mirror and no new shared oracle. | trips §7 says meter corrections use their owning permission and no trip.trip.amend key exists in catalog v5; VAL-26 is a fleet manager correcting a reading; the offline matrix makes corrections and decisions online; the kernel and its 193 vectors already fix the decision order and the device never evaluates an amendment, so a mirror would have no consumer (EDR-137). | A new permission key or catalog version; amending through the signed intake; editing the trip or finish rows in place; superseding the reading at proposal time (it would change the series before approval); a Kotlin mirror. | EMP-TRIP-015; B-BR-EMP-365; BR-AMD-001/002/004, BR-AUTH-005; EDR-137/138, EDR-161, EDR-187, EDR-232. | | EDR-237 | Apply an approved amendment in the decision transaction: orgamend Resolve (period re-checked), then for each corrected reading the fleet port MeterStore.SupersedeApprovedTx (the METER-004 supersession under the asset and meter locks, reviewer as author, its company session as capture, the decision operation and digest, the amendment reason, segment re-evaluation; no own authority, audit event or approved-parent refusal); a deferred guard proves the supersession at commit. Derive usage per named revision with the TRIP-001 rule from the stored values plus approved corrections; the decision context adds the effective revision with its usage and each amendment with corrections, state, author, reason and usage (an amendment's own reading values are the content under review). The METER-004 parent port becomes a set (fuelings and trips) so a reading of an approved trip is AMENDMENT_REQUIRED. | VAL-26 (c) requires the correction to be a new reading that supersedes the old one only when the amendment is approved, 290 000 m until then and 280 000 m after, named by revision; reusing the METER-004 supersession keeps one reading-correction behaviour (classification, voiding, links); B-BR-EMP-290 already names the approved parent rule; deriving usage avoids a stored figure that could drift. | Superseding without review; a stored trip distance column; a second reading-correction implementation in the trip module; recalculation jobs without consumers (METER-006/KPI own them); leaving METER-004 able to change an approved trip's readings in place. | EMP-TRIP-015; B-BR-EMP-366..368; BR-AMD-002/005, BR-TRIP-003/004; B-BR-EMP-287..290; EDR-187..189. | | EDR-238 | Record damages and incidents through one signed operation check.incident.report schema 1 (entity incident_report) on the existing OFFL-002 intake, with the exact payload report_type, incident_kind, asset_id, trip_id, description, location, blocks_use; the envelope declaration is when it happened. The owner (maintenance adapters) shares the trip owners' real sources: a new IncidentAuthority over the meter authority's memberships, recorded role periods, devices and FLEET-006 assignee port (current device; check.incident.report from retained history with ORG grants covering every asset and SELF grants covering assigned periods; structural grants unsupported as for every intake owner), the fleet lifecycle lookup for the root and asset locks, the FLEET-005 allocation snapshot at the declared instant, and the trip store. Outcomes: foreign/unknown asset whole-response NOT_FOUND; no permission FORBIDDEN; DRAFT asset, shape, kind/type mismatch, text profile, identity reuse MALFORMED; changed rights or a disposal-ended assignment store nothing and stay RETRY/UNAVAILABLE; envelope attachments stay RETRY/UNAVAILABLE. Migration 000230: forced-RLS org_incident_reports (insert re-proves the operation, the active reporter and enrollment, a non-DRAFT asset, the trip's asset, author and window under the root and trip locks; only state, revision and updated_at change, one revision at a time, each backed by its history row) and append-only org_incident_report_transitions (the handling history and command receipt: action, from/to, note, duplicate, handler account/membership/employee, operation with a deferred audit-event key, digest; the database re-proves the transition, the note policy, the duplicate's asset and the separation of handler and reporter for a blocking report); asset, unit and cost-centre usage sources extended from their latest bodies (000223, 000220) as associations. | maintenance.md §8 names one record per report operation; a damage and an incident share the state model, permission and handling (08-state-model), so one operation and one table with a discriminator avoid duplicating the owner, the contract and the guards; the trip owners already prove the device, history continuity, locks and allocation, and reusing their ports keeps one copy of those rules; storing the allocation at the declared instant follows BR-AUTH-005 and lets structural managers be scoped without reading the asset's current allocation; a non-final answer for changed rights follows EDR-207/TRIP-003 until a held owner exists. | Two operations check.damage.report/check.incident.report with duplicated owners; a member-session report route (not durable offline); storing the current asset allocation instead of the one at the declared instant; refusing reports on INACTIVE or disposed assets outright; a held review path for changed rights now; a free-text field for injuries, people or amounts. | EMP-CHECK-003; B-BR-EMP-369, B-BR-EMP-370, B-BR-EMP-371; BUC-EMP-186; BR-CHECK-014/015/018, BR-OFFL-004/006/007, BR-AUTH-005. Retained: held reports for changed rights and late intake, notice numbers and linked damages of an incident, damages from checklist answers (EMP-CHECK-002), the asset block and release (EMP-CHECK-002/004, BR-CHECK-010/011), notifications, Android producer. | | EDR-239 | Attach photos only through the existing EMP-DOC-002/003 document chain: the DOC-001 closed link kinds gain INCIDENT (Go domain, Kotlin mirror and one document-v1.psv ENUM row, not allocatable), org_document_links gains the typed reference incident_report_id with its same-organization key and binding branch (000230), and the maintenance module registers the INCIDENT owner resolver (check.incident.report, OperationalWrite to link and Read to list, the report's reporter as the authored-by fact), so linking needs doc.document.attach on the member's own document and check.incident.report on the member's own report. The report operation itself carries no document reference; report reads join the links and show each document only with its own storage state and link instant. | BR-CHECK-016 says photos are organization documents; DOC-003's closed registry and owner resolvers are the designed extension point, and both endpoint checks come for free (another member's document is refused by the document-side S cell); keeping photos out of the report operation makes the report's acceptance independent of uploads by construction (BR-OFFL-015) and needs no second copy of document state; the DOC-003 link port takes a pgx.Tx, while intake owners receive a borrowed DBTX, and the signed device link path belongs to EMP-DOC-004/EMP-OFFL-005. | A report-owned attachment table copying document identity or state; a payload list of document identifiers linked inside the intake (would make reports wait on uploads or need an ORPHAN review path); widening the DOC-003 link port to DBTX now; serving content or a capability from the report read; letting managers link photos to another member's report. | EMP-CHECK-003; B-BR-EMP-372; BUC-EMP-187; BR-CHECK-016, BR-PRIV-004, BR-OFFL-015, OQ-04; EDR-162/163. Retained: device attachment declarations and signed links (EMP-OFFL-005, EMP-DOC-004), photo kinds beyond the C1 synthetic JPEG receipt container, unlink and replacement (EMP-DOC-011), retention (EMP-DOC-012). | | EDR-240 | Show a report made inside a trip on the trip timeline by a read join, not by a logbook row: trip/application declares the TimelineReports port and trip/adapters.EventStore.TimelineTx requires it, merging each accepted report of the trip as an INCIDENT or DAMAGE timeline event (identity, reporter, declaration, receipt, no text) in the B-BR-EMP-324 order; the maintenance store implements it and the suite composes it. trip.event.record answers INCIDENT and DAMAGE with a final MALFORMED (their facts are their own operation, like start and finish); the logbook vocabulary and oracle stay unchanged (both remain RESERVED for the logbook operation). | BR-CHECK-014 asks that the report "also appears" in the logbook; a read join keeps one fact in one place, needs no change to the 000225 tables, guards or held path, and cannot drift from the report; the report's own trip checks (asset, author, window) run under the same locks as the trip finish; an endless RETRY for a token whose owner now exists would never converge, while MALFORMED tells a producer at once to use the report operation. | Writing an org_trip_events row from the report transaction (redefines the 000225 trigger functions and couples two owners' guards); keeping RETRY/UNAVAILABLE for INCIDENT/DAMAGE forever; copying the description into the timeline; a timeline that silently omits reports when the source is not composed. | EMP-CHECK-003, EMP-TRIP-003; B-BR-EMP-371; BR-CHECK-014; EDR-207/209. Retained: the panel timeline (EMP-TRIP-006) and the Android timeline (EMP-TRIP-005). | | EDR-241 | Handle reports on company routes under check.incident.manage (org-permissions-v5): POST /v1/orgs/{org_id}/incidents/reports/{report_id}/decide (configuration write, fresh proof, revision, admission class check.incident), …/{report_id}/read and the organization queue …/incidents/reports/list (reads; the queue is an organization-level resource that only an ORG grant covers, as EDR-222), structural grants resolving through a new IncidentStructure (the stored asset, unit and cost centre; no team facts yet); the reporter's own list …/incidents/reports/mine under check.incident.report (read, own target = the membership, as the FLEET-006 own assignment list). The queue representative of check.incident.manage and the own list of check.incident.report join the authorization matrix (S cells cover exactly the member's own list); AUDITOR is FORBIDDEN on all four. The pure rule lives in maintenance/domain/incident (standard library) with the Kotlin mirror com.anpfuel.domain.enterprise.maintenance.incident over the shared oracle contracts/testdata/enterprise/checklist/incident-v1.psv (REPORT and DECIDE; errors INVALID, CONFLICT, TRANSITION, SELF_APPROVAL in that order), because the app records reports offline and shows their state. | UC-CHECK-04 and SCR-CHECK-05 are panel actions that need the server (BR-OFFL-017), so a fresh company decision with an expected revision and one audit event per step follows TRIP-004; the stored structure makes the scoped refusal exact; a SELF read of one's own reports is the minimal reporter view that needs no new key; the shared oracle keeps the device's and the server's validation identical. | A per-asset queue for structural managers now; queue filtering by structural scope (EMP-CHECK-004 panel); work orders from a report (EMP-MAINT-003); a server-only domain without the Kotlin mirror; letting the reporter see handlers' notes before notifications exist. | EMP-CHECK-003; B-BR-EMP-373, B-BR-EMP-374; BUC-EMP-188; UC-CHECK-03/04, BR-CHECK-011/017/018, BR-AUTH-005/011. Retained: scoped queue filters and the panel (EMP-CHECK-004), notifications to the reporter, team-scope facts, production grants. | | EDR-242 | Keep the EMP-TRIP-005 "local trip storage" inside the accepted EMP-PRIV-003 protected generation of the exact account/origin/organization, never as Room tables: one sealed RECORD entry per partition with a fixed identifier holding a versioned canonical trip-book v1 (membership, enrollment and, per trip, the asset identifier and label from the picker, the warning flag, the declared start instant and finish instant, the operation identifiers of its start, events in creation order, finish and submission, and a start-refused flag). It is written only by four registered trip.* queue producers inside the same protected write that stores the operation (EnterpriseQueueTransaction), and the start producer projects a final REJECTED start receipt as the refused flag in the receipt's own write. Trip facts (instants, readings, types, texts) are read back from the immutable operations and every record's sync state from its own retained queue entry (receipt and review resolution) in one snapshot; no status is copied into the book. The producers enforce B-BR-EMP-377 atomically: one unfinished, not-refused local trip per asset per partition, events and finish only on an unfinished trip, finish and submission once, submission after the finish, nothing declared before the start. The four producers are the first business producers of the production registry; a build flag enterpriseTripUiEnabled (default on) hides the entry as the rollback switch while queued work keeps its delivery. The book's format test is the codec (strict decode, unknown version refused) plus pre-existing-generation, foreign-enrollment and process-death tests. | EDR-076 rejected a second Room store and PRIV-003 forbids plaintext; FLEET-013 (EDR-224) set the sealed-entry precedent; a producer projection is exactly what OFFL-003 designed for an owning record, so the operation and its index can never diverge; the projector only sees records, so the per-asset check and the refusal fact must live in a record; one book per partition is rewritten with the whole generation anyway and keeps the per-asset scan inside the atomic write; deriving sync state from receipts keeps acceptance from being shown early. | Room tables (plaintext, outside custody); a CACHE entry (a business record is not a derived copy); one record per trip without an index (the projector cannot enumerate records); copying statuses into the book (drifts from receipts); one local active trip per member (not a BR-TRIP rule); refusing nothing locally (queues facts the server must refuse or hold). | EMP-TRIP-005; B-BR-EMP-375..377; BR-OFFL-002/003, BR-TRIP-001/002; EMP-OFFL-003, EMP-PRIV-003, EMP-FLEET-013; record before code. | | EDR-243 | Declare every trip record with the device wall instant (milliseconds), the device time-zone identifier when the orgtime zone profile accepts it (otherwise UTC) and the zone offset at that instant; attach a run clock to the start and the finish from AndroidEnterpriseDeviceClock — boot-<Settings.Global.BOOT_COUNT> and SystemClock.elapsedRealtime() — the same source the protected lease uses, omitted (null) when it cannot be read; events and the submission carry no run clock (EMP-TRIP-003 stores none). The device validates its own records with the accepted EMP-TRIP-001/017 rules before saving: a finish or event declared before the start is refused locally and the finish reading is checked with the METER-003 validator against the departure on the same meter (warning only). | BR-TIME-005 and EDR-183 define the run clock as boot identity plus monotonic milliseconds and the driver-shift boot profile accepts boot-N; reusing the lease clock avoids a second device clock; the server profile refuses aliases such as GMT, so a fallback must still be a valid zone and keep the real offset; validating locally prevents a permanently MALFORMED record created by a clock that moved back; METER-003 is a warning, never a block. | SystemClock.uptimeMillis (stops in deep sleep); a random per-install boot identity (cannot detect a reboot); inventing a run clock when the read fails; sending a refused zone and letting the server reject the record; blocking a finish on plausibility. | EMP-TRIP-005; B-BR-EMP-377/378; EDR-182/183, B-BR-EMP-272/278/323, B-BR-EMP-280..285; record before code. | | EDR-244 | Supply the driver of trip.start through the existing context read: /v1/org-access/contexts/read adds employee_id, the employee record bound to the requesting active membership that the read already loads and checks (no SQL, migration, route or permission change; the list stays unchanged). The Android gateway parses it strictly (canonical identifier when present), the selected EnterpriseContextSummary carries it in memory only, and the trip start is unavailable ("confirm the organization again") without it. A second one-line backend change, found by this task's native acceptance against the real runtime: the trip intake's embedded-reading proof (readingRecorded) also accepts a reading the METER-003 validator keeps aside as SUSPECT, exactly like the meter and fueling intakes; before it, a trip start or finish with an implausible or decreasing reading stayed RETRY/UNAVAILABLE forever and the record never left "Salvo no aparelho". | EDR-202 freezes driver_employee_id in the start payload and the intake requires it to equal the author's employee for SELF drivers; no device-facing response carried it; a membership's employee identifier is immutable (EDR-054), so the value read at selection stays valid for every operation of that membership; selection is already an online read, so no new cache or offline copy is needed; the field is the member's own record identifier, already implied by the member's own operations. | Adding it to the reference feed (changes a pinned 129-row wire and cache codec for a non-asset fact); the contact or enrollment replies (exact-key device protocol changes); the company-cookie own-assignments route (needs a second company channel and an active assignment); a new signed device route (inventory, matrix and auditor changes); letting the driver type it; refusing or holding a trip whose reading is suspect (B-BR-EMP-280..285 keep suspect readings aside, never refused). | EMP-TRIP-005; B-BR-EMP-380; EDR-054, EDR-202; B-BR-EMP-280..285 (EMP-METER-003); business-web ignores the additive field; minimal backend changes justified here. | | EDR-245 | Present each trip record's own sync state from its retained queue entry (EnterpriseSyncProjection), reusing the OFFL-004/008 labels and reason texts, and keep the trip's operational line local and its review line limited to what a receipt proves (DRAFT → "Pronto para enviar" while trip.submit waits, SUBMITTED → "Aguardando aprovação" after its ACCEPTED receipt). The author's own trip review-result read (approved/returned/rejected) does not exist on the server (EMP-TRIP-004 retained it); it is retained, not invented, and the screen says the company's decision is not received on this device yet. A held start (ASSET_BUSY, ASSET_UNAVAILABLE, PERMISSION_CHANGED) shows "Precisa de revisão" with its reason and a notice that the trip's other records wait for that review (they stay DEPENDENCY_PENDING until EMP-TRIP-007 resolves the held start). Pin the wire with a new contracts/testdata/enterprise/trip/trip-operations-v1.psv from an independent oracle: the Kotlin builders must produce the exact canonical operation bytes and decode them back, the Go intake parsers (ParseStart, ParseEvent, ParseFinish, ParseSubmit) must accept every produced row and refuse every row the builders refuse with the same class (MALFORMED/UNSUPPORTED). Native acceptance uses an opt-in integration && nativefixture ordinary-PostGIS signed HTTPS intake and a data instrumentation test on the owned API 36 emulator only; another member's earlier start on the same asset is a real signed operation of a second enrolled member through the same intake (a second physical device is not run). | BR-REV-001/002 and 08-state-model §1 keep operational, sync and review states apart and make SUBMITTED a server fact; showing a review outcome without a read would be invented; dependents of a held start cannot be accepted before its resolution (EDR-202/207/220); the first business producer must prove its bytes against the real server parsers, not only its own tests; OFFL-003/008 and FLEET-013 are the accepted native patterns. | Polling an invented review route; showing APPROVED on completion; hiding the held start's children; Kotlin-only builder tests; a mock server for native acceptance; claiming a two-device run. | EMP-TRIP-005; B-BR-EMP-379; BUC-EMP-191; EDR-202, EDR-207, EDR-220, EDR-223; retained: own review-result read (EMP-TRIP-015 correction loop or a dedicated read owner). | | EDR-246 | Extend the pure mission domain for PLAN and mirror it in Kotlin over a versioned shared oracle: MissionTransition admits PLAN from DRAFT, PLANNED, ASSIGNED and DECLINED to PLANNED (assignee and answer withdrawn), refuses it from ACCEPTED (INVALID_TRANSITION) and keeps IN_PROGRESS UNSUPPORTED_COMMAND and the terminal states INVALID_TRANSITION; NewMissionPlan validates the plan value and Mission.Plan(scope, expected, input) returns the next mission and the validated plan with the fixed order scope → plan content → positive expected revision → CONFLICT → table. The plan is a separate value (MissionPlan), not a field of the restored mission: its current revision is a stored planning record, so the EMP-TRIP-008 restore invariants and every other command are unchanged. contracts/testdata/enterprise/trip/mission-v2.psv supersedes mission-v1.psv (kept, no longer consumed, like the authorization catalog versions): all v1 rows with the eight PLAN transition rows decided by the new table, plus LOAD, PLAN_VALUE and PLAN rows; Go and Kotlin assert its hash, counts, unique IDs, argument names, every operation, every error code and every state/command pair. | The app shows planned missions (EMP-TRIP-021), so device and server must agree on the table and on what a valid plan is; a re-plan before acceptance must not leave a pending answer about a different plan, so it withdraws the assignment and a late answer is FORBIDDEN (the member is no longer the assignee, B-BR-EMP-356) while a stale command is CONFLICT; an accepted mission is the member's commitment and the 08-state-model rule "transitions are commands" keeps it from being rewritten silently; a new oracle version is the honest form of a changed expectation. | Editing mission-v1.psv in place (a frozen oracle would change silently); a separate mission-plan-v1.psv beside an unchanged v1 (v1's PLAN rows would then contradict the code); a PLAN that keeps ASSIGNED (a target state depending on the source and an answer about a superseded plan); re-planning an accepted mission; storing the plan inside the restored mission (changes every EMP-TRIP-008 vector). | EMP-TRIP-009; B-BR-EMP-381..383; B-BR-EMP-353; EDR-228; 08-state-model §4; retained: the app display (EMP-TRIP-021). | | EDR-247 | Minimise the plan to the REQ-07.3 inputs with typed, organization-owned references: destination = exactly one of a free-text place or an ACTIVE operating unit of the organization (the organization's own typed place); reason required; the customer or project reference = an optional ACTIVE cost centre of the organization (organizations §3 uses cost centres per client contract, project or route; 06-domain-model names the mission's cost centre); load = NONE, CARGO with a required description, or PASSENGERS with only a count 1..999 (a technical bound, not a product rule). Free texts use the METER-001 profile and refuse a standalone CPF-shaped token through the existing kernel.HasCPFShapedToken shape (Kotlin mirrors the same pattern; SQL repeats it). No passenger identity, document, contact or description, no coordinates; the strict body refuses any other field. | BR-PRIV-005 forbids fields without a purpose and nothing in the specification allows passenger identities; BR-PRIV-007 bounds and guides free text; the CPF-shaped refusal is the repository's established privacy shape, so free text cannot silently carry the most common personal identifier; typed references keep customers who are natural persons out of plan text and give reports a stable key; a cost centre is already approved organization structure with its own permission and lifecycle. | A passenger list or names (no purpose; would need a legal basis and a retention rule); a new customer or project registry (an unrequested entity); free-text customer names (personal data of natural-person customers); coordinates or a public station as destination (ROUTE route plans own points, BR-ROUTE-002); new detectors for e-mail or phone shapes (no repository precedent; the hint of BR-PRIV-007 stays the guidance); cargo counts or weights (no consumer). | EMP-TRIP-009; B-BR-EMP-382; BR-PRIV-005, BR-PRIV-007; REQ-07.3; organizations §3; 06-domain-model §3; kernel HasCPFShapedToken. | | EDR-248 | Persist plans in migration 000231: insert-only, forced-RLS org_trip_mission_plans keyed by (organization, mission, revision) with the content columns, the planner account and membership and the command operation, a composite foreign key to the PLAN transition's receipt key (org, mission, revision, operation) and same-organization foreign keys to the destination unit and the cost centre; CHECKs repeat the shape, the text profile and the CPF-shaped refusal; a BEFORE INSERT guard re-proves the PLAN transition, the current planner, an ACTIVE destination unit and an ACTIVE cost centre under the organization root lock; update, delete and truncate are refused. The transition and receipt kind/state CHECKs are widened by name (PLAN, PLANNED); org_trip_mission_next, the transition source, the head guard and the deferred publication check are replaced with every 000227 line kept plus the PLAN clauses (assignee and answer withdrawn, a PLAN transition published only with its planning revision). The unit and cost-centre sources keep their 000230 bodies (EMP-CHECK-003, which runs first), each recognising one plan key as an association (counts unchanged). Head queries are unchanged; plans are read by their own queries in db/queries/mission. | A separate table keeps planned inputs apart from the head and from every trip fact and gives the immutable history BR-AUD-001 asks for; binding to the transition's receipt key makes the authorized source (actor, command, receipt, audit event) part of the record; widening the constraints by name keeps 000227 rows valid; associations follow EDR-230 (a plan names only ACTIVE structure, so archiving behaviour is unchanged). | Plan columns on the head (would need head rewrites and lose history); a JSON document column (no typed keys or database refusal); deleting superseded plans; counting plans as unit or cost-centre use; reading plans inside the head queries (the 000227 rehearsal runs the store before 000231 exists). | EMP-TRIP-009; B-BR-EMP-383, B-BR-EMP-386; migration 000231; EDR-230; rollback: the plan route can be withdrawn while the history remains. | | EDR-249 | One company route POST /v1/orgs/{org_id}/missions/{mission_id}/plan under fresh trip.mission.manage on the mission target (MissionStructure: stored unit and asset; admission class trip.mission, revision required), body schema_version, operation_id, revision, destination ({kind: TEXT, text} or {kind: UNIT, unit_id}), reason, optional cost_centre_id, load ({kind: NONE}, {kind: CARGO, description} or {kind: PASSENGERS, count}); success 200 with the mission acknowledgement (PLANNED, new revision). Errors: unknown or foreign mission, unit or cost centre NOT_FOUND; invalid or sensitive content, an archived unit or cost centre VALIDATION_FAILED; unknown fields MALFORMED; stale revision or a disallowed transition CONFLICT. Audit action trip.mission.planned (target trip_mission). Read, list and the own list add an optional plan object (planning revision, destination, reason, cost centre, load, planned_at). Inventory: trip.mission.manage ROUTED with six routes (representative unchanged); on the F4 head bff5a788 146 normal routes (28 routed / 56 not routed); AUTH-011 walk 146 / 30 / 116; matrix cells unchanged (280: 112 allowed / 168 denied). | Planning is a panel action (10-offline-sync §10.3 "missions planning (panel)" is online), so no signed operation is needed; the mission target already carries the planner's structural scope; one route per command matches the EMP-TRIP-008 routes; returning the current plan where the mission is read lets the assignee see it before answering. | A signed device operation (planning is online); a PATCH-style generic update; a separate plan read route (the plan is part of reading a mission); exposing the planner's membership in reads (kept in the transition, plan row and audit). | EMP-TRIP-009; B-BR-EMP-384, B-BR-EMP-385; EDR-231; 07-permissions §7.3; route inventory, matrix, AUTH-011 auditor walk, OpenAPI. | | EDR-250 | Model the vehicle change as a server-only operation of the pure mission, not a lifecycle command: Mission.ChangeVehicle(scope, expected, asset, reason) with the fixed order scope → vehicle reference → reason → positive expected revision → CONFLICT → state (DRAFT, which exists only at revision 1, and the terminal states INVALID_TRANSITION; IN_PROGRESS UNSUPPORTED_COMMAND) → same vehicle INVALID_TRANSITION; the result keeps state, assignee and answer and moves the revision by one. The seven-command vocabulary, MissionTransition and the shared mission-v2.psv are unchanged; Go table tests cover it and no Kotlin mirror is added. A running trip is never moved: the change is refused while the mission's assignee has a trip in progress on the current vehicle (finish with the final reading first), and work on the new vehicle is a new EMP-TRIP-002 trip with the new vehicle's own reading. Refusals for the new vehicle come from facts, not from the starter: lifecycle and kind (ACTIVE, not IMPLEMENT), IN_USE (another trip runs it, the one-active-trip rule) and UNAVAILABLE/IN_MAINTENANCE/BLOCKED at the planned start from the EMP-FLEET-007 assessment (read through StartDecisionDBTX with the current assignee, else the planner's membership, whose assessment does not depend on the starter); reservations and a missing primary assignment stay for the trip start decision. A current assignee must still hold trip.trip.start covering the mission with the new vehicle. | The app never changes a vehicle (a panel action) and reads only the mission's current vehicle, so a Kotlin mirror would be unused code; keeping state and acceptance avoids forcing a new answer for a resource change while the revision CAS still voids answers about the earlier revision; refusing during a running trip is the only way to keep each vehicle's trip and readings separate without a mission–trip link (EMP-TRIP-021/023); availability refusals reuse FLEET-007 instead of inventing a second rule. | A VEHICLE lifecycle command in the closed vocabulary (changes B-BR-EMP-353 and every shared vector); moving or splitting the running trip; returning the mission to ASSIGNED after a change; refusing on the starter-dependent start decision (would refuse any vehicle the driver is not yet primary-assigned to); a Kotlin mirror. | EMP-TRIP-013; B-BR-EMP-387, B-BR-EMP-388; EDR-228, EDR-229, EDR-246; FLEET-007 B-BR-EMP-300; TRIP-002 one-active-trip rule; retained: changes during IN_PROGRESS with the trip link (EMP-TRIP-021/023). | | EDR-251 | Persist changes in migration 000232: insert-only, forced-RLS org_trip_mission_vehicles keyed by (organization, mission, revision) with the previous (nullable) and new vehicle, reason, planner account and membership and the command, a composite foreign key to the VEHICLE transition's receipt key and same-organization foreign keys to both assets; its BEFORE INSERT guard re-proves the VEHICLE transition and planner, the mission's current vehicle as the previous one, an ACTIVE non-implement new vehicle without a trip in progress, and no trip in progress of the assignee on the previous vehicle. The transition and receipt CHECKs are widened by name (VEHICLE; receipts may end ACCEPTED or DECLINED); org_trip_mission_next gains the VEHICLE row (PLANNED, ASSIGNED, ACCEPTED and DECLINED keep their state); the head guard (231 body) admits an asset change only with the record of its revision and the deferred publication check (231 body) publishes a VEHICLE transition only with it; the asset usage source keeps the 000230 body (EMP-CHECK-003) plus the two keys as associations. One route POST /v1/orgs/{org_id}/missions/{mission_id}/vehicle/change under fresh trip.mission.manage (mission target, admission class trip.mission, revision required; body asset_id, reason); audit action trip.mission.vehicle_changed; errors as B-BR-EMP-387/388 (NOT_FOUND, VALIDATION_FAILED, CONFLICT, FORBIDDEN); inventory trip.mission.manage seven routes, 147 normal routes (28 routed / 56 not routed), AUTH-011 walk 147 / 30 / 117, matrix unchanged (280: 112 / 168). | A record beside the head keeps each vehicle's period in the mission explicit and immutable (BR-AUD-001, BR-TEN-005) while the head keeps answering the current structure that scope and responses use; proving the previous vehicle, the running trip and the one-active-trip rule in the database keeps a defective handler from moving work between assets; an asset association does not block disposal (EDR-230). | Rewriting the head's asset without a record; columns on the transition table; counting changes as asset use; a separate read route for the history (the panel board, EMP-TRIP-022); a signed device operation (planning is online). | EMP-TRIP-013; B-BR-EMP-389; migration 000232; EDR-230, EDR-248, EDR-249; route inventory, matrix, AUTH-011 auditor walk, OpenAPI; rollback: the route can be withdrawn while the history remains. | | EDR-252 | Model pause, resume and cancellation as lifecycle commands of the pure trip (Go and Kotlin) with an operational revision, in a new shared oracle trip/trip-v2.psv that supersedes trip-v1.psv (every v1 row byte for byte except the eight IN_PROGRESS/PAUSED TRANSITION rows that now follow the new table, plus PAUSE, RESUME, CANCEL and HISTORY operations). Table: PAUSE IN_PROGRESS→PAUSED, RESUME PAUSED→IN_PROGRESS, CANCEL and FINISH from IN_PROGRESS or PAUSED; PLANNED/ASSIGNED/ACCEPTED stay UNSUPPORTED_COMMAND; terminal states INVALID_TRANSITION. Revision 1 at START, +1 per command or FINISH. Order: scope → author → present reason/declaration → expected revision → INCOMPLETE (REASON for CANCEL, DECLARATION) → FORBIDDEN (not the member who started the trip) → terminal → CONFLICT → table → BEFORE_START. A cancellation keeps the departure evidence and reports usage NOT_MEASURED/CANCELLED; logbook events close at the cancellation instant like at a finish. No ordering rule between lifecycle instants: the revision orders the commands and the declared instants stay explicit. New codes CONFLICT and BEFORE_START, missing part REASON, usage reason CANCELLED. | 08-state-model §4 rule 7 asks each transition to name its expected state or revision, and an offline device needs it to detect that someone else moved the trip; the GPS validation scenario ends a paused trip directly, so FINISH from PAUSED loses no field fact; a refusal for a resume declared a second before its pause (a clock correction) would strand the trip paused, while BR-TIME-005 already flags clock gaps; the mission-v2 precedent keeps every unchanged v1 row byte for byte. | Pause/resume/cancel as logbook types of trip.event.record (logbook facts never change a trip, TRIP-003 B-BR-EMP-323, and the shared device vectors pin those types as unsupported); requiring RESUME before FINISH; an order check between lifecycle instants; a separate pause oracle beside a stale trip-v1 TRANSITION table; inventing a distance for a cancelled trip. | EMP-TRIP-011; B-BR-EMP-390; EDR-178 (replaced refusals), EDR-182, EDR-207, EDR-228/246 (oracle precedent); REQ-07.5. | | EDR-253 | Persist and receive the lifecycle in migration 000233 through three signed operations trip.pause, trip.resume, trip.cancel schema 1 (entity trip with required expected_revision, payload exactly {"reason"}), owned by one handler type with three descriptors under the EMP-TRIP-002 trip.trip.start policy and authority; outcomes: shape, missing cancel reason or an instant before the start MALFORMED, another member FORBIDDEN, trip not stored here RETRY/DEPENDENCY_PENDING, terminal trip held TRIP_ALREADY_CLOSED, stale revision or a state that no longer admits the command held STALE_REVISION, changed rights RETRY/UNAVAILABLE; the finish acknowledgement carries the trip revision after the finish. Migration: org_trips.state admits PAUSED and CANCELLED; the one-active-asset index (same name) covers IN_PROGRESS and PAUSED; insert-only forced-RLS org_trip_transitions (PK organization, trip, revision) and org_trip_held_transitions; org_trip_revision(); BEFORE/AFTER/deferred triggers for transitions and held transitions; the 000220 completion guard, finish source/apply, publication and held-source bodies, the 000229 logbook and held-logbook sources and review-source hook (three new owner branches) and the 000232 mission-vehicle source are redefined keeping every other line; FLEET-003 open work, FLEET-007 active use, the start facts and the mission running query count PAUSED and end a cancelled trip at its cancellation. The reserved logbook types stay RETRY/UNAVAILABLE; a trip.submit of a cancelled trip is MALFORMED. No route, permission, usage-source or Kotlin builder change (the Android producer is EMP-TRIP-021). | One table and one handler keep the three commands' history, locks and proofs identical; a derived revision (no column) needs no backfill under forced RLS and cannot drift from the rows that define it; keeping PAUSED in the stored state is honest (08-state-model), and counting it wherever an open trip is counted keeps a paused vehicle from being started, deactivated or moved; holding instead of refusing keeps late or stale field facts visible (BR-OFFL-006). | Logbook types changing state; a revision column with a forced-RLS backfill; leaving the row IN_PROGRESS while paused; a final refusal for stale or post-terminal commands; deleting or rewriting events or readings on cancellation; Android builders here. | EMP-TRIP-011; B-BR-EMP-391..393; migration 000233; EDR-202..209, EDR-220, EDR-234/235, EDR-251; OpenAPI owners (8 → 11); retained: Android producer and trip-book (EMP-TRIP-021), supervisor cancellation (trip.trip.close_for_other, EMP-TRIP-014), held-item resolution (EMP-TRIP-007), panel timeline (EMP-TRIP-006). | | EDR-254 | Model the handover as a server-recorded fact of the pure trip in Go and Kotlin over a new shared oracle trip/handover-v1.psv (trip-v2 and logbook-v1 stay unchanged and consumed): Trip.Handover(scope, HandoverInput{Recorder, Receiver, ReceiverEmployee, Expected, Reason, At}) with the order scope → trip → recorder, receiver, receiving employee (absent INVALID, foreign SCOPE) → present reason and instant (INVALID) → expected ≥ 1 (INVALID) → missing reason (INCOMPLETE REASON) → terminal (INVALID_TRANSITION) → stale revision (CONFLICT) → recorder is the current responsible member or the receiver (FORBIDDEN) → receiver already responsible (INVALID) → instant before the previous handover (INVALID); an accepted handover appends one HandoverFact (revision, giving member, receiver, receiving employee, recorder, instant, reason) at the next revision without changing state, asset, start driver or reporting. Responsible() is the receiver of the latest handover (else the starter) and gates PAUSE, RESUME, CANCEL and FINISH; ResponsibleAt(t) is the receiver of the latest handover whose instant is at or before t and gates logbook events. The instant is the server's; no order is imposed against the start or lifecycle declarations (EDR-252), only between handovers. No new failure token: the shared TripFailure enum and its trip-v2 coverage stay closed. | A device that receives a handed-over trip (EMP-TRIP-021) must rebuild the responsible member in its own pure domain, so the rule is mirrored; the declared instant is the only order an offline event has, and "responsible at the declared instant" keeps the giving driver's offline facts admissible (BR-OFFL-006) while refusing anything it declares after it lost the trip; a server instant cannot be compared fairly with a device start declared under clock skew, so refusing a handover "before the start" would strand legitimate handovers. | A trip-v3 oracle re-generating every v2 row; new TripFailure tokens (they would break the closed v2 coverage); the current responsible member for events (the giving driver's offline facts would be lost); copying the receiver into the trip row; ordering handovers against device declarations. | EMP-TRIP-012; B-BR-EMP-394/395; EDR-252 (no ordering between lifecycle instants), EDR-182; REQ-07.6. | | EDR-255 | Persist handovers in migration 000243 (000234 stays unused: it would sort before the 000233/000237 bodies it must extend) as insert-only, forced-RLS org_trip_handovers (PK organization, trip, revision; unique operation; composite keys to the trip, the three memberships and employees, deferred key to the audit event; giving ≠ receiving; recorder outside both) whose BEFORE guard re-proves under the root and trip row locks the open state, revision = org_trip_revision + 1, the giving member as the current responsible member with that member's employee, the receiver's and recorder's active membership and active unmerged employee, the separation by account, membership and canonical employee and an instant not before the previous handover, and whose deferred guard publishes it only with its trip.trip.handed_over audit event. No trip column moves: org_trip_responsible(org, trip, at, submicro) derives the responsible membership and employee (NULL instant = current) and org_trip_responsible_member(org, trip) is its scalar form; both carry a SET clause, so they are never inlined and a read that finds no trip touches no handover row. Redefined from their latest bodies (the generator asserts each source) keeping every other line: org_trip_transition_source, org_trip_held_transition_source, org_trip_finish_source (233: the current responsible member); org_trip_revision (235: + handovers), org_trip_event_source, org_trip_held_event_source (235: the member responsible at the declared instant), org_trip_review_entry_source (235: submission by the current responsible member, every handover party excluded beside the closer), org_trip_closure_source (235: the closer is not the current responsible member either); org_trip_held_source (236: a late finish and a held closed-trip finish of the current responsible member) and org_offboarding_guard (236: the TRIP flags are the trips the ending membership is currently responsible for); org_trip_held_submission_source (229); org_incident_report_source (230: a report inside a trip by the member responsible at its declared instant). org_trip_source, org_trip_complete, the 237 resolution, publication and effect guards, the completion guard and every usage source are unchanged (no asset, unit or cost-centre key; the revision function feeds the finish publication). Three company routes: POST …/trips/{trip_id}/handover (fresh configuration write under trip.trip.close_for_other, TripStructure, revision required, the EMP-TRIP-014 admission class trip.close), POST …/trips/handovers/list (organization read under the same permission) and POST …/trips/mine/list (trip.trip.start on the requesting membership); receiver eligibility uses the requesting transaction's role candidates of the receiver (trip.trip.start covering the trip as its own record) and the FLEET-006 assignment at the database instant. Signed intake: the authority target, the history rule's driver, the stored-fact proofs and the receipt reads use the responsible member (a former responsible member reads its own receipts); the offboarding open-work read, the closure separation, the incident report trip window and the tracking trip facts (EDR-279) follow the same responsibility. Counts on the F4 head 0912b48a: 156 normal routes (30 routed / 54 not routed / 26 specials), AUTH-011 auditor walk 156 / 31 / 125, matrix unchanged at 300 cells (121 / 179: trip.trip.close_for_other keeps the EMP-TRIP-014 open-list representative). | A derived responsibility needs no backfill under forced RLS and cannot drift from the facts that define it; counting handovers in the existing revision function makes every stale device command and every concurrent supervisor command fail the same CAS; re-proving in the database keeps a defective handler from creating two responsible members; the handover list gives supervisors the history SCR-TRIP-03 retains without a trip per row. | A responsible_membership_id column on org_trips (forced-RLS backfill, a second truth); a signed trip.handover device operation (C1 stays driver-initiated and the handover is a supervisor's online decision); deciding eligibility in SQL from role tables; redefining the conflict-resolution guards (held starts precede any handover); the starting member as the offboarding or tracking owner after a handover. | EMP-TRIP-012; B-BR-EMP-394..397; migrations 000220, 000229, 000233, 000237; route inventory, authorization matrix, AUTH-011 walk, OpenAPI; rollback: withdraw the routes, every handover and later fact remains valid. | | EDR-256 | Tracking session ownership after a handover: a session belongs to the member who opened it (B-BR-EMP-421/EDR-273) and never moves. After a handover the pure session already refuses the giving member (start and resume FORBIDDEN, Collecting false, because the trip's current driver no longer equals the owner) and the trip stays IN_PROGRESS, so FOLLOW changes nothing. Rule for the Android client (EMP-GPS-002) and the tracking store (EMP-GPS-004): when the giving member's device learns the handover (a FORBIDDEN answer or the own-trips read), it stops collection at once, records the interruption it observes (OWNER_CHANGED) and ends its session; the receiving member's device opens its own session for the same trip from the trip screen. The tracking owner must therefore add an end cause for a handover and relax "one session per trip" to "one open session per trip, at most one per owner" (domain, session oracle and the database constraint); until then the remaining trip is recorded without tracking, which is an explicit gap, never an invented track. The server side follows now: the EMP-GPS-004 trip facts name the member responsible at the declared instant, so after a handover the giving member's session is refused start and resume and its fixes count outside the session, while the 000240 opening guard (owner = trip author) and the one-session-per-trip rule keep refusing a receiver's session until the tracking owner changes them. The receiving member learns the trip through trips/mine/list (company session); a signed device feed of handed-over trips belongs to EMP-TRIP-021. | Owner binding to account, device and membership (BR-GPS-014) forbids reusing the giving device's session for another member; ending rather than suspending keeps the giving member's periods closed and bounded by the handover; the tracking domain, its shared oracle and its persistence are owned by the GPS tasks that run in parallel, so changing them here would fork their vocabulary. | Rebinding the open session to the receiver; letting the giving device keep recording; changing the session vocabulary, oracle or constraint inside this task. | EMP-TRIP-012; B-BR-EMP-398; EDR-271, EDR-273/274; retained for EMP-GPS-002/004 and EMP-TRIP-021. | | EDR-257 | Model the supervisor closure as a server-only operation of the pure trip, not a lifecycle command: Trip.Close(scope, CloseInput{Closer, CloserEmployee, Absence}) with the fixed order scope → trip → closer references → absence reason (METER-001 Missing profile) → self-closure (the closer is the start author's membership or the driver's employee record: ErrSelfClosure) → state (terminal INVALID_TRANSITION, anything but IN_PROGRESS UNSUPPORTED_COMMAND); the result is COMPLETED with the closure and no finish, its MeterUsage is NOT_MEASURED/READING_ABSENT, a later Finish is INVALID_TRANSITION and every later logbook event is ErrEventAfterFinish. The C1 command vocabulary, Transition, trip-v1.psv, logbook-v1.psv and the Kotlin mirror are unchanged; Go table tests cover it. The closure carries no reading or value. Separation (BR-REV-003): the closing member is excluded as a trip author from every review decision of that trip, in DecideRevision (another excluded person beside the author and an amendment's author) and in the review-entry guard; closing one's own trip is SELF_APPROVAL. | The app never closes someone else's trip (a panel action), so a Kotlin mirror and new shared vectors would be unused code (the EDR-250 precedent); the closure completes the record the reviewer judges, so its author deciding that review is a self-decision; the trip's author has trip.finish and is not "another" person; a reading taken later has its own author and time (JRN-07 step 3), so binding it to the trip is a reviewed amendment, not part of the closure. | A CLOSE command in the shared vocabulary; a supervisor-supplied final value or distance; letting the closer review the trip after closing; a new usage reason (the final reading is simply absent). | EMP-TRIP-014; B-BR-EMP-399..402; BR-TRUTH-003, BR-REV-003; EDR-178, EDR-180, EDR-250; retained: adding a later reading to a closed trip through an amendment (EMP-TRIP-015 "adding missing readings"). | | EDR-258 | Persist closures in migration 000235 (rebased on the EMP-TRIP-011 lifecycle of 000233: a PAUSED trip is open and closable, a CANCELLED one closed; the 233 bodies of the completion guard, logbook and held-logbook sources and org_trip_revision, which counts the closure like a finish, are the starting point): insert-only, forced-RLS org_trip_closures keyed by (organization, trip) with the operation, digest, closing membership and employee record, reason, missing-reading reason and the database clock, same-organization foreign keys to the trip, the membership and the employee record and a deferred one to the closure's audit event (no asset, unit or cost-centre key, so no usage source changes). Its BEFORE INSERT guard takes the organization root and trip row locks and re-proves an IN_PROGRESS trip, an active unmerged closer and the separation from the author and driver (account, membership, canonical employee); its AFTER INSERT trigger performs the completion; the 220 completion guard admits IN_PROGRESS → COMPLETED only beside a finish or a closure; a deferred check publishes a closure only with its trip.trip.closed audit event by the closer's account and digest. Replaced bodies, every other line kept: the logbook source (229 body) refuses a direct fact on a closed trip, the held-event source (229 body) admits TRIP_ALREADY_CLOSED on a closed trip for any instant at or after the start and keeps STALE_REVISION for finished trips only, the review-entry source (229 body) excludes the closer. The held finish (220) already admits a closed trip. The trip-backed active use (ActiveTripsOfAssetAt) counts a trip without a finish only while it is IN_PROGRESS, so a closed trip holds its asset until the closure and no end instant is invented; ReadTripTx reads the closure of a completed trip without a finish. | Completion must stay one guarded transition proven by a stored fact (B-BR-EMP-316); the closure has no device instant, so comparing device declarations with a server clock would turn evidence into proof (BR-TIME-003) — holding every later event is the BR-OFFL-006 answer; an invented end instant would fabricate when the asset was free, while later overlapping facts are the asset-overlap resolution's (EMP-TRIP-007). | A synthetic finish row authored by the supervisor; a new operational state; reusing the finish table; a period gate on closure; treating the closure instant as the trip end. | EMP-TRIP-014; B-BR-EMP-400..403; migration 000235; EDR-203, EDR-206, EDR-207, EDR-234/235; rollback: withdraw the routes while closures and their history remain. | | EDR-259 | Two company routes under trip.trip.close_for_other: POST /v1/orgs/{org_id}/trips/{trip_id}/close (configuration write, fresh proof, revision = the operational revision 1, body reason and missing_reading_reason, admission class trip.close; resource: the trip through TripStructure) and POST /v1/orgs/{org_id}/trips/open/list (read, keyset by start instant, the organization itself as resource, so only ORG grants cover it; the matrix representative). TripReviewAuthority gains CheckTripCloseTx with the same company proof, ACTIVE organization for writes and returned closer; the store locks the trip row after the authority (which holds the organization root exclusively for writes). Errors: SELF_APPROVAL (self-closure), CONFLICT (stale revision, completed trip, concurrent finish), VALIDATION_FAILED (reasons), MALFORMED (unknown body key, so a meter value cannot be sent), NOT_FOUND, FORBIDDEN, OPERATION_ID_REUSED. The review read gains a nullable closure object; audit action trip.trip.closed. Inventory: trip.trip.close_for_other ROUTED (2 routes), 149 normal routes (29 routed / 55 not routed / 25 special), AUTH-011 walk 149 / 30 / 119, matrix 290 cells (116 / 174). | The catalog v5 row grants the key to OWNER, ADMIN, FLEET_MANAGER and SUPERVISOR at ORG; a supervisor needs to find open trips (JRN-07 step 1) and the matrix needs an organization-level representative as for the review queue (EDR-222); the closure is online only (a panel action). | A signed device operation; closing through the review routes; a list filtered by structural scope (the panel lists are EMP-TRIP-006); a separate closure read (the review read shows it). | EMP-TRIP-014; B-BR-EMP-399, B-BR-EMP-403; EDR-222; route inventory, authorization matrix, AUTH-011 auditor walk, OpenAPI, apicontract. | | EDR-260 | Wire open trips (IN_PROGRESS or PAUSED) into the EMP-IDN-010 open-responsibilities source through an explicit port, not a cross-module query: membership/application.OpenWork.OpenWorkKeysTx(tx, scope, membership) returns handover keys read in the offboarding transaction (which already holds the organization root exclusively, serializing with the trip intake), implemented by trip/adapters.OpenWork (trips IN_PROGRESS that the membership started → TRIP:<trip id> at source revision 1, the operational revision) and wired in the runtime; the keys join the team and settings items, sorted, inside the reviewed digest, so every open trip needs its pending-manager flag. Migration 000236 replaces the 191 org_offboarding_guard body keeping every line, admitting a TRIP flag only for such a trip and refusing an offboarding that leaves one unflagged. The flag is the handover: offboarding never closes, cancels or deletes the trip; the open-trip list gains author_membership_state so supervisors find trips left by ended members and close them with EMP-TRIP-014 under scoped authority; a successor driver taking over a running trip is EMP-TRIP-012 (retained). pending_sources is unchanged: OPERATIONAL_WORK still names the other kinds (records awaiting correction, reviews awaited from the member). | BR-IDN-028 lists trips in progress among the responsibilities and forbids offboarding from closing work; IDN-010 left trips as a pending producer that "must integrate its actual reduction"; module ports must stay explicit (sqlc ownership rule), and a database completeness check keeps a defective or absent source from silently leaving an open trip; the closure already gives scoped supervisors the resolution and keeps the missing final reading honest. | A membership-owned query over org_trips; auto-closing, cancelling or reassigning the trip at offboarding; a new successor field in the offboarding command (IDN-010's wire stays); removing OPERATIONAL_WORK from the pending sources. | EMP-TRIP-018; B-BR-EMP-404, B-BR-EMP-405; BR-IDN-027/028, JRN-04; EDR-052 (IDN-010), EDR-257..259; migration 000236; rollback: drop the port wiring while flags already recorded remain. | | EDR-261 | Give trip.finish the EMP-OFFL-009 late holder: the owner holds ACCESS_ENDED_BEFORE_RECEIPT only (never the OFFL-012 organization-state codes), validates the payload, a trip stored in the organization (unknown: MALFORMED, as EDR-198), the trip's author as the late source's membership, the pure finish rules and the reading's meter of the trip's asset, and stores the OFFL-008 held finish with its declared reading, never a completion; migration 000236 replaces the held-trip guard (its 233 body, EMP-TRIP-011) keeping every line plus one late branch requiring the exact late source (org_sync_late_end), the author and a declaration or an earlier claim before the end. The trip stays in progress until a reviewer (EMP-TRIP-007) or the closure decides. Starts, logbook events and submissions keep the OFFL-009 default for owners without a held path (RETRY/UNAVAILABLE, never dropped; after the window INTAKE_WINDOW_CLOSED). | The finish carries the final evidence of exactly the open trip that offboarding flags; BR-OFFL-011/012 keep pre-end facts for review and refuse later or lost-device ones as a whole, decided from server history by the existing late store; a held fact keeps the reading out of usage and history until a decision. | Accepting the late finish (completing the trip with a revoked device's reading); a late holder for every trip operation in this task; a new held table. | EMP-TRIP-018; B-BR-EMP-406; BR-OFFL-006/011/012, BR-IDN-029; EDR-197..199, EDR-202..204; migration 000236. | | EDR-262 | Resolve held trip facts through the existing OFFL-008 resolution with its frozen outcomes ACCEPTED/REFUSED only: REFUSE (reason required) for every held trip owner (trip.start, trip.finish, trip.event.record, trip.submit and the EMP-TRIP-011 trip.pause, trip.resume, trip.cancel); ACCEPT only for a held trip.start, meaning "store it as the trip it declared" (in progress at entity revision 1 with its TRIP_START reading received at the original receipt and classified there, a readiness effect so the author's pending finish proceeds) and admitted only when the asset is ACTIVE and not disposed at the declaration, the author's membership and enrolled device and the driver are still current, and no stored trip of the asset is in progress or paused, or ended (finished or, under EMP-TRIP-011, cancelled) after the declared start; anything else is CONFLICT with nothing written. Accepting a held finish, event, submission or lifecycle command is CONFLICT. The decision rules are a server-only pure function in trip/application (no Kotlin mirror and no new shared PSV: the device never decides a resolution and the ReviewResolution wire it receives is unchanged and already shared by the OFFL-008 review vectors). | BR-OFFL-006 keeps the losing fact and BR-REV-003/007 apply to the resolver; VAL-07 requires that at no moment two trips of the asset count as in progress, so an accepted start must not overlap any stored trip (the intake's "trip holding the declared instant" rule alone would let a start declared before a later trip run open-ended across it); a finish, a closed logbook and a reviewed revision are immutable (BR-TRIP-003, the amendment path owns corrections); the frozen review wire and the Android poller already consume ACCEPTED/REFUSED. | Automatic winner changes; a new outcome vocabulary (ATTACHED) that every client would have to learn; attaching the losing fact to the winning trip's timeline (a held fact is not another member's logbook fact; the timeline read is EMP-TRIP-006); accepting with another asset (the held reading belongs to the declared asset's meter; retained); accepting a held finish as a correction (EMP-TRIP-014/015); deleting or archiving the held fact after a decision. | EMP-TRIP-007; B-BR-EMP-408/409/411; BUC-EMP-206/207; VAL-07; UC-OFFL-04; EDR-204, EDR-117..121, EDR-235. | | EDR-263 | Three company routes beside the meter review routes: POST /v1/orgs/{org_id}/sync/reviews/trips/list (organization target, state filter and keyset cursor bound like the meter queue), …/trips/{review_item_id}/read and …/trips/{review_item_id}/resolve (fresh configuration write, revision required, body schema_version, operation_id, revision, decision ACCEPT/REFUSE, reason), all under trip.trip.review with the EMP-TRIP-004 policies (no new permission or company-authority policy). The queue is organization-level (only ORG covers it, EDR-222); structural grants resolve through a new AUTH-006 kind HeldTripStructure (a held start: its declared asset, that asset's FLEET-005 unit and cost centre at the declared instant and the teams covering its author or driver at the receipt; other held facts: the stored structure of the trip they name, as TripStructure). TripConflictAuthority reuses the trip review company proof with that kind. The reviewer is not the author (account, membership, canonical employee) nor a held start's declared driver (SELF_APPROVAL). Replay by operation identifier and command digest (trip.conflict.resolve tag), OPERATION_ID_REUSED, CONFLICT for a resolved item or stale revision; audit offl.review.resolved on offl.review. The OFFL-008 signed review-results read answers every owner's items from the review item, its acknowledgement and its resolution (a new owner-neutral proof query instead of the meter held-row join), so held trip items return their resolution and a chunk mixing trip and meter items is no longer NOT_FOUND. Inventory trip.trip.review six routes, 150 normal routes (28 routed / 56 not routed), AUTH-011 walk 150 / 30 / 120, matrix unchanged (280: 112 / 168). | The OFFL-008 queue is per record type (SCR-OFFL-03, UC-OFFL-04 names trip.trip.review for trip conflicts); reusing the trip review policies keeps one authorization surface for trip reviewers; a held start has no stored trip, so its structure must come from the declared asset and its allocation at the declaration (BR-AUTH-005), exactly what the trip would have stored; the own-result read already serves the Android poller, which polls every retained REVIEW entry, and the item and acknowledgement proof is owner-neutral (the held row was proven at commit and is immutable). | Listing trip items in the meter queue under meter.reading.correct; routes under /trips/{trip_id} (a held start has no trip); reading a held start's structure from the asset's current allocation; a separate trip own-result endpoint; a new trip.conflict.resolve permission. | EMP-TRIP-007; B-BR-EMP-407/410/411; EDR-222, EDR-161, EDR-118; route inventory, matrix, AUTH-011 auditor walk, OpenAPI. | | EDR-264 | Migration 000237 adds no table and no foreign key: it widens the 199 resolution outcome check by definition lookup (ACCEPTED needs entity revision 1; the meter branch of the source guard still requires its held reading, a trip start may carry a stated absence) and replaces, keeping every check of their latest bodies: the 199 resolution source guard (per-owner branches: meter unchanged, trip start with its held reading, the other trip owners REFUSED only, the declared driver added to the self-review refusal), the 199 resolution publication guard (meter reading for meter items, the stored trip and reviewed reading for an accepted start, the readiness effect for both), the 216 observation guard (a reviewed TRIP_START reading equal to the held start's reading under its accepted resolution, received at the original receipt), the 199 effect source (accepted receipt; else an accepted resolution of the operation must exist; then the reviewed meter or trip-start publication, each a separate statement, so an ordinary or unresolved effect reads only what the 199 body read), the 220 trip source (a held start's identity is admitted only for its own accepted resolution with every held fact equal, received at the original receipt, and refused when any stored trip of the asset is in progress or paused, or finished or cancelled after the declared start) and the trip publication from its 000233 (EMP-TRIP-011) body (an accepted receipt or the reviewed publication, checked in that order; the finish branch unchanged). Usage sources keep their 000231/000232 bodies (no new key). | Reusing org_sync_review_resolutions keeps "resolved once" a single unique key across owners, keeps the OFFL-008 own-result query and audit unchanged and gives the trip start reading the existing review_resolution_id path; database re-proof keeps a defective handler from creating overlapping trips or an unaudited acceptance; splitting the conditions keeps unrelated intake and fixture roles from needing trip privileges (the held finish, event and submission branches are read only for those owners). | A separate trip resolution table (two "resolved once" sources and a second own-result path); dropping the check by its generated name; inserting the reviewed reading as an ordinary new reading (receipt at the decision, bypassing the held proof); a trigger-free application-only overlap check. | EMP-TRIP-007; B-BR-EMP-408/409/411; migrations 000199, 000216, 000220; rollback: the routes can be withdrawn while every resolution and accepted trip remains. | | EDR-265 | Link a trip to the mission it executes through one envelope soft reference {type: "mission", id} on trip.start schema 1 (payload and Kotlin builders unchanged, no schema 2), decided at receipt under the root and asset locks after the final refusals: eligible only for an ACCEPTED mission of the organization whose current assignee is the author membership and driver employee, whose vehicle (when named) is the asset and which has no linked trip; otherwise an otherwise-accepted start is held ORPHAN_REFERENCE (held codes PERMISSION_CHANGED, ASSET_UNAVAILABLE, ASSET_BUSY keep priority; held starts never link, and an EMP-TRIP-007 acceptance creates the declared trip without the mission). Migration 000249 (not the reserved 000238, which would run before the 000243 bodies it must extend): insert-only forced-RLS org_trip_mission_links (trip primary key, unique mission and operation, same-organization keys to trip, mission and operation) whose source trigger re-proves the mission against the stored trip and whose deferred publication requires the mission's START; mission transitions gain kinds START, COMPLETE, RESERVE, source TRIP and an optional trip_id; org_trip_mission_next (from 000232) adds START, COMPLETE, CANCEL from IN_PROGRESS and RESERVE; the transition source (000231), head guard and publication (000232) gain the TRIP and RESERVE branches keeping every line; an AFTER UPDATE OF state trigger on org_trips completes the linked IN_PROGRESS mission in the transaction that completes the trip (finish or closure, actor and operation from that fact); org_trip_held_source (000243) admits ORPHAN_REFERENCE for held starts. The shared mission table moves to mission-v3.psv (Go and Kotlin hash-checked; UNSUPPORTED_COMMAND leaves the mission vocabulary). | BR-OFFL-007 names a soft reference with ORPHAN_REFERENCE as the protocol's way to point at another record that may be refused or missing at receipt; a schema 2 would need a protocol change on both clients (only schema 1 is supported) while the reference keeps TRIP-002/005 bytes; holding (not dropping) the start lets a reviewer decide with the existing TRIP-007 queue; a separate link table leaves org_trips and its guards untouched and makes the one-trip-per-mission rule a key; completing the mission in the trip-completion transaction covers both completion paths (finish and closure) exactly once, following the FLEET-007 same-transaction consumer precedent; a cancelled trip says nothing about the mission's outcome, so the planner decides. | trip.start schema 2 with mission_id; accepting the start and dropping the link silently; refusing the start; a mission_id column on org_trips; completing or cancelling the mission from a cancelled trip; linking on held-start acceptance (retained). | EMP-TRIP-023; B-BR-EMP-412/413; BR-OFFL-007, BR-TEN-005, BR-OFFL-004; 10-offline-sync §10.2; EDR-228/230, EDR-202/204, EDR-262; migration 000249; rollback: the reference returns to RETRY/UNAVAILABLE by owner withdrawal while links and transitions remain. | | EDR-266 | Link reservations to missions and give FULFILLED its source. Migration 000249 adds mission_id, trip_id and fulfilled_at to org_asset_reservations (same-organization keys to mission and trip; FULFILLED exactly with a trip; one reservation per trip) and replaces the 000217 row guard keeping every line: a mission-linked insert only with the mission's RESERVE transition of the same operation on the mission's vehicle and window; CONFIRMED → FULFILLED only before the no-show deadline, for an IN_PROGRESS trip linked to the reservation's mission on its asset whose declared start lies in start − 30 min, end); mission, trip and instants otherwise immutable. The planner's request is a new company route POST /v1/orgs/{org_id}/missions/{mission_id}/reservations/request (fresh trip.mission.manage on MissionStructure, revision required) implemented as mission command kind RESERVE that calls a fleet port inside the mission transaction (settle due outcomes, window pre-check, insert, outcome job, fleet REQUEST receipt); the ack adds reservation_id. The start intake calls the fleet FulfilMissionReservationDBTX port after storing the link, on the borrowed intake transaction (the fulfilment is an effect of the start operation, audited by its receipt; no separate audit event); StartDecisionDBTX gains the eligible mission so a mission reservation admits its own start (ReservationFact.MissionID, Starter.MissionID; the assignment warning and the vehicle change pass their own mission). The outcome job takes the organization root lock first (one lock order with every command and the trip start). Server-only (no Kotlin mirror, as EDR-195). Inventory: trip.mission.manage keeps its representative (157 normal routes, 30 routed); auditor walk 157 / 31 / 126; matrix unchanged. | UC-FLEET-06 makes trip.mission.manage a requester and fleet.md §6.4 names FULFILLED from a qualifying start; keying the request by mission lets the planner's coverage of the mission be checked and the vehicle and window come from the mission, with a revision so a stale planner view cannot reserve a replaced vehicle; consuming only at receipt before the deadline keeps a stopped job from extending a window and a device clock from reviving a released one; one lock order makes the release/start race resolve to exactly one outcome instead of a deadlock. | A second permission on the fleet request route; a request keyed only by asset with an optional mission; fulfilment by declared instant after the deadline; fulfilment of a reserved-employee start without a mission and mission cancellation releasing its reservation (retained); a stored availability flag. | EMP-TRIP-023; B-BR-EMP-414; BR-FLEET-030/031, UC-FLEET-06, fleet.md §6.4; EDR-192..195; route inventory, AUTH-011 walk, OpenAPI; retained: reserved-employee fulfilment, mission-cancel release, configurable early/no-show tolerances, notifications, panel and app. | | EDR-267 | Keep EMP-OFFL-005 attachment bytes inside the accepted EMP-PRIV-003 protected generation of the exact account/origin/organization: one sealed ATTACHMENT entry per attachment (the existing VaultKind.ATTACHMENT, keyed by the document UUID) and one sealed RECORD with a fixed identifier holding the versioned canonical attachment-book v1 index (bound to membership and enrollment: identifiers, declaration, link target, owning operation, local state, refusal code, retry state), written together in one protected write; capture requires the owning operation's queue entry in the same snapshot; unsettled bytes are bounded at 16 MiB and the index at 500 entries per partition (capture refused beyond, nothing evicted); verified (STORED) bytes are removed in the write that records the verification; build flag ENTERPRISE_ATTACHMENT_UPLOAD_ENABLED (data module, default off, validation builds on) gates capture and delivery. | The protected generation already seals attachments with the queue under one trusted head, binds them to the exact partition, inherits two-account isolation, custody expiry, backup exclusion and erasure, and needs no new key or file channel; C1 is synthetic JPEG at most 5 MiB, so a 16 MiB bound keeps the 32 MiB / 10 000-entry snapshot budget (pressure at 80 %) for the queue and indexes; every queue mutation re-seals the generation, so the measured write cost is recorded in the evidence and removing verified bytes keeps it bounded; capture without its operation would be a dangling attachment. | Encrypted per-attachment file blobs with their key in the vault (a second ciphertext channel the PRIV-003 erasure, janitor and lost-head rules do not cover yet; revisit when real receipts, larger formats or measured write amplification need it); Room or plaintext cache files (PRIV-003 forbids plaintext); deleting unsent bytes on budget pressure (BR-OFFL-013); keeping verified bytes on the device. | EMP-OFFL-005; B-BR-EMP-415, B-BR-EMP-418, B-BR-EMP-420; BUC-EMP-211; EDR-076, EDR-242 (trip-book precedent), PRIV-003. Retained: an encrypted blob store for real receipts (with its erasure channel), dismissal of refused attachments, retention of the index, capture in the same write as a producer's operation (DOC-004/FUEL-011). | | EDR-268 | Deliver attachments by whole-body safe retry with an explicit local state machine: WAITING_FOR_RECORD (no final receipt of the owning operation) → DECLARED (the signed session answered UPLOADING, linked) → RECEIVED → STORED, or REFUSED with a closed code (OWNER_REJECTED, NOT_FOUND, FORBIDDEN, VALIDATION_FAILED, CONFLICT, OPERATION_ID_REUSED, QUARANTINED, FAILED) or FILE_MISSING; every delivery asks the session first (fresh capability, current state), checks the sealed bytes' size and SHA-256, sends them once and records only what the server answered; transport failures, timeouts, 5xx, 401/404 on the ingress (expired or unusable capability) and 422 integrity refusals keep the state and schedule a retry with the EMP-OFFL-003 QueueRetryPolicy (30 s base, 6 h cap, equal jitter, unlimited, Retry-After within the cap) stored per attachment; the operation worker runs attachment delivery after the queue and review lookups of each partition, under the same account lease, and its earliest due time joins the worker's continuation; the capability and any "sending" hint are memory only. | The ingress (EDR-153) is a single bounded request with no byte offset, so resuming means repeating the whole at most 5 MiB body, and DOC-002/014 already make UPLOADING retries, RECEIVED checks and STORED replays idempotent; persisting only server answers means a killed process can never leave a false "verified" state; reusing the queue policy and worker keeps one battery and backoff profile (OFFL-003) and one scheduling owner; a separate retry state keeps attachment failures from delaying or re-sending operations (BR-OFFL-015). | A ranged/chunked resumable upload protocol (new server boundary, no measured need at 5 MiB); persisting a SENDING state or the capability; an attempt cap or dropping after failures (BR-OFFL-013); a separate WorkManager job for uploads; uploading before the owning operation has a final receipt. | EMP-OFFL-005; B-BR-EMP-416, B-BR-EMP-418, B-BR-EMP-419; BUC-EMP-212; EDR-078, EDR-122, EDR-153, EDR-170. Retained: Wi-Fi-only and battery-tuned scheduling (10-offline-sync §2 later), byte-level progress UI, re-declaration with a new document after a closed (FAILED UPLOAD_ABANDONED) session. | | EDR-269 | Link an attachment to its operation through the EMP-DOC-003 link of the record the operation created, named explicitly at capture: the device stores the owning operation identifier (its final receipt gates the declaration) and one link target from the DOC-003 registry (INCIDENT for a check.incident.report, METER_READING for a reading — including the departure or final reading embedded in trip.start/trip.finish — ASSET, EMPLOYEE); the signed session route creates the link with the device actor inside DOC-003 Service.Link (owner policy and coverage, FORBIDDEN for another member's record, NOT_FOUND across organizations), at declaration time so the record's documents show the attachment as pending (BR-OFFL-015); the operation envelope's attachments field stays unused and owners keep answering it RETRY/UNAVAILABLE. | CHECK-003 (EDR-239) keeps photos out of the report operation so acceptance never waits on uploads; DOC-003's registry and owner resolvers are the designed extension point, so no owner changes; a verified device actor through Service.Link is the real signed proof, not the forged web actor EDR-177 rejected; linking while UPLOADING is what the link guard admits and what CHECK-003's report read already shows; a target captured at capture time needs no server-side guessing from operation types. | Envelope attachment declarations linked by every owner inside the intake (would couple operation acceptance to documents and change every owner); a doc.document.link sync operation owner (needs a borrowed-DBTX link port, EDR-106/177, and a second ordering path); linking only after STORED; inferring the target from the operation type on the server. | EMP-OFFL-005; B-BR-EMP-416, B-BR-EMP-417; BUC-EMP-211; EDR-162/163, EDR-177, EDR-239. Retained: TRIP, FUELING, EXPENSE and WORK_ORDER link kinds (their owners, FUEL-011, EXP-004, TRIP-020), held incident reports, unlink and replacement (DOC-011). | | EDR-270 | Make one minimal backend change: a special signed route POST /v1/orgs/{org_id}/sync/attachments (boundary SIGNED_ATTACHMENT_SESSION, orgapi.SignedAttachmentSessionRule: account proof, signature, current exact enrollment, creator-bound, owner-linked, whole-body preflight, 200) in orgsync/adapters/http with the reference feed's device proof and a strict 4 KiB flat request; its port is implemented by document/adapters/http.DeviceSessions over a new document/application Service.OpenDevice (android actor only: Create, then Link unless the document is FAILED/REPLACED/DELETED, the capability returned only after the link); the response is a fixed wire struct bound to the request, membership, enrollment and document; composed in enterprisesuite only when the document service has storage-independent tokens (always) and mounted with the other signed routes; route inventory, OpenAPI, apicontract and the authorization inventory counts gain the boundary; a shared sync/attachment-session-v1.psv oracle pins request and response between Go and Kotlin. No SQL, migration, permission, role, job or orgaccess change. | The only device-reachable declaration and capability path was missing (DOC-002 retained it): the company routes need a browser session, the ingress needs a capability, and a capability cannot travel in an ACK; one route carrying declare+link+capability is the smallest surface that covers renewal, status and linking with existing idempotent services; the signed-route precedents (OFFL-006/008) already define the proof and the boundary checks; production composes no document bucket, so the route answers capabilities but bytes stay UNAVAILABLE there until the operator gate. | Two or three routes (declare, link, capability, status); a capability in the sync acknowledgement; signed proof on the byte ingress instead of the capability; letting the company uploads/create accept device proof; adding the route to the authorization matrix as a normal permission route (it is a special boundary that rechecks doc.document.attach and the owner's permission itself). | EMP-OFFL-005; B-BR-EMP-417; BUC-EMP-213; EDR-152/153, EDR-170, EDR-216..218, OFFL-008 review results. Retained: provider qualification and the production document bucket (operator gate), production grants (none new), rate budget for the route (none, like the reference feed). | | EDR-271 | Owner decision, 2026-11-15: EMP-GOV-005 (legal review of location, documents and labour boundary) is declared complete by the owner and every tracking feature will be covered by the terms of use; EMP-GPS-001..015 are implemented for real and prepared for production. EMP-GOV-006 (target-device tracking spike) is validated on the owned API36 emulator with synthetic/mock locations; acceptance on physical target devices stays OWED because the attached physical phone is excluded from automated use. Tracking stays activated per organization only once its employee notice and terms are in force (M4 activation strategy). | The owner holds the legal and product authority the gate waited for; the roadmap risk table already keeps tracking parameters as configuration; the device restriction is a standing session rule, not a product decision. | Keeping GPS blocked after the owner's declaration; using the physical phone; enabling tracking for an organization without its notice; treating emulator runs as real-device acceptance. | Owner answer in the F4 session (2026-11-15); EMP-GOV-005, EMP-GOV-006, EMP-REL-005; [F4 ledger. | | EDR-272 | Delivery after the integrated F4 batch (PR #223): merge PR #224 (Play Store readiness) alone first once every check is green, then deliver the F4 continuation as its own dev → main PR merged only with valid CI. Because the local dev branch is checked out by another worktree with unpublished commits that must not change, the guarded merge is make quick-verify on the exact PR head followed by gh pr merge --merge --match-head-commit <head> (the same guards as git-flow.sh finish, which needs that local branch). Enabling the enterprise routes in production is a manual VPS change made only after the automatic deploy, with a written rollback plan and the owner's final confirmation. | The owner chose "#224 first, F4 after" and "enable enterprise on the VPS"; one open dev → main PR at a time; the deploy agent applies main automatically. | Folding the Play Store work into the F4 PR; a merge without green checks or with a changed head; touching the other worktree's dev; a VPS change without the final confirmation. | ADR-020; DELIVERY_WORKFLOW final integration; owner answers (2026-11-15). | | EDR-273 | Place the pure tracking session in Go tracking/domain and Kotlin enterprise.tracking with one session-v1 oracle consumed by both; reuse the trip domain's TripRef, MembershipRef and operational State/TripState instead of new references; take the bound trip's current facts (reference, driver membership, operational state) as an input of every command instead of storing a trip state in the session; keep persistence, clock, authority, device/account binding, service and buffer out of the domain. | 09-architecture §2 names the module tracking (uses trip) and §2 Android :domain holds enterprise rules; the Android tracking service (EMP-GPS-002) runs the session offline, so a Kotlin mirror is required; tracking importing trip makes Go's acyclic imports guarantee that no trip transition can read the session (BR-GPS-005). | A session copy of the trip state (two truths); importing the session into the trip lifecycle; a server-only domain; new trip or membership reference types; device, account or origin fields before EMP-GPS-002/BR-GPS-014. | EMP-GPS-001; B-BR-EMP-421/425/426; EMP-GPS-002/004 bind device, account and storage. | | EDR-274 | Close the session vocabularies: origins TRIP_SCREEN, NOTIFICATION, PERSONAL, BOOT, WORKER, PUSH, GEOFENCE, SERVER (only the trip screen opens, starts or resumes); causes = the §10.10 session reasons NOT_STARTED, PERMISSION_DENIED, NOTIFICATION_BLOCKED, PERMISSION_REVOKED, PRECISION_REDUCED, PROCESS_STOPPED, DEVICE_RESTARTED, STOPPED_BY_DRIVER, LONG_STATIONARY, OWNER_CHANGED plus the §6.1 trip and server situations named TRIP_PAUSED, TRIP_COMPLETED, TRIP_CANCELLED, MEMBERSHIP_ENDED, DEVICE_REVOKED, with NOTIFICATION_BLOCKED also an interruption cause (BR-GPS-004/015); actor kinds DRIVER, DEVICE, TRIP, SERVER fixed by command and cause; refusals PERSONAL_TRIP, IMPLICIT_START, SESSION_EXISTS, TRIP_STATE, OUT_OF_ORDER beside INVALID, SCOPE, FORBIDDEN, TRACKING_OFF, INVALID_TRANSITION; another trip of the organization is SCOPE as in trip-v1. | BR-GPS-002 lists what may never start recording and UC-GPS-03 says a notification only opens the trip screen; BR-GPS-008 requires actor, instant and reason on every transition; the gap reasons SIGNAL_LOST, PROVIDER_DISABLED and MOCK_LOCATION describe fixes inside a recording period, not a session state, so their derivation stays with EMP-GPS-003/005. | Free-text reasons; an origin flag that a caller can claim generically; mapping a personal start to SCOPE only; a generic CONFLICT for the duplicate session; storing a membership as actor of device or server events. | EMP-GPS-001; B-BR-EMP-421..424/426; EMP-GPS-003/005/010 own fix-level gap reasons. | | EDR-275 | A start or resume refused for permission NONE or a hidden notification keeps the state and records the attempt as the visible cause (no transition outside the §6.1 table, in particular no SUSPENDED → INTERRUPTED); precision is decided at each start or resume and only reduced in between (REDUCE), a raise waiting for the driver's next resume; policy OFF also stands for an inactive capability or an organization whose employee notice and terms are not in force (EDR-271), checked only at opening; showing the notice at each start (BR-GPS-034) stays with the trip screen of EMP-GPS-002/015. | UC-GPS-01 keeps the session NOT_STARTED with PERMISSION_DENIED and never blocks the trip; BR-GPS-007 records the precision granted at start and resume; the matrix records a reduction as RECORDING coarse with PRECISION_REDUCED; BR-GPS-006 stops new sessions without touching existing ones. | Returning an error that drops the refused attempt (hides the missing permission); a silent precision upgrade mid-period; a new transition invented for a refused resume; a domain flag for "notice shown" that the app would always set. | EMP-GPS-001; B-BR-EMP-421/422/423; EMP-GPS-002/015 own the notice and the visible trip screen. | | EDR-276 | Fix the track quality classification of §6.2/§10.4 (BR-GPS-026) here as one pure function of counted inputs (expected seconds, gap seconds, accepted fixes, any coarse period) with coverage unknown for zero expected time and expected time bounded by 10¹² seconds; GPS-005 derives those inputs from stored fixes and gaps; the per-fix filter of BR-GPS-017 (age, accuracy, speed jump, mock), GPS distance, divergence and the distance basis stay with EMP-GPS-003/005/006; the fix-level label is the precision of the current period (APPROXIMATE = coarse, BR-GPS-007). | The task names "quality states" (08-state-model Track quality) and the session owns the precision of every period; integer permille arithmetic is exact in both languages, while a speed-jump check needs great-circle floating point owned by the distance golden vectors of GPS-005; the instant profile spans less than 3.2×10¹¹ s, so the bound only prevents overflow. | Classifying from floating-point percentages; coordinates or haversine in this domain; deriving quality from session state alone; deciding distance use in the session. | EMP-GPS-001; B-BR-EMP-425/427; EMP-GPS-003/005/006 retained. | | EDR-277 | Carry track batches as the signed operation gps.track.batch through the OFFL-002 intake instead of a dedicated route, with the six session operations gps.session.start, resume, suspend, interrupt, reduce and end (the §8.1 list plus reduce, because a precision reduction bounds coarse periods) on the entity tracking_session; the batch identifier is the operation identifier; one operation is at most 8 KiB and 200 fixes, one upload request at most 64 KiB and 50 operations (the protocol bounds, BR-OFFL-018); the persistence uses parametrized SQL in tracking/adapters instead of a new sqlc stanza; the codec is server-only and the Kotlin producer belongs to EMP-GPS-003. | The intake already gives the signed source, organization sealing, one result per (organization, identifier), byte-exact replay, OPERATION_ID_REUSED, dependency handling, organization-state and late-intake decisions and atomic audit, which a second endpoint would have to re-implement (§8.1: "the same authentication, organization sealing and replay rule"); a 64 KiB upload of several operations keeps the 360-fix default of §10.2 with smaller per-operation bounds; PostGIS geometry and integer arrays do not fit the shared sqlc models without overrides in a shared file. | A dedicated POST /tracking/batches route with its own proof, ledger and replay; raising the protocol's 8 KiB operation bound; one gps.session.record type with a command field; sqlc models for geometry. | EMP-GPS-004; B-BR-EMP-429/431/433; EMP-GPS-003 owns the device envelope and splitting. | | EDR-278 | Keep every tracking outcome inside the closed OFFL-001 receipt vocabulary: policy OFF is a final REJECTED FORBIDDEN; the other EMP-GPS-001 refusals (INVALID, SCOPE, PERSONAL_TRIP, IMPLICIT_START, SESSION_EXISTS, INVALID_TRANSITION, TRIP_STATE, OUT_OF_ORDER) and a batch of more than 200 fixes are a final REJECTED MALFORMED that stores nothing; another member is a whole-request FORBIDDEN (EDR-202 precedent); a trip or session not stored here is RETRY DEPENDENCY_PENDING with no claim (BR-GPS-022, EDR-202); OUTSIDE_SESSION and the other counters live on the stored segment, not in the receipt; the trip facts of a command are those at its declared instant (from the stored start, EMP-TRIP-011 pauses, resumptions and cancellation, and finish); before a session command the stored session follows the trip's stored pauses, cancellation and finish from its last transition up to the command's instant (GPS-001 FOLLOW), those rows stored with the command, and batches are judged against the same followed periods and the trip's running intervals; receipt reads use trip.trip.read; the owners have no held form, no late holder and no asynchronous follow-up. | Adding TRACKING_OFF, BATCH_TOO_LARGE or counters to the receipt would change the shared Go/Kotlin protocol vectors; the offline matrix says tracking needs no online validation, so a refusal must be final and per operation rather than block the queue; current-state trip facts would refuse a session operation delivered after a later finish of the same trip; a receipt carries no coordinate. | New receipt codes or warning tokens; a whole-request 409/413 for tracking refusals; current trip state for past operations; held sessions before a review owner exists. | EMP-GPS-004; B-BR-EMP-428/429/431/432; held sessions and late tracking retained (§8.1). | | EDR-279 | Persist tracking in migration 000240: insert-only org_tracking_policies (absent = OFF, read at receipt; no writer route here), org_tracking_sessions (unique per trip, owner = the trip's author membership until a handover exists), org_tracking_transitions (contiguous sequence, non-decreasing instants, terminal ENDED, operation source re-proved) and org_tracking_segments (one row per accepted batch with integer arrays and a trigger-derived geometry(MultiPoint,4326)); every write locks the trip row (the trip finish and the EMP-TRIP-011 lifecycle rows lock the same row) and the triggers re-prove the followed recording period, the trip's running intervals (org_tracking_trip_running_at), precision and per-session instant uniqueness; a deferred trigger publishes each row only with its ACCEPTED receipt; tracking instants are whole microseconds; a stored session is rebuilt by replaying its rows through the EMP-GPS-001 domain. | EDR-018 stores one row per batch; the trip row lock gives the per-session serialization that makes de-duplication exact without a session update privilege; replay keeps the GPS-001 domain the only rule source (no Go-only restore or Kotlin change); microsecond instants are what PostgreSQL stores, so period and finish comparisons stay exact. | One row per fix; a session update counter; a stored copy of the trip state; nanosecond instants with a sub-microsecond column; deriving periods in Go only. | EMP-GPS-004; B-BR-EMP-428/430/432..434; EMP-GPS-005 derives gaps and summaries; EMP-GPS-011 owns retention deletes. | | EDR-280 | A fix's instant is the batch's declared instant plus its offset (the device wall clock, the same clock as the session and trip operations it is compared with); the boot identity and base elapsed milliseconds are stored for EMP-GPS-005's monotonic correction and CLOCK_UNCERTAIN flag; the source is PHONE only; the device of a segment is its enrollment; a fix already stored for the session is identified by its instant. | BR-TIME-005's monotonic derivation needs the processing job's view of several batches and boots; comparing device instants with server receipt time would refuse ordinary offline delay; the instant is the only identity a resent or re-batched fix keeps. | Re-anchoring fixes on receipt time; rejecting batches without a boot identity; de-duplicating by position. | EMP-GPS-004; B-BR-EMP-431/433; EMP-GPS-005 retained. | | EDR-281 | Serve recorded tracks through one company route, POST /v1/orgs/{org_id}/trips/{trip_id}/track/read, owned by tracking/adapters/http, under gps.track.read only: the route resolver states the stored trip's author as its own record (AuthoredBy) and driver (TripDriver) and the read as a recorded track (RecordedTrack), the TripStructure source also answers gps.track.read, and a TrackAuthority re-proves the same facts inside the read transaction through the company authority; pages hold at most 20 segments behind a reader-bound cursor; no migration is needed (000241 unused). Live positions and the Android driver's own device-channel read are not routed here. | The catalog already encodes OWN_TRIPS_ONLY and RECORDED_TRACKS_ONLY against TripDriver and RecordedTrack, so the authority needs only server facts; reusing the trip's structural snapshot keeps unit and team scope identical to the trip review; the live projection does not exist before EMP-GPS-007 (F5), so a live route would serve nothing real; a segment can hold 200 fixes, so 20 segments bound a page. | Deriving the read from trip.trip.read; a live route over the newest stored fix; resolving the driver from the request; a new structure kind; an unbounded track response. | EMP-GPS-012; B-BR-EMP-435/437; EMP-GPS-007/008/009/015 retained. | | EDR-282 | Record two PRIV-005 access rows per page read, LOCATION_TRACK ISSUED then SERVED referencing it, each with a fresh server identifier and a digest of the page's identities, after the in-transaction read and before the response is written; any recording error serves nothing (UNAVAILABLE). | The PRIV-005 contract gives recorded tracks an issuance and an access action and refuses a served record without an issuance; recording after the read binds the record to what is actually served, while writing the response only afterwards keeps "audit before bytes". | One record only (loses either the grant or the content action); recording before reading (a digest of unknown content); serving on a failed record; a capability token round trip for a JSON page. | EMP-GPS-012; B-BR-EMP-436; PRIV-005 (B-BR-EMP-207..210). | | EDR-283 | The device obtains the applicable checklist template through the existing EMP-CHECK-001 applicable read (POST /v1/orgs/{org_id}/checklists/assets/{asset_id}/applicable, fleet.asset.read) on the account cookie plane the app already uses for its context reads, per asset and context while online, and keeps each answer sealed in one versioned checklist-book v1 RECORD per partition of the PRIV-003 protected store (with the server evaluated_at as its confirmation instant, the runs in progress with their answers and the completed runs with their operation), written in the queue's protected write by the check.run.complete producer (TRIP-005/EDR-242 precedent). The device reads its delivered run's server outcome through the new run read on the same plane. Kotlin builds the operation; the shared contracts/testdata/enterprise/checklist/run-v1.psv (operation bytes from an independent oracle, hash-checked by the Kotlin builder and the Go parser) pins it; the server recheck stays Go-only (server-only rule, budget/payable precedent) and is mirrored by the database. | The applicable read already answers exactly the version, items and policy revision a run pins under the permission a driver holds for an assigned asset, so no new wire or permission is needed; the device plane is offline-first and the sealed store is the only private local storage (EDR-076, PRIV-003). | Extending the OFFL-006 reference feed with a checklist entity type now (it changes the closed entity set, the 000224 entry CHECK, the 129-row reference-feed-v1.psv consumed by both languages and the FLEET-013 cache format — retained as the OFFL-006 extension); Room tables; a new signed template route; mirroring the recheck in Kotlin. | EMP-CHECK-002; B-BR-EMP-438/441; EMP-CHECK-001; EMP-OFFL-006/FLEET-013 retained extension. | | EDR-284 | One signed operation check.run.complete schema 1 (entity checklist_run, payload of B-BR-EMP-439) owned by the maintenance module with the CHECK-003 intake shape (Admit/Apply/Confirm, no held path, terminal results ACCEPTED/REJECTED, NO_ASYNC_FOLLOWUP) and the check.checklist.execute intake authority (EDR-177 history rule, the meter authority's real sources). The recheck is one pure function RecheckRun (B-BR-EMP-440): MALFORMED for an unknown version or policy revision, another context, a wrong answer count, a target that does not cover the asset or a refused answer set; the policy in force at the declared completion instant by the server's history (the first revision before it); TEMPLATE_SUPERSEDED as a stored flag. A disagreement is stored ACCEPTED with both outcomes and review_required (held for review in the run itself); the author learns the server outcome through the run read (B-BR-EMP-441). A photo declaration is RETRY/UNAVAILABLE until the run-photo channel exists. | BR-CHECK-007/008 store the server outcome and refuse nothing; the review-code vocabulary of the acknowledgement is closed and shared with the Kotlin protocol and operations-v1.psv, and an ACCEPTED_FOR_REVIEW result needs an OFFL-008 review-result owner that does not exist for runs, so the run itself carries the review mark and the governing outcome is effective at once (the asset block). | ACCEPTED_FOR_REVIEW with a new review code (protocol, Kotlin, two oracles and the review-result owner change); refusing a disagreement; trusting the device outcome; TEMPLATE_SUPERSEDED as a refusal; accepting unproven photo claims. | EMP-CHECK-002; B-BR-EMP-439..441; BR-CHECK-006..008; EMP-CHECK-003 intake precedent. | | EDR-285 | Migration 000242 adds org_checklist_runs (signed fact; the only update is BLOCKING → COMPLETED_WITH_ISSUES at revision 2 written by its release row), insert-only org_checklist_run_answers (keyed to the template item) and org_checklist_run_releases (one per run, actor separated from the author by account, membership and canonical employee, audited check.run.released), forced RLS, same-organization keys, a deferred database recheck of outcome, flags and in-force policy, publication only with the ACCEPTED receipt or the release audit event, and the asset (000232 body), unit and cost-centre (000231 bodies) usage sources with the run keys as associations. FLEET-007 availability gains the port ChecklistBlockPort (maintenance answers BLOCKING runs whose period covers the instant; NoChecklistBlocks is the explicit no-source adapter and is reported as the missing source CHECKLIST_RUN) and the cause kind CHECKLIST_RUN (row 4, BLOCKED, after manual blocks). Two company routes: the run read under fleet.asset.read and the release under fresh check.incident.manage (configuration write, revision, admission class check.incident), both resolving the stored run through a new ChecklistRunStructure; AUDITOR reads and is FORBIDDEN to release; both permissions are already routed with matrix representatives, so the matrix is unchanged and the inventory gains two normal routes. | BR-CHECK-010/011 put the block on the asset for every member and make release explicit and separated; reusing the derived-availability source keeps one answer for the picker, the panel and the start check, and an explicit port keeps the fleet module free of maintenance tables (the active-use precedent). | A row in org_asset_blocks (its command key belongs to fleet reservations and a manual removal would bypass SELF_APPROVAL); a BLOCK cause with reason SAFETY; blocks from open incident reports with blocks_use (retained to EMP-CHECK-004 with their release without resolution); answers as JSON in the run row. | EMP-CHECK-002; B-BR-EMP-442; FLEET-007 (EDR-192..195); EMP-CHECK-003 (EDR-238..241). | | EDR-286 | Android: Kotlin domain/.../enterprise/maintenance/checklist/ChecklistRuns.kt (operation builder and strict decoder, checklist-book v1 codec and local transitions with a closed failure vocabulary, presentation), application ChecklistRunService/ChecklistFlow with the registered check.run.complete producer, data ProtectedChecklistStore and EnterpriseChecklistHttpGateway (cookie plane), app ChecklistRunScreen reached from the enterprise context and from the trip start form, which shows the chosen vehicle's latest valid departure run and disables the start while it is BLOCKING; rollback flag ENTERPRISE_CHECKLIST_UI_ENABLED; strings in the eight locales. Photos of not-OK items (a DOC-003 CHECKLIST_RUN link kind through the OFFL-005 session) are retained: an item requiring a photo cannot be completed NOT_OK on the device and the server never accepts a photo claim. Native acceptance runs only on emulator-5588 against a real local backend. | The task's scope is the cached template, durable answers, the local outcome and its server recheck; the photo channel needs a new link kind across DOC-001/003, OFFL-005 and two shared oracles, which is a separate bounded change. | Capturing photos into the attachment book without a link target (bytes that can never be linked); letting the driver declare a photo the server cannot verify; a Room table for runs. | EMP-CHECK-002; B-BR-EMP-438/443; EMP-OFFL-005/DOC-003 retained run-photo kind; EMP-TRIP-019 gate. | | EDR-287 | Project the fueling cost inside the fueling.submit intake transaction, after the fueling insert and before the ACK, through a fueling-owned port implemented by the expense store; keep NO_ASYNC_FOLLOWUP for the fueling owner. Allow neither half alone: a deferred constraint trigger refuses a fueling inserted after 000244 without its FUELING expense at commit, and the composite foreign key plus the source trigger refuse an expense without its stored fueling. Do not backfill in the migration; give the store an idempotent per-organization catch-up (ProjectPendingFuelingsTx) for fuelings accepted before 000244 and retain its production trigger. | expenses-finance §8 makes posting and source uniqueness transactional; the intake transaction already holds the organization root and asset locks; no worker consumer of the org-event job kind is registered, so an asynchronous projection would add a service, a retry path and a fueling-without-cost window; the ordinary forced-RLS migrator cannot enumerate organizations, so a SQL backfill is impossible without BYPASSRLS; enterprise routes are not enabled anywhere yet (EDR-272), so only synthetic pre-244 fuelings exist. | An org-event/job projection with eventual consistency; a fueling allowed to commit without its cost; a migration backfill run as a bypassing role; deriving the cost from the device payload; re-reading the fueling inside the ACK confirmation (the database already proves it at commit). | EMP-EXP-002; B-BR-EMP-444/445; FUEL-003/015 own fueling revisions; the catch-up job or command is retained. | | EDR-288 | Store org_expenses (migration 000244): origin kinds FUELING and DIRECT only, origin key unique on (organization, kind, source) plus unique (organization, fueling), unique creating operation, required asset, payer, exact paid/company centavos, competence instant with sub-microsecond remainder, entry zone and offset, reporting day/zone/source re-proved by the source trigger (unit zone of the snapshot, else the organization zone, as trips), FLEET-005 snapshot, SUBMITTED revision 1 and source revision 1. A FUELING expense must mirror its stored fueling exactly (category FUEL, paid = company = fueling paid total, payer, asset, author, enrollment, operation, digest, declaration, snapshot, review state); a DIRECT expense must match its expense.submit operation, a non-draft asset and the snapshot at its instant. Categories are a named CHECK (org_expenses_category_v1) that EMP-EXP-003 replaces: FUEL for fuelings, the REQ-11.1 names other than fuel for direct expenses. The 000232 asset and 000231 unit/cost-centre usage sources are redefined with every line kept and the three new keys listed as associations, not counted. | 06-domain-model §5 names unique (organization, fueling); VAL-13 recognizes one 97 350 cost per fueling, so the submitted company amount of a fueling is its paid total until review; EDR-132 keeps catalogues out of the pure domain, so the v1 list lives in the application codec and one replaceable constraint; BR-AUTH-005 scopes by the allocation at the instant; an expense names only non-draft assets, so it never decides a draft discard or a kind change. | Settlement or WORK_ORDER kinds before their owners; a nullable asset in schema 1; categories in the pure domain or an organization table before EXP-003; counting expenses as asset operations (new grants for every usage caller); a separate review-entry table before EXP-005; trusting a client reporting day. | EMP-EXP-002; B-BR-EMP-444/445/447/449; EXP-003 categories, EXP-005 review history, EXP-006 allocation and MAINT work orders retained. | | EDR-289 | Add the signed expense.submit schema 1 owner for DIRECT expenses: entity expense, exact payload asset_id, category, paid_total, company_amount, payer, trip_id; recognised forms (trip_id, a structurally valid category outside v1, attachments, dependencies, soft references) stay RETRY/UNAVAILABLE; exp.expense.record covered by any positive ORG rule or by SELF on FLEET-006 assigned periods (the fueling rule with own responsibility always true), held cases fail closed; receipt replay under exp.expense.read; no period gate at intake. The Android producer of EMP-EXP-004 builds the payload, so a Kotlin builder and decoder (ExpenseOperations) and the shared oracle contracts/testdata/enterprise/expense/expense-submit-v1.psv, generated by an independent script, are consumed by both languages (TRIP-005 precedent). | The field records an expense offline like a fueling (expenses-finance §8, SCR-EXP-01); scoping by the asset reuses the accepted fueling authority and snapshot instead of inventing an organization-level SELF rule; EXP-004 must not build bytes the server refuses; the configured catalogue (EXP-003) and receipts (DOC-004) are later owners, so their forms must not become facts or be refused for good. | An organization-level expense without asset (SELF would cover any record and no snapshot exists); accepting unknown categories as facts; FUEL as a direct category (a second fuel cost path); a payment method field without a consumer; a route or held-expense review item without its resolution owner. | EMP-EXP-002; B-BR-EMP-447/448/449; EMP-EXP-004 Android, EMP-EXP-005 held expenses and review, TRIP-020 trip link, DOC-004 receipts retained. | | EDR-290 | Make the projection a versioned idempotent upsert-free operation: it reads the stored fueling and the stored expense of its origin; same source revision with equal facts returns the stored expense (no write); a stored expense of a newer source revision makes the request stale (no write, ErrStale); a fueling revision newer than the request, or a request newer than the stored expense, is unavailable until fueling revisions exist; a concurrent insert that loses the unique origin key re-reads and applies the same comparison. Prove the second cost at the database by racing a raw second insert against a held fueling transaction in both orders (the organization root lock serializes them) and prove the partial transaction by a projection port that fails, and one that silently skips the insert, inside the real intake. | BR-OFFL-005 delivers at least once and effects once; an insert-only fact cannot be overwritten, so a stale event must be a refusal, never an update; the root lock taken by every fueling and expense source trigger makes the race deterministic to assert; a silently skipped projection is the realistic defect the deferred check must catch. | Overwriting amounts or state from the latest event; ON CONFLICT DO UPDATE; treating a stale request as success with a write; proving uniqueness only with sequential inserts. | EMP-EXP-002; B-BR-EMP-445/446; FUEL-003/015 revision chaining retained. | | EDR-291 | Bring receipt originals in with the two dependency-free platform contracts the app already uses: the system camera through ActivityResultContracts.TakePicture into a FileProvider file under a dedicated cache folder (enterprise-receipts/), requested only after the CAMERA permission, and the Android photo picker through PickVisualMedia(ImageOnly), which needs no storage permission; read each selection once, bounded to 5 MiB + 1 byte, judge it by content with the EMP-OFFL-005 JPEG policy, keep the bytes unmodified, delete the camera file right after reading and sweep the folder whenever capture opens. | Both contracts ship in androidx.activity, already used by CaptureScreen (TakePicture) and VehicleScreen (PickVisualMedia), so no dependency, licence or security review is added; the server accepts only image/jpeg in C1 (EMP-DOC-002) and BR-PRIV-020 decides type by content and preserves originals; a cache file is never backed up and is the only plaintext moment, removed before anything is reported saved. | CameraX in-app capture (already a dependency for the live price board, but a second camera surface for a still photo); the Storage Access Framework OpenDocument with PDF/XML (C1 refuses them on the server); transcoding PNG/HEIC or downscaling large camera files to JPEG (would alter the original, B-BR-EMP-451); reading files by extension or MIME type. | EMP-DOC-004; B-BR-EMP-450, B-BR-EMP-451; BR-PRIV-020; EDR-267. Retained: PDF/XML import and re-encoding policy for real receipts (OQ-04), EXIF/location handling of real camera originals, a document-oriented frame. | | EDR-292 | Give legibility feedback as a pure Kotlin heuristic over a decoded luminance sample (longest side at most 512 px, BT.601 integer luma): issues LOW_RESOLUTION (shortest original side below 480 px), TOO_DARK (mean below 60), TOO_BRIGHT (mean above 225), LOW_CONTRAST (standard deviation below 24) and BLURRED (variance of the 4-neighbour Laplacian below 60); thresholds are hypotheses kept in one object; an undecodable image is NOT_CHECKED; the hint is shown with a fixed "does not validate the receipt" statement, never blocks, is never stored or sent. | REQ-10.1 asks for legibility feedback while LV-04/LV-11 and OQ-04 keep fiscal judgement out of C1; a deterministic integer heuristic is host-testable with synthetic grids and identical on every device; the Android decoder only supplies pixels. | On-device OCR or ML Kit (text recognition is out of scope and a new data processing); a server-side check (needs network, contradicts offline capture); blocking illegible photos (hint only); storing the score. | EMP-DOC-004; B-BR-EMP-452; REQ-10.1. Retained: calibration of the thresholds on target devices and real receipts (OQ-04), a document frame guide. | | EDR-293 | Own a capture by the screen flow of its record: the hosting flow (C1: TripFlow, on the start or finish record that carries a reading, target METER_READING with the reading identifier, owner the record's operation) keeps an unsaved photo only in memory and saves it through EnterpriseReceipts, a thin application wrapper of EnterpriseAttachmentService.capture that maps local refusals to closed reasons, inside the flow's existing account/epoch/partition fencing; attachments are read per owner operation from the same partition and shown beside the record; the operation and its photo stay two protected writes (the photo is refused unless its operation is already queued). | Reusing the record flow's fencing avoids a second owner that could drift from the visible partition; the OFFL-005 store already refuses a capture without its queued operation, so two writes never create an orphan photo; a single combined write would need a new queue-transaction surface for attachment entries; trip readings are the only C1 producer with a registered link kind until FUEL-011 adds FUELING. | A separate attachment screen owner per screen; capture on the pending-sync screen (OFFL-004 keeps payloads out of presentation, so it cannot name a target); one protected write for the operation and its photo; persisting the unsaved photo. | EMP-DOC-004; B-BR-EMP-453, B-BR-EMP-454; EDR-267..269. Retained: fueling receipts (EMP-FUEL-011), incident photos on Android (CHECK-003 Android), the closing conference (EMP-TRIP-020), dismissal of refused or missing attachments. | | EDR-294 | Build fueling.submit on Android as a pure Kotlin mirror of the Go intake parser (domain/.../enterprise/fueling/FuelingOperations.kt: builder and strict decoder over the FUEL-001 candidate rules, refusing in the intake's order and class) and pin both with one new shared oracle contracts/testdata/enterprise/fueling/fueling-submit-v1.psv (59 rows: 15 OK covering every product, payment method, fill and payer, 39 MALFORMED, 5 UNSUPPORTED retained forms) generated by an independent Python script and consumed by the Kotlin builder/decoder and by the real Go protocol.ParseOperation + application.ParseOperation; the app never produces a retained form, unit_price_text or an envelope attachment. | The TRIP-005 precedent (trip-operations-v1.psv) is the repository's pattern for producer bytes; the FUEL-001 fueling-v1.psv oracle already aligns the candidate rules, so the new oracle only needs the wire; refusing retained forms locally keeps a fueling from waiting forever RETRY/UNAVAILABLE. | A Kotlin builder tested only against Kotlin expectations; reusing fueling-v1.psv (candidate, not wire); producing unit_price_text for more than three decimals (no rounding owner yet). | EMP-FUEL-011; B-BR-EMP-455; EDR-175/176. | | EDR-295 | Keep no separate fueling index: the registered fueling.submit producer re-reads its operation inside the protected write and projects nothing, and the list and detail are read back from the partition's retained fueling.submit queue entries in one protected snapshot (ProtectedFuelingStore); sync state comes only from each entry's own receipt and the review line "Aguardando aprovação" only from ACCEPTED; the asset label is resolved from the FLEET-013 cache at display time; rollback flag ENTERPRISE_FUELING_UI_ENABLED (default on). | The operation is the whole record and a fueling has no cross-record local rule (unlike the trip book's one-unfinished-trip rule), so a second sealed index would only duplicate facts; retained final receipts are kept until a policy exists (OFFL-003), so the list is complete; FUEL-002 stores held fuelings nowhere, so RETRY is the truthful state. | A fueling-book record like trip-book; Room tables (EDR-076, PRIV-003); copying the asset label into the operation. | EMP-FUEL-011; B-BR-EMP-456, B-BR-EMP-458; EDR-076, EDR-177, EDR-242. Retained: list retention and dismissal, held-fueling review results (FUEL-003), cancel/correct (FUEL-004/015). | | EDR-296 | Enter fuelings exactly and offline: asset from the FLEET-013 picker (implements excluded), products from the cached asset's accepted products (all nine when none), quantities and unit prices with up to three decimals and money with two (decimal comma or point, no grouping, integer conversion without rounding, too many decimals refused before saving), explicit fill, payer and the offline payment methods (agreement voucher and internal stock withheld), responsible = the member's own employee record from the context read (EDR-244), reading from the cached in-service meters or a stated absence; the device shows the BR-MONEY-005 arithmetic warning (EnterpriseValues.reconcile, KWH under the litre profile as EDR-176) and the METER-003 check against the latest reading of the same meter and segment among this device's own fuelings, both never blocking. | Exact integers are the wire contract (EDR-175) and BR-MONEY-004 forbids recomputing the paid total; 10-offline-sync §10.3 makes agreement vouchers online-only and internal tanks are F6; the feed carries no previous reading (EDR-216), so this device's own fuelings are the only local series; FUEL-002 refuses another responsible for SELF members. | Rounding prices with more than three decimals; offering every payment method; blocking on warnings; a server read for the previous reading. | EMP-FUEL-011; B-BR-EMP-457, B-BR-EMP-458; BR-FUEL-002/006/008/009/017; EDR-176, EDR-216, EDR-244. Retained: trip link and place references (soft references), capacity warning (needs tank capacity in the feed), previous readings from trips on the device. | | EDR-297 | Link a fueling receipt through a new EMP-DOC-003 FUELING link kind: migration 000245 adds org_document_links.fueling_id with a same-organization composite foreign key to org_fuelings(org_id,id) and widens the target-kind and binding checks (the 000230 pattern; no function, usage source, trigger, policy or row change); fueling/adapters.FuelingDocumentTargets resolves it under fuel.fueling.record with the fueling's author membership as AuthoredBy (an S cell: only the author's own fueling), registered in the enterprise suite; the device captures the optional receipt in the form through the EMP-DOC-004 sheet and seals it after the fueling in a second protected write (target FUELING = the fueling identifier, owner = its operation), declared by OFFL-005 only after the fueling's final receipt; a failed or refused second write keeps the fueling and says the receipt was not saved. | OFFL-005 (EDR-269) retained the FUELING kind for this producer and fixes the target at capture; a stored fueling exists exactly when its ACCEPTED receipt exists (held forms store nothing), so the declaration gate links only to a real row; reusing fuel.fueling.record follows fuelings §7 ("receipt through doc.document.attach" plus the record permission) and DOC-003's owner-resolver design. | Linking to the fueling's embedded METER_READING (wrong record); a receipt in the envelope attachments (the intake answers UNSUPPORTED); one protected write for fueling and photo (needs a new queue surface); fuel.fueling.read as the target permission (would let readers attach). | EMP-FUEL-011; B-BR-EMP-459; EDR-162/163, EDR-239, EDR-267..270, EDR-291..293; migration 000245. Retained: production grants for the link principal, receipt replacement and unlink (DOC-011), fuelings linked to trips. | | EDR-298 | Place the processing rules in the pure Go tracking/domain (ProcessTrack, Simplify, Metres, the gap vocabulary) and its composition in tracking/application (Summarize over the replayed session, the trip's running intervals and the session's own segments); persist and fence in tracking/adapters (ProcessingStore, ProcessHandler, requestProcessing), registered by enterprisesuite.TrackingHandlers on the general worker dispatcher. The trigger is the tracking store itself: storing an ENDED transition, or a segment for an ended session, queues org-tracking-process in the intake transaction (payload version, organization, session; de-duplication key with the stored segment and transition counts; 5 attempts). No Kotlin mirror and no shared vector file: the job is server-only and the device filter of EMP-GPS-003 is its own rule set; the Go vectors are the domain tests. The tracking intake owners keep NO_ASYNC_FOLLOWUP (no OFFL event): the queue row is the owner's own effect, as the FLEET-007 outcomes are. | UC-GPS-05 processes after the trip ends or when segments arrive for an ended trip; the store already holds the trip row lock and knows both events, while the trip packages never import tracking (EDR-273), so a trip finish without the device's end is not a trigger (retained); a session's work is bounded (one trip, at most a few thousand fixes), so it needs no dedicated slot; one job per input lets a late batch supersede without waking the job for every batch of a running trip. | A scheduled cross-organization sweep (forced RLS forbids it without a definer); an OFFL follow-up event; a dedicated serial slot; processing every batch while the trip runs; Kotlin vectors for a server-only job. | EMP-GPS-005; B-BR-EMP-461, B-BR-EMP-466; UC-GPS-05; EDR-273, EDR-277..280. | | EDR-299 | Fix the server filter and gap rules: stored fixes are judged in instant order against the session's replayed spans and the trip's running time (start → finish, cancellation or the EMP-TRIP-014 closure instant; pauses excluded; with no end stored, until the session's end); OUTSIDE (not inside a recording span while running, or a coarse flag disagreeing with its span), ACCURACY (precise, above 50 m), SPEED (precise, implied from the previous accepted precise fix above 70 m/s, so one outlier never moves the anchor); coarse fixes skip both checks and are never measured. Gaps: not-recording spans with the transition's cause (actor DRIVER/DEVICE → detected by the device, TRIP/SERVER → by the server; before the opening NOT_STARTED by the server; after an early end its cause) and SIGNAL_LOST (server) for more than 180 s without an accepted fix inside a recording span. Expected seconds = floor, gap seconds = ceiling bounded by expected (never overstating coverage). The age of a fix (15 s) and the provider-off and mock intervals are device facts (the batch carries only their counters), so the server records them as counters and never as intervals; CLOCK_UNCERTAIN counts segments without a boot identity or with a wall base more than 2 s away from the first segment of their boot, and no instant is rewritten (fixes are never edited, BR-GPS-023). | BR-GPS-017/024/026 and §10.4 fix the thresholds and the classification (EDR-276 owns the function); the device applies the same filter before upload, so the server re-check is defence in depth on what was stored; a closure instant is the server's own fact and is the only end a closed trip has. | Resetting the speed anchor after rejections (a teleport would re-anchor); measuring coarse fixes; rewriting instants from the monotonic clock without a trusted anchor; inventing provider or mock gap intervals; rounding gaps down. | EMP-GPS-005; B-BR-EMP-462, B-BR-EMP-463; BR-GPS-007/017/024/026; EDR-276, EDR-280. | | EDR-300 | GPS distance follows the TrackRecordingPolicy anchor rule (a fix counts once it is at least 10 m from the last counted fix) on the 6 371 008.8 m sphere, inside runs split at every SIGNAL_LOST gap and at every recording span, summed in float64 and floored once; absent (never zero) when the quality is INSUFFICIENT or no precise run has two accepted fixes. The simplified geometry is Douglas–Peucker in Go on a local equirectangular projection in metres per run at 20 m, the tolerance doubled until the whole geometry holds at most 1 000 vertices (bounded at 20 × 2²⁰ m), with no geometry when the quality is INSUFFICIENT, no run has two fixes or more than 500 runs exist; it is stored as integer arrays with part sizes and a database-derived MULTILINESTRING of SRID 4326. | §10.2 fixes the tolerance and the bound in metres, which PostGIS ST_Simplify on SRID 4326 degrees cannot honour without a projection per trip; the anchor rule is the one the app's own track recorder uses for the same 10 m constant; integer arrays keep the stored values exact and the derived geometry serves EMP-GPS-009 replay with gaps as breaks. | ST_Simplify/ST_SimplifyPreserveTopology in degrees; a projected copy of every fix; a step rule that drops crawls; distance zero for an unmeasured track; one line bridging gaps. | EMP-GPS-005; B-BR-EMP-464, B-BR-EMP-465; BR-GPS-025; §10.2/§10.4. | | EDR-301 | Migration 000246 adds the insert-only, forced-RLS org_tracking_summaries (key organization + session + revision; same-organization keys to the session and the trip; method, input counts, job and lease, expected/gap seconds, coverage, coarse flag, quality, filter, intake and device counters, CLOCK_UNCERTAIN count, distance and its method, gap arrays, line arrays and tolerance, a derived geometry and the database processing instant), with checks that re-derive coverage and quality from the counts (BR-GPS-026), forbid any derived value on an INSUFFICIENT track, and bound the arrays, and a guard that, under the trip row lock, requires an ended session, the exact stored segment and transition counts, the session's own fix, intake and device totals, a strictly newer input at the next revision, ordered disjoint gaps with closed reasons (SIGNAL_LOST only by the server) whose ceiling equals the gap seconds, and lines of at least two vertices; UPDATE/DELETE/TRUNCATE refused, PUBLIC holds nothing. The processing transaction first locks its queue row FOR UPDATE with its lease token (a superseded holder fails ErrStaleLease, and a live holder keeps another claim out until it commits), then the trip row. | A derived row must be re-provable from its inputs (BR-GPS-023, BR-TRUTH-004); the counts identify an insert-only input exactly, so "newer" and "the same input" are decided by the database rather than by a job's clock; the queue's own fence protects acknowledgement but not the business effect, so the effect holds the row too. No asset, unit, cost-centre or employee key is added, so no usage source changes. | Overwriting a current-summary row; a job clock or job id as the version; trusting the job's counts; a database trigger that queues work; storing geometry without integer arrays. | EMP-GPS-005; B-BR-EMP-465, B-BR-EMP-466; EDR-279; runtime grants retained. | | EDR-302 | Give the tracking policy a writer as a coordinator-assigned prerequisite of the EMP-GPS-002 activation, owned by the tracking module: tracking/application PolicyService (change and read, the completed request decision bound before and after every repository call), tracking/adapters PolicyStore (raw parametrized SQL, the EMP-GPS-004 style) and tracking/adapters/http two company routes POST /v1/orgs/{org_id}/tracking/policy/change (fresh configuration write under org.settings.manage, organization target only, admission class org.setup, which already holds that key) and POST /v1/orgs/{org_id}/tracking/policy/read (org.settings.read); organization/adapters.TrackingPolicyAuthority re-proves the company authority inside the transaction. The body's revision is optional (absent = no recorded version yet) because the shared gateway admits only revisions of at least 1; enabling needs a notice version and an in-force instant at or before the database's effective instant; the notice text is not stored. Unused pre-allocated identifiers: none. | The specification gives the tracking policy to org.settings.manage (gps-navigation §7, SCR-GPS-09) and no gps.* catalog key configures tracking, so no key is invented; EMP-GPS-004 already created the insert-only org_tracking_policies table with the notice columns and the in-force rule, so the writer reuses it instead of the ORG-008 settings bag, whose strict fixed-key JSON, heads and designations would duplicate the in-force rule; EDR-271 activates tracking per organization only with its notice in force, and no platform notice registry exists (the only notice versions in code are fixed invitation constants), so the organization declares its own notice version and instant; a scheduled future notice would store an enabled version that is not in force, which the brief names as a refusal. | Folding the policy into ORG-008 settings values; a new gps.policy.manage key; storing or templating notice text; accepting a future notice instant (a stored OPTIONAL that reads as OFF); a mandatory revision: 0. | Coordinator assignment after EMP-GPS-004/012 (retained writer); B-BR-EMP-467..469; BUC-EMP-237/238; EDR-271, EDR-279. | | EDR-303 | Migration 000247 adds only the insert-only, forced-RLS command receipt org_tracking_policy_commands (primary key organization + operation; unique resulting revision; same-organization foreign keys to the policy version and the actor membership; account, membership, 64-hex request digest, database creation instant) with a guard that re-proves the scope, that the receipt names the newest version of the organization and that an enabled version's notice was in force at its effective instant; UPDATE/DELETE/TRUNCATE are refused and PUBLIC holds nothing. The 000240 policy table, guard and in-force function are unchanged, so EMP-GPS-004 fixture versions stay valid. Replay reads the receipt and the version it names; the audit event is the existing org_audit_events row of gps.policy.changed on target tracking_policy (the organization). | Every enterprise command keeps an immutable receipt for byte-stable replay and author attribution (checklist and settings precedents); a receipt references its version so a version and its receipt commit together, and checking only receipts keeps the policy table writable by the existing fixtures; production grants follow the same retained rule as every enterprise table. | Altering org_tracking_policies (applied migration, append-only rule); a deferred rule requiring a receipt for every version (breaks the GPS-004 fixtures and the upgrade image); replay from the audit table alone (it does not hold the resulting revision). | B-BR-EMP-467/468; EMP-GPS-004 (000240); runtime grants retained. | | EDR-304 | Add one company read, POST /v1/orgs/{org_id}/missions/{mission_id}/assignees/list, owned by trip/adapters/http under the mission read policy (trip.mission.manage, read, not fresh, the MissionStructure resource): the store scans ACTIVE, unmerged employees with an ACTIVE account-linked membership in employee order inside one read transaction between two authority checks and keeps those for which EligibleAssigneeTx (the assignment command's own rule) is true; items are employee_id, display_name, registration_number; the gateway-sealed cursor binds route, mission and limit and carries the last scanned employee, so empty pages with a cursor are legal. No migration, table or permission key is added; the route is inventoried under trip.mission.manage and walked by the AUTH-011 auditor. | REQ-07.2 and the EMP-TRIP-022 acceptance require that only eligible assignees are shown, and eligibility is the member's current trip.trip.start coverage of that mission (structure, SELF), which no existing read exposes; reusing the command's predicate makes the list and the command agree by construction. The name and registration number are the employee list's own descriptive fields, already readable by every planner role (idn.employee.read O), and are needed to tell homonyms apart. | Compose employees/list (shows FINANCE, AUDITOR and other ineligible members and needs client-side authorization); compose roles/list (only OWNER/ADMIN hold auth.role.assign, and it would re-implement coverage in the browser); a dry-run flag on the assignment command (a command route answering reads); returning membership or role data (not needed). | EMP-TRIP-022; B-BR-EMP-470; BUC-EMP-241. | | EDR-305 | Ship the board (SCR-TRIP-03) as a section of the organization workspace in the existing /empresas/ shell, opened on demand by the member (no automatic request), with no new URL: src/missions.ts (port, parsers, controller) and src/missionpanel.ts (DOM). It composes the existing reads — missions/list and {id}/read, the EDR-304 assignees read, fleet/assets/list (ACTIVE; IMPLEMENT filtered out), cost-centres/list (ACTIVE, optional), availability/read, reservations/list, blocks/list — and the five existing commands. The panel's creation binds the mission unit to the chosen vehicle's current unit (unit_id of the asset read) and therefore requires a vehicle; plan destinations are entered as text, and an existing unit destination is shown as linked; times are entered and shown in the browser time zone, which is named on screen. A refused optional read (cost centres, assets) disables only its picker; a refused mission read clears the board. | The context hints carry only idn.* keys, so no trip.mission.manage hint exists and the server's answer (including 403) must decide visibility; the units read needs org.structure.manage, which FLEET_MANAGER and SUPERVISOR planners do not hold, while every planner reads assets and the server stores the asset's current unit. A separate route would need Caddy deep-link changes for no product gain. | A permission hint for trip.mission.manage in contexts/read (a second backend change and a hint that is still not authority); a unit picker from units/list (fails for most planners); free UUID inputs (forbidden by the panel conventions); a dedicated /missoes/ deep link. | EMP-TRIP-022; B-BR-EMP-471..474; BUC-EMP-239/240. | | EDR-306 | Deliver SCR-FLEET-06 in this task as the read-only agenda (the spec's list view) of the vehicle a mission uses or would use: current FLEET-007 availability with every cause and the evaluation instant, then reservations (state, window, end cause) and blocks (reason kind, period, removal) one page each with a further-page control. Free-text reservation purposes and block notes, and reservation employees, are not displayed. Reservation request/confirm/cancel, block/unblock, the grid calendar rendering and trips in progress as their own rows are retained for the fleet panel. | FLEET-007 retained the screen for this board, whose decision needs the vehicle's current and planned availability; the list view carries the same data with full keyboard access; the planner does not need free text to decide and minimisation keeps it out. | Implementing every FLEET-007 command here (a separate fresh fleet.reservation.manage surface outside the mission board's scope); a grid calendar without a list (worse keyboard and screen-reader access). | EMP-TRIP-022; B-BR-EMP-472; EMP-FLEET-007 retained list. | | EDR-307 | Carry planned stops in the EMP-TRIP-009 PLAN command as an optional ordered stops list of 1 to 20 free-text places (plan text profile with the CPF-shaped refusal; no unit, coordinate, time, person or contact; absent = none, empty refused), stored insert-only per planning revision; keep the trip.mission.plan.v1 digest byte for byte when there are no stops and bind them in trip.mission.plan.v2 otherwise; project stops only when the revision has stops; derive the planned legs (start → stops → destination) without distance or duration. The pure value is trip/domain PlannedStops and its Kotlin mirror TripPlannedStops, shared through the PLANNED rows of the new trip/stops-v1.psv; mission-v3.psv and the mission plan value stay unchanged. | The domain model gives the mission its planned stops and REQ-07.3 asks for planned and actual in one timeline; PLAN already owns the revision check, receipt, audit event and the freeze at acceptance (EDR-246, B-BR-EMP-413), so stops can never be edited once the member accepted; keeping v1 for stop-less plans keeps every stored receipt replayable; text-only stops add no unit association, so no usage source changes (the FUEL-002 trap); route plans with typed points and planned distance stay in ROUTE (BR-ROUTE-002/008). | Unit-or-text stops like the destination (a new unit key and an org_unit_current_usage redefinition; retained with ROUTE organization places); a separate stops command, route and transition kind; planned times per stop (no consumer, invites equating an estimate with travel); stops inside the mission plan value (mission-v4, every PLAN_VALUE row rewritten); a JSON column or a stop count on the 000231 plan row (changes the insert that older rehearsals run). | EMP-TRIP-010; B-BR-EMP-475, B-BR-EMP-479, B-BR-EMP-480; EDR-246/247; BR-ROUTE-008; trip/stops-v1.psv. | | EDR-308 | Derive the observed stops and legs at read time from the trip's typed facts instead of recording anything new: the start, the end (finish or cancellation; a closure has no device instant) and the accepted STOP, ARRIVAL and DEPARTURE events in the B-BR-EMP-324 order; STOP/ARRIVAL open a stop and end the incoming leg, DEPARTURE closes the open stop and opens the next leg, the end closes the moving leg or leaves the trip at its stop. Incoherent sequences are surfaced, not repaired: a DEPARTURE without an open stop is a stop and an incoming leg with ARRIVAL_MISSING; a second opening while a stop is open leaves it and the next leg with DEPARTURE_MISSING; an event accepted while the trip was open but declared after the end recorded later (no guard orders a finish after existing events) is listed apart as after_end, so the read never fails or hides it. The derivation is pure trip/domain ObserveStops mirrored by Kotlin TripStops.observe through the OBSERVE rows of stops-v1.psv; the server adds each boundary's zone, offset and receipt and the after_receipt flag (declared after its own receipt), and lists held stop observations with their code. No signed operation, payload, oracle or Android producer changes. | EMP-TRIP-003 already records these types offline with identity, actor, declared instant, zone, offset and receipt (REQ-07.3, BR-TIME-001/002) and EDR-207 kept them typed for this task; a derived view cannot drift from its facts, so planned edits can never touch it; BR-ROUTE-008 keeps actual stops in the logbook and the plan unrewritten; BR-TRUTH-003 makes a missing boundary explicit rather than invented; BR-TIME-006 reports a suspicious time instead of rewriting it; one shared table keeps the device and the server from deriving different stops. | A new trip.stop.record operation with arrival and departure in one payload (a second source of the same fact, a new owner, wire and producer); a planned_stop soft reference on trip.event.record (the device would pick the match, equating the plan with reality; trip-operations-v3; retained); materialised stop rows (could disagree with late deliveries); pairing by count or receipt order; treating a DEPARTURE right after the start as leaving the origin (a special case that hides a missing arrival); holding future-declared events at intake (changes EMP-TRIP-003 intake). | EMP-TRIP-010; B-BR-EMP-476, B-BR-EMP-477; EDR-207/208; BR-TIME-001/002/006, BR-TRUTH-003, BR-ROUTE-008. | | EDR-309 | Add one company read, POST /v1/orgs/{org_id}/trips/mine/{trip_id}/stops/read, owned by trip/adapters/http under the EMP-TRIP-012 own-trips policy (trip.trip.start, read, target the requesting membership; HandoverRecords and TripHandoverAuthority reused, checked before and after the read in one forced-RLS transaction): a trip is the member's own when the member started it or is its current responsible member; anything else is the same NOT_FOUND. It returns the trip summary, planned (null without an EMP-TRIP-023 link or a planning revision, else the mission's current planning revision with window, destination, stops and derived legs) and observed (stops, legs, held observations). Inventory: trip.trip.start gains the route (normal routes 163 → 164, permissions routed 30 unchanged); AUTH-011 auditor walk 164 / 33 / 131 (FORBIDDEN); the matrix keeps its trip.trip.start representative (300 cells unchanged); OpenAPI one path and its schemas. | The observed side is trip facts that only the trip read (EMP-TRIP-006, trip.trip.read, not routed) or the member's own records may expose; trip.mission.manage must never substitute for a trip read (the BR-AUTH-011 "never substitutes" line of EDR-281); the own policy already serves trips/mine/list and missions/mine/list; the member who recorded the observations and accepted the plan is the one the deliverable names. | A mission read under trip.mission.manage showing trip facts (permission substitution); routing trip.trip.read now (EMP-TRIP-006 owns the panel trip detail and review); adding stops to trips/mine/list (open trips only, list pages); no route and a store read only (the EDR-209 precedent; the deliverable is the member's read). | EMP-TRIP-010; B-BR-EMP-478; EDR-255, EDR-231, EDR-281; route inventory, AUTH-011 walk, OpenAPI. | | EDR-310 | Migration 000256 adds only forced-RLS, insert-only org_trip_mission_plan_stops (primary key organization + mission + revision + sequence; same-organization key to the planning revision; sequence 1..20; the plan text profile) with a BEFORE INSERT source guard under the organization root and mission row locks (organization setting; the head at that revision and PLANNED; no receipt yet for the plan's operation; sequence = stored stops + 1) and a deferred constraint trigger that publishes a stop only with its PLAN receipt; no existing table, function, row or usage source changes. The store writes and reads it with raw parametrized statements after the head moves and before the receipt (the mission sqlc stanza stays unchanged, the EDR-265/334 precedent). Upgrade from the populated 000255 image with an injected failure, recovery, no-op replay and previous-image compatibility. Production grants (not provisioned): the company runtime SELECT, INSERT ON org_trip_mission_plan_stops; the own read SELECT on it, org_trip_mission_links, org_trip_mission_plans, org_trip_missions, org_trip_events, org_trip_held_events, org_sync_review_items; the migrator REFERENCES ON org_trip_mission_plans. | A guard tied to the receipt and the head proves that stops are written only by their own PLAN transaction without changing the 000231 row or insert; the deferred check refuses an orphan stop; forced RLS and the insert-only trigger keep history; no unit or cost-centre key means no allow-list redefinition. | A stop count column on the plan row (changes the 231 table and insert run by older rehearsals); a JSON array column; transaction-id (xmin) checks (fragile under savepoints); sqlc for the new table (would regenerate the mission package for one insert and two reads). | EMP-TRIP-010; B-BR-EMP-479; migration 000256; rollback: the route is removed and PLAN refuses stops while stored stops remain. | | EDR-311 | Derive the segment a reading counts in from the segment intervals: org_meter_reading_segment(org, meter, reading) returns the recorded segment of a METER_REMOVAL reading (the segment its removal closes), else the one whose half-open [opened, closed) contains its instant; the supersession clause of the reading-state guard uses it and every segment-keyed meter query (latest valid, series, current state, reading lookup, history page) inlines the same expression over 000198 columns, so the current store still populates the older images of the upgrade rehearsals; these use it instead of org_meter_readings.segment_id, which stays the immutable segment that was open at intake. Migration 000251 closes segments and removes meters by one guarded UPDATE each (statement trigger kept for DELETE/TRUNCATE; a row guard admits only the first closure/removal with every other column unchanged), adds the closure columns (kind, value or unknown, closing reading, operation) and org_meters.removal_operation_id, widens the segment kinds to RESET/ROLLOVER with an opening operation, and checks the whole chain at commit (contiguous, kinds matching, opening and closing readings at the boundary, the rollover closing at the modulus, a removal closing the meter's last segment at its removal instant). | BR-METER-001 forbids changing a reading, yet a rollover's reading and the readings typed after an unrecorded reset must count in the next segment (§10.4 example D, BR-METER-012); time intervals are what fleet §3 already states ("segments do not overlap in time") and need no copy of any reading; the existing partial unique indexes (one_in_service_kind, one_open_segment) and the observation guard already read removed_at/closed_at, so a one-time guarded update keeps every existing invariant working. | Updating segment_id on readings; a re-homing table; superseding the rollover reading with a copy (wrong author and capture); closure tables beside never-set closed_at/removed_at columns; refusing boundaries that leave later readings behind (the usual way a reset is discovered). | EMP-METER-005; B-BR-EMP-481; BR-METER-001/005/007/012; EDR-184; rollback: capability off, recorded segments keep counting. | | EDR-312 | Add POSSIBLE_ROLLOVER as the last canonical flag (Go meter.PossibleRollover, Kotlin ReadingFlag.POSSIBLE_ROLLOVER, org_meter_flags_canonical widened) and produce it only through the modulus-aware CheckMeter/ReevaluateMeter (Kotlin checkMeter/reevaluateMeter): a candidate below its valid predecessor, without a valid successor in its segment, whose exact wrap usage (M − v₁) + v₂ passes the §10.2 pair check; the modulus-free Check/Reevaluate keep the EMP-METER-003 behaviour and oracle unchanged. Store a confirmed rollover as history cause ROLLOVER (person cause, VALID), admitted by the guard only over a POSSIBLE_ROLLOVER reading that opens a ROLLOVER segment of the same operation; CONFIRMED over POSSIBLE_ROLLOVER is refused like the monotonicity flags. | §10.2 defines the candidate with the same limit; a valid successor contradicts a wrap in the same segment; keeping the old entry points unchanged keeps validation-v1 (104 vectors) byte-identical; a separate cause makes the person's rollover decision distinguishable from a rate confirmation in the history and lets the guard tie it to its segment. | A rollover applied by intake; reusing CONFIRMED; flagging without the rate check; changing validation-v1. | EMP-METER-005; B-BR-EMP-483, B-BR-EMP-486; BR-METER-012/020; EDR-184/185. | | EDR-313 | Expose replacement and reset as one company command POST /v1/orgs/{org_id}/fleet/assets/{asset_id}/meters/{meter_id}/change (change = REPLACE or RESET) and the rollover as decision CONFIRM_ROLLOVER on the existing EMP-METER-004 decide route, all under meter.reading.correct (configuration write, fresh proof, admission class of the decide route); the change command's revision is the meter's segment count, so a concurrent boundary is CONFLICT. The reset's after value is its new segment's STANDALONE/TYPED opening reading by the deciding member through the company session and its before value the old segment's closing value (one operation carries one reading per meter, UNIQUE(org_id, meter_id, operation_id)); replacement readings are METER_REMOVAL/METER_INSTALLATION on two meters; the new meter takes the old meter's kind and the asset revision is unchanged. Replay is proven by the audit event (meter.replaced, meter.reset on target meter; meter.rollover.confirmed on target meter_reading) and rebuilt from the stored boundary rows; no receipt table. Device readings that name a segment closed by a boundary keep today's RETRY/DEPENDENCY_PENDING outcome. | fleet §7 gives replace, reset and rollover to meter.reading.correct and §8 makes them online commands; SCR-METER-04 is one dialog for replace and reset, and SCR-METER-05 confirms a rollover beside confirm/correct/void, so one new route plus one decision keeps the inventory small; the meter has no revision column, and its segment count changes exactly when a boundary is recorded; BR-METER-003's origin list has no reset origin. | Three routes; the asset revision as expected revision (a replacement is not an asset edit); a new origin; a receipt table; re-targeting late device readings (retained, OFFL/fleet §8). | EMP-METER-005; B-BR-EMP-484..486; BUC-EMP-245..247; EDR-187/188; route inventory, matrix, auditor walk, OpenAPI. | | EDR-314 | Share one pure segment model in Go (fleet/domain/meter/segments.go) and Kotlin (enterprise.meter.MeterSegments) over a new oracle contracts/testdata/enterprise/meter/segments-v1.psv (operations CHECK_WRAP, REEVALUATE_WRAP, CUMULATIVE, USAGE, REPLACE, RESET, ROLLOVER; examples C and D, a reset, the unknown final value); the track takes VALID anchors only and refuses an inconsistent chain (gaps or overlaps inside a meter, an open segment that is not the last, a decreasing valid series, a value outside its segment); the planners decide the command preconditions and the implied usage purely, the store adds only the database clock and locks. | The existing meter family already runs every rule in both languages from shared vectors (meter, capture, validation); the device needs the same figures for SCR-METER-04 and offline display; refusing inconsistent input is safer than computing a number from it. | A server-only implementation; computing usage in SQL; extending validation-v1. | EMP-METER-005; B-BR-EMP-481..485; EDR-185; check-manifest unchanged (packages exist). | | EDR-315 | Migration 000252 adds the forced-RLS org_meter_current_values (key organization + meter; same-organization keys to the meter, the open segment and the current reading; value, instant and the revision) written only by SECURITY DEFINER trigger functions owned by the migrator (AFTER INSERT on readings, history revisions and segments, AFTER UPDATE on segments and meters) that call one recompute org_meter_current_refresh(org, meter) under the caller's organization scope; the revision is the count of the meter's source facts, so incremental maintenance and a rebuild produce the same number; the runtime role only reads it. | A database trigger is the only place every reading change passes through (signed intake, fueling, trips, held reviews, METER-004 decisions, METER-005 boundaries and TRIP-015 supersession) without a call added to each path; SECURITY DEFINER trigger functions are the 000171 precedent and keep the projection out of every runtime grant set and test fixture; a counted revision is deterministic, so AC1's "identical revisions" holds by construction and any fact raises it. | A Go call in each write path; a counter incremented per transaction (a rebuild could not reproduce it); a deferred refresh at commit (stale inside the transaction); runtime write grants on the projection. | EMP-METER-006; B-BR-EMP-487, B-BR-EMP-488; BR-METER-006/016, BR-TRUTH-004; rollback: stop reading the projection; readings are untouched. | | EDR-316 | Serve usage between instants as the server port fleet/adapters.MeterStore.UsageBetween(ctx, scope, asset, kind, from, to) (no HTTP route): one organization transaction takes FOR SHARE on the asset's meters of the kind (every reading, history, segment and removal writer locks the meter FOR UPDATE), then reads the meters of the kind in installation order, their segment chain, the readings currently VALID with the segment B-BR-EMP-481 derives and the projection revisions, builds the EMP-METER-005 meter.Track and answers with Between, both anchors, method meter-usage-v1 and the revision sum; an asset without a meter of the kind is NOT_FOUND. | UC-METER-08's actors are system modules (trips, fuelings, maintenance, indicators), so a port is what the backlog asks for; the share lock makes a concurrent correction all-or-nothing while WithOrgTx stays READ COMMITTED (its write-skew rule); reusing the shared pure track keeps one formula in Go and Kotlin; a sum of per-meter revisions changes whenever any input of the figure changes. | An HTTP route before a panel needs it; a SQL implementation of §10.3; returning usage 0 or NO_READING_BEFORE for an asset with no meter of the kind. | EMP-METER-006; B-BR-EMP-489, B-BR-EMP-490; UC-METER-08; EDR-314. | | EDR-317 | Rebuild through the restricted operator tool ops meter rebuild-projection --org <uuid> [--operator <id>], which requires an operator identity and runs org_meter_current_rebuild(org) (SECURITY DEFINER: delete the organization's rows, recompute every meter) in one organization transaction and prints the meter count; no audit event, because the projection holds no business fact. No Kotlin change: the app reads no projection and the pure formulas were mirrored by EMP-METER-005. | The backlog places the rebuild in cmd/ops; the tool already denies anonymous use; a deleting rebuild proves AC1 literally; auditing a cache refresh would put a non-fact into the business audit trail. | A worker job (no schedule is needed); an HTTP admin route; a Kotlin projection. | EMP-METER-006; B-BR-EMP-488; BUC-EMP-249. | | EDR-318 | Deliver EMP-GPS-006 as a pure Go evaluation in tracking/domain (four sources kept apart, the BR-GPS-028 basis and the BR-GPS-029 signal, no I/O) plus the server port tracking/application.DistanceService/DistanceRepository implemented by tracking/adapters.DistanceStore: one organization transaction re-proves gps.track.read over the stored trip through the EMP-GPS-012 TrackAuthority.CheckTrackTx (a PermissionDenied answer withholds the GPS source; any other refusal fails the read), reads the trip through the existing Trips port and, when allowed, the session's latest EMP-GPS-005 summary; then the odometer comes from METER-006 MeterStore.UsageBetween, the answer is composed and, when the GPS source was served, the PRIV-005 LOCATION_TRACK ISSUED/SERVED pair is recorded before it is returned. No HTTP route, OpenAPI, inventory, matrix or auditor-walk change: the first trip.trip.read route with its structural, self and AUDITOR semantics is EMP-TRIP-006's. | Coordinator decision for this task: the backlog types GPS-006 as DOM and its consumers (trip panel, indicators) do not exist yet; gating the GPS figure behind the recorded-track authority and its access log never opens a location-derived read that GPS-012 does not audit; reusing the meter port keeps one usage formula (corrections, rollovers, replacements) instead of the trip's own two-reading delta. This is stricter than the gps-navigation §7 row that lists the four distances under trip.trip.read (numbers only); relaxing it is a later EDR of the route owner. | A trip.trip.read route in this task (belongs to EMP-TRIP-006); serving the GPS distance under trip.trip.read without an access record; the trip's own MeterUsage delta (refuses rollovers and replacements, ignores corrections); storing distances on the trip. | EMP-GPS-006; B-BR-EMP-491..494; BR-GPS-027..029, BR-GPS-033, BR-TRUTH-003; EDR-281/282, EDR-298, EDR-316. | | EDR-319 | Odometer distance = UsageBetween(asset, ODOMETER, trip start instant, finish instant) accepted only when the figure is known and both anchors are currently VALID readings at exactly those instants (a supersede without a new declaration keeps the instant); a closure or cancellation is answered without the meter port (NO_FINAL_READING, TRIP_CANCELLED), an in-progress or paused trip is TRIP_NOT_FINISHED, the port's NOT_FOUND is NO_METER and its unavailable answer METER_UNAVAILABLE; any other port or store error fails the read. GPS source = the latest summary revision of the trip's only session (NO_TRACK, NOT_PROCESSED, NO_GPS_DISTANCE). Divergence thresholds are the BR-GPS-029 defaults (2 000 m, 10 %); the domain validates configured values in their ranges for a later settings owner. The signal is derived at read time: no table, no gps.divergence.detected event, no consumer of reading changes; migration 000253 is not used. | UsageBetween answers usage between instants from the latest anchors at or before each instant, so a trip finished without its own reading would read as 0 m from the start reading: the anchor-instant rule is the only way to keep an absent final reading from becoming zero (BR-TRUTH-003); trip readings are stored at the trip event's declared instant (readingRecorded), and a correction that keeps the instant still counts; a read-time signal follows every reading correction and summary revision without a cache to invalidate. | Accepting any known usage (absent basis as zero); comparing anchor reading identifiers (a correction has a new identifier); persisting the signal or emitting the event now (no consumer, a second source of truth); per-organization thresholds without a settings owner. | EMP-GPS-006; B-BR-EMP-491..493; BR-METER-006, BR-TRUTH-003/005; EDR-316. | | EDR-320 | No Kotlin mirror and no shared vector file for GPS-006: the app neither computes nor displays trip distance sources in this task, and the evaluation is server-only like the EMP-GPS-005 processing (EDR-298). V-MONEY is met without money: no monetary figure is derived here; distances are exact int64 metres bounded by 10¹² (BR-MONEY-010) so diff × 100 and P × odometer cannot overflow, thresholds compare with integers only, and the basis exposes a value only with its basis (Travelled.Value), so no consumer can price an absent distance. The Go oracle is the §10.5 worked table, VAL-27 and the threshold boundaries in distance_test.go. | A Kotlin mirror would duplicate a rule no app screen uses; shared vectors exist for domains both clients compute (meter, fueling, review, expense, document, fiscal); the money profile's risk here is a number from missing data, which the closed answer shape removes. | A contracts/testdata/enterprise/tracking/distance-v1.psv with no second consumer; a percentage or ratio field (rounding belongs to display, BR-MONEY-008). | EMP-GPS-006; B-BR-EMP-492/493; BR-MONEY-002/008/010/011; EDR-298. | | EDR-321 | The Android trip screen learns the organization's tracking policy from a new driver-level company read POST /v1/orgs/{org_id}/tracking/policy/mine (EMP-GPS-002) under trip.trip.start covering the requesting membership's own record (the EMP-TRIP-012 own-record pattern), answering only the policy in force now (OFF until a notice is in force, revision 0 when nothing is recorded) and, when not OFF, the notice version and its in-force instant; no session, member, coordinate or audit write. The device stores the last read with its read instant in the sealed tracking book of the partition and shows tracking only from that cached value: OFF and never-read hide it, OPTIONAL offers it, EXPECTED nudges it; the value is a display hint, never authority (the intake still decides, EDR-278). | Drivers are the tracked members and hold trip.trip.start but not org.settings.read (EDR-302 read); the specification gives the driver's start screen the policy and the notice (SCR-GPS-01, BR-GPS-034); a dedicated read keeps a missing production grant local to tracking. | Adding the policy to the account-context read (every context read and native fixture would need SELECT on org_tracking_policies; a missing grant would break context selection for everyone); widening org.settings.read to DRIVER (exposes every setting); the signed reference feed (a versioned device format with its own vectors for one value); learning the policy only from a refused start (no way to hide or offer before the trip). | B-BR-EMP-495; EMP-GPS-004 (000240 in-force rule), EDR-302. | | EDR-322 | Session transitions on the device are the six gps.session.* schema-1 operations built by a Kotlin TrackingOperations builder (entity tracking_session = session identifier, no expected revision, no attachment or soft reference; start/resume payload {trip_id, origin, permission, notification_visible}, the others {trip_id, cause}) pinned with Go by the shared oracle contracts/testdata/enterprise/tracking/session-operations-v1.psv (Go consumer through protocol.ParseOperation and ParseSession, Kotlin builders byte for byte and the decoder). Each operation is saved through the existing protected queue with a tracking-book v1 record (one per partition, bound to membership and enrollment) that stores every session's transitions and operation identifiers; the producer re-derives the transition inside the protected write by replaying the stored transitions through the EMP-GPS-001 domain with the trip facts of the partition's trip book (a mirror of the Go Rebuild). Dependencies order delivery: the first start depends on the trip's trip.start, every later session operation on the previous one, and the end also on the trip's trip.finish, declared at the finish's own instant (a later end would meet the server's FOLLOW of the stored finish and be MALFORMED). The device follows only trip facts it knows: the finish ends the session (TRIP_COMPLETED), a final refused start ends it (TRIP_CANCELLED), another responsible member interrupts it (OWNER_CHANGED); the handover and closure feed stays with EMP-TRIP-021. | The intake already decides these exact payloads (EDR-277) and replays its stored history through the same domain (B-BR-EMP-430); a device index replayed through that domain cannot store a transition the server would refuse; dependency chains are the existing OFFL ordering for related operations (trip.event.record depends on its start). | A session table in Room (no plaintext enterprise table exists, EDR-242); storing only operation identifiers and decoding every operation on each read (needs trip facts per operation anyway); no dependencies (a batch or end could arrive before its parent and wait a retry back-off; an end before the finish is refused). | B-BR-EMP-497, B-BR-EMP-499; EMP-GPS-001 (EDR-273..276), EMP-GPS-004 (EDR-277..280), EDR-256. | | EDR-323 | Collection runs in a fourth location foreground service app/.../ui/enterprise/tracking/OrganizationTrackingService.kt (non-exported, foregroundServiceType="location", START_NOT_STICKY, no boot receiver, no ACCESS_BACKGROUND_LOCATION), owning one listener through one pinned LocationManagerCompat.requestLocationUpdates line on the GPS provider (precise) or the fused/network provider (approximate) at a 5-second request; the service is not a Hilt entry point: its collector is installed by the application (or a device test) in a process-wide host, and it starts collecting only after consuming a one-time start grant that the resumed trip screen arms for that exact partition and session for 30 seconds; any other start intent stops the service without listening. The ongoing notification (own channel) names the organization, says that tracking is active and offers "Parar rastreamento"; a watchdog every 30 s re-checks permission, precision, provider, notification visibility, owner (fence epoch and partition custody) and the trip book, and writes the running checkpoint. scripts/check-mobile.sh section 5 allow-lists exactly that file, pins its request line, request builder and provider choice, asserts its manifest entry is non-exported with type location, that it returns START_NOT_STICKY, and keeps refusing background location, any unlisted continuous subscription and any boot receiver; its own fixture tests prove acceptance and each refusal. | The owner decided that tracking is implemented for real (EDR-271) and the module specification asks for the guard to be updated deliberately in the same change (gps-navigation §2.5, BR-GPS-002/003/013); a non-Hilt service lets the real service, notification and platform listener run in the API 36 device acceptance against a real backend; the visible grant is the device-side proof of BR-GPS-002 (acceptance 2). | Reusing TripRecordingService or guidance (personal/local, mutually exclusive, no organization binding); a sticky or boot-restarted service (BR-GPS-011); relying on exported=false alone (a worker or a stale pending intent of the same app could still start it); ACCESS_BACKGROUND_LOCATION (BR-GPS-003). | B-BR-EMP-496, B-BR-EMP-498, B-BR-EMP-500; EDR-271, BR-GPS-002/003/004/013/015. | | EDR-324 | Recovery and checkpoint on the device (EMP-GPS-002 part): the tracking book stores, per recording session, a checkpoint with the boot identity and the wall instant written when the service starts listening and at every watchdog tick; when the trip screen opens (or the service is asked to start) and a RECORDING session has no running service in this process, the session is interrupted at the checkpoint instant (never earlier than its last transition) with DEVICE_RESTARTED when the boot identity differs and PROCESS_STOPPED otherwise, and the screen asks "Retomar rastreamento?"; nothing resumes by itself. In EMP-GPS-002 the service only counts accepted platform fixes in memory; the sampling, buffer, per-fix filter and batches belong to EMP-GPS-003. Native acceptance runs only on emulator-5588 with emulator geo fixes against an orgtest child database; real-device acceptance stays OWED (EDR-271). | BR-GPS-011/012 and the §8.2 interruption matrix require an honest, typed interruption found at the next start; the checkpoint instant is the last proof that the device was recording, so the server's gap starts there. | Interrupting at the recovery instant (overstates coverage); restarting the service from the application (silent resume, BR-GPS-011); a boot receiver (needs background start). | B-BR-EMP-499; BR-GPS-011/012, EDR-274. | | EDR-325 | Sampling on the device follows the specification's sampling-v1 defaults without per-organization overrides: a 5-second platform request (GPS for precise, fused on API 31+ else network for approximate; the TrackingSamplingPolicy constants), the sampler deciding what is recorded (first fix; moving ≥ 1.5 m/s every 10 s or a ≥ 30° turn after ≥ 5 s; slow 50 m; heartbeat 120 s; approximate heartbeat only; economy below 15 % battery and not charging: 30 s, no turn trigger, shown on the trip screen, no exemption request); the filter of BR-GPS-017 on the device (mock, 15 s age or before the period start, unknown or > 50 m accuracy in precise mode, > 70 m/s implied speed; non-finite or out-of-range ignored); a fix's instant is the device wall clock at collection minus the report's monotonic age (the same clock as the session operations it is judged against); integer units of the batch (10⁻⁷ degrees, whole metres rounded up, cm/s, whole degrees). Economy is not recorded on the server in this task. | The intake compares fix instants with the device-declared session instants (EDR-280), so the device clock with the monotonic age is the consistent basis; GPS time could differ from the wall clock by seconds and cut fixes at period boundaries; the specification already fixes the defaults and ranges, so no organization setting is invented. | A 1-second request like guidance (battery, EMP-GOV-006 measures it); the location's own UTC time (skew against the operations); recording every accepted fix (unbounded growth); recording economy as a session operation (no such operation exists in EMP-GPS-004). | B-BR-EMP-501, B-BR-EMP-502; BR-GPS-017/018/019. | | EDR-326 | Batches are built by a Kotlin TrackingBatchOperations builder and decoder pinned with Go by contracts/testdata/enterprise/tracking/track-batch-v1.psv (Go consumer through protocol.ParseOperation/Seal and ParseBatch; Kotlin builder bytes and decoder): base = first fix and its instant as occurred_at, deltas from the previous fix, boot_id + base_elapsed_millis of the first fix, source PHONE, the device counters since the previous batch; a gps.track.batch producer re-checks inside the protected write that the batch is exactly the buffer's oldest continuous run with the next sequence and its counters, depends on the session operation that opened the run's recording period, and removes the fixes in the same write (the batch operation identifiers are indexed in the buffer for the trip screen). Splitting: at most 200 fixes, then fewer until the canonical operation fits 8 KiB, never across a gap start, a boot change or 24 hours. Sealing triggers: oldest pending 60 s, 200 pending, a gap opening, stop/interrupt/end, recovery. Delivery: the ordinary queue (the collector asks for one dispatch after sealing). | The intake's batch format, bounds and per-batch replay already exist (EDR-277/280); a producer-checked removal makes a batch and its fixes leave the buffer together or not at all, so a fix is sent at most once and never lost; the dependency gives the delivery order the session operation needs. | A dedicated batch endpoint (EDR-277 chose the signed intake); sealing at every fix (≈ 1 KiB envelope per 40-byte fix); batches across a gap (would present a gap as continuous to a reader of one batch); dropping the oldest fixes under pressure (BR-OFFL-013). | B-BR-EMP-504; BR-GPS-020/021/022. | | EDR-327 | The buffer is a second sealed record per partition, tracking-buffer v1 (one session buffer per session: boot identity, next sequence, pending fixes, counters, anchors, gaps, overflow, batch identifiers), written through the protected persistence on every recorded fix and every gap change, separate from the tracking-book so that the frequent buffer write never rewrites the session history; the recovery's interruption instant is the later of the book checkpoint and the buffer's last recorded or accepted fix; bounds: 2 000 unsealed fixes (then overflow counted, nothing recorded), 500 gaps per session; fix-level gap reasons (SIGNAL_LOST, PROVIDER_DISABLED, MOCK_LOCATION) live in the buffer and on the trip screen only. | BR-GPS-012/020 require the fix to be durable before it counts and the checkpoint to be the last fix; the batch format of EMP-GPS-004 has no gap field and the server derives gaps itself (EMP-GPS-005), so a device gap intake is a later server change; the bounds keep one partition's vault far below its 32 MiB limit (one day ≈ 2 160 fixes). | Room or a plaintext file (no plaintext enterprise data, EDR-242); appending fixes to the tracking book (rewrites the history on every fix); sending gap reasons inside dropped (closed key set). | B-BR-EMP-503, B-BR-EMP-505; BR-GPS-012/020/024, EDR-324. | | EDR-328 | Add one company read, POST /v1/orgs/{org_id}/checklists/runs/list, owned by maintenance/adapters/http with the new RunQueue company action whose policy is exactly the incident queue's (IncidentPolicy(IncidentQueue): check.incident.manage, read, not fresh, the organization root, IncidentRecords, no structure). The store reads under the run company authority before and after (RunQueue checks the organization target only) and pages the runs ordered by attention group (current outcome BLOCKING, then outcome_differs, then the rest), declared completion descending and run id, with a sealed cursor carrying the last key (group, completion instant, id) bound to the route and limit. Each item is the run read's projection (EnterpriseChecklistRun). No migration, table, index or permission key. | No organization-wide or attention-ordered run read existed (the run read needs the asset and the run id), and the panel's purpose is the release queue, whose command already uses check.incident.manage; reusing the incident queue's policy keeps the matrix unchanged (an existing routed permission with its representative) and makes structural holders open records through the scoped reads as for reports. Ordering on the server is the only way BLOCKING and review_required come first across pages. | A per-asset run list under fleet.asset.read (the panel would need one request per asset to find blocked ones); a client-side sort of a run-id-ordered list (wrong across pages); a new check.run.read key (catalog change for a panel); an outcome filter parameter (two lists to merge); an index (synthetic scale; retained with volume evidence). | EMP-CHECK-004; B-BR-EMP-506; BUC-EMP-260; EMP-CHECK-002 retained list. | | EDR-329 | Add doc.document.view_content to the contexts/read permission hints when a current ORG-scope assignment covers it on the organization root (ContextHints, read hint, not gated by proof freshness or writability), and offer an attachment's content action in the panel only with that hint and a STORED state. The action calls documents/{id}/content/access then content/read with the capability (a new transport method allowlisting exactly those two paths, bounded at 8 MiB for the read whose content_base64 is at most 6 990 508 characters) and hands the decoded image/jpeg bytes to the browser as a saved file through a short-lived object URL revoked at once; nothing is kept. The OpenAPI hint enum gains the key (at most 4 items). | The task forbids offering content without its permission and the server never reveals it beforehand without an audited access (probing content/access would itself issue and record an access); the company CSP is img-src 'self' (no data:/blob:), so inline display would need an infrastructure change, while a user-requested file save needs none; ORG coverage is the conservative hint for the organization-wide queue (structural grants cannot list it anyway). | Showing the action to everyone and relying on the 403 (a content link without permission); per-attachment permission flags in the report read (changes the CHECK-003 closed shape and needs a second authority in the incident store); widening the company CSP to blob:; reusing the 64 KiB JSON bound (refuses every real photo). | EMP-CHECK-004; B-BR-EMP-507; BR-AUTH-011; BR-CHECK-016; EMP-PRIV-005. | | EDR-330 | Ship SCR-CHECK-04/05 as one panel section of the organization workspace in the existing /empresas/ shell, opened on demand (no automatic request), with no new URL: src/checks.ts (port, strict parsers, controller) and src/checkpanel.ts (DOM). It composes the EDR-328 run queue, the run read through its asset, the release, the incident queue, read and decide, fleet/assets/list for asset labels (any state; a refusal leaves neutral labels) and fleet/assets/{id}/availability/read with its own parser that accepts the CHECKLIST_RUN cause and missing source. Reports are listed open first (REPORTED, ACKNOWLEDGED, IN_TREATMENT, blocking marks first) inside each server page. SELF_APPROVAL joins the transport's safe codes so the panel can name it. Retained: the asset block from open reports with blocks_use and a release without resolution (a FLEET-007 cause owned by the maintenance module), the review acknowledgement of a disagreement, structural (UNIT/ASSET) queues and the SCR-CHECK-04 day/author/template filters, run photos (DOC-003 CHECKLIST_RUN link kind), work-order links (EMP-MAINT-003), the actual-API HTTPS browser flow. | The prompt scopes the panel to the CHECKLIST_RUN block and the existing routes; the report block needs a new FLEET-007 source, OpenAPI cause kind and PostGIS proofs outside a web task; the TRIP-022 availability parser refuses the CHECKLIST_RUN missing source introduced by CHECK-002, so the panel cannot reuse it without changing the mission board. | A dedicated /ocorrencias/ route (Caddy deep links for no product gain); reusing the mission board's availability parser; implementing the report block here (a second backend surface). | EMP-CHECK-004; B-BR-EMP-508..510; BUC-EMP-258/259. | | EDR-331 | Name the checklist runs of a trip through envelope soft references {type: "checklist_run", id} on trip.start (at most one, beside the EMP-TRIP-023 mission reference) and trip.finish (at most one, nothing else), keeping operation schema 1 and both payloads; any other reference stays RETRY/UNAVAILABLE. The Android trip builders gain an optional departure run (start) and return run (finish); the producer sends the latest completed departure run of the chosen vehicle its sealed checklist book holds as valid and not BLOCKING (EMP-CHECK-002 already shows it on the start form). The shared operation table moves to trip-operations-v2.psv (every v1 row byte for byte plus the reference rows; Go and Kotlin hash-checked); v1 stays unconsumed. The finish form's return-run line is retained. | BR-OFFL-007 is the protocol's way to point at a record that may be missing at receipt, and EDR-265 already chose it for missions; a schema 2 or payload key would change the TRIP-002/005 bytes on both clients and the frozen schema-1 support; BR-CHECK-012 makes the run the evidence of one start, which only the device that ran it can name. | trip.start schema 2 with a departure_run_id; the server picking the latest run itself (it would silently attach another member's or a later run); a hard dependency on the run (a refused run would block the start forever). | EMP-TRIP-019; B-BR-EMP-511; BR-OFFL-007, BR-CHECK-012; EDR-265, EDR-245, EDR-283; trip-operations-v2.psv. | | EDR-332 | Decide the departure gate on the server at receipt under the start's root and asset locks, after the final refusals and the FLEET-007 decision: required from the current CHECK-001 applicable-template rule for DEPARTURE (not the device cache, not history); a named run counts when it is the organization's DEPARTURE run of the start's asset authored by the start's author membership and not linked to a trip; it is blocking at the declared start when its recheck is BLOCKING and its release was recorded after that instant (the EDR-285 block period) and valid in completion, completion + validity) with the validity of the run template's policy revision in force at the declared start by server history. Reasons, first failure first: CHECKLIST_REQUIRED, ORPHAN_REFERENCE (named but not counting, nothing required), CHECKLIST_BLOCKING, CHECKLIST_EXPIRED. A named run is decided even when nothing is required. A finish links a counting RETURN run of the finishing member completed within the trip and never holds for it. | The deliverable is that the departure decision follows current policy and that a cached policy cannot bypass the server: requirement from the current configuration cannot be bypassed by a backdated declaration, while validity and outcome are facts of the run at the start instant (BR-CHECK-007 decides the outcome by history too); only the author's run is in the author's book and a run gates one start (BR-CHECK-012); BR-CHECK-013 forbids a return run from keeping the trip open. | Requirement by template history at the declared instant (backdating bypass, unknown category history); validity from the device's named policy revision; any member's run; the current outcome instead of the outcome at the start instant (receipt order would decide); holding a finish for its return run. | EMP-TRIP-019; B-BR-EMP-512, B-BR-EMP-515; BR-CHECK-002/005/007/012/013, BR-OFFL-006; EDR-284, EDR-285. | | EDR-333 | Keep the closed acknowledgement vocabulary: a failed gate holds the start ASSET_UNAVAILABLE (CHECKLIST_REQUIRED without a named run, CHECKLIST_BLOCKING, CHECKLIST_EXPIRED) or ORPHAN_REFERENCE (a named run that does not count), after PERMISSION_CHANGED, ASSET_UNAVAILABLE, ASSET_BUSY and before the mission reference; the specific reason (CHECKLIST_REQUIRED, CHECKLIST_BLOCKING, CHECKLIST_EXPIRED, ORPHAN_REFERENCE) is a server fact stored beside the held start whatever code won. org_trip_held_source keeps its code list (no redefinition). Showing the reason in the EMP-TRIP-007 conflict view and the panel is retained. | The review-code set is frozen in the shared protocol (Go reviewCodes, Kotlin decoder, operations-v1.psv); an unknown code would make every installed device refuse the acknowledgement, and EDR-284 already declined a new review code for runs; ASSET_UNAVAILABLE is the code a BLOCKING run already produces through availability (CHECK-002), so the device sees one consistent answer; storing the reason keeps the fact the protocol cannot carry for the reviewer. | Adding CHECKLIST_* review codes to the protocol (both clients, sync vectors, review owner); holding without recording why; a new held code list in the held source. | EMP-TRIP-019; B-BR-EMP-513; BR-OFFL-006/007, 10-offline-sync §10.2; EDR-262, EDR-265, EDR-284. | | EDR-334 | Migration 000255 (EMP-TRIP-010 moves to 000256; 000250 stays unused): insert-only forced-RLS org_trip_checklist_links (trip and context primary key, unique run, unique operation, same-organization keys to trip, run and operation) whose source trigger re-proves the departure (the trip's own start operation, IN_PROGRESS, context, asset, author, not blocking and valid at the declared start by history) or the return (the trip's finish operation, context, asset, finishing member, completion within the trip), and insert-only forced-RLS org_trip_checklist_holds (operation primary key, keys to the held start, its review item and the run) whose source trigger proves BLOCKING/EXPIRED from the run's history at the held start's instant; no existing function or row changes. The gate is a trip application port (ChecklistGate) implemented by the maintenance adapters over the 000223/000242 tables (sqlc maintenance stanza), composed into both trip owners; the links and reasons are written by the trip store. Reads take no row lock: the organization root lock the start already holds serializes run inserts (their source trigger) and releases (their company authority check locks the root before the run row), so the release keeps its code and one lock order holds. Server-only rules (the gate, the reason, the links) have no Kotlin mirror beyond the operation bytes. No route is added. | Separate tables leave org_trips, the held rows and their guards untouched and make one-run-one-trip a key; the maintenance module owns the checklist tables and already depends on the trip application, so the port avoids an import cycle; one lock order is the EDR-266 precedent. | Columns on org_trips or org_trip_held_starts; raw checklist SQL in the trip store; locking the run row; a Kotlin copy of the gate. | EMP-TRIP-019; B-BR-EMP-514, B-BR-EMP-516; EDR-265, EDR-266, EDR-285; migration 000255; rollback: the owner stops reading the references (they return to RETRY/UNAVAILABLE) while links and reasons remain. | | EDR-335 | "Meus ativos" (EMP-FLEET-013 MyAssetsFlow) adopts the delivery-proof lease as soon as deliveryAccount() returns it (after the identity, epoch and background checks) and only then asks whether the view is still current; the lease that open captured for the offline read is superseded, never consulted again for the pull. This is the rule the trip, fueling, checklist and sync-status owners already follow. The enterprise validation runner initializes WorkManager in every test process with a delegating worker factory and drops earlier classes' work before the first test; classes that compose the real UI graph install their own Hilt worker factory. | A same-family session refresh inside the delivery proof (the access token's last 60 s or expired; synthetic tokens last 900 s) replaces the stored credentials without moving the fence, which retires every full-token lease captured before it. The flow checked the retired open lease and cleared the view as STALE with no feed contact, so the first online "Meus ativos" after an idle access token always failed until retried: the recurring EnterpriseSyncContextDeviceTest intermittent (FLEET-013, TRIP-005, DOC-004). Separately, periodic system jobs enqueued by classes that start the real app graph outlived their process and crashed a later class's process without WorkManager. | Moving the fence on every refresh (would withdraw every open screen each 15 minutes); making leases token-independent (weakens the delivery-proof binding, EDR-122); retrying the pull in the view (hides the cause, one more feed request); cancelling jobs only from the host script (other runners keep crashing); swallowing the service crash in the runner (leaves a service ANR). | [f4-fix-sync-context-intermittent | | EDR-336 | EMP-EXP-004 producer and local read: the Android app queues only schema 1 of expense.submit through the EMP-EXP-002 Kotlin builder (ExpenseOperations.submit, shared oracle expense/expense-submit-v1.psv unchanged); a registered EnterpriseExpenseProducer re-reads its operation inside the protected write and projects nothing; list and detail come from the partition's retained expense.submit entries (ProtectedExpenseStore, one queueAccess snapshot) and sync and review lines only from each entry's own receipt; ExpenseFlow copies the fueling owner's owner/epoch/lease fencing and adopts the delivery lease at once (EDR-335); flag ENTERPRISE_EXPENSE_UI_ENABLED (default on) hides only the entry. | The builder and vectors already pin the bytes for both languages; a second index would be a second source of truth that can drift from the queued operation; the receipt is the only proof of acceptance (BR-REV-002); the fueling owner is the reviewed precedent for an offline record with a photo. | A plaintext or separate sealed expense index (drift, more erasure surface); new vectors (would duplicate EXP-002's oracle); showing "Enviado" as accepted (BR-TRUTH-001). | f4-exp004-app-expense | | EDR-337 | Exact expense entry: the asset comes from the EMP-FLEET-013 picker (implements excluded); the category is chosen among the seven EMP-EXP-002 v1 direct categories (FUEL is a fueling, never offered); "Valor pago" and "Valor para a empresa" are both required and converted by the EMP-FUEL-011 money rule (FuelingEntry.money: digits, at most two decimals, a decimal comma or point, no grouping or sign) to integer centavos, and the builder refuses a company amount above the paid total or beyond the money profile; the payer is an explicit choice with no default; trip_id stays null (EMP-TRIP-020 decides the trip relationship). Anything refused saves nothing and says "confira os valores". | BR-MONEY-001 (integer centavos, paid amount authoritative) and the EXP-002 intake profile; one shared exact conversion keeps fuelings and expenses identical; an assumed company share or payer would invent a fact. | Defaulting the company amount to the paid total (an unentered fact); locale number parsing (accepts grouping and rounds); offering FUEL (a second cost path for one fueling, BR-EXP-001). | f4-exp004-app-expense | | EDR-338 | EXPENSE document link kind: migration 000257 adds only org_document_links.expense_id with a composite same-organization foreign key to org_expenses(org_id,id) and the widened kind and binding checks (no function, trigger, usage source, policy or row change); expense/adapters.ExpenseDocumentTargets resolves only a stored DIRECT expense under exp.expense.record with its author as the SELF subject (another member's FORBIDDEN, another organization's, a missing one or a FUELING-origin expense NOT_FOUND), registered in the enterprise suite; OpenAPI's two link-kind enums add EXPENSE. On the device the receipt is a second protected write after the expense (target EXPENSE, owner the expense.submit operation of the same partition) and is declared only after the expense's final receipt (EDR-268/269). | The FUELING kind (000245, EDR-297) is the reviewed pattern; a typed column keeps the binding checkable in SQL; a fueling's projected expense already has its receipt through FUELING, so admitting it here would let one receipt document one cost twice; the S cell keeps a member to their own records. | Envelope attachments on expense.submit (the intake keeps them RETRY/UNAVAILABLE until a reviewed attachment policy); a generic target_id without a typed reference (no same-organization key); admitting FUELING-origin expenses. | f4-exp004-app-expense | | EDR-339 | EMP-TRIP-020 keeps the closing conference device-local: the trip owner (TripFlow) reads the same partition's own fueling.submit and expense.submit entries through TripRelatedRecords (the FUEL-011 and EXP-004 services) and groups with a trip only records of the trip's vehicle declared between its start and finish (TripClosings.of); no trip reference is produced, no server support and no migration is added (000258 unused). | The server keeps trip_id RETRY/UNAVAILABLE for expenses (EDR-289) and fuelings (FUEL-002 retained), and BR-OFFL-007 soft references need an owner that accepts them; the conference only has to help the driver check before submitting (UC-TRIP-02), which the device can do honestly from its own records without claiming a server link. | A soft trip_id on fueling/expense intake (a new accepted form, held-review and orphan handling across two owners, beyond this task); a separate local link index (a second source of truth that would drift from the queued operations). | f4-trip020-closing-conference | | EDR-340 | Evidence states of the conference: per item, from the photos its own operation owns and that target that record only — MISSING (none usable: none, FILE_MISSING or REFUSED), PENDING (saved on device, sending, verifying or needing attention), AVAILABLE (every usable photo STORED), UNREADABLE (attachment index unreadable); record states only from each record's own receipt; amounts per item, never summed; a null related list is "possibly incomplete", never empty. | BR-TRUTH-001 (a status says what was checked: stored is not verified), BR-PRIV-004 and the negatives (foreign attachment, duplicate cost, unreadable evidence shown as verified). | A single "documentation complete" flag (collapses independent checks); counting any photo of the owner operation (a foreign target would count); a cost total (duplicates the fueling's projected expense, BR-EXP-001). | f4-trip020-closing-conference | | EDR-341 | The conference's submission is the EMP-TRIP-005 first trip.submit (revision 1, depending on the finish), offered only for a finished, unmarked trip; a marked trip queues nothing more. The resubmission after a return (EMP-TRIP-015, naming the returned revision) stays retained until the author can read their own review result on the device; the conference shows the submission's own receipt state and never a decision. The trip screen's existing rollback flag (ENTERPRISE_TRIP_UI_ENABLED) hides it. | The device has no source for a return (TRIP-004/005 retained the author's review read), so any resubmission revision it chose would be a guess; the server owns decisions (BR-REV-002). | A driver-declared "returned" gesture that resubmits the last accepted revision (unsourced, would hold or refuse stale submissions as review noise); a new review-results route in this task (route, inventory, matrix and auditor walk scope of its own). | f4-trip020-closing-conference | | EDR-342 | Feed the Android missions inbox from the existing EMP-TRIP-008 own list POST /v1/orgs/{org_id}/missions/mine/list on the account cookie plane (CompanyAccessClient, the EMP-CHECK-002 precedent), one page of limit 100 (a non-empty next_cursor is shown as more missions not listed), parsed strictly and refused whole when an item's assignee is not the context's own employee_id; keep it as one sealed mission-inbox v1 RECORD per partition (fixed identifier, bound to membership, enrollment and employee record) replaced in one protected write, holding the items with their plans and the device receipt clock; state the age from that clock with the FLEET-013 rule (elapsed time within one boot, wall time after a reboot, 24 hours default, unknown when negative). No server change, route, permission or migration (000259 is not used). | BR-OFFL-016 needs the age of cached assignments; the own list already exists for the member under trip.trip.start and carries plans (EMP-TRIP-009); a device receipt clock measures exactly how old the copy is, independently of a wrong wall clock within one boot. | A mission entity in the OFFL-006 reference feed (closed entity set, a 000224 CHECK, the 129-row oracle in two languages and the FLEET-013 cache format would all change, and the feed's authority is fleet.asset.read); a server confirmed_at field on the own list (an additive wire change that measures nothing the receipt clock does not); following every cursor page (more than 100 assigned missions is not a C1 case; the bound is stated). | EMP-TRIP-021; B-BR-EMP-527, B-BR-EMP-531; BUC-EMP-270; EMP-TRIP-008/009 retained lists. | | EDR-343 | Record an answer as the frozen trip.mission.respond schema 1 through a registered producer that writes the answer's line into the mission-inbox record in the queue's own protected write (refusing a mission absent from the copy, not ASSIGNED, or already answered for that revision); add an alone flag to EnterpriseQueueProducerDescriptor (default false, set only for this producer) with which OFFL-003 dispatch sends every due ordinary operation first and an alone operation only as the single operation of its batch; keep a transport-denied response saved and unconfirmed under the existing retry backoff (no device-made final receipt, no queue format change) and explain it from the copy after a refresh; offer "Iniciar viagem da missão" only after a confirmed acceptance (the copy's ACCEPTED or the device's own ACCEPTED receipt for that revision). | EMP-TRIP-008 answers a stale, reassigned or foreign response with a whole-request FORBIDDEN/NOT_FOUND/CONFLICT transport denial that the device cannot attribute inside a mixed batch; isolating it is the only way a denial never holds another record. The queue has no ordering between independent operations and trip.start admits no dependency (EDR-202), so a start naming a mission whose acceptance is still on the device could reach the server first and be held ORPHAN_REFERENCE. | A device-made final REJECTED receipt (the server never produced it; OFFL-001 receipts are server facts); a new queue entry state for denied work (a protected queue codec change owned by OFFL-003); attributing 403/404 bodies to the response (the same codes are source denials); a local delivery order between the answer and the start (a second ordering mechanism beside depends_on); starting from an unconfirmed acceptance. | EMP-TRIP-021; B-BR-EMP-528, B-BR-EMP-529; BUC-EMP-270; EMP-TRIP-008 retained list (device handling of a whole-batch denial). | | EDR-344 | Execute planned trips with the existing operations: trip.start gains the optional mission soft reference of EMP-TRIP-023, and the Android producer gains trip.pause, trip.resume and trip.cancel (EMP-TRIP-011) with the local revision rule (1 plus the trip's earlier lifecycle commands on this device), all pinned by contracts/testdata/enterprise/trip/trip-operations-v3.psv (every EMP-TRIP-019 v2 row byte for byte plus START with the reference — alone or beside the departure checklist run, as the Go ParseStart admits — PAUSE, RESUME, CANCEL and RESPOND rows; v2 kept unchanged and no longer consumed) generated by an independent Python oracle and consumed by the Go intake parsers and the Kotlin builders/decoders; the trip index becomes trip-book v2 (mission_id and ordered lifecycle commands per trip, local states running, paused, cancelled, finished, refused) and decodes v1; the inbox lives as a "Missões" section of the existing trip panel with its own rollback build flag ENTERPRISE_MISSION_UI_ENABLED (default on); native acceptance on the owned emulator against an opt-in nativefixture source. | EMP-TRIP-011 and EMP-TRIP-023 retained the Android producer, the trip-book states and the mission reference to this task; one oracle keeps both languages exact (the EMP-TRIP-005 precedent); reading v1 keeps every saved trip; one panel keeps the mission and its trip under one visible owner bound to account, epoch and background lease. | A separate mission screen and owner (a second set of partition guards and withdrawals for the same trip flow); a trip-operations-v2 extension (changes a frozen oracle's hash and meaning); lifecycle as logbook types (refused by EMP-TRIP-011); a server-provided trip revision on the device (no device read exists; the server holds a stale command STALE_REVISION). | EMP-TRIP-021; B-BR-EMP-529, B-BR-EMP-530, B-BR-EMP-531; BUC-EMP-271, BUC-EMP-272; EMP-TRIP-011/023 retained lists. | | EDR-345 | Hand the approved destination to the existing in-app route preview as its destination search: "Navegar" on a mission of the partition's missions copy and on a trip whose start names that mission resolves, in the pure TripNavigation, exactly the current plan's free-text destination and passes it to the app's own map tab as MapRouteTarget.Address (the existing station hand-off, which opens the route sheet with the query and requires the driver to pick a search result before the on-device engine computes the route); a UNIT destination, a missing plan, a trip without mission or a mission no longer in the copy is unsupported with its reason and opens nothing. | The approved destination of EMP-TRIP-009 is a free text or a unit, with no coordinates; units carry no location (only an optional IBGE municipality code) and the device holds no unit name; the existing map already resolves a typed address through its offline search with user confirmation (BR-ROUTE-003: points come from the app's offline search). | Geocoding the text (BR-ROUTE-003 forbids bulk public geocoding and the device has no other geocoder); parsing a "lat,lon" text into a point (fromStationQuery; it would invent a precision the planner never approved); a unit location read (no such field exists); opening guidance directly without the preview (skips the driver's confirmation). | EMP-ROUTE-004; B-BR-EMP-532, B-BR-EMP-533; BUC-EMP-273. | | EDR-346 | Prove that guidance alone records and sends nothing by construction and by test: the hand-off is a navigation callback from the enterprise screen to the app navigation graph that carries only the query; TripNavigation is pure; a source guard asserts that the enterprise trip and mission screens and the navigation domain build no Intent, geo:/navigation URI or startActivity and reference no tracking, queue producer or HTTP client; presentation device tests assert the exact query handed over and that nothing else is called; native acceptance on the owned emulator through the real map tab (route sheet opened with the query while the enterprise queue, trip book and intake stay unchanged) is the end-to-end proof, owed while the emulator is unavailable. The EMP-GPS-002 tracking session is started and stopped only by the driver's own taps on the trip screen and follows the trip's finish, pause and cancellation; nothing in the navigation path calls it, so guidance can neither start nor stop it (BR-ROUTE-011, BR-ROUTE-015). | BR-ROUTE-011/012/015 and the negatives "silent upload" and "external hand-off replacing the planned flow" are properties of what the code can reach; a guard plus a real run is stronger than a mock of the guidance service. | A runtime network monitor during guidance (the guidance service has no network client; measuring nothing proves little); a tracking lease stub (phase 2, EMP-ROUTE-008). | EMP-ROUTE-004; B-BR-EMP-534, B-BR-EMP-535; BUC-EMP-274. | | EDR-347 | Ship the action behind the EMP-TRIP-021 rollback flag (ENTERPRISE_MISSION_UI_ENABLED: the inbox and its trip actions), with six strings in all eight locales generated from one table, a notice that the navigation is not recorded on the trip, and no new permission, route, migration or server change (no ID of migration space was allocated). | Navigation phase 1 exists only where the planned destination exists, which is the mission inbox and its trips; one flag keeps rollback of the whole feature in one switch. | A separate flag (two switches for one flow); showing "Navegar" on every trip with a free search (that is the map tab itself, not a trip hand-off). | EMP-ROUTE-004; B-BR-EMP-532..535. | | EDR-348 | EMP-OFFL-011 learns a revocation class only from the EMP-PRIV-003 exact signed device contact. The signed delivery plane's whole-response 403 or 404 and the late-intake acknowledgement codes ACCESS_ENDED_BEFORE_RECEIPT, MEMBERSHIP_ENDED, INTAKE_WINDOW_CLOSED and DEVICE_REVOKED are hints: after that partition's delivery the operation worker makes at most one contact per partition per invocation, with the partition's retained exact enrollment, and applies only its verdict: ERASE erases that partition, LOCK records the durable intake-only lock, ACTIVE, a generic refusal or an outage change nothing. The person's company selection applies the same verdicts. No server change: both classes are already observable (contact verdicts, EMP-OFFL-009 intake), so migration 000260 stays unused. | Delivery and late answers are not bound to the enrollment, revision or class, while the contact answer is (request, account, origin, organization, membership, enrollment, family, revision; B-BR-EMP-104); before this task only a person's selection ever contacted, so a lost phone retried its refused queue forever and an ended member's LOCK was learned only by a selection the ended member can no longer make. Contacting only on hints bounds network use to delivery cadence (EDR-122 backoff). | Erasing on a 403/404 or on an acknowledgement code (generic refusals are never wipe commands, B-BR-EMP-104); periodic or startup contact for every partition; letting the worker renew custody on ACTIVE (PRIV-003 keeps reconfirmation person-confirmed, EDR-122); a new server class or route. | EMP-OFFL-011; B-BR-EMP-536, B-BR-EMP-537; BUC-EMP-275, BUC-EMP-276; EDR-068, EDR-122, EDR-197..199. | | EDR-349 | The ACCESS_ENDED lock is a fourth opaque Keystore marker, abastevo_enterprise_v2_ended_<token> (no content, outside restorable files, discovered like the denied_/lock_ markers and erased with the partition). The protected store separates delivery use (queue pending, entry, acknowledge, retry, with the owning acknowledgement projection) from every other use (records, feature reads and writes, new operations, sync status, review lookups, attachments), which the marker refuses; the worker skips review lookups and attachment uploads of a locked partition. After each locked delivery the worker reads the sealed queue under the vault lock: no unsent operation, or a final REJECTED INTAKE_WINDOW_CLOSED, erases the partition in that same lock; otherwise it stays INTAKE_ONLY. Attachment bytes not yet stored are erased with the partition (the server has no late attachment path). An exact ACTIVE for the same enrollment still removes the lock (EMP-PRIV-003 behaviour, unchanged). | The PRIV-003 LOCK was a reconfirmation wait (lock_): it stopped delivery and nobody could reconfirm an ended membership, so eligible pre-end work stayed stuck until offline expiry erased it silently, against BR-IDN-029/BR-OFFL-011. A Keystore marker survives a restored file set like the existing denials, and opaque discovery can see it without a payload key. The window never reopens (EDR-197: R > E + W only grows), so after one INTAKE_WINDOW_CLOSED the rest would be refused too. | Keeping the reconfirmation wait; a flag inside the sealed snapshot (codec version bump, invisible to opaque discovery and maintenance); erasing pending work at LOCK; sending the remaining work after the window closed; waiting for attachment uploads the server refuses; keeping review lookups the server refuses after the end. | EMP-OFFL-011; B-BR-EMP-538; BUC-EMP-275; EDR-069, EDR-070, EDR-122, EDR-177, EDR-197, EDR-268. | | EDR-350 | Cleanup states come from one pure Kotlin rule (RevocationCleanup): INTAKE_ONLY (locked, N unsent), CLEANUP_PENDING (erasure decided, disposal not verified) and CLEANED (only when the existing erasure verified that every key, file and marker of the partition is gone); without a verdict there is no state and no claim. The selection presents a LOCK verdict as its own message (access ended; records saved before are still being sent for review; data locked here and removed after sending); an ERASE keeps the existing acknowledged empty-recovery flow; the pending screen of a locked partition keeps its existing "unavailable" text. Retained: a reboot or clock rollback before or during intake-only delivery keeps EDR-122's person-confirmed reconfirmation, which an ended member cannot give, so that partition stays locked until its offline validity expires and erases it; re-anchoring an intake-only partition from a contact's server time without extending its validity is a follow-up. | Truthful reporting is the acceptance (BR-OFFL-014, BR-PRIV-018); the existing erasure already persists its intent first, refuses every read once the intent exists and reports cleanupRequired until verified, so the states only name what it proves. Changing reconfirmation ownership belongs to EMP-PRIV-003's owners, not this S task. | A "removed" message on the verdict alone or while disconnected; a new screen or notification; worker reconfirmation of ordinary partitions; extending validity from a LOCK answer. | EMP-OFFL-011; B-BR-EMP-539; BUC-EMP-276; EDR-070, EDR-122. | | EDR-351 | EMP-OFFL-013 suite shape and command. Server half: TestSyncResilience* in organization/adapters (tag integration) over the real default enterprise runtime (every default owner, no injected handler) through the signed TLS intake and attachment routes on real PostGIS child databases, a disposable MinIO bucket for the receipt transfers and an explicit synthetic intake budget only so the repeated attempts are admitted; delivery faults come from the transport (a lost answer is a committed request whose connection is closed before the body). Device half: EnterpriseSyncResilienceTest (data host JVM) with the real protected vault (file test keys, child-JVM process death), protected queue, the product trip, checklist, fueling and expense producers, EnterpriseQueueService and EnterpriseOperationHttpClient, behind an edge ledger that answers the 10-offline-sync §10.2 replay, reuse, dependency and orphan rows. Native: EnterpriseSyncResilienceNativeDeviceTest against the EMP-DOC-004 receipt fixture, which gains a one-shot lost-answer fault; compiled and owed while emulator-5588 is locked. One command per half: go test -race -count=1 -tags=integration -p 2 -run '^TestSyncResilience' ./internal/modules/organization/adapters/ and the Gradle filters listed in TEST_STRATEGY. | The backlog asks for the normal entry points and forbids mocking the request and persistence boundaries; the composed runtime and the protected vault are those boundaries, and the native fixture is the only real cross-language run on this machine. | A Kotlin host client against the Go server (needs software device keys and a second identity-v1 signer outside the product); a shared scenario oracle file (outcomes are observations of two runtimes, the wire is already pinned by the operation vectors); mocks of the intake store or vault. | f4-offl013-sync-resilience | | EDR-352 | Device ordering for soft references (defect found by the suite): EnterpriseQueueOrdering.localReferences maps each queued operation to the unacknowledged operations of the same partition whose entity (type and identifier) one of its soft references names; EnterpriseQueueService.dispatch orders them first and holds the referencing operation until each has a final receipt, with that operation's remaining delay; a reference cycle or a parent that needs attention makes the child need attention. Before the fix a departure run in backoff let the trip start naming it go alone, and the server held the start ORPHAN_REFERENCE (or ASSET_UNAVAILABLE/CHECKLIST_REQUIRED) for review with nothing linked. | BR-OFFL-007 makes a soft reference to a missing target an irreversible review item, trip.start may not declare dependencies (EDR-202, EDR-331), and the queue's per-operation backoff can make the referenced operation not due while the reference is due. Waiting for the final receipt (not only an earlier position in the same batch) also covers a referenced operation answered RETRY inside the batch; the cost is one more immediate round, which the worker already takes for a drained batch. | Same-batch ordering only (a RETRY parent still orphans the child); a hard dependency on the run (changes the frozen trip operation profile and vectors); server-side waiting for soft targets (contradicts BR-OFFL-007 and is unbounded). | f4-offl013-sync-resilience | | EDR-353 | Convergence oracle and scope: equivalence is an effect signature of the organization (per script position the result, code, revision and review presence; claims, receipts, effects and audit events per operation; trips, events, finishes, review entries, readings by origin, value and state, fuelings with their one FUELING cost, direct expenses, checklist runs and links, mission links and state, held rows and review items), excluding server times and generated identifiers. A soft reference delivered before its target is an asserted named divergence (ORPHAN_REFERENCE), prevented on the device by EDR-352, not part of the equivalence. VAL-23 (f) CLOCK_SKEW is retained (no owner flags skew at intake and normal delivery delay never establishes it, OFFL-002). Migration 000261 is unused. | The backlog's "equivalent final state" must ignore what legitimately differs between two runs (receipt instants, server identifiers) and nothing else; naming the soft-reference divergence keeps the server rule visible instead of hiding it in a weaker oracle. | Byte comparison of whole tables (server times and identifiers always differ); comparing counts only (would miss a held start or a missing link). | f4-offl013-sync-resilience | | EDR-354 | Interruptions on the device are recorded as soon as they are observed, with the closed EMP-GPS-001 causes only: the EMP-GPS-002 recovery at the next opening of the trip screen stays, and the collector also interrupts a session it consumed the visible grant for but cannot listen to (permission missing, notification hidden, platform refusal, another session already listening), as does the service when it cannot show its foreground notification; the instant is the last proof of recording (EDR-324/327) and the cause is chosen in the order DEVICE_RESTARTED (another boot in the checkpoint or buffer), PERMISSION_REVOKED (no location permission now; Android ends the process when a runtime permission is revoked), NOTIFICATION_BLOCKED (the tracking notification cannot be seen now), otherwise PROCESS_STOPPED, whose text becomes "the collection stopped on this phone without your command"; a start intent with no grant writes nothing (it may not come from the screen). The trip screen lists the session's interruptions derived from the stored transitions (TrackingInterruptions.of); the ongoing notification states an open PROVIDER_DISABLED, SIGNAL_LOST or MOCK_LOCATION gap. No new cause, no server change, no migration (000262 unused) and no v2 session oracle: the EMP-GPS-004 intake already accepts every cause used. | BR-GPS-011/012/015 and the §8.2 matrix require a typed, honest interruption and forbid a session shown as recording while nothing listens; a revoked permission kills the process, so the watchdog rarely sees it and the next opening must name it; the matrix asks the notification to say "GPS desligado". | A new SERVICE_FAILED/BUSY cause (closed vocabulary shared with Go and the intake, EDR-274/278; needs a v2 oracle and a server change for a device-only situation); leaving a never-collected session RECORDING until the next opening (hidden interruption); interrupting at the observation instant instead of the last proof (overstates coverage); a local "tracking interrupted" notification now (in a live process the causes that reach it are rare; after a process death it needs the periodic worker, whose timing after a restart is EMP-GOV-006's) — retained. | B-BR-EMP-544, B-BR-EMP-547; EMP-GPS-002 (EDR-323/324), EMP-GPS-003 (EDR-327). | | EDR-355 | A fix claims the lower of its recording period's precision and the permission the platform reports with it (TrackingInterruptions.fixPrecision); a report observed without permission is not recorded; the first approximate report in a precise period writes gps.session.reduce at that report's instant (never before the last buffered fix) before recording it, and a collector that begins with only approximate permission for a precise period writes the reduction before attaching, so the coarse flag always matches the period; precision rises only at the driver's next resume (EDR-275); the trip screen keeps saying that no GPS distance comes from the approximate parts (TrackingSessionView.coarse). Batches are sealed per recording run: a run is cut where the session operation that opened it changes, even if the seal at the interruption failed, and a fix-level gap still open from an earlier run is closed at that run's end. | BR-GPS-007/024/025 and acceptance of the approximate row of §8.2: a coarse fix flagged precise would overclaim, and the EMP-GPS-005 filter counts a coarse flag outside an approximate span as OUTSIDE (EDR-299), so reducing first also keeps those fixes; a batch spanning an interruption would make the device claim continuity the session history denies. | Waiting for the 30-second watchdog to reduce (coarse fixes recorded as precise meanwhile, or discarded by the server); flagging such fixes coarse inside the precise period (server drops them); upgrading precision mid-period; splitting batches only at fix-level gaps (the EMP-GPS-003 rule alone). | B-BR-EMP-545, B-BR-EMP-546; EDR-275, EDR-299, EDR-326. | | EDR-356 | Resumption authority on the device: every start or resume tap re-checks, before any write, the account lease and partition custody, the context's membership against the enrollment, the member's own open trip, a session neither refused nor ended, the latest policy read on the device (OFF → POLICY_OFF, never read → POLICY_UNKNOWN, also for an existing session) and that no other session is being collected on this phone (BUSY); with a connection the trip screen first reads the policy in force (tracking/policy/mine, which also re-proves trip.trip.start) inside the same gesture, a failed read keeping the cached value and saying so; only a session left RECORDING by the tap arms the one-time grant. This device rule is deliberately stricter than the intake, which checks the policy only when a session opens (EDR-275); a resume under a policy turned off is not collected. The long-stationary guard (BR-GPS-016) is not among this task's rules and stays open with the device-side LONG_STATIONARY suspension. | BR-GPS-002/006/011 and the deliverable "resumption follows explicit user and authority checks"; offline-first (12-ux-app) keeps the cached policy usable without a network; one listener per device (BR-GPS-013) means a second session cannot be collected. | Resuming with only the session's original policy (collects after the organization switched tracking off); requiring a network to resume (a reboot in a dead zone would block tracking); refusing on any failed online read (an outage would look like a withdrawal); changing the server's resume rule (shared session vectors and receipts, EDR-278). | B-BR-EMP-547; EDR-321, EDR-323, EDR-275. | | EDR-357 | The enterprise tracking indicator is derived only from a process-wide TrackingRuntime.activity state that the running organization collector publishes (partition, session, trip, the organization name passed by the visible start, since, precision, open gap; no coordinate) and clears when its listener is released; it is drawn once in the EnterpriseContextScreen top bar, under the organization name, which every enterprise panel shares, opens "Meu rastreamento" on tap and is not shown in personal mode (the ongoing notification is the indicator everywhere else); the trip card uses the same state to say that a session stored as recording is not being collected by this phone. | BR-GPS-004 asks every enterprise screen to show the state, and only the running collector proves that the phone collects now; a stored RECORDING row survives a process death until the next opening, so deriving the indicator from the book would show "active" while nothing listens. | One indicator per panel (eight copies to keep in step); reading the tracking book on every screen (a false "active" after a death, a protected read per screen); an indicator in the personal screens (mixes organization and personal contexts; the notification already covers them); a bound service or broadcast for the state (more lifecycle surface than a process-wide flow). | B-BR-EMP-548, B-BR-EMP-550; EDR-323, EDR-354. | | EDR-358 | "Meu rastreamento" (SCR-GPS-04) is a read-only enterprise panel owned by MyTrackingFlow, which reads, offline, the selected partition's sealed tracking book, buffer, trip book and queue entries through EnterpriseTrackingService.history (own sessions newest first with vehicle label, tracking start and end, interruptions, gaps, approximate parts, positions waiting and batch states; policy and notice version last read); it is opened from a home card and from the indicator, with the same epoch, background and account-custody fences as the other panels. No server read is added (none exists for a driver's own sessions; sessions recorded on another phone or before a reinstall are retained to a later driver-facing read), so no route, matrix, auditor-walk or migration change (000263 unused). The first-use acknowledgement of SCR-PRIV-01 is not added here: the notice stays shown at each start and resume on the trip card (BR-GPS-034) and its text is repeated on this panel. | UC-GPS-10 asks for the employee's own sessions with start, end, gaps and reasons and SCR-GPS-04 says it works offline from local data; the phone's sealed book already holds exactly the own sessions, bound to membership and enrollment. | A new tracking/sessions/mine route (an authorization surface, OpenAPI and auditor changes for data the phone already has); listing sessions from every partition on the phone (another organization's data on this screen); showing coordinates or a map of one's own track (no coordinate leaves the sealed buffer, BR-GPS-039). | B-BR-EMP-549; EDR-322, EDR-327, EDR-354. | | EDR-359 | The transparency copy is a fixed, eight-locale string set (what is collected and how often, what is not, who sees it, the default retention and its range, what stays on this phone and when this phone's copy is erased, the phone-not-vehicle label) generated from one table; a JVM test pins every key and placeholder in all locales, requires each locale's device text to state that a phone without a connection is not erased remotely and refuses any other remote-erasure wording in every enterprise_tracking* string; the personal recorder's state, strings and notification are not touched and its running state is proven not to reach the enterprise indicator. | BR-PRIV-018 and BR-OFFL-014 forbid promising immediate remote erasure of a disconnected device; BR-GPS-040 requires the phone source to be named; BR-PRIV-015 requires plain-language categories. | Free-text copy per locale reviewed by eye only; promising that the organization's copy is deleted on leaving (it follows the organization's retention, BR-PRIV-014); reusing the personal recorder's strings for the organization indicator. | B-BR-EMP-550, B-BR-EMP-551; BR-PRIV-014/015/018. | | EDR-360 | EMP-REL-005 gate shape: the M4 scenario union is one documented command set run on the integrated F4 head — (G1) the named scenario tests of organization/adapters on real PostGIS with -race -tags=integration -p 2 and a throwaway MinIO project, selected by one -run pattern (late and state intake, sync intake and resilience, every TestTrip*, tracking intake, policy, processing and track reads, the meter amendment, projection and segment tests, checklists, incidents, reservations, the authorization matrix and the AUTH-011 auditor walk); (G2) the whole orgsync, orgaudit and fleet adapter packages (SQL oracles of late and state intake, the sensitive-access log); (G3) the pure and application packages of trip, tracking, orgsync, fleet domain, maintenance and the API contract under -race, plus the cmd/api route inventory; (K) the enterprise filters of the four Android modules under the shared Gradle lock and scripts/check-mobile.sh --static-only. Each VAL clause and each M4 exit criterion is mapped to named tests; a clause no owner produces is recorded as not proven with its owner. The gate adds no behaviour and no test; no migration (none pre-allocated). | 15-validation §1 says a gate adds no behaviour and never stands in for a missing task test, and §8 asks for every listed scenario on one named revision with VAL-02/VAL-21 rerun over the phase's routes; the owners' tests already exercise the normal entry points, so the gate's value is one repeatable selection, exact counts and an honest mapping. No earlier milestone gate record exists (EMP-REL-001..004 are TODO), so the record follows the F4 evidence files and §8. | Writing gate-specific scenario tests (behaviour or test ownership moves into the gate); the whole organization/adapters package as the gate command (most of it is F1–F3 and is the coordinator's merged-tree union); counting compiled device tests or the pure VAL-27 arithmetic as the whole scenario; substituting meter readings for the fuelings VAL-04/VAL-22 name. | B-BR-EMP-552, B-BR-EMP-553, B-BR-EMP-555; BUC-EMP-283; f4-rel005-m4-gate | | EDR-361 | M4 gate decision on 1ee50c9e: the source and host scenario union passes (counts in the evidence), the device evidence is OWED and named, and M4 is NOT accepted. Blockers named on the task, which moves to BLOCKED: (1) native acceptance on emulator-5588 (OFFL-013 resilience stage, GPS-002/003 service, GPS-010 interruption stages, GPS-015, TRIP-021, ROUTE-004, OFFL-011, EXP-004, TRIP-020, the sync-context 20-run GREEN) while the emulator is RUNNING_LOCKED behind its synthetic credential, which only the owner may enter; (2) the real-device interruption matrix on phones of at least three manufacturers and the two-physical-device checks (EMP-GOV-006 for the spike; the owner or pilot users for the gate); (3) scenario clauses no owner produces yet: held late and suspended-grace fuelings (EMP-FUEL-003) for VAL-04 and VAL-22 part 2, VAL-23 (f) CLOCK_SKEW (BR-TIME-006 owner), VAL-27's displayed sources, review request and gap (EMP-TRIP-006, UC-GPS-08), and VAL-02 as one cross-surface sweep with log scanning over the F4 routes (the matrix's other-organization variant per permission representative, the owners' per-route foreign NOT_FOUND and forced-RLS tests are the proof recorded); (4) the entry condition M3 (EMP-REL-004 not run). Nothing is claimed complete, INTEGRATED or RELEASE_CERTIFIED. | B-BR-EMP-552 and 15-validation §§7–8 forbid recording owed device coverage or an unproduced clause as a pass; the emulator lock and the excluded physical phone are standing session rules, and the open clauses have named owners, so the honest record is "held with owed evidence named", which the backlog's deliverable allows. | Recording M4 as accepted with device items "pending"; LOCAL_DONE for the gate task (reads as an accepted gate); unlocking, wiping or replacing the emulator or using the physical phone to close the gap; weakening VAL-04/22 to the reading operations that the late and state holds do cover. | B-BR-EMP-552, B-BR-EMP-555; BUC-EMP-284; EDR-196, EDR-271, EDR-353; f4-rel005-m4-gate | | EDR-362 | Tracking hold until the device matrix passes: while the real-device interruption matrix is owed, tracking collects from no real employee of any organization — every real organization's tracking policy stays absent or OFF, and OPTIONAL/EXPECTED is set only in synthetic validation organizations. The hold is procedural (no code, flag or migration change): the policy command already defaults to OFF and requires a notice in force. It is lifted only by a recorded M4 gate pass that includes the matrix (at least three manufacturers; screen off, app swiped away, reboot, force stop, battery saver, Doze; synthetic organization and trips; phones the owner or pilot users consent to use and operate themselves) or by a new explicit owner decision recorded as an EDR naming the accepted risk. EDR-271 is unchanged: tracking stays implemented for real and prepared for production, synthetic validation continues, and per-organization activation still needs the employee notice and terms in force. | 15-validation §8 (M4 row) allows a gate with the matrix owed only if tracking is enabled for no organization; an emulator does not reproduce manufacturer background behaviour (§7), and VAL-28's process-death, reboot and approximate-only rows are host-proven only. | Treating EDR-271's per-organization activation as already satisfying the M4 device condition; enabling tracking for a pilot organization with the matrix owed without a recorded owner decision; a code-level kill switch (the policy default is already OFF, and a new flag would be speculative behaviour in a TEST gate). | B-BR-EMP-554; BUC-EMP-284; EDR-271, EDR-302, EDR-354..356; f4-rel005-m4-gate | | EDR-363 | Runtime grant inventory: derive it, do not hand-list it. backend/internal/platform/runtimegrants parses every non-test Go file of the cmd/api and cmd/worker production build closure (linux/amd64, CGO off, no tags; string literals, constant concatenations and same-package constants), adds the head catalog's SECURITY INVOKER bodies, RLS policies, column defaults, checks and views (they run as the caller), and grants per relation SELECT (mentioned or written), INSERT (INSERT INTO), UPDATE (UPDATE … SET, ON CONFLICT … DO UPDATE, or any relation read by a statement with a row lock) and DELETE (DELETE FROM); sequences get USAGE when their owning relation is inserted or they are named; EXECUTE only for a function the runtime calls that PUBLIC cannot execute (none today). Reviewed exceptions, each verified on every generation so a stale one fails: schema_migrations at most SELECT (the migrate package is in the API closure for its readiness check), org_meter_current_rebuild(uuid) operator-only (EDR-317). Generation also fails if a SECURITY DEFINER function is executable by PUBLIC. TestRuntimeScriptMatchesHead compares the rendered script with infra/db/runtime-role.sql on a freshly migrated head and rewrites it only with ANPFUEL_RUNTIME_GRANTS_WRITE=1. At schema 000257: 357 of 359 relations granted (134 SELECT, INSERT; 150 +UPDATE; 34 +DELETE; 34 all four; 3 SELECT; 2 SELECT, UPDATE), 2 without access, 5 sequences, 0 explicit functions. One role serves the API and the worker. Grants are table-level: where a task granted only some columns of a mutable relation, the other columns stay protected by the relation's trigger guard (seen in script mode as 55000 instead of 42501, EDR-365). | The README task paragraphs name column-level grants that were written per task and never assembled; a hand list of ~360 relations and ~250 migrations would drift with every change and a missing column breaks a live public path. The production SQL is entirely literal (no dynamic table names, no EXECUTE in plpgsql, verified), so a deterministic scan of exactly the shipped code is complete by construction for relations; withholding UPDATE/DELETE from append-only relations adds a privilege refusal in front of their trigger seals; forced RLS still isolates organizations because the role is neither owner nor BYPASSRLS. | Blanket SELECT, INSERT, UPDATE, DELETE on every table (simpler, but drops the defence in depth on 134 append-only relations); hand-maintained column-level lists; separate API and worker roles now (the scan is per binary closure and can split them later, but the shared Deployment uses one secret and one rollout); EXECUTE grants for every function the code names (PUBLIC already holds them; only closed functions need a decision). | EMP-REL-002 prerequisite; B-BR-EMP-556/557; BUC-EMP-285; EDR-272, EDR-317; f4-enterprise-activation | | EDR-364 | Later migrations: the script sets owner default privileges (SELECT, INSERT, UPDATE, DELETE on new tables and USAGE on new sequences, never TRUNCATE/REFERENCES/TRIGGER/MAINTAIN) as a safety net, and a documented re-run converges them: after every release whose infra/db/runtime-role.sql differs from the deployed one, the coordinator applies that release's script once the deploy agent has migrated. The script carries the schema version it was generated for and refuses any other, converges the role (revokes everything in schema public, the database and the default privileges, then grants the inventory) and verifies inside the same transaction that the role is ordinary, admitted by the organization role guard, owns nothing, holds no TRUNCATE/REFERENCES/TRIGGER/MAINTAIN, cannot create objects and executes no SECURITY DEFINER function. It never touches the password. Residual window, recorded: a release whose code needs a new privilege on an existing relation serves that path as unavailable from the automatic rollout until the re-run; wiring the convergence into the release pipeline is retained. | Without default privileges every release that adds a table would break the feature using it until a manual step; a strict version guard prevents an old script from silently narrowing a newer schema; one transaction applies all or nothing on the live database without locking user tables. | No default privileges (an outage per new table); changing the deploy agent or the migrate Job in this task (the coordinator owns the agent; the canonical script lives under infra/, outside the Go module that go:embed could reach); a version-tolerant script (would grant a stale inventory). | B-BR-EMP-557/558; EDR-363; retained: pipeline convergence | | EDR-365 | Proof strategy. (1) cmd/api TestRuntimeRoleServesProductionProcessAndEnterprise runs the real API process (run(), ANPFUEL_ENTERPRISE_ENABLED=true, forum on) logged in as a role provisioned only by the script on a fresh head database: public reads (stations, prices, community, nearby, map assertions, forum, charging history), contributor enrollment and signed observation writes with replay, account sign-in and refresh, premium and cloud status, then the enterprise flow over the real cookie plane — organization creation, setup discovery, settings read with the capability off, a capability-gated write refused ENTITLEMENT_REQUIRED, the capability enabled through the audited store as that login (no production operator path exists), organization activation, unit, employee, invitation, asset, meter installation, asset activation, latest reading, device enrollment and one signed meter.reading.record through the sync intake (accepted, replay byte-identical), a foreign organization NOT_FOUND both ways — and the real worker binary with the same login and switch settling a queued org-asset-reservation-outcome job; the superuser login, in a subtest, mounts the routes but organization creation answers 503 UNAVAILABLE and leaves nothing. (2) runtimegrants integration tests: idempotent and convergent re-application, ordinary attributes, SCRAM verifier, guard admits the role and refuses the owner, RLS hides the other organization, and 42501 for TRUNCATE/DELETE/UPDATE of append-only rows, ledger writes, the operator-only and closed functions, DDL and SET ROLE; the script refuses another version, an owning role and the owner. (3) Opt-in script mode ANPFUEL_TEST_RUNTIME_GRANTS=script: orgtest pools log in as a script-provisioned role while grants that tests address to RuntimeRole land on the unused fixture login, and the public process tests run the API and the worker they start as a script-provisioned role. Failures in that mode are classified, never hidden: tests that inject faults by revoking from or observe lock waits of RuntimeRole, seal tests that now get 42501 because the privilege itself is withheld, and the template-isolation test that inspects the fixture login. | One composed run of the real process proves the deployable unit; the script mode reuses ~350 existing enterprise tests at the cost of a decoy login, so a pass proves the script alone served that test; classification keeps every expectation unchanged. | Rewriting existing tests to tolerate both modes (weakens them); granting test privileges to the script role (masks misses); claiming the default suites prove production grants. | B-BR-EMP-556..558; EDR-363; f4-enterprise-activation | | EDR-366 | Deployment wiring and activation scope. New secret key ANPFUEL_RUNTIME_DATABASE_URL (the owner DSN with the runtime user and a newly generated hexadecimal password, so no URL escaping) beside the unchanged ANPFUEL_DATABASE_URL; the api and worker containers override ANPFUEL_DATABASE_URL with valueFrom.secretKeyRef (a container env entry wins over envFrom) and set ANPFUEL_ENTERPRISE_ENABLED=true, recorded in infra/k8s/staging/api-deployment.yaml as desired state with test-manifests.py pinning it and pinning that the agent's Jobs keep the owner key. The deploy agent changes only images, pull policy, strategy and annotations and its rollout undo targets the revision recorded before its own image change, so a hand-set env survives; the coordinator still applies it holding the agent's apply.lock. Rollback is a strategic-merge delete of the two entries, never rollout undo (which could revert a newer image). Pre-flight gates: the deployed release carries the script for the live schema version; with the switch on, ANPFUEL_R2_ENDPOINT must be https (or absent) because the organization export store refuses any other endpoint at startup; the session that sets the password turns statement logging off. Scope: verification with synthetic organizations; real organizations keep tracking absent or OFF (EDR-362); the organizations capability has no production operator path yet, so every organization created on the VPS stays capability-off (ENTITLEMENT_REQUIRED on writes) until one exists; any signed-in account can create a capability-off organization under the synthetic DPA while the switch is on. | The secret key keeps the migrate, backup and schema Jobs and the registry job on the owner without touching the agent; pinning the manifests keeps a future re-render from silently reverting the switch; the R2 check prevents a crash-looping rollout (the old pod keeps serving because maxUnavailable is 0, but the activation would fail). | Replacing ANPFUEL_DATABASE_URL in the secret (the agent's Jobs would migrate as the runtime role); rollout undo for rollback; enabling the switch on the API only (worker jobs for exports, reservations, tracking and documents would wait forever); adding an operator capability command inside this task (new behaviour outside the runtime-role scope). | B-BR-EMP-558/559; BUC-EMP-285/286; EDR-272, EDR-362; runbook | | EDR-367 | Where the operator capability command runs and with which login. ops gains enterprise capability set|show; the production api image now ships /ops (distroless, no shell; kubectl exec deploy/abastevo-temp-api -c api -- /ops …), so the command reads the container's ANPFUEL_DATABASE_URL, which after activation is the runtime DSN (EDR-366). Before any read or write it opens one organization-scoped transaction and stops with an explicit refusal when the organization role guard rejects the login, so the owner DSN never reaches the store. The runtime grant inventory is unchanged: the command's SQL lives in packages already in the cmd/api closure (capability store, audit store, organization root store), its integration test runs it as the script-provisioned role, and cmd/ops is deliberately not added to the scanned closure (its other operator commands would widen the runtime role). | The coordinator asked for the runtime role and never the owner; the guard already refuses the owner, so the earliest refusal is the honest one; the API container already holds the runtime DSN and every configuration value config.Load validates; shipping one more static binary in the image the release pipeline already signs adds no new credential or listener. | An admin HTTP route (a new public surface on the admin key plane); a separate Kubernetes Job with its own secret wiring; running with the owner DSN (refused by the guard and forbidden); the worker image (equally possible, but the runbook already patches and smoke-tests the api container); scanning cmd/ops into the runtime inventory. | B-BR-EMP-561/562; BUC-EMP-287; EDR-363, EDR-366 | | EDR-368 | Command shape. set --org <uuid> --capability organizations --enabled|--disabled --operation-id <uuid> --expected-revision <n> [--operator <uuid>] and show --org <uuid> --capability organizations [--operator <uuid>]; both require the operator identity, here a canonical UUID because the audit event stores it in actor_id. No free-text --reason: the capability audit definition admits only operator.request and the change carries no reason field, so the justification goes into the coordinator's receipt (adding a column for it is not justified by this task). The command composes the existing orgcapability Service with Enabled: true (an operator surface; Set is already independent of the global switch) and an operator authorizer that admits only Manage and Read and resolves the organization through the existing root store (absent → not found; present, even before its setup snapshot → admitted). The capability codes come from one exported list shared with the API composition. Runbook decision for the synthetic VPS organization: enable it, prove units/create succeeds, then disable it again (final revision 2), so no organization is left capability-on after the smoke; re-enabling later uses the revision show reports. | One source of truth for the codes keeps the API and the tool from drifting; refusing before the store keeps the audit trail free of failed operator attempts; restoring the synthetic organization to capability-off keeps the VPS at the scope EMP-REL-002 allows until a named pilot is approved. | A free-form operator name (cannot be recorded); a --reason accepted but not stored (misleading); calling the store directly without the service; leaving the synthetic organization enabled after the smoke. | B-BR-EMP-560/561; BUC-EMP-287; EMP-PLAT-005; EDR-363, EDR-366 | | EDR-369 | EMP-GOV-007 resolves OQ-10: business-web renders live operations, replay trajectories, and geofences behind an explicit replaceable MapPort abstraction with an offline interactive HTML5 canvas vector renderer as default and complete accessible table/list fallback without external map-tile SaaS requests or unreviewed npm dependencies. On Android, multi-stop routing runs purely on-device through NativeEnterpriseRoutingAdapter (CAR profile with © OpenStreetMap contributors attribution); the optional server-side routing adapter slot remains disabled (isServerRoutingUsed = false) in F5. | Keeps map and routing providers strictly swappable (BR-ROUTE-023/024, EMP-ROUTE-010, CX-10) without leaking private organization coordinates to external routing/tile third parties or delaying F5 behind recurring tile contracts. | Requiring a third-party SaaS map SDK without list fallback; forwarding private fleet waypoints to an unreviewed server router; coupling panel DOM logic directly to a concrete map library. | EMP-GOV-007, EMP-ROUTE-001, EMP-ROUTE-002, EMP-ROUTE-010; B-BR-EMP-563; BUC-EMP-288 | | EDR-370 | Adopt org-permissions-v6 (authorization-catalog-v6.psv): preserve every v5 cell and grant gps.location.read_live (OWNER, ADMIN, FLEET_MANAGER, SUPERVISOR O, DRIVER S on own trips, AUDITOR explicitly denied), gps.geofence.manage (OWNER, ADMIN, FLEET_MANAGER, SUPERVISOR O), and route.plan.manage (OWNER, ADMIN, FLEET_MANAGER, SUPERVISOR O). | Operational supervision requires reading live positions, maintaining geofences, and saving route plans on active trips/missions while keeping AUDITOR restricted to recorded track replay and audit trails (gps.track.read only). | Treating gps.track.read as live tracking permission; letting AUDITOR open live positions; adding uncatalogued role exceptions. | org-permissions-v6; B-BR-EMP-564; BUC-EMP-289; VAL-16, VAL-21 | | EDR-371 | Live position projection (EMP-GPS-007/008/009/011): project one monotonic org_tracking_live_positions row per tracked trip in transaction alongside batch intake (collected_at moves forward only for strictly newer fixes, while last_communication_at always advances); derive CURRENT / STALE / NO_SIGNAL and 24-hour post-trip expiry at read time; audit every single/list live read (LOCATION_LIVE) and replay read (LOCATION_TRACK) without coordinates; purge expired live positions and raw org_tracking_segments via insert-only org_tracking_purge_receipts while preserving org_tracking_summaries and end-trimming raw fixes cleanly. | Ensures late offline batches never rewind a live marker or falsify CURRENT status (VAL-16, §10.6), enforces mandatory privacy expiration before background jobs catch up, and keeps org_tracking_segments immutable against unreceipted deletion while allowing legal retention purge. | Overwriting coordinates backwards from late batches; persisting mutable freshness flags; allowing arbitrary unreceipted DELETE on raw segments; leaking coordinates in audit rows. | EMP-GPS-007..011; B-BR-EMP-565/566; BUC-EMP-289/290; VAL-16 | | EDR-372 | Server-side geofences and operational alerts (EMP-GPS-013/014): support validated CIRCLE (50..50 000 m) and non-self-intersecting POLYGON (3..32 vertices) geometries (GEOFENCE_INVALID_GEOMETRY 422 on bow-tie/invalid shapes), evaluate entry/exit/dwell and long-stop / stale-tracker alerts strictly on non-coarse precise fixes (accuracy <= 50 m) inside PostgreSQL transactions, deduplicate by (geofence_id, trip_id, event_kind, fix_at) / alert key, record late crossings historically with late_suppressed=true, and avoid Android background geofencing or SQL foreign keys to organizational units. | Server-side evaluation respects BR-PRIV-003 (no background geofencing listener), prevents coarse/inaccurate fixes from fabricating false boundary crossings (VAL-30), and preserves migration 000244 foreign-key isolation by validating optional unit_id inside trigger guards. | Device-side background geofencing APIs; generating alerts from coarse / approximate fixes; re-notifying stale historical crossings as live alerts; adding SQL FKs to org_units. | EMP-GPS-013/014; B-BR-EMP-567; BUC-EMP-291; VAL-30 | | EDR-373 | Multi-stop route plans, shared location lease, driving-mode lock, and neutral station detour evaluation (EMP-GPS-006, EMP-ROUTE-003..010): cap plans at 102 waypoints (ROUTE_POINT_LIMIT 422), keep TEXT_ONLY unresolved mission stops explicit, queue in-progress sync plan revisions until stopped, propose "Cheguei" arrival confirmation manually without auto-finishing, enforce >= 1.5 m/s (150 cm/s) driving lock (<= 4 quick actions) and heavy-vehicle CAR disclaimers, coordinate TRACKING + GUIDANCE over a single LocationLeaseCoordinator hardware subscription without disturbing pinned LocationManagerCompat.requestLocationUpdates guards, and compute detour station rankings with exact BigInt §10.7 math (contracts/testdata/enterprise/route/suggestions-v1.psv) free of commercial bias (has_paid_plan, has_active_agreement). | Protects safety while moving, guarantees single hardware location listener ownership between tracking and turn-by-turn guidance without duplicating distance or leaking unstarted tracking fixes, and ensures station suggestions match cross-language vectors with zero pay-to-rank distortion. | Duplicate location listeners; auto-completing stops without driver confirmation; overwriting an in-flight navigation route while moving; mixing incomparable price sources or paid-station ranking boosts. | EMP-GPS-006, EMP-ROUTE-003..010; B-BR-EMP-568/569; BUC-EMP-292/293; VAL-29 | | EDR-374 | M5 gate (EMP-REL-006) local verification checkpoint: recorded against 000258 real PostGIS 18+3.6, MinIO storage, business-web, and mobile static guards covering VAL-16, VAL-21 (org-permissions-v6), VAL-29, VAL-30, and EMP-ROUTE-010 replacement drills across panel and Android. Retains prior explicit M4 real-device interruption matrix and VPS capability activation obligations without claiming production certification. | Separates verified local and host-suite M5 functional behavior from physical-device hardware/emulator coverage and remote CI checks. | Claiming production certification or real-device matrix closure from host/local integration runs. | EMP-REL-006; B-BR-EMP-570; VAL-16, VAL-21, VAL-29, VAL-30 | | EDR-375 | Adopt org-permissions-v7 (authorization-catalog-v7.psv) while keeping all 13 fixed roles (DATA_MANAGER, STATION_* remain denied on ordinary company routes): preserve every v6 cell and activate the 11 F6 routed permission keys (stock.tank.manage, stock.movement.record, maint.plan.manage, maint.workorder.manage, maint.workorder.review, maint.request.create with DRIVER/OPERATIONS_STAFF self-scope S, kpi.dashboard.read, find.finding.read, find.finding.resolve, audit.event.read, org.group.manage fresh-auth). Produces 44 routed permissions (440 matrix cells: 174 allowed, 266 denied) and 195 routed endpoints (37 AUDITOR positive, 158 denied). | Gives F6 management, stock, maintenance, intelligence, audit viewer, and consolidation operations explicit least-privilege boundaries with zero implied authority and intact AUDITOR read-only separation. | Granting AUDITOR write/resolve powers; omitting self-scope restrictions on maint.request.create; letting org.group.manage bypass fresh authentication. | org-permissions-v7; B-BR-EMP-571; BUC-EMP-294; VAL-21 | | EDR-376 | Internal fuel stock (EMP-STOCK-001..007, VAL-32): model per-product moving-average inventory pools (MOVING_AVG_UNIT_V1, exact BigInt HALF_UP rounding) across org_fuel_tanks, append-only org_fuel_tank_movements, org_fuel_tank_reconciliations, org_internal_fuelings, and org_operating_cost_entries. RECEIPT posts zero operating expense; DISPENSE posts one INTERNAL_STOCK_DISPENSE cost and internal fueling atomically; TRANSFER conserves cost across compatible tanks; ADJUST/RECONCILE require explicit reasons. Reject incompatible products (STOCK_PRODUCT_MISMATCH 422) and non-negative overdrafts (STOCK_INSUFFICIENT 409). | Prevents double-counting fuel inventory purchases alongside dispensed consumption while matching identical moving-average vectors in Go (fuelstock/domain) and Android (EnterpriseFuelStock). | Recognizing operating cost at stock purchase; mixing fuel products or units inside one pool; float rounding on dispense cost. | EMP-STOCK-001..007; B-BR-EMP-572/573; BUC-EMP-295; VAL-32 | | EDR-377 | Preventive maintenance, work orders, holds & compliance (EMP-MAINT-001..012, EMP-FLEET-010, VAL-31): evaluate multi-dimension distance/hour/calendar triggers (ACTUAL vs SCHEDULED rebase, earliest due trigger, ceiling projected day on reading corrections); check in-service meters on org_meters.removed_at IS NULL (METER_REQUIRED 422); enforce SoD review (SELF_APPROVAL 409), quote expiry (QUOTE_EXPIRED 409), overrun ceilings (OVERRUN_NOT_APPROVED 409), invoice document links (INVOICE_REQUIRED 409), live MAINTENANCE_HOLD propagation into fleet/availability/read (IN_MAINTENANCE / AVAILABLE), closed finance-period refusal (PERIOD_LOCKED on org_finance_periods.state='LOCKED'), CONTROL_DISABLED (409) when driver licence control is off, plus asset documents, components, parts stock, and insurance policies/claims. | Keeps work order execution, asset unavailability, and one-time maintenance expense posting atomic and auditable across fleet, maintenance, and finance boundaries without duplicating cost entries. | Checking non-existent meter state columns; closing an unapproved work order or releasing maintenance holds implicitly on delete; double-posting work-order expenses on settlement. | EMP-MAINT-001..012, EMP-FLEET-010; B-BR-EMP-574..578; BUC-EMP-296/297; VAL-31 | | EDR-378 | Fleet KPI registry & ratio-of-sums engine (EMP-KPI-001..006, EMP-FUEL-009/010, VAL-10, VAL-11, VAL-20): register all 20 versioned indicators (IND-001..020, kpi-v1) in Go and Kotlin, return explicit INSUFFICIENT_DATA reasons for missing denominators or incompatible energy sources (CNG, mixed products), compute consumption as exact GCD reduced ratios and HALF_UP 1dp/2dp decimals (160/39 -> 4.10 km/L, never average-of-ratios), mark < 3 samples small_sample, separate approved vs pending totals, and allocate closed intervals proportionally to trips (AllocateIntervalToTrips). | Guarantees mathematical consistency across panel, PDF/ZIP reports, API, and Android while eliminating silent zeroes and misleading sample averages. | Averaging per-fillup efficiencies (6.71 error); replacing missing denominators with zero; combining incompatible units across fuels. | EMP-KPI-001..006, EMP-FUEL-009/010; B-BR-EMP-579/580; BUC-EMP-298/299; VAL-10, VAL-11, VAL-20 | | EDR-379 | Price comparison & anomaly findings lifecycle (EMP-KPI-005, EMP-FIND-001..005, VAL-15): compute non-judgmental price differences (price-comparison-v1) per comparable source (OFFICIAL, COMMUNITY, ANNOUNCED, NEGOTIATED), enforcing condition/product/unit/coverage/staleness checks (CONDITION_MISMATCH); run bounded threshold detection (FT-001..FT-006) deduplicated per open subject (org_findings_one_open_subject); block self-resolution (SELF_APPROVAL 409) and terminal edits (FINDING_CLOSED 409); map CONFIRM/EXPLAIN to CONFIRMED/EXPLAINED; supersede only undecided findings on reprocessing runs. | Preserves objective financial neutrality and separation of duties so automated findings never assert fraud, mutate source records, or allow self-clearing. | Using loss/savings language; allowing authors to confirm/dismiss own findings; overwriting already decided findings during reprocessing. | EMP-KPI-005, EMP-FIND-001..005; B-BR-EMP-581..583; BUC-EMP-300/301; VAL-15 | | EDR-380 | Accounting views, statements, recurring/fine costs & PDF/ZIP reports (EMP-EXP-007, EMP-FIN-005/006, EMP-RPT-003..006): export fin.accounting_competence.csv and fin.accounting_cash.csv keeping competence and cash bases distinct over org_operating_cost_entries + org_payable_statements; generate deterministic standard-library %PDF-1.4 reports (rpt.trip_logbook.pdf, rpt.fueling_statement.pdf, rpt.period_summary.pdf) with zero unreviewed PDF third-party packages (CX-10); deliver `org.full_exp

Fuel prices wiki

Source: AlexandreZanata/Abastevo @ e4a67580fc368a59bc1c0f1e0466fc011313f330

Clone this wiki locally