Known issues & gaps
Every item here was found by reading the cse-http-be source (audit of
2026-09-24), not by running requests against dev. The "Confidence"
column says how sure the finding is. Each API page links to the items that
affect it. When an item is fixed, delete it here and correct the affected
page(s) in the same change.
Summary
| ID | Area | Issue | Impact | Confidence |
|---|---|---|---|---|
| KI-5 | Email OTP sign-in | Only registered, verified accounts pay for the DynamoDB + SES calls | Timing side-channel on account existence | Medium |
| KI-6 | Email OTP sign-in | Not usable by real users yet: needs a verified SES sender (-c otpSenderEmail), DKIM and SES sandbox exit (owner actions); old phone-OTP app builds stop signing in on deploy | Codes reach only SES-verified recipients until then | High (known) |
| KI-7 | Legacy POST/PUT routes (the seven lenient mobile routes) | A body that isn't valid JSON throws SyntaxError | 500 INTERNAL instead of 4xx. Already fixed on every strict route (the Team API and on, 400 MALFORMED_REQUEST) — only these seven original lenient routes still have the bug — see details | High |
| KI-8 | POST …/devices | 500 | Now 200 with the existing device | High |
| KI-9 | POST …/devices | Two plants claiming the same serial at the same moment can both succeed | High | |
| KI-10 | GET /v1/me | deviceCount onto membership items | deviceCount is always 0 until feature 005 (devices) maintains it | High |
| KI-11 | GET /v1/me | selectedPlantId is never set automatically | Absent after the first plant is created, until the client PUTs it | High |
| KI-12 | Authorization | N/A — see details | High | |
| KI-15 | Profile | email/displayName are copied from Cognito once | Later Cognito name changes don't show up in GET /v1/me. A stored empty email is a partial exception — see details below | High |
| KI-16 | Tooling | IdentityProvider.createUser omits phone_number, which the pool requires | That method (and a naive admin-create-user) is expected to fail | Medium |
| KI-17 | Infra | Cognito not on SES | Password-reset email capped at Cognito's built-in sender | High (known) |
| KI-21 | POST /v1/plants | Idempotency-Key (optional on mobile, required on the web X-Org-Id variant) | A retry with the same key replays the first response instead of creating a duplicate | High (code reading, 2026-10-13) |
| KI-19 | Plant timezone | +05:00 were accepted | Only IANA names are accepted now; an offset is 422 VALIDATION_FAILED | High (code reading, 2026-10-13) |
| KI-24 | Team API — GET .../members, GET .../scopes/summary | Invitations never appear in the people list or scope summary, and the org's pending-invitation count is always 0 | status=INVITED matches zero rows; list pending invitations with GET .../invitations. A page can hold fewer than limit items while a cursor is present. members/summary, the members list statusCounts.INVITED and /v1/me/context pendingInvitations are exact counts since 2026-11-25 (deployed to dev); always 0 before | High (code + unit tests, 2026-11-04; counts fixed 2026-11-25) |
| KI-57 | Team API, shares, access requests | Member, share and access-request counters (and member/share search tokens) were never maintained by the deployed stream-router | People counts, role/department memberCount, members q search, share level bands and the pending access-request badge read 0 / nothing. Fixed and rebuilt on dev 2026-11-25; access-request rebuild added 2026-11-26 (dev dry run: no access requests to count) | High (bundle inspected, unit tests, 2026-11-25) |
| KI-25 | Team API — PATCH .../members/{sub}, POST .../members/{sub}:suspend, GET .../roles/{roleId}, GET .../scopes/summary | Several response fields are permanent placeholders today | PATCH's impact is always {} (plantsRemovedApprox never computed); :suspend's assignedWorkOrdersRemain is always false; ScopesSummary carries no per-kind design caveat | Medium (code reading, 2026-10-02) |
| KI-27 | Team API — POST .../members:bulk-assign-scope, POST .../departments | Idempotency-Key required but doesn't replay | A retry with the same key re-executes rather than returning the stored response (no commitItem, same gap as invitations create) | Medium (code reading, 2026-10-03) |
| KI-28 | Shares (email grantee) | Invitations are in-app only since 2026-11-17 | An external-share invitee with no account has no way to learn of the share except the non-production acceptUrl | Medium |
| KI-29 | Authorization — MFA | Moot since 2026-11-11 (two-factor is never required; the gate never forms). CUSTOM_AUTH (email OTP) sign-in may bypass TOTP enrolment (no amr claim on the LITE Cognito plan to check) | MFA_ENFORCEMENT defaults to warn (logs only, never blocks) until the OQ-09 manual verification procedure confirms the risk; flipping to on before then could lock out legitimate email-OTP users on an mfaRequired org | Medium — mitigated by the warn default, not yet independently verified |
| KI-30 | Retired 2026-10-26 (ADR 0012 phase 3) — DELETE /v1/plants/{plantId} | Plant delete now removes every serial binding; nothing is skipped | — | |
| KI-31 | Resolved by removal (ADR 0012) — PATCH /v1/device-models/{modelId} | A model is marked "in use" only by a manufacturing-record import | A type change is still accepted on a model whose only users are registered/claimed devices | Medium |
| KI-37 | Email delivery (password reset, report emails; invitations are in-app only) | SES is still in sandbox: DKIM verification and sandbox exit are pending (owner actions) | Email reaches only SES-verified recipients (see KI-6, KI-17). Invitations are not emailed at all | High (known) |
| KI-38 | Any route | Intermittent 503 DEPENDENCY_UNAVAILABLE | An AWS SDK call was throttled or unavailable; retry after Retry-After: 1. Find the dependency with the Logs Insights query in Operations → Troubleshooting | High (code reading, 2026-10-28) |
| KI-39 | Legacy (mobile-created) plants on the web | Migrated on dev 2026-10-29 (17 plants); app-created plants are legacy again until the next run; staging/prod pending, and must wait for the mobile edit/delete fix | Where unmigrated: favourites list them without entity; they are missing from search suggestions and the web plant list | High (executed against dev, 2026-10-29) |
| KI-40 | Brand-asset uploads (N-49) | Fixed in code, not deployed (issue #14, 2026-11-13): uploads now go to pending/brand/<org>/<asset>, which the bucket's 1-day pending/ lifecycle rule cleans up. Not verified on dev | Until deployed, unconfirmed uploads still stay under brand/. Objects left there before the fix are not cleaned up by the new rule | High (code reading, 2026-11-13; not run on dev) |
| KI-41 | Report rendering | Superseded. The TCP Server built a renderer after 2026-10-29; its reports integration page records an end-to-end report verified on dev on 2026-11-05. Not re-verified from the HTTP side, and the scheduled-run path has not been checked end to end on dev | Newer renderer content (sections, completeness, dataAsOf) and manifest v5 (platform-wide reports) depend on the TCP deploy state | Medium (TCP documentation, 2026-11-25) |
| KI-42 | Plant deletion saga | Both halves are now in code: the TCP Server's plant eraser replies plant.erasure.completed.v1, and this API's handler for it erases the plant. Whether both are deployed and working on dev is not verified | If the eraser isn't running on dev, or has no TCP_EVENTS_TOPIC_ARN, a web-deleted plant still stays DELETING (410 GONE) and the 24 h overdue sweep reports it | Medium (code reading of both repos, 2026-11-13; not run on dev) |
| KI-43 | Every stream-maintained projection (search, counters, access index, inbox, outbox) | Resolved on dev (bus on since 2026-11-19; cse-http-be-dev-integration re-verified UPDATE_COMPLETE on 2026-11-23). On a stage deployed without busEnabled, the IntegrationStack, and with it the stream-router, is not created | On such a stage writes succeed, but nothing derived from them updates: new or renamed records are missing from search, facet and customer counters go stale, revocations do not fan out, the HTTP inbox stays empty and no event reaches the TCP Server | High (code reading, 2026-10-29) |
| KI-44 | Platform-wide plant list (SVC-2, ADR 0016; committed 2026-11-03, not deployed) | Super Admin / Administrator in Crown HQ can list every org's plants, but the summary counts, the installer filter and plants created before the deploy are not covered yet | GET /v1/plants/summary from HQ still needs operatorOrgId; installerOrgId without operatorOrgId is 400; older plants are missing from the all-org list until rebuild:projections -- --all-orgs --execute runs; q matches only plants the stream-router has tokenised (KI-43) | High (code reading, 2026-11-03) |
| KI-45 | Plant devices (binding) and the web console's Device Inventory | ADR 0018: the binding follows TCP's device.binding.changed.v1. Resolved on dev (both servers deployed, first sync completed 2026-11-04); not deployed on staging or prod | On staging and prod, a transfer accepted in TCP isn't reflected here until both servers are deployed there; the first sync then takes about 28 h for 1M devices | High (verified on dev from logs and queue metrics, 2026-11-04) |
| KI-48 | Web push (ADR 0022; HTTP half committed 2026-11-06, not deployed) | Updated 2026-11-25 from the TCP side: its FCM sender runs on dev and honours link, tag and platforms. Still open: the sender's Firebase project (cse-datalogger) differs from the one these docs name (crown-solar-energy-dev); WEB_CONSOLE_ORIGIN is unset on dev, so push links are bare paths; iOS pushes fail with an invalid APNs credential | Web tokens minted in another Firebase project are rejected by FCM; a bare-path link may be refused. Report-ready pushes for ["WEB"] no longer reach mobile | Medium (TCP session report, read-only checks, 2026-11-25; no push verified end to end) |
| KI-49 | Crown HQ dashboard fleet view (bug B-2, ADR 0024; committed 2026-11-11, not deployed) | The HQ dashboard reads fleet-wide counters that start empty and count suspended orgs | Until deployed, HQ shows 0 plants / 0 kWp / 0 regions. After deploy, only plants created or changed since then show up until rebuild:projections -- --all-orgs --execute runs. Plants of a suspended org stay counted (owner decision). Counts can differ from the TCP fleet messages, which count plants by in-service devices | High (code reading, 2026-11-11) |
| KI-50 | Role boundaries (console request 2026-11-11; deployed to dev 2026-11-12) | Backfills and rebuild:projections --all-orgs run on dev 2026-11-12; nothing open on the HTTP side | None on dev: all 19 personal orgs and 15 live plants are in the Crown-wide list, fleet totals and search | High (executed against dev, 2026-11-12) |
| KI-52 | Sign-in records (session fixes 2026-11-12; committed, not deployed) | No IP-location provider is configured; Cognito cannot revoke one sign-in's refresh token; an open TCP WebSocket is not cut at once | location stays absent on every row (ipAddress is recorded); an ended device can still refresh at Cognito (every token is refused by this API); an open WebSocket from an ended sign-in drops within about 11 minutes | High (code reading, 2026-11-12) |
| KI-53 | Push: End Users only and the push toggle (ADR 0025; HTTP half written 2026-11-13, not committed, not deployed) | The TCP Server must honour pushEligible (its own ws-gateway tokens included) and the stricter pushEnabled; staff already on the TCP side stay unprojected until one reconciliation run after deploy | Until both sides deploy, staff still get mobile alert push and the push toggle does not stop CRITICAL pushes | High (code reading, 2026-11-13) |
| KI-54 | Plant hasBattery (battery moved to devices, 2026-11-18; written, not committed, not deployed) | Plant hasBattery is derived from TCP's per-device battery flag on device.binding.changed.v1; existing plants learn it only from TCP's migration 0138 events (single-device plants) or a later battery change | Until then a plant reports hasBattery: false (and gridTopology ON_GRID, battery-temperature alert default off). Deploy this server before TCP | High (code reading and unit tests, 2026-11-18) |
| KI-51 | Profile picture (/v1/me/avatar; committed 2026-11-11, not deployed) | The server does not strip image metadata, and other users cannot see a user's picture yet | A JPEG uploaded without re-encoding keeps its EXIF data (for example GPS location), readable by anyone holding the 5-minute signed URL — today only the user. Team lists, work orders and other screens still show initials | High (code reading, 2026-11-11) |
| KI-33 | Resolved by removal (ADR 0012) — D13 device transfers | The hourly sweeper is in IntegrationStack (busEnabled only) | Without the bus, PENDING transfers never auto-expire; they expire only when someone tries to decide them (409 TRANSFER_EXPIRED) | High |
| DEV-2026-10-13 | Dev verification run, 2026-10-13 | Several routes 500 on dev; some docs were wrong | Resolved: fixes and GSI3 deployed to dev 2026-10-13; realtime still needs its flag | High (executed against dev) |
| FE limits 005 | Device registry | Deliberate contract limits | See below | High |
FE contract limits (feature 005)
These are by design, not bugs; build the console around them.
- Search fields: inventory
q(2–64 chars) is a prefix match on serial, label and model only. No search on plant name, customer, installer or country; use the filters instead. WithqorplantIdonly the default sort is allowed. - No fleet-wide list: every device list is scoped to one organisation (
GET /v1/orgs/{orgId}/devices) or one plant. There is no cross-org device list, not even for Crown; use the verification queue or serial lookup. - Removed (ADR 0012) —
CSV only: bulk import (D14) accepts; the import queue, worker and uploads bucket are gone (Device imports).text/csvonly, ≤ 5 MiB, ≤ 5,000 rows. No XLSX. D14 is routed; without-c busEnabled=truethere is no import queue/worker, so:validate/:commitanswer503 PARENT_OFFLINEnot computed: the warning row code exists in the enum but is never emitted; it needs live telemetry, which this API never reads.
Details
KI-5
Timing side-channel on account existence
The response shape is the same for registered and unregistered emails.
Timing is not: only a registered account with a verified email triggers the
conditional throttle PutItem and the SES SendEmail. That adds tens to hundreds of milliseconds. So the
"identical at every step" claim holds for shape, not timing.
KI-6
Email OTP sign-in not usable by real users yet
Phone + SMS sign-in was removed (owner decision OQ-09, 2026-10-27); sign-in codes go by email through SES. Before real users can sign in this way:
- Deploy with
-c otpSenderEmail=<verified SES identity>(optionally-c otpSesConfigurationSet=<name>). Without it no code is sent andCreateAuthChallengeFnlogsemail_signin_sender_not_configured. - SES DKIM verification and sandbox exit (owner actions). In the sandbox only verified recipient addresses receive mail (200/day).
- Codes are sent only to an account whose email is verified; otherwise the
trigger logs
email_signin_unverified_addressand sends nothing.
Old app builds: builds that use the removed phone + SMS sign-in stop signing in once this version is deployed. There is no transition period (owner decision).
No real email sign-in has been captured against dev yet.
KI-7
Malformed JSON body returns 500 — legacy lenient routes only
Fixed for strict routes (parseBody(), packages/api/src/http/claims.ts):
a present-but-invalid body is now 400 MALFORMED_REQUEST. PATCH /v1/orgs/{orgId}/members/{sub} (Team) is the first live
strict route with a body, so the fix is reachable today — the bug remains
only on the seven original legacy routes below.
On the seven legacy lenient routes (the ones the shipped APK calls),
parseBody() still calls JSON.parse(raw) unguarded, deliberately, until the
mobile team confirms the shipped APK always sends valid JSON (CR-13). A
SyntaxError there is neither an AppError nor a ZodError, so handler()
logs unhandled_error and returns 500 INTERNAL. An empty body is
handled correctly on every route (422, "Request body is required").
KI-8
:::note Fixed in feature 005 (code complete, not yet deployed)
A same-plant re-claim now returns 200 with the existing device. See Devices API.
:::
Same-plant re-claim of a serial returns 500
claimDevice() writes the device inside a TransactWriteCommand with
attribute_not_exists(PK) OR attribute_not_exists(SK). If the serial is
already on the same plant, findPlantBySerial() returns that plant, the
"other plant" check passes, and the transaction's condition fails with
TransactionCanceledException. Nothing maps that exception, so it becomes
500 INTERNAL.
KI-9
:::note Fixed in feature 005 (code complete, not yet deployed)
A SERIAL#<serialNorm>/GUARD item is written in the claim transaction; a concurrent claim elsewhere gets 409 CONFLICT. Legacy duplicates are quarantined on migration.
:::
Concurrent claims of one serial can both succeed
Global uniqueness comes from a Query on GSI1 before the write. GSI reads
are eventually consistent, and the device item's key (PLANT#<id> /
DEVICE#<serial>) differs per plant, so the transaction's condition can't
catch a claim under another plant. Two claims for the same serial on two
plants, close together in time, can both be written. A real fix needs a
uniqueness item keyed on the serial alone (e.g. SERIAL#<serial>/CLAIM),
written in the same transaction with attribute_not_exists(PK).
KI-10
:::note Fixed in feature 005 (code complete, not yet deployed)
The stream router adds/subtracts deviceCount on each access-index item when a device is linked to or removed from a plant.
:::
deviceCount is always 0
getAccountSummary() sums a deviceCount attribute on each membership item.
claimDevice() never increments it, and nothing else writes it. Device
claiming is implemented, but GET /v1/me and
PUT /v1/me/selected-plant still return deviceCount: 0.
Fix path (feature 005, code complete, not deployed): the stream router
adds 1/subtracts 1 on each access-index item when a plant-device link is
inserted/removed (idempotent on redelivery); when a user gains access to a
plant, the access-index seeds their deviceCount by counting the plant's
device links (bounded query). The count is approximate: a link in flight can
be counted twice, and a partial failure can undercount. Until 005 deploys,
treat 0 as "unknown", not "no devices".
KI-11
selectedPlantId is never set automatically
createPlant() doesn't set the creator's selectedPlantId. The self-heal in
GET /v1/me only fires when a value exists and is stale. It never fills
in a missing one. An account with plants has no selectedPlantId until the
client calls PUT /v1/me/selected-plant. So clients shouldn't read "no
selectedPlantId" as "no plants". Use plantCount.
KI-12
Only OWNER memberships can exist — CLOSED (2026-10-03, feature 003's evaluator)
The original finding: the only code that wrote legacy plant memberships was
createPlant(), and it always wrote role: 'OWNER', with no invite/add-member
endpoint for that model — so the VIEWER check in claimDevice() and the
ADMIN/VIEWER distinction could never be reached, and access pattern #6
(members of a plant, GSI1PK=PLANT#<id>) had nothing querying it.
Why this is closed, not fixed: feature 003 doesn't add an
ADMIN/VIEWER-granting endpoint to the legacy per-plant model — it
replaces graduated access with the org-scoped roles/scopes/shares model
described in Authorization instead. The
evaluator (effectiveAccess) reads the three legacy memberships as a
compatibility path alongside the new organisation paths — OWNER as the
external FULL ceiling, ADMIN as EDIT, VIEWER as VIEW — so the
original impact ("every membership is OWNER, ADMIN/VIEWER unreachable")
no longer describes a gap: an operator org's own Technician/Sales/Operations
Manager/Compliance Auditor roles, or an external share at one of the 5
ceiling levels, are now the real way to grant anything less than full access
to a plant. createPlant() still only ever writes OWNER — that's expected,
not a bug, since a plant's creator legitimately gets full access at creation.
Access pattern #6 remains undesigned-against; nothing on this site claims it
will be built.
KI-15
Profile fields aren't synced from Cognito
ensureUserProfile() copies email, name → displayName, and
custom:terms_accepted_at once, when the profile is created. There's no
general update path: a later change to the user's Cognito name doesn't
reach GET /v1/me.
Partial exception (T002-039): email specifically is repaired, not just
copied once. An access token has no email claim (requireClaims() reads it
from JWT claims only), so a profile auto-provisioned from an access-token
call used to be stored with email: "" permanently. ensureUserProfile()
(packages/core/src/repositories/users.ts) now takes an IdentityProvider
and:
- on first provisioning, falls back to
identityProvider.getUserEmail(sub)(CognitoAdminGetUser, bysub) when the token carried noemail, so a fresh profile is no longer stored with""; - on every subsequent
GET /v1/me, if the stored profile'semailis still""(from before this fix), repairs it in place from the sameAdminGetUsercall and returns the repaired value.
This only fixes email. displayName and termsAcceptedAt are still
copied once and never resynced.
KI-16
Admin user creation omits the required phone_number
The user pool marks phone_number as a required standard attribute.
CognitoIdentityProvider.createUser() (and the admin-create-user example
formerly in docs/getting-started.md) sends only email, email_verified
and optionally name. Cognito is expected to reject this for a missing
required attribute. Operations → Minting a test JWT
includes phone_number.
KI-17
Cognito email not on SES
Known and deliberate for now. See Authentication → Forgot / reset password. (No CloudFront is a separate, already-documented architectural decision — see Architecture → Overall architecture — not listed here as an issue.)
KI-21
Creating a plant wasn't idempotent — FIXED in feature 004
POST /v1/plants used to take no idempotency key, so a client retry after a
lost response created a second plant. Feature 004 wired the existing
claim/commit/complete mechanism (ADR 0010, FR-012–FR-015) to the route:
lib/routes.ts now declares CreatePlant with idempotency: 'optional'.
A retry that sends the same Idempotency-Key gets the stored first response
back. The web variant (with X-Org-Id) requires the header (428 PRECONDITION_REQUIRED without it); the mobile variant accepts it but does not
require it, so the shipped APK keeps working. Mobile clients that do not send
the header still need the client-side check in the
FE guide.
KI-19
Plant timezone accepted UTC offsets — FIXED in feature 004
The shared Timezone schema in packages/core/src/schemas.ts now accepts
IANA names only (for example Asia/Karachi). An offset such as +05:00 is
rejected with 422 VALIDATION_FAILED (T004-012).
KI-24
People list and scope summary never show invitations (by design)
GET /v1/orgs/{orgId}/members and GET /v1/orgs/{orgId}/scopes/summary
list members only. Pending invitations have their own list,
GET /v1/orgs/{orgId}/invitations.
status=INVITED is accepted by the query schema but always matches zero
rows, and no list item ever carries an inviteId.
Internal and delegated invitations are still written into the same DynamoDB indexes the People list reads (data model D-05). Both routes drop every item that is not a membership after the read, so:
- a page can hold fewer than
limititems (even zero) while a cursor is still returned; keep paging until it is absent; - revoking or accepting an invitation removes it from those indexes; an
invitation that simply expires stays in them until its
ttl(expiry + 30 days) deletes it, which the filter makes harmless.
Pending invitations are left out of the member counts. Their own count —
GET …/members/summary pendingInvitations, the members list
statusCounts.INVITED and GET /v1/me/context badges.pendingInvitations —
was always 0 until 2026-11-25, because it read the org counter
COUNT#invitations#status#PENDING, which nothing maintains. Since 2026-11-25
(deployed to dev) all three count the org's PENDING, unexpired
invitations directly (repositories/invitation-counts.ts). The per-role count on
GET …/roles/{roleId} is a live query and is correct. A caller's own
pending invitations are counted by badges.myInvitations (2026-11-23).
History: until 2026-11-04
(cse-http-backend#15)
the routes did not filter, so one pending invitation made GET …/members
answer 500 INTERNAL and put an item with no sub into the scope
summary.
KI-25
A few Team API fields are permanent placeholders until later features land
PATCH /v1/orgs/{orgId}/members/{sub}'s responseimpactis always{}—plantsRemovedApproxis never computed, even when a scope narrowing genuinely drops plants from the member's coverage.GET /v1/orgs/{orgId}/scopes/summary'sScopesSummarycarries no per-scope-kind design caveat (ALL_REVIEW_OFTEN/TAG_SILENT_GRANTfrom the design copy are not surfaced).POST /v1/orgs/{orgId}/members/{sub}:suspend's responseassignedWorkOrdersRemainis alwaysfalse— it's meant to warn that a suspended technician still has open work orders assigned, sourced from a facet counter feature 006 (work orders) hasn't been built yet to maintain.
KI-27
Idempotency-Key on POST /v1/orgs/{orgId}/members:bulk-assign-scope and POST /v1/orgs/{orgId}/departments doesn't replay
Both routes require the header (428 if missing) and reject a reused key
with a different body, but neither splices a commitItem into its own
write path — so a crash/timeout between commit and response leaves no
stored response to replay from. A retry with the same key re-executes
the operation rather than returning the original response. For
bulk-assign-scope this is low-risk in practice (re-applying the same scope
to a member already on it is a harmless no-op, see Team
API's own note); for department creation a retry after a
genuine partial failure could attempt the create again and surface
409 ALREADY_EXISTS instead of the original 201. Same documented
simplification as POST /v1/orgs/{orgId}/invitations's own gap.
KI-28
Invitations are in-app only — no invitation email (2026-11-17)
The invitation email path was removed (owner decision 2026-11-17): no SES
call, no INVITE_EMAIL_* variables, no ses:SendEmail grant on the
invitations function. An invitee with an account sees pending invitations
with GET /v1/me/invitations and accepts or
declines them in the app. delivery.status is always NOT_SENT.
- Since 2026-11-23 (deployed to
dev2026-11-23) an invitee whose account has the invited email verified also gets anINVITATION_RECEIVEDinbox item and web push when an INTERNAL/DELEGATED invitation is created or renewed. Share (EXTERNAL) invitations get none. - Someone with no account learns of an invitation only outside the system (the
inviter tells them; outside
prodthe console can copyacceptUrl). Once they sign up with the invited email and verify it, the invitation is in their in-app list. POST /v1/orgs/{orgId}/shares's email-grantee path has the same property.
KI-29
Superseded 2026-11-11 (product decision): two-factor is the user's own choice. No organisation, org kind or role requires it —
effectiveMfaRequiredis alwaysfalse— so no route returns403 MFA_REQUIRED, whateverMFA_ENFORCEMENTis set to. The code stays reserved in the contract. The text below describes the earlier behaviour.
MFA enforcement can't cryptographically verify CUSTOM_AUTH used TOTP (OQ-09)
Cognito's LITE feature plan issues no amr (authentication methods
reference) claim, so a request authenticated via email OTP (CUSTOM_AUTH)
is indistinguishable, from the token alone, from one that somehow bypassed
TOTP entirely. Authorization's
MFA check works around this by trusting only the client id the request
came through (WEB_CONSOLE_CLIENT_IDS — SRP-only, TOTP-challenging clients)
rather than anything in the token itself; MFA_ENFORCEMENT ships defaulted
to warn (logs what would have been a 403 MFA_REQUIRED refusal, never
blocks) specifically so this can run in dev and be observed before anyone
flips it to on. The manual verification procedure (specs/003-organizations-access/quickstart.md
§6, repo-internal) confirms CUSTOM_AUTH never independently satisfies an
org's MFA requirement before that flip happens. Until that verification is
complete and -c mfaEnforcement=on is set, an org with mfaRequired is
only advisory-enforced for email-OTP sign-ins, not hard-blocked.
Owner decision (OQ-09 sign-in, 2026-10-27): the mobile app signs in with
email OTP only and can never satisfy an MFA requirement. A refused request
now carries details.reason: WEB_CONSOLE_SIGN_IN_REQUIRED (non-web
token) or TOTP_ENROLMENT_REQUIRED (web token, no TOTP).
Closed (2026-10-27): the earlier bypass where routes without an org
selector skipped the MFA check is closed for both plant and org-level paths:
every route acting through an MFA-requiring membership (plants, reports,
schedules, invitations, plant jobs, service routes, device binding) is gated
by that membership, with or without X-Org-Id (see Authorization).
Dev verification (2026-10-13)
Unlike the items above, this one comes from requests executed against
dev on 2026-10-13. Resolved: every fix below was deployed to dev
on 2026-10-13 (data stack for GSI3, then auth and api stacks). The
signed-in fixes are deployed but not yet re-verified with a signed-in call.
Deployed to dev 2026-10-13:
- DynamoDB
Keycarried GSI1 attributes →500. Reads now narrowkeys.relationship()/keys.customerProfile()/keys.partnerProfile()withprimaryKey(). Affected web plant detail and workspace (legacy plants), customer get/PATCH/:close, partner get/PATCH, and web plant create with a customer or installer. - GSI3 missing — deployed (T002-134); customer list default path, partner
lists filtered by relationship/status, single-
statusmember lists and the web plant created-order/lifecycle path are expected to work. - Realtime
500when tickets are disabled — now503 DEPENDENCY_UNAVAILABLE(captured ondev, see Realtime). GET /v1/me/contextlevels for personal orgs — now the full role levels.- Member
ETag—GET /v1/orgs/{orgId}/members/{sub}sendsETag: "<version>". - Router
404tracing —X-Request-Id,X-Correlation-Id,Cache-Control: no-store,requestIdin the body. - Saved views and plant share links — deployed.
Still open:
- Realtime flag —
devhasrealtimeTicketsEnabledoff, so no tickets are issued until a human deploys with-c realtimeTicketsEnabled=true -c realtimeWsUrl=<wss://…>. Both are now saved incdk.jsoncontext.stages.dev(2026-11-03,realtimeWsUrl=wss://d2heoz2zkqbsg1.cloudfront.net/ws), so the next plainnpm run deploy:devturns tickets on. Synth refuses a missing or loopbackrealtimeWsUrlonce tickets are on.
By design (docs corrected):
- Mobile
POST /v1/plantsstill creates legacy plant items, so a mobile-created plant is missing from the web plant list until it is migrated or gets its first webPATCH— see Plants. GET /v1/me/contextrequires an org selector (X-Org-Idor?orgId=); there is no fallback todefaultOrgId— see Me.
KI-30
Plant delete skips devices it cannot release
:::info Retired 2026-10-26 — ADR 0012 phase 3
The 005 device-release hook is gone. Plant delete (route, deletion sweep,
erasure) now deletes every serial binding of the plant and its SERIALBIND#
guard via unbindAllBindingsForPlant; no device is skipped, no
device.upserted.v1 is published, and the :bind / :unbind device routes
no longer exist (the only unbind route is
DELETE /v1/plants/{plantId}/devices/{serial}).
:::
Residual: when the owner delete's second release fails (log
plant_after_deleting_hook_failed, metric PlantDeviceReleaseFailed), the
device links are kept so the release can be re-run, but there is no
operator re-run command or alarm yet — re-running
unbindAllForPlant(plantId) needs a code-level invocation. See
Operations → Troubleshooting.
KI-31
:::info Resolved by removal — ADR 0012 phase 2 The routes this entry describes are no longer registered; devices and commands are served by the TCP server over the WebSocket. Kept for history only (ADR 0012 phase 5 complete). :::
Device-model "in use" lock is set only by imports (yet)
PATCH /v1/device-models/{modelId} refuses a type change with
409 INVALID_STATE (MODEL_IN_USE) once the model is in use. Today only
POST /v1/manufacturing-records:import sets that flag; registering or
claiming a device against the model does not, so such a model can still
have its type changed. See Device catalog.
KI-32
:::info Resolved by removal — ADR 0012 phase 2 The routes this entry describes are no longer registered; devices and commands are served by the TCP server over the WebSocket. Kept for history only (ADR 0012 phase 5 complete). :::
A deleted device answers 410 regardless of caller access
GET /v1/devices/{deviceId} (D05) checks the device tombstone before the
access check, so a removed device returns 410 GONE
(details.lifecycle: "REMOVED") to any signed-in caller, including one who
never had access. This reveals only that the ID once existed (a minor
existence leak) and is kept as the contract. FE: handle 410 as "device
removed" and leave the page. See Device inventory.
KI-33
:::info Resolved by removal — ADR 0012 phase 2 The routes this entry describes are no longer registered; devices and commands are served by the TCP server over the WebSocket. Kept for history only (ADR 0012 phase 5 complete). :::
Since issue #26, device transfers are immediate on the TCP server: there is no pending transfer
state and the HTTP side no longer has a TRANSFER_PENDING binding state. The text below about
pending transfers describes the retired two-step flow. See Device transfers.
Phase 3 removed the sweeper itself and DeviceRemovalStuck. Original entry: the device-registry-sweeper (transfer expiry, stale import-job expiry,
DeviceRemovalStuck) was deployed in IntegrationStack, which exists only
with -c busEnabled=true. Until the bus is enabled, a pending transfer past
expiresAt stays PENDING in lists and keeps the device TRANSFER_PENDING;
it is expired the first time someone accepts, declines or cancels it. Stuck
removals are not counted either. FE: treat expiresAt in the past as
expired in the UI. See Operations.
KI-34
:::info Resolved by removal — ADR 0012 phase 2 The routes this entry describes are no longer registered; devices and commands are served by the TCP server over the WebSocket. Kept for history only (ADR 0012 phase 5 complete). :::
Feature 007 device operations were removed (ADR 0012). They were never
deployed. The routes, the api-devices-ops stack, the command sweep, the
bulk-task driver, the firmware and engineering-files buckets, the
COMMANDS_DISPATCH_ENABLED / FIRMWARE_TASKS_ENABLED flags and the
command.* events no longer exist in code. Commands, bulk tasks, firmware
and device files belong to the TCP server; see Commands
(stub).
KI-35
POST /v1/orgs/{orgId}/invitations/{inviteId}:resend dispatch changed
(batch 51 router fix). The old router split the action off the first
path variable (orgId), so :resend most likely answered 404 instead of
reaching the handler. The fixed router splits the variable that carries the
verb, so the call now reaches ResendInvitation. Not verified against a
deployed stage; FE code that treated the 404 as permanent should retry.
KI-36
Pre-2026 legacy device claims can be bound to two plants (ADR 0012).
Legacy claim items (PLANT#<p>/DEVICE#<rawSerial>) were written before the
SERIALBIND# uniqueness guard existed. On the same plant, a legacy item and
a normalised claim of the same serial are treated as one binding. Across
plants they are not guarded: the same device can appear on two plants
until the owner runs the one-off guard backfill
(npm run backfill:binding-guards, see
Operations), which writes the missing guards and reports
conflicts for manual resolution. New claims are always guarded.
Audit wave 1 known issues (2026-10-27)
- Realtime
opbinding is HTTP-side only untilcse-tcp-bechecksplant.operatorOrgId === op. - Email OTP lockout can be imposed by others: anyone who knows an address can cause a ~1-minute refusal, and up to 15 minutes if they keep guessing.
- Mailbox = account on mobile (A10): email OTP never adds TOTP. After an admin
reset-mfa, an attacker can re-enrol TOTP. - Throttles/Errors alarms are account-wide and also fire on
cse-tcp-befunctions. - The
execute-apiendpoint is reachable directly, bypassing CloudFront's HTTP-to-HTTPS redirect. - No reconcile sweep for report schedules. Retryable sync errors are rethrown and retried, but nothing re-checks drift afterwards.
- Device-count projection costs about 4 WCU per access-index item per binding change (transactional guard). This is negligible at current volumes.
Feature 008 — notifications (planned)
Applies to the Notifications API, which is routed (the web team observed the routes answering on dev on 2026-10-28); the NotifyStack (queued recompute, digests) exists only with -c busEnabled=true.
- Audience recompute (Q36, 2026-10-27): changes affecting more than 25
users are queued to notify-recompute (
USERSrequests, ≤ 1000 users each) whenbusEnabledis on; otherwise, or after an enqueue failure (WARNnotify_recompute_enqueue_failed), they are recomputed synchronously, chunked, in the request. The ≤ 2-minute revocation bound is a target, not a measured value. - User deletion has a notify hook but no caller: no user-deletion
path (route, script or Cognito delete) exists yet. The hook
planUserDeletionNotify(sub)inpackages/core/src/notify/access-change.tsis ready: it returns thenotify.user.deleted.v1tombstone plus aNONEaudience tombstone for every operator that held the user, to put in the deletion's own transaction. Until a deletion path calls it, a deleted user's audiences and endpoints are only cleared by removing their memberships first. - Channel availability from SSM flags (Q37): PUSH follows
/cse-tcp-be/<stage>/notify/push-enabled, EMAIL/cse-http-be/<stage>/notify/email-enabled. Unset ⇒UNAVAILABLE. - Org directory needs a backfill (Q38): the GSI2
ORGS#<kind>directory is written on org create and rename (never for personal orgs) since 2026-10-27. Orgs created earlier are missing from it until the owner runsnpm run backfill:org-directory(see Operations). Until then theORG_SETTINGS_ALLrepublish and the reconcile ORGS pass skip those orgs (WARNnotify_org_directory_emptywhen a walk finds none). - Email consumer is off by default: SES is in sandbox, so
notify.email.requested.v1is not sent as email. - Edit capability: the FE shows rule edit controls only when
viewer.capabilitiescontainsnotificationRules.edit(alerts ≥ MANAGE). - B-02 / TCP-REQ-17 pending: push sending and the delivery log depend on TCP work that is not done.
- Huawei devices without Google services get no push (FCM only).
- 008 routes are routed: A09, G01, G02 and G05 live in
cse-http-be-<stage>-api-notify, G03 inApiStackviaPOST /v1/{collection}(observed answering ondev, 2026-10-28). - Recompute is synchronous without the queue (Q36): in a stage without
busEnabled(no NotifyStack), audiences beyond the first 25 users are recomputed synchronously after commit, in chunks of 25. Rule writes in very large orgs can then be slow (Lambda timeout 25 s); if the timeout is exceeded the rule is saved but some audiences may stay stale until the next weekly reconcile. - Reconcile-stale alarm has blind spots:
NotifyReconcileStalechecks one 7-day period (Sum ofReconcileCompleted< 1) with missing data not breaching. It is quiet after the first deploy and cannot detect a reconcile function that never runs at all. - tcp-events consumer cannot create digest schedules yet: the
IntegrationStack tcp-events consumer can create digest schedules, but it
has no
scheduler:CreateSchedule/iam:PassRolegrant and noDIGEST_*environment variables. That path is reached only whenNOTIFY_EMAIL_REQUESTS_ENABLED=true(off by default). Add the grants and variables before turning that flag on. - Digest DLQ has no alarm: only the notify-recompute queue age feeds
BacklogAge; no DLQ has an alarm (see below).
No DLQ alarm — check by hand
- Owner decision 2026-10-27 dropped the
DlqDepthalarm to stay within the CloudWatch free tier (10 alarm metrics). The DLQs still exist, but a message landing in any of them alerts nobody. Check them by hand with the DLQ runbook.
Feature 009 — reports (routed; generation gated)
- Report/schedule routes are routed (observed answering on
dev, 2026-10-28). Generating requiresReportsStack(-c busEnabled=true) andreportsGenerateEnabled=true(-corcdk.jsonstages.<stage>; dev sets it since 2026-11-04; else422 REPORTS_GENERATE_DISABLED); withoutReportsStack, generating routes (H02, H03a, H06, H05b,:resume,:run-now) answer503 DEPENDENCY_UNAVAILABLEbefore any write. - The S3 expiry write-back needs
reportDispatchQueueArnon the data stack; omitting it on a later data deploy silently drops the notification. Dev keeps it incdk.jsonstages.dev(2026-11-04), so this only affects a stage without it. ReportsOverduecounts sweeps from logs; a sweeper that never runs emits no datapoints, so the alarm stays quiet.- With
busEnabledthe account has 8 alarms = 10 standard alarm metrics (exactly the free tier;DlqDepthand the notify-recompute input ofBacklogAgewere dropped by owner decision 2026-10-27, so neither the DLQs nor the notify-recompute queue age are alarmed — check them by hand) NoDependencyUnavailablealarm (dropped by owner decision 2026-11-10, Q12): an AWS dependency outage shows up in theDependencyUnavailablemetric and theDEPENDENCY_UNAVAILABLE503 log lines, but notifies nobody. Source: CloudWatch pricing page, read 2026-10-27. - Per-customer fan-out re-resolves the scope in every batch (25 customers each); a plant that changes customer between batches of one run can leave a customer out of that run's reports.
- Email delivery of reports blocked by B-02.
- Portal
qsearch covers only the newest 200 viewer rows. - Download ignores
PREVIEWwhen deciding whetherfileis required. - Per-customer schedules accept every scope kind; plants with no customer are left out and counted as
lastRun.unassignedPlantCount, except with scopeALL, where they are not counted (gap; Q40). - Schedule create/resume/run-now are refused (503) without Scheduler config; schedules stored earlier stay unarmed until it is deployed.
UPLOAD_URL_EXPIREDtreated asUPLOAD_FAILED, no re-dispatch.- Q39 (resolved 2026-11-02): no default retention floor; old data renders as partial.
- Rendering depends on the TCP renderer (see TCP dependencies).
KI-37
Email delivery is blocked by the SES sandbox. Password-reset email via SES and report emails cannot reach arbitrary users until the owner completes DKIM verification and SES sandbox exit. Until then SES delivers only to verified recipients. See KI-6 and KI-17. (Invitations are not emailed — KI-28.)
KI-38
Intermittent 503 DEPENDENCY_UNAVAILABLE. packages/api/src/http/respond.ts
returns this (with Retry-After: 1) when an AWS SDK call is classified as
throttled or unavailable, emits the dimensionless DependencyUnavailable
metric and logs dependency_unavailable with the dependency field. See
Operations → Troubleshooting
for the query that finds which dependency.
KI-39
Legacy plants are only partly visible on the web. GET /v1/me/favorites
returns favourited legacy plants without entity (B-1). They have no org id
and no search tokens, so search suggestions and the web plant list skip them
until the owner runs npm run migrate:legacy-plants (see
Operations).
Status: run on dev on 2026-10-29 with --apply: 16 users, 17 legacy plants, 17 migrated, 0 skipped,
0 failed; owners without a personal org got one. Dry run again on 2026-11-19: 30 users, 0 legacy plants. The
script only finds plants owned by a current user, so a legacy plant with no owner record, or whose owner account
was deleted, would not be counted; whether any exist on dev has not been checked.
Search tokens still missing on dev (B-3). Neither the migration script nor the If-Match: "0" web PATCH
writes SRCH# tokens inline. Plant search tokens and plant facet counters are written only by the stream-router
(planRecord with the plants extractor), which is not running while the bus is off. Migrated plants therefore
still do not appear in q search or search suggestions until the bus is turned on. See KI-43.
The bus is now on for dev (checked 2026-11-19), but the stream starts at LATEST, so a plant migrated while it
was off gets its tokens only from its next write. Whether the migrated dev plants now have tokens has not been
checked.
New app plants are no longer legacy (committed 2026-11-03, not yet deployed). The mobile app's
POST /v1/plants now writes the same schema v2 item the migration script produces (see
Plants), so the stream-router indexes it like a web plant. Until that change is deployed, plants
created in the app are still legacy: run the script once more after the deploy (it is idempotent) to pick up the
ones created in between.
Side effect, until the fix below is deployed: the deployed mobile PUT and DELETE routes accept only legacy
items, so the app gets 409 INVALID_STATE ("managed by an organisation") when it edits or deletes a migrated
plant. The app still lists and opens these plants. The fix (committed 2026-10-29, not yet deployed) lets the app
edit and delete a migrated plant that still belongs only to its owner's personal org, and stops a web edit of such
a plant from hiding it from the owner's app list. Do not run the migration on staging or prod before that fix is
deployed there.
KI-40
Fixed in code, not deployed; not verified on dev (issue #14, 2026-11-13, code reading).
The problem: POST /v1/orgs/{orgId}/brand-assets presigned a PUT straight to brand/<org>/<asset>. If the client
never called :confirm, the PENDING record expired after 2 days, but the uploaded object was not deleted, because
the org-branding family had no S3 delete grant.
The fix (packages/core/src/orgs/brand-assets.ts, lib/route-family.ts):
- The presigned PUT now goes to
pending/brand/<org>/<asset>. The bucket's existingexpire-pending-uploadslifecycle rule (prefixpending/, 1 day) deletes an upload that is never confirmed. :confirmchecks the upload, copies it tobrand/<org>/<asset>, sets the asset READY, then deletes the upload. It now returns{asset, download}with a presigned GET of the final key.- The family gained
s3:PutObject/s3:GetObject/s3:DeleteObjectonpending/brand/*only. - Assets created before the fix have no upload key; their confirm still checks
brand/<org>/<asset>directly. Objects already orphaned underbrand/are not removed by the rule.
To close it on dev: deploy, create an asset, upload, and confirm it; check that the object is at
brand/<org>/<asset> and gone from pending/. Leave a second upload unconfirmed and check it is gone after a day.
See Web console additions.
KI-41
Superseded (2026-11-25). On 2026-10-29 the TCP Server had no renderer. It has since built one: the TCP
reports integration page records a customer monthly summary reaching READY on dev
on 2026-11-05. This entry stays open only until the HTTP side re-verifies a manual and a scheduled run end to end on
dev, and until the TCP renderer accepts manifest v5 for platform-wide reports.
The renderer contract is ready for the TCP team: a handout describing the S3 layout, IAM grant, render-manifest v3
and status events has been prepared, and the contract itself is in
specs/009-analytics-reports/contracts/integration-events.md (cse-http-be repo). See
Reports pipeline → Render manifest v5.
KI-42
Plant deletion: both halves are in code, not verified on dev (updated 2026-11-13, code reading). The contract
is in the blueprint (docs/blueprint/05-integration.md §7.2, TCP-REQ-12): TCP erases the plant's device data and
replies plant.erasure.completed.v1 { plantId }.
- TCP side (
cse-tcp-backend, committed 2026-11-04):plant.deletion.requested.v1queues aplant_erasuresjob, and the plant eraser (server/internal/httpbus/eraser.go, run bypersistence-worker) erases the data and publishesplant.erasure.completed.v1on TCP's SNS topic. It only reports when the worker hasTCP_EVENTS_TOPIC_ARNset. Without it, the worker still erases but sends nothing back. - HTTP side:
from-tcpsubscribes toplant.erasure.completed.v1(lib/integration-stack.ts), andonPlantErasureCompleted(packages/core/src/plants/lifecycle.ts) deletes the remaining items, writes a tombstone and removes the pending marker. The hourly sweep raisesPlantDeletionOverduefor anythingDELETINGlonger than 24 h.
To close it on dev: delete a web plant (C11), check the TCP worker logs for the erasure, and check that the plant
leaves DELETING (GET stays 410, and the tombstone is written) with no PlantDeletionOverdue after 24 h.
App deletes of a migrated plant finish here; a later plant.erasure.completed.v1 for them is a logged no-op.
KI-43
:::note Status on dev
The bus is on for dev: on 2026-11-19 the stream-router's event-source mapping
(cse-http-be-dev-integration-StreamRouterFn…) was Enabled, and npm run resync:plants -- --bump-version --apply
was run afterwards. The table below describes what happens on any stage deployed without busEnabled=true,
and why writes made on dev while it was off still have stale projections until their next write.
:::
Stream-maintained projections do not update while the bus is off. busEnabled defaults to false on every
stage, and with it false the cse-http-be-<stage>-integration stack is not created at all. Even inside that
stack the stream-router's DynamoEventSource is created with enabled: busEnabled (lib/integration-stack.ts).
So no DynamoDB stream record is processed. The request itself always succeeds (the source item is written); only
the derived items below never change. Each was checked against its plan function in
packages/api/src/handlers/stream-router.ts:
| Pass (plan function) | What it maintains | Visible effect on dev today |
|---|---|---|
planAccessRevocation | Fan-out when a role's level is lowered | Members keep their old access-index copies after a role downgrade |
planScopeWidening | Fan-out when a role scope goes SCOPED → ALL | Members do not gain copies of the newly in-scope plants |
planAccessIndexActions | Per-user plant copies for PLANTS-scope memberships and user shares | New grants do not appear in "my plants" lists |
planShareIndexActions | Plant ↔ share reverse links and the grantee's per-user copy | Share lists by plant and the grantee's list lag |
planPlantCopyRefresh | Refresh of access-index copies from plant META (beyond the ≤ 25 rows a web PATCH refreshes inline) | Renames/edits of plants with many viewers are stale in their lists |
planCustomerRetokenise | Re-tokenising plants when a customer is renamed | Plant search by the new customer name misses |
planTagRelabel / planTagDetach | Tag rename copied into plant tagLabels; a DELETING tag detached from plants/customers and then deleted | Renamed tags show the old label on plants; deleted tags stay DELETING and attached |
planDeviceCountDelta | deviceCount on every access-index copy of a plant | Device counts in plant lists do not move after a bind/unbind |
planRecord (registered collections: plants, customers, partners, tags, members, shares, access requests, reports, work orders) | Facet and sum counters (COUNT#…), search tokens (SRCH#…) and outbox publishing to SNS | New or renamed plants, customers, partners, members, work orders and reports are missing from q search and suggestions; facet counts, tag groupCounts, the pending access-request badge and customer counters are stale; outbox rows are never published, so the TCP Server receives no plant.upserted.v1, notify.*.v1 or other event |
planAssignmentChanges | Work-order assignment facts and per-customer open counter | Technician assignment listeners and COUNT#WOCUST#OPEN#<c> do not move |
planReportChildCleanup | Deleting a removed report's download/event children | Children stay until their own TTL |
planReportScheduleSync | EventBridge Scheduler schedules for report schedules | Report schedules are stored but never armed |
planInboxNotifications | The HTTP in-app inbox | Only ACCESS_REQUEST_DECIDED, SHARE_GRANTED and REPORT_READY are missing. Since 2026-11-05 (ADR 0019) the work-order and service-request items are also written on the request path, so they arrive without the stream-router. ADR 0023 (built, not deployed) retires the service-request items and adds nine work-order kinds, also written on the request path |
Work orders are moving off this list (ADR 0023 D10; built 2026-11-10, not deployed). Once deployed, the
work-order counters (COUNT#WO#…, COUNT#WOHIST#<day>, COUNT#WOCUST#OPEN#<c>, the new COUNT#WOSTATUS#<status>,
and the Crown-wide ORG#ALL counters) and
the work-order search tokens (SRCH#<o>#workOrders#…) are written right after each order write, on the request
path, by the same projector code (packages/core/src/service/wo-projection-bridge.ts, one dedup id per order
version, best-effort). The stream-router's copy then becomes a no-op. The work-order assignment facts
(planAssignmentChanges) still need the stream-router. Whether the existing counters and tokens on dev are stale
has not been checked against the table (that read needs the owner's approval). The
lifecycle v2 backfill
with --counters rebuilds them for existing orders.
Why it was off. It was gated by blocker B-01 (Lambda concurrency quota 10). B-01 closed on 2026-10-26
(quota now 1000, shared with the TCP Server), so that reason is gone. Turning the bus on is an owner deploy
decision (-c busEnabled=true). After the first such deploy on a stage, run
npm run resync:plants so the TCP Server learns
plants written more than 7 days earlier,
npm run republish:orgs so it learns every
existing org's name, and the
customer counter backfill so counters include older records.
The mapping starts at LATEST, so writes made while the bus was off are never replayed: their projections are
rebuilt only by those scripts (plant events, customer counters) or by the next write to the same item (search
tokens, copies, other counters).
KI-45
The binding follows TCP only where TCP's publisher is on. Resolved on dev; open on staging and prod. ADR 0018 makes TCP the source of truth for which plant
a device is on. This server applies TCP's device.binding.changed.v1
(Integration bus).
- Dev (2026-11-04): both servers are deployed, and TCP's
cse-tcp-be-dev-eventstopic delivers tocse-http-be-dev-from-tcp. The first sync completed at 08:06Z: 6SYNCevents were applied, and 2 were stale (already applied as live changes). The queue and DLQ were 0. The console can call TCP only on dev. - Staging and prod: out of scope — dev is the only stage (Hard Rule 4, owner 2026-11-05). The console keeps calling both servers for bind and unbind (Plant devices).
- First sync: when it's turned on, TCP sends one
SYNCevent per device at 10/s (about 28 h for 1M devices). Live changes go first. Bindings that drifted during the two-call period are corrected as their device's event arrives. - Reused logger ids: a binding found only under a device's previous serial is left alone when it belongs to another TCP device, so a reused logger id can't delete someone else's binding. That other device's own event corrects it.
KI-44
The platform-wide plant list (SVC-2) has three gaps. ADR 0016 lets the built-in Super Admin and Administrator
in the Crown HQ platform org call GET /v1/plants (and /geo) without operatorOrgId and get every org's
plants, personal orgs included (committed 2026-11-03, not deployed). Still open:
- Summary counts stay per org.
GET /v1/plants/summaryreads facet counters kept per operator org and written by the stream-router. From HQ it still returns400 VALIDATION_FAILED(details.field: operatorOrgId) withoutoperatorOrgId, for every role. A platform-wide summary is a separate change. - No installer filter across orgs. Installer links are keyed by operator org, so
installerOrgIdwithoutoperatorOrgIdis400 VALIDATION_FAILED(details.field: installerOrgId). - Backfill needed after deploy. The list reads one
PLANT#<p>/LISTALLentry per plant. New plants get it in their own transactions; plants created before the deploy appear only after a human runsnpm run rebuild:projections -- --all-orgs --execute(Operations). qin the all-org list reads the platform-wide search tokens, which only the stream-router writes (KI-43).
KI-46
Invitation onboarding (ADR 0021): two points still open. The code was committed on 2026-11-06. None of the new routes has been called against dev yet, so every example on Invitations is illustrative.
- Resolved on dev, 2026-11-06: the RBAC roles backfill moved all 11 personal-org owners from Administrator to End User, and raised the HQ Installer role to the IO-9 defaults. A final dry run found nothing left to do.
- Personal orgs created before the deploy start with an Administrator owner, because the code before ADR 0021
creates them that way. Re-run the backfill after
npm run deploy:dev; it is safe to re-run. GET /v1/me/invitationsmisses older invitations. It reads a per-email inbox written since this change. A pending invitation created earlier is listed once its inviter resends it. Its token link still works.- No invitation email (KI-28). Since 2026-11-17 invitations are in-app only.
KI-47
Role edits that don't rename the role failed on DynamoDB (fixed 2026-11-06, live after the next deploy).
patchRole always sent the #name attribute name, even when the name wasn't changing. DynamoDB rejects an unused
attribute name (ValidationException), so on dev every role edit that only changed permissions, summary, note,
colour, scope rule or audit trail failed with a 500, from the console as well as the backfill. Unit tests fake
DynamoDB, so they never caught it; a regression test now checks for unused names. Fix: commit 349e2e2.
KI-48
Update 2026-11-25 (TCP side, read-only checks). The TCP FCM sender is running on dev (push switch on, FCM secret
set) and honours link, tag and platforms, so WP-1 and the field support below are done. Still open: (1) the
sender uses Firebase project cse-datalogger, while WP-1 below names crown-solar-energy-dev, and web tokens must come
from the sender's project; (2) WEB_CONSOLE_ORIGIN is unset on dev, so the click-through link is a bare path, which
FCM documents as needing to be an HTTPS URL; (3) iOS pushes fail with "Invalid APNs credential" (Firebase console).
The original entry follows.
Web push: the HTTP half is committed, nothing is sent yet. This server now leaves staff users' web tokens out of the TCP projection (End Users only), pushes work-order and report-ready inbox items, and charges the registration quota only for new tokens (Web push). It is committed, not deployed, and none of it has been exercised on dev. Still open, all on the TCP Server's side:
- WP-1: deploy its FCM sender, store the service-account credentials for
crown-solar-energy-devin its secret store, and set its push kill switch totrue. - WP-2: send each web token one message with a
notificationblock andwebpush.fcm_options.link. - Honour the new fields on
notify.push.requested.v1:link,tagandplatforms. Untilplatformsis honoured, those pushes would also reach the mobile app. - WP-4: document the alert push content.
- WP-5: publish
notify.endpoint.invalid.v1for dead tokens. This server's consumer is already built. - WP-6: write its own inbox entry before each alert push.
This server's bus must also be deployed on dev, or the TCP Server never receives the tokens (KI-43).
KI-49
Crown HQ dashboard: fleet view committed, not deployed. For a Super Admin or Administrator in Crown HQ,
GET /v1/dashboard returned 0 plants, 0 kWp and 0 regions, because it read the HQ org's own counters and no plant
belongs to HQ (bug report B-2, 2026-11-05). ADR 0024 adds a fleet-wide partition, FLEET#ALL, kept by the plants
stream projector and the plant write transactions, and the dashboard reads it for those two roles
(fleet view). Still open:
- Deploy, then run the fleet backfill once. Until then, plants written before the deploy are not counted.
- The counters need the stream-router (KI-43).
- Plants of a suspended org stay in the totals (owner decision 2026-11-11).
GET /v1/plants/summaryfrom HQ still needsoperatorOrgId(KI-44).
KI-50
Role boundaries: deployed to dev, backfills run. The console request "Business, Installer and End User access" (2026-11-11) is on dev since 2026-11-12 (Role boundaries). Run on dev on 2026-11-12 (human-run, dry run first each time):
- RBAC roles backfill: raised 2 Installer
roles to
reports: MANAGE; no Administrator left to move in customer or personal orgs. - Customer list backfill:
19 personal-org entries; platform counters
active=19 personal=19(dev has no Business customer orgs). A first run had a bug that skipped personal orgs (they arekind: CUSTOMER); fixed in95a20f1before the real run. - Crown staff masking backfill
with
--by-membership: 19 access-log entries and 2 work-order events marked; nothing else matched. rebuild:projections -- --all-orgs --execute: 19 personal orgs, 15 plants, 61 search tokens, fleet totals written, 0 failures. A first run found personal orgs through Cognito users only and skipped one no user points to (a second "Crown Admin" personal org with 1 plant); the script now reads every personal org from theORGCODE#guards (332584b) and the re-run counted all 15.- Resolved 2026-11-12 (deployed to dev): an Installer's customer list has no plant cap; the Crown-wide customer list has tiles (zero until the every-org customer-list backfill runs); a Business no longer grants End User or lists the Business role.
- Alert actions are TCP-owned: HTTP now issues the
pm/vpticket claims the TCP Server uses to hide Crown staff there; the TCP side is committed incse_tcp_be(437fbcd, 2026-11-12), deployment not verified here. - 2026-11-12 (committed, not deployed): Installer-type roles are stored with scope
NONEon invite, invite edit, member role / scope change and bulk assign. Still open (decision C-2): existing Installers stored with another scope keep it — and §6 still keys on the stored scope — until their role or scope is next changed. - 2026-11-12 (console authorization audit; committed, not deployed): Installers stored with
NONEstill see work orders, maintenance history and reports on their assigned plants; WO-4 now also coversWO-lookups and an alert's linked work orders; scoped members are narrowed on access requests,CU-/PB-lookups and partner businesses; Crown staff masking fails closed. Still open: notification rules (/notification-rules) are org-wide for any member withalerts ≥ VIEW(what an Installer may see of a rule is not decided), and an audit reported roster / maintenance-plan reads as org-wide forservice ≥ VIEW(not re-checked).
KI-51
Profile picture: metadata kept, own picture only. The Profile picture API (committed 2026-11-11, not deployed) stores the uploaded bytes unchanged after checking type, size and magic bytes. Still open:
- EXIF is not stripped server-side. Doing it would need an image library in the Lambda. The client must re-encode (crop/resize) before upload, which drops EXIF; the app teams' checklist says so.
- Only the owner can read the picture. No route returns another user's picture (team members, work-order
assignees,
POST /v1/users/lookup). Showing it there needs an access rule for who may see whose picture. - Account deletion has no HTTP route today, so nothing removes
avatars/<sub>/*when a user is deleted.
KI-52
Sign-in records: committed, not deployed; three gaps remain. The session fixes of 2026-11-12 (one record per
sign-in, EXPIRED after the refresh-token lifetime, :end-others, refusal on every route, ipAddress,
expiresAt) are in code on main, not on dev. Still open:
- No IP-location provider.
locationis resolved from the console-forwarded IP through a pluggable resolver with a per-IP cache, but no provider is wired (which service may receive users' IP addresses is the owner's decision). Until thenlocationis absent on every row; the console shows "Location unavailable". - Cognito cannot revoke one sign-in's refresh token server-side.
RevokeTokenneeds the token itself andAdminUserGlobalSignOutends every sign-in. After{sessionId}:endor:end-othersthe ended device can still refresh until its refresh token expires (1 day, or 90 days for "Remember me"); every token it gets is refused401 SESSION_REVOKEDby this API, and the web console revokes its own refresh token on that answer. - TCP WebSocket: closed at once since 2026-11-30 (QA B5), with one exception. Tickets now carry the
sign-in's
origin_jtiasoj. Ending a sign-in (current:end,{sessionId}:end,:end-others, and the other sign-ins onpassword:report-change) publishesaccess.revoked.v1 {scope: USER, reason: SESSIONS_ENDED, originJtis}, and ws-gateway closes those sockets at once. This needs the integration bus (busEnabled). The exception: a socket whose ticket was issued before this change, so has nooj, is closed too, but that ticket can reconnect until it expires, at most about 11 minutes as before. The TCP side's own gap (unticketed legacy mobile messages whileWS_AUTH_MODE=optional) is documented bycse-tcp-be. - Rows written before the deploy that were never tied to a token are hidden, not deleted; they expire by TTL.
KI-53
Push for End Users only, and the push toggle: the HTTP half is written, nothing is deployed. ADR 0025
(2026-11-13) adds pushEligible to notify.user.v1, sends no endpoints for staff on any platform, republishes
notify.user.v1 on every membership change and on every notifications preferences save, and makes
pushEnabled: false block CRITICAL pushes too (details).
Not committed and not deployed; nothing has been exercised on dev. Still open:
- TCP Server: treat
pushEligible: falseas "no push at all" for that person, including the tokens the app registered over the ws-gateway WebSocket andnotify.push.requested.v1. Treat a missingpushEligible, or a user that was never projected, as eligible. Stop the CRITICAL override from pushing pastpushEnabled: false. Accept the newNOT_ELIGIBLEreason in the conformance vectors. - After the HTTP deploy: staff whose tokens live only on the TCP side have no
notify.user.v1until the next reconciliation run completes (it projects every member of a Platform, Business or Installer org). Until then the TCP Server treats them as eligible. - Mobile app: the toggle is
PATCH /v1/me/preferences{"notifications":{"channels":{"push":false}}}(Account settings). No new route.
RBAC v2 (ADR 0026): deployed to dev 2026-11-13; follow-ups (carried-in shares, customer backfill, a new Business
after close, work orders cancelled on detach, blocked badge, legacy plants moved) built 2026-11-14, not deployed
yet. Business
suspend/restore/close/reopen with End Users unaffected, self-serve Business onboarding, join codes and join
requests, the connected End User remote-control switch, plant moves on join/detach, Business plant-delete rules and
user block (A/B) — see RBAC v2, including its known gaps. Needs a human deploy, the
backfills (backfill:rbac-roles --only installer, backfill:rbac-v2, backfill:rbac-v2 --only customers) and
republish:orgs; the TCP half in cse_tcp_be is deployed to dev.
KI-54
Plant hasBattery is derived from the plant's devices (2026-11-18): written, not committed, not deployed. Battery
details moved from plants to devices on the TCP server (batteries). This server no longer stores any battery field
on a plant; hasBattery in every plant response is true only when a device bound to the plant has a battery, which
this server learns from the new hasBattery field on device.binding.changed.v1
(integration bus). Still open:
- TCP Server (implemented 2026-11-18, not deployed):
hasBatteryis on everydevice.binding.changed.v1(falseonERASE), with a new event (higherseq,reason: SYNC) when a device's battery count goes 0 ↔ non-zero. TCP's migration 0138 sendshasBattery: trueon its deploy for the devices of plants that had exactly one in-service device. Deploy this server first, so those events are not lost. - Other plants: report
hasBattery: false,gridTopologywithout_BACKUP, and the battery-temperature alert defaults to off, until a battery is added to one of their devices on the TCP server. - Stored data: old plant items keep the retired attributes until
npm run migrate:strip-plant-battery -- --stage dev --applyruns (Operations). Nothing reads them. - Mobile app: older builds that still send wizard step 4 keep working (the fields are ignored). Remove step 4 and add batteries per device on the TCP server.
KI-55
Plant ownership, share and unshare (2026-11-20, ADR 0029): committed, not deployed. Plant create takes no battery
data (old fields ignored), every new plant stores its owner, share sets the owner to the end user (Crown staff may pick
a Business for an independent end user), and POST /v1/orgs/{orgId}/plant-unshares (removed 2026-11-27, ADR 0035) made the caller the owner
(Plants). Not exercised against dev. Still open:
- Backfill: older plants have no stored owner until
npm run migrate:plant-owners -- --stage dev --applyruns (Operations); until then their events keep the old derived owner. - Owner questions: unsharing a plant that sits in an end user's own account (
PLANT_IN_PERSONAL_ORG) or that the End User brought into the Business (PLANT_BROUGHT_IN) is refused rather than moving the plant. - No owner left: when a staff owner leaves a Business that has no other Business-role member, the plant keeps the leaving user as owner.
KI-56
Role defaults and permission rules RBAC-S1 … S13 — CLOSED (2026-11-27). Built, deployed to dev, and every
backfill below has run. The rules themselves are in the
Role permissions matrix.
- TCP-owned parts (
cse_tcp_be): done. RBAC-S3 on the TCP side is ondev: migration 0156 is applied, and the backfill for older rows was committed ondev_telemetry_dbon 2026-11-27. A caller outside the Crown org gets "Crown Support" instead of a Crown staffsubin the operation log, its CSV export, theuserSubfilter, device events, Activity Trail detail, and command and bulk-task replies and pushes (Operation log, Commands, Activity Trail detail). RBAC-S8 is closed by owner decision (register writes need no second-person approval). RBAC-S12's device-transfer check is gone, because device transfer has been removed. - Old Crown actors on the HTTP side: done.
backfill:via-platform -- --by-membership --applyhas been run ondev(2026-11-27), so records written before 2026-11-12 by Crown members show "Crown Support" to callers outside the Crown org. A dry run with--include-former-crown(which also counts the Crown org's 1 REMOVED member) found nothing left to mark (Operations). - Not open items, standing behaviour (owner decisions): Installer roles created before the change keep their
reportslevel until each Business lowers it (note ² in the matrix), and connected End Users have the reduced levels in note ¹ of the matrix, including that their earlier shares on Business plants are not revoked.
KI-57
Member, share and access-request counters were never maintained (fixed on dev 2026-11-25; access-request rebuild added 2026-11-26)
@cse/core's barrel loaded the members, shares and accessRequests collection registrations with
export {} from '…'. esbuild (the Lambda bundler, and vitest) drops that line as an empty re-export, so the
deployed stream-router never registered those three collections. Confirmed by bundling stream-router.ts: 7
registerCollection calls before the fix, 10 after. As a result, on every deployed stack:
COUNT#members#…never moved: members liststatusCounts.ACTIVE/SUSPENDED,members/summarytiles,roles[].memberCountand departments'memberCountread 0 (console review 2026-11-25: "0 People", "3 of 0 shown" in the Crown org);- no member search tokens were written, so
GET …/members?q=found nobody; COUNT#shares#…(share level bands) andCOUNT#accessRequests#status#PENDING(/v1/me/contextbadges.pendingAccessRequests) never moved either.
Not a DLQ or a missed-write problem: the stream delivered the records and the router planned nothing for them. Dev
also had no stream mapping before 2026-11-03 (busEnabled), with StartingPosition.LATEST.
Fix: plain side-effect imports in packages/core/src/index.ts, guarded by
test/collection-registrations.test.ts. Same change: a REMOVED membership leaves every member counter (it used to
stay in its role's and department's count).
Done on dev (2026-11-25): npm run deploy:dev, then rebuild:projections --all-orgs (dry run) and
--all-orgs --execute: 40 orgs' COUNT#members#… counters and 443 tokens written, shares (none on dev) recomputed,
0 failures. The same run also rebuilt the Crown FLEET#ALL totals and deleted 7 stale items there.
Access-request counters (2026-11-26): rebuild:projections --all-orgs now also recounts each org's
COUNT#accessRequests#status#… counters from its ACCESSREQ# partition (access requests have no GSI2 list key;
see Operations). Dev dry run (2026-11-26): 41 orgs walked, 0 access-request counters to write, 0 failures. Dev holds no
access requests, so the pending access-request badge was not wrong there and nothing needs writing. The rebuild counts the stored
status, like the stream, so a PENDING request past its expiresAt still counts in the badge.