דילוג לתוכן
מרכז התיעוד
לאתר LinkNodes Energy
LinkNodesENERGYתיעוד

טוענים את החיפוש…

    חיפוש גם בתוך המאמרים ↑ ↓ לניווט Esc לסגירה

    לאתר החברה

    נתונים ודיווח

    יומן אנרגיה מאוחד

    חוזה נתונים ליבוא מורשה ולקריאה מאוחדת, יחידות, ייחוס ובידוד לקוחות.

    בעמוד הזה

    Decision: LinkNodes is software above existing fuel-card/telematics and EV-charging providers. It does not manufacture hardware, issue a fuel card, supply petroleum, perform payments, or authorize fueling.

    Delivered backend slice#

    • A normalized, tenant-scoped energy event contract for electricity (kWh), petrol, diesel and lpg (litres). PHEV vehicles can generate events in multiple categories, never a fake mixed unit.
    • Exact minor units for money (agorot) and physical quantities (milli-kWh / milli-litres) to prevent floating rounding errors.
    • Authenticated, role-restricted routes:
      • GET /api/platform/tenants/:tenantId/energy?from=YYYY-MM-DD&to=YYYY-MM-DD — unified EV session and imported fuel/electric records for one tenant; returns count, total ILS, separate quantities, breakdown by energy source, a partial flag for bounded reads, and provenance.
      • POST /api/platform/tenants/:tenantId/energy/import — normalized supplier export batch: { "provider": "supplier-slug", "records": [{ "external_reference": "...", "energy_kind": "diesel", "quantity_milli": 45000, "amount_minor": 30000, "occurred_at": "2026-11-10T12:00:00+02:00", "vehicle_plate": "12345678", "station_name": "..." }] }. Max 100 records per batch and 16 kB per request. No automatic provider integration is claimed.
    • Imported events are unconditionally customer_import_unverified and never treated as receipts, final CDRs, provider authorization, live fuel-price quotes or payment confirmation.
    • Deduplication is scoped to (tenant, provider, external_reference) with an immutable conflict check: exact replays are idempotent, mismatching replays reject atomically. When an imported electricity record matches a platform session by provider and external reference, the platform event remains the single primary event. Differences in amount, quantity, transaction instant or an explicitly supplied vehicle ID are retained in that event's reconciliationConflicts, including the imported evidence. The response and summary set reconciliationRequired; the summary also reports sourceConflictCount. These totals use the primary event and require reconciliation when flagged. Matching evidence is not counted twice or marked verified.
    • Report dates use the account's local calendar. Platform-session queries receive exact UTC boundaries before the 501-row database limit, including Israel's 23-hour and 25-hour daylight-saving transition days. Summaries cover the returned items only; partial: true means the result is not a complete period statement.
    • ICE vehicle plates may be recorded without changing or inventing an approved registered-vehicle entry. When a vehicle UUID is provided, PostgreSQL verifies it belongs to the same tenant. A dedicated registration experience for combustion/hybrid-only vehicles comes in a later implementation.
    • Existing platform routes, navigation, images, commercial subscriptions, supplier-provider settings and approved UI remain unchanged.

    Isolation and security#

    • ev1_private.lne_energy_records has enabled RLS; no direct anon or authenticated table grants.
    • Narrow PostgreSQL functions lne_energy_list and lne_energy_import check the active Clerk identity and ev1_private.has_role on each request; only owner/admin/fleet manager/finance can read or import. A driver cannot read aggregate fleet spending.
    • Same-origin checks on writes, strict input schema, numeric bounds, bounded result windows and a streaming 16,000-byte energy-import limit. Actual bytes are counted even when Content-Length is missing or incorrect; oversized streams are cancelled. Other platform request readers are unchanged.
    • Source/tenant identity, verification status and cost currency are not accepted from client records; the tenant comes from authenticated route and PostgreSQL verification.
    • The schema is versioned separately under infra/energy/001_unified_energy_records.sql; the additive 002_bounded_energy_list.sql rejects null limits so direct authenticated RPC calls cannot remove the read cap. Apply both to the existing Supabase project using dedicated migrations; do not edit an already-applied version. Isolated PostgreSQL CI installs the same extension and runs denial/duplicate/conflict/rollback/tenant-isolation regressions.
    • Import is not a privileged partner webhook. Do not issue third-party API credentials, activate remote fueling commands or expose a provider-specific integration until the relevant provider authorizes the connection.

    Release verification#

    • Run the complete GitHub workflow on the exact release commit: unit tests, typecheck, lint, build, PostgreSQL 17, product browser scenarios and the restored company-form website tests.
    • scripts/verify-unified-energy-live.sql is also executed in isolated CI. After migration 002, run the entire file as one statement batch through the trusted Supabase maintenance connection. It switches to actual authenticated and anon roles, verifies two synthetic tenants and denied access, checks replay/conflict atomicity, validates dates and row caps, and rolls every fixture back before returning its success summary. Never execute only the final summary statement.
    • Confirm the production database still denies direct anonymous/authenticated access to the private energy table, and that RPC authorization requires active membership in an active tenant.
    • Record the Vercel product deployment ID and its Git commit, check authenticated identity and unauthenticated denial through the deployed API, and inspect runtime errors. The company website is a separate deployment; its approved Contact/Careers version must remain intact.
    • No test in this release certifies a live supplier feed, fuel authorization, payment, invoice or production supplier credential. Those require a separate provider integration and acceptance test.

    Deliberately deferred decisions#

    1. Confirm one fuel-card provider's actual export schema/API contract, credentials, refresh/reconciliation rules, legal access and update cadence.
    2. Add provider-specific adapters that convert raw supplier evidence to the normalized contract. Each adapter must authenticate supplier identity on the server and include a verifiable source transaction identifier; never accept a browser-asserted "verified" flag.
    3. Add a user-facing import/mapping UI or integrations page only after reviewing against the approved existing product screens. No unrequested UI redesigns.
    4. Expand the vehicle registry/energy analytics for petrol, diesel, HEV and PHEV; show source-quality indicators, exception handling, unit-specific efficiency, cost/km with verified mileage, and tax/accounting interpretations as separate features.
    5. Evaluate commercial arrangements for any payment or service fees separately from the existing EV subscription pricing. No new fuel transaction fee is assumed.

    Current readiness: functional source-neutral storage + authorized normalized import + unified read contract. No live supplier API, payment, fueling activation, verified supplier statement or end-user UI is claimed in this phase.