infrastructure.tuturuuu.com, apps/admin) is the
privileged operational console. It exposes workspace/account controls,
monitoring, configuration, and selected provider gateways. The existence of a
console route never bypasses its operator eligibility and permission checks.
Workspace secret permissions
Infrastructure workspace-secret reads and writes require eithermanage_workspace_secrets or manage_workspace_roles in the root workspace,
checked server-side. This includes rate-limit secrets, AI-agent secret operations
and external-app registry secrets. Workspace ownership alone does not grant
this access.
Creating, updating, renaming or deleting MANAGED_CRON_ENABLED also requires
a verified Tuturuuu staff identity, checked against current Auth state, matching
Web. Updates check both the existing and proposed secret names, and the route
then writes the secret with the service role. The database enforces the same
boundary: a workspace_secrets trigger rejects direct anon/authenticated
writes whose old or new name is MANAGED_CRON_ENABLED, so root permissions
alone cannot change it over PostgREST. Other secret names retain the root
permission requirement without this additional restriction. Workspace role
catalogs do not expand based on email domain.
Web workspace-secret POST and PUT requests accept only nonempty string name
and value fields. Unknown fields, including ws_id, id, and created_at,
return HTTP 400 before either client writes. The workspace comes from the
authorized route context and the secret id comes from the URL; the editor sends
only the editable fields. This applies to ordinary and reserved secrets alike.
Regression coverage lives in Infrastructure’s workspace-secrets.test.ts,
infrastructure-admin-access.test.ts, AI-agent and external-app access tests,
Web’s workspace-secrets route tests, Utils’ permissions.test.tsx, and the
workspace-reserved-secrets-guard.sql pgTAP suite.
Export and request identity boundaries
Migration exports requiremanage_external_migrations in the requested workspace,
normalize workspace aliases before querying, and return at most 1,000 rows per
page. Root view_infrastructure alone does not authorize tenant migration data.
Wallet transaction exports retain their SQL-enforced transaction permissions.
AI-agent, suspension and calendar-sync handlers resolve the Infrastructure actor
through the canonical satellite helpers with the infra audience. The helpers
retain their supported Supabase session fallback when no app-session token is
present; a token for another app cannot select that fallback. Calendar metrics
and logs verify target workspace membership before admin-backed reads. STT
requires root manage_workspace_roles before calling its provider.
Global task-embedding statistics require root ai_lab; generation requires root
manage_workspace_roles. Employee email alone does not grant either operation.
The external SDK storage demo is development-only; production requests are denied
by its API proxy before SDK access. Hosted integrations must supply their own
user authorization.
Regression coverage includes the migration export boundary tests, Infrastructure
session boundary tests, Tasks embedding admin-access tests, and External proxy
admission tests in their owning apps.
Operational areas
- Workspace/user administration, internal accounts, external-app registration, account benefits, and app coordination.
- AI policy, agents, credits, rate limits, abuse intelligence/events, blocked IPs, recovery/appeals, and entity-creation limits.
- Email queues/templates/audit, push notifications, and Calendar sync.
- Mobile/desktop deployment records, versions, translations, holidays, timezones, Devboxes, and migration diagnostics.
- Monitoring for requests, logs, analytics, projects, deployments, rollouts, resources, and retained cron/control surfaces.
navigation.tsx.
The route reference lists every current
Infrastructure entry point in its numbered source pages. Feature-specific
operating rules remain in DevOps and
Commercial controls.
Fleet machine states
Infrastructure > Fleet (/[wsId]/fleet) reads the devbox runner snapshot and
shows one state per machine. The first matching state wins:
Resource readings (load per core, memory, disk) are shown only while the
heartbeat is fresh and the runner’s
reportedAt is within five minutes.
Otherwise they read Unknown or Not reported, never as zero or as the last
value. A queued, claimed or running run on a late, disconnected, untrusted or
revoked machine shows Outcome unknown. It is neither counted as running nor
assumed failed, and this view never reschedules it.
Judge sandbox limits (resource_limits) do not constrain trusted commands. They
are not lane ceilings, so Fleet reports the lane ceiling as not reported until
the balancer publishes host lanes. Run counts cover only the latest snapshot
window, and the tiles say so.
Infrastructure > Fleet > Runs (/[wsId]/fleet/jobs) lists the snapshot’s devbox
runs. Filters: all, running, queued, outcome unknown, and failed (including timed
out). A run page shows its source and the tail of its event log (the last 500
events). For a commit run, the source is the decoded __ttr_commit_run_v1__
envelope: SHA, directory and argv. The decoding is display only; runners remain
the authority. The run page never selects env or env_files. Administrators can
request a stop, which sets cancel_requested on running work; a stop request is
not proof that the process ended. Balancer runs (@tuturuuu/devbox/balancer)
use their own identities. They link here through balancer_runs.devbox_run_id
once that table ships.
Regression coverage: src/lib/fleet/fleet-model.test.ts (state precedence,
freshness, unknown run outcomes, telemetry parsing) and
fleet/_components/machine-card.test.tsx (fresh versus disconnected rendering),
src/lib/fleet/run-source.test.ts (envelope decoding and rejection) and
fleet/jobs/[runId]/page.test.tsx (unknown outcome, logs, stop permission).
Current schedulers
Hosted Calendar provider sync and smart scheduling run through Infrastructure’s Vercel schedule and authenticated Calendar gateway. The Cloudflare Cron Control Worker owns immediate notification recovery. The Docker cron runner is retired. Retained Docker controls and stale local heartbeat records do not establish the health of either hosted scheduler. Use the active runtime map to trace a job from scheduler to gateway to processor. Verify recent domain results as well as a successful scheduler invocation.Privacy and change control
Console pages and APIs are noindex, including errors, auth redirects, and non-HTML responses covered by the app policy. Search controls supplement actor, workspace, permission, token, and storage checks. Runtime logs use nativeconsole.* with the original severity; operational log-drain services are
separate boundaries.
A configuration edit, deploy action, external registration, or production write
requires its own authorized workflow. Reading a runbook or recalling a private
record is not authority to execute it.
Account passwords and access
Infrastructure internal-account API requests require fresh persisted root-workspaceMEMBER membership for the authoritative current actor before any account-service
RPC, in addition to the existing exact corporate email, permission, confirmed and
unbanned Auth identity, and MFA checks. The global workspace creator permission
override does not replace this membership requirement. Each request rechecks
membership without caching: removal returns 403 even for a creator; a membership
query error or transport exception returns 503 without exposing diagnostics.
Regression coverage: authorization.test.ts. The separately guarded CLI recovery
exception retains its documented authentication boundary below.
Administrators with root-workspace manage_internal_accounts permission use
Reset any password to select an account by email, or Reset password in
an internal account’s menu. Both dialogs accept a chosen password or generate a
20-character temporary password locally using Web Crypto. Passwords must contain
12–72 characters. The global reset dialog freezes its target and password and
prevents dismissal while the request is pending; a failed request keeps the form
editable, and a successful request exposes the credential handoff. Passwords are
not written to application logs.
The internal-account menu shows Disable access for active accounts and
Enable access for disabled accounts. Both require matching target-email
confirmation. Disable and enable accept the root @tuturuuu.com domain and
strictly validated managed subdomains such as @xwf.tuturuuu.com, preserving
the account UUID. External addresses and suffix lookalikes are rejected. This
exception does not widen profile, password, or MFA action eligibility or the
exact-root administrator identity requirement. Enable removes the provider ban; it does not change the password
or perform managed-employee restoration. These existing password/access actions
have no optional activation gate. Current administrator identity, permission,
target eligibility and self-target protections still apply. Administrators cannot
use these actions on their own account; managed-employee lifecycle recovery
continues through its separate inspection and restoration flow.
Regression coverage: account-password-reset-dialog.test.tsx exercises password
bounds, pending-request protection, generation and refusal;
internal-account-row.test.tsx exercises the existing active/disabled menus and
self-target controls; service.test.ts verifies exact confirmation and provider
ban changes, managed-subdomain disable/enable UUID preservation, unmanaged-target
rejection, and unchanged root-only profile/password/MFA eligibility. Route authorization and password-boundary suites cover the existing
Infrastructure API contracts. These synthetic tests do not establish provider or
production acceptance.
Administrator profile username input
The Infrastructure internal-account profile dialog accepts administrator usernames without product minimum or maximum length limits. Input is trimmed and lowercased; empty input clears the username. Changed nonempty usernames start with an ASCII letter or digit and contain only lowercase ASCII letters, digits, and underscores. An unchanged legacy username can be retained while editing the display name. Usernames must be unique; reserved names and availability are checked by the server when saving. This administrator input policy does not change ordinary self-service username rules or workspace handles. Transport and storage safety limits remain separate from product input policy. UI and service regression coverage lives ininternal-account-edit-dialog.test.tsx, profile-service.test.ts, and
managed-profile-service.test.ts; these tests do not establish database or
production acceptance.
Diagnose an internal profile save failure
The internal profile dialog sends a same-origin UUIDPATCH through
updateInternalAccount in packages/internal-api. Infrastructure owns this
route and its profile service. Web’s satellite rewrite inventory does not forward
this legacy UUID route. The employee subtree below has a separate owner.
The generic update toast does not identify the failing boundary. Inspect the
existing failed request’s HTTP status and response message first, then the owning
Infrastructure request logs. Do not replay a profile mutation to gather evidence.
Keep credentials, request bodies, provider error details, and account identifiers
out of shared diagnostics.
profile-service.ts emits Internal account profile stage failed on a returned
database failure, with a fixed profile_read, username_reserve, or
profile_update stage and an allowlisted code. Unrecognized or absent codes become
unknown. A successful profile lookup that returns no row also logs profile_read
with code unknown and returns HTTP 404; this event does not necessarily indicate
a database error. These events do not prove a specific SQL trigger caused the rejection.
They do not cover earlier authorization, provider lookup, or thrown transport
failures. Missing events alone do not prove that execution stopped earlier.
Returned username-cleanup failures emit Internal account profile cleanup failed
with a fixed username_rollback or previous_username_release stage and the same
code allowlist. Cleanup diagnostics omit account IDs and raw error fields. A
thrown rollback rejection emits username_rollback with code unknown and
preserves the original profile-update failure. Returned previous-username cleanup
errors preserve the successful profile response.
For an update-stage 42501, a separately authorized read-only SQL inspection can
compare the target’s canonical users.display_name with the registry’s
infrastructure_employees.managed_name and confirm the installed managed-name
trigger. Registered employee names remain managed: changing the public name away
from that managed value is rejected even for a service-role write. Do not bypass
that fence or widen administrator authorization to make the toast disappear.
23505 indicates a uniqueness conflict; PT429 indicates a profile change limit.
Confirm the exact database error before attributing either to this incident.
profile-service.test.ts covers each returned failure stage, unknown-code privacy,
unchanged status/rollback behavior, cleanup returned errors and rollback rejection,
explicit read/reserve/update/cleanup ordering, and success without failure logs.
apps/database/supabase/tests/employee-signup-guards.sql covers the managed-name
fence through the public profile RPC. Service mocks do not establish deployed
schema, provider, transport, or customer acceptance.
Employee API routing
Web owns/api/v1/infrastructure/internal-accounts/employees and its descendants,
including CREATE readiness, employee inspection, restore, and reconcile.
Infrastructure forwards that exact subtree in beforeFiles, including the base
path with zero wildcard segments. A fallback-only rewrite lets the local
internal-accounts/[userId] PATCH route capture employees and answer GET with
an empty 405 before Web can handle it.
The local internal-account list and legacy UUID PATCH remain in Infrastructure;
address-migration endpoints retain their existing Web fallback. The installed
Next matchers in apps/admin/next.config.test.ts cover these boundaries.
Routing checks do not establish downstream readiness: require the exact-commit
Infrastructure CI build and an authorized production recheck after deployment.
Employee SQL transport qualification
HTTP RPC runtime candidate
The Web employee CREATE route can compose the durable operation journal with fixed service-only Supabase RPCs. CREATE is available by default to all authorized root administrators withmanage_internal_accounts; no administrator activation
exception or EMPLOYEE_CREATION_RUNTIME_ENABLED opt-in applies. Server
configuration and SQL/provider readiness still determine availability.
Infrastructure consumes the same availability endpoint; its create control
remains disabled while the runtime is unavailable. Isolated SQL, generated-type,
HTTP/Auth, target-project migrations and exact-build checks remain release evidence.
The adapter uses the configured server Supabase project for both Auth and SQL.
The request still requires an eligible root administrator, current membership and
permission, and the account-action origin/header checks. SQL repeats the actor
assertion and denies expanded function ACLs. An original actor/operation key owns
one target UUID. Durable attempted phases and single-use invocation capabilities
precede provider effects; unknown responses retain that identity for inspection.
Every RPC write acknowledgement is followed by a separate persisted-state
observation. A function response from a transaction configured to roll back cannot
authorize provider creation or publish account success. Lost responses, malformed
state and readback disagreement fail closed without an automatic retry. Passwords
remain transient Auth inputs and never enter the operation tables or RPC body.
This adapter does not activate the fixed child-worker prototype below. That
prototype retains its separate operator, connection and asset qualification
requirements. RESTORE and legacy-domain migration remain separate runtime flows;
successful CREATE qualification does not establish either behavior.
In the Infrastructure CREATE form and Web boundary, the shared password schema
requires 12–72 characters with lowercase and uppercase ASCII letters, a digit
and ASCII punctuation before journal admission. The password remains transient.
Normal success confirms that the account is ready to sign in without an extra
observation request. After an uncertain response, the browser retains the original
operation reference scoped to actor and workspace, without retaining the password,
and admits up to six observation checks within 30 seconds of the first check.
These reads never replay CREATE. Completion requires independent active onboarding
identity and fresh SQL account/profile/mailbox/grant proof; incomplete outcomes
retain the original operation and stay blocked against another CREATE. This
behavior does not promise a creation latency. Regression coverage and remaining
runtime evidence are recorded in the
CREATE qualification contract.
CLI recovery of an existing CREATE operation also supports read-only
GET .../operations/{operationId}/cli-recovery?view=outcome with the same platform
CLI access credential. Fresh CLI MFA, current canonical email, root membership
and permission checks apply before reads and before disclosure. This view binds
the original actor/operation and requires provider plus fresh SQL proof; it never
resumes or mutates. Default rejection GET and version-3 POST resume keep their
existing contracts. Infrastructure audience authentication remains separate.
See the CLI recovery runbook
and its CLI outcome route/client regressions for strict HTTP and identity checks.
Managed employee inspection
Web servesGET /api/v1/infrastructure/internal-accounts/employees/:userId
for the native Infrastructure management client. It returns the retained
restoration inspection contract, provider observation time and next action.
It requires a current confirmed, active canonical-domain root MEMBER with
manage_internal_accounts; it rechecks the same request actor before SQL and
before disclosing private recovery details. Responses are private and uncached.
The adapter reads the exact provider UUID and calls only
private.inspect_employee_management in the same configured Supabase project.
Missing schema, conflicting tuples, unavailable reads and changed authority fail
closed. An unresolved restore operation remains inspect; it never relaunches
provider work. Unmanaged legacy addresses remain an adoption/migration concern.
The portable restoration boundary lives under
packages/utils/src/internal-accounts, with Infrastructure compatibility exports.
This GET path does not enable CREATE, RESTORE writes or legacy-address migration. No runtime flag is changed. Route and transport
regressions live beside the Web implementation, while the existing Infrastructure
restoration suites cover compatibility. Exact-source CI builds, deployed request
authentication and target-project SQL qualification remain separate release gates.
RESTORE and reconciliation POST candidate
Web ownsPOST /api/v1/infrastructure/internal-accounts/employees/:userId/restore
and the sibling /reconcile route. Both are available by default to all authorized
root administrators with manage_internal_accounts; no administrator activation
exception or EMPLOYEE_RESTORATION_RUNTIME_ENABLED opt-in applies. Configuration,
request authorization and lifecycle/SQL/provider guards remain mandatory. The
Infrastructure console consumes this contract through the managed-access dialog
below; legacy-domain address migration remains a separate flow.
The routes reuse the portable restoration HTTP/orchestration helpers, with
Infrastructure compatibility exports. The server supplies the actor and provider;
strict request input supplies only confirmation email, expected revision and,
for reconciliation, the original operation UUID. Current request authentication,
root membership/permission and active canonical-domain actor checks repeat before
every RPC and provider call and before a successful or pending response is disclosed.
The fixed five-function transport uses the same configured Supabase project for
Auth and SQL. Separate inspect_employee_management requests must observe the
matching reserved and attempted operation before the sole provider unban. SQL
confirmation/reconciliation receipts must match independently observed completed
state, revision and managed name. Rollback responses, missing or malformed
readbacks and lost responses retain an unknown outcome without automatic retry.
Reconciliation uses the original actor/target/revision/operation tuple and never
begins an operation or dispatches another provider mutation.
employee-restoration-rpc.test.ts and employee-restoration-runtime.test.ts in
Web exercise actual loopback HTTP against a disposable synthetic SQL endpoint,
including unpersisted replies, revocation and provider acknowledgement loss.
The shipped route test proves RESTORE and reconciliation work with unset or false
activation flags independently of CREATE, while nonadmins and unavailable server
configuration remain denied. employee-creation-runtime.test.ts covers the same
production-composition policy for CREATE and retains SQL-readiness failures.
The retained Infrastructure suites cover helper compatibility. These fixtures
qualify source and HTTP serialization only: before release, independently
verify the five deployed function definitions and service-only ACLs, commit and
rollback/readback behavior through real PostgREST/PostgreSQL, request-session
and actor revocation behavior with real Auth, and the exact-source Web and
Infrastructure CI builds. Production migration completion and authorized
delivery remain release-owner gates; neither GET inspection nor CREATE
qualification establishes RESTORE delivery.
Simple account forms
For root administrators in Infrastructure, Create uses staff email, full name and an in-memory temporary password. Readiness and bounded original-operation confirmation run automatically; the form reports readiness only after existing creation proof succeeds. Password generation uses the existing cryptographic sampler; explicit password copying requires the secure clipboard and reports failure without logging the credential. Save the CREATE credential before submitting: its field clears after submission and on close, and never enters recovery storage. Password reset accepts a new credential through its ordinary form, supports Enter, and prevents simultaneous duplicate submissions. Its explicit credential handoff remains available until close; administrators must share it securely. The Create dialog accepts the root workspace UUID and theinternal route alias,
including its case variants. Both use the canonical root UUID for component,
query and saved-operation scope, so switching between these routes preserves an
unknown original CREATE without another POST. Personal and non-root workspaces,
and sessions without an actor, do not expose Create. Server permissions and actor
lifetime checks remain authoritative. Mounted regressions in
employee-creation-alias.test.tsx cover these routes and retired-actor results.
These Infrastructure forms distinguish a failed availability read from confirmed
unavailability; Check availability again performs only a GET and cannot admit
CREATE. Input, authorization and local recovery-storage failures have separate
safe guidance. A bound non-admission receipt proves only that invocation stopped
before claim: the original UUID, actor, email and name stay retained for inspection,
including after generic errors. Unknown outcomes never clear intent or replay.
Secure password generation failure leaves the existing value and visibility intact
and offers manual entry in Create, row reset and reset-any-account forms; passwords
never enter recovery storage. The directory defaults to active, verified accounts;
Include disabled accounts changes only the existing active filter. A disabled
row grants no restoration eligibility. See the
mounted regression tests:
employee-creation-dialog.test.tsx, temporary-password-field.test.tsx and
internal-accounts-client.test.tsx.
Ordinary messages explain the next action without requiring UUID, digest, revision
or provider-state inspection. Advanced recovery retains technical observations and
explicit audited CREATE adjudication for exceptional failures. Unknown CREATE
never silently replays or receives a replacement operation. Legacy migration and
retained mailbox adoption remain separate, and neither is authorized by Restore.
These defaults cover the active Infrastructure forms; backend readiness, conflict,
self-action and actor/workspace fences remain authoritative. Coverage includes
employee-creation-dialog.test.tsx, account-password-reset-dialog.test.tsx and
the restoration regressions below. Hosted login and production account delivery
require separate acceptance by the release owner.
Managed-access console
The Infrastructure account directory exposes Restore access for other accounts. Opening the form automatically checks current state; only an active, managed, mailbox-ready canonical account with a confirmed provider ban and a RESTORE next action offers restoration. Creation recovery, adoption, conflicting or unconfirmed provider state and legacy migration have explanatory states without a restore button. This dialog never renames an account or implements stable-UUID legacy-domain migration. Confirmation requires the exact inspected account email. Every submit performs another uncached inspection and compares revision and operation before dispatch. The portable consumer retains the original expected revision and server operation UUID across pending results and dialog close/reopen. A lost POST response blocks another RESTORE in that dialog lifetime, even if a subsequent read has no operation. Pending or uncertain replies expose read-only inspection of the retained request; the form does not invoke reconciliation or offer another mutation for it. A latched revision/operation conflict remains visible and blocks subsequent mutations even after another inspection. The portable consumer’s explicit reconciliation API is unchanged and remains separate from this ordinary form. It never automatically repeats RESTORE or reconciles on dialog open. No client-generated replacement UUID or blind POST retry is used. State is private and ephemeral; a new page lifetime recovers operations from the authorized persisted inspection rather than browser storage. RESTORE is enabled by default for authorized root administrators at the Web endpoint. Inspection does not advertise write availability. A capability-unavailable response therefore locks writes for the current dialog lifetime while preserving read-only inspection and any retained uncertain operation; it does not establish account absence. Session and permission denial retires actions until the page is reauthorized. Client actor lifetime checks surround each awaited stage, while the endpoint remains authoritative for current actor, root membership and permission. A successful POST alone is not displayed as restored. The console requires a separate GET showing the matching completed operation, original revision plus one, managed active registry, ready mailbox and confirmed active provider. Missing, malformed, mismatched or failed readbacks preserve uncertainty. Directory status and private management state remain separate observations.employee-restoration-consumer.test.ts covers revision/UUID fences, explicit
reconciliation, unavailable capability, duplicate admission and revoked actors.
employee-restoration-dialog.test.tsx covers rendered English/Vietnamese controls,
automatic readiness, exact confirmation, inspection-only pending recovery and revision conflicts,
replacement-operation denial, pending close/reopen, independent readback and actor replacement.
These are synthetic source regressions. Exact-commit Infrastructure/internal-API
CI and authenticated deployed session/provider/SQL acceptance remain separate;
no runtime flags, account activation or migration are performed by the UI change.
Fixed child-worker prototype
The fixed child-worker transport remains unavailable until its protected SQL supplier and project readiness are independently qualified. The fixed transport prototype accepts only preflight, finalize and activation-confirm operations. Each request owns one terminable child and TLS connection; no shared pool, caller SQL, account password or inherited database configuration enters that boundary. The executor is shared through the server-only@tuturuuu/inventory-core/infrastructure/employee-sql/process leaf; only this
leaf’s dependency closure is framework-free. Original Infrastructure entry
points remain compatibility entries, while the canonical raw worker and protocol
are colocated under packages/inventory-core/src/lib/infrastructure/employee-sql/.
Before binding the Web supplier, verify that the compiled route’s .nft.json
trace and resolved fork() target load the canonical worker, protocol, and
runtime dependencies. Relocation requires qualification of the exact source and
build with refreshed signed attestations, even when raw worker/protocol hashes
are unchanged.
The parent requires external Ed25519-signed project and execution attestations,
including the exact worker and protocol hashes. Missing bindings deny before
spawning. Ordered, same-connection catalog checkpoints validate the role, cluster,
ledger, function bodies and effective privileges before effects and COMMIT.
The parent records an uncertain commit before authorizing COMMIT; lost commit
acknowledgement never authorizes a blind retry or replacement account ID.
The process requests cancellation at 13 seconds and kills only its owned child
at 14.5 seconds, reserving cleanup time within the qualification profile’s
15-second budget. It waits for actual child closure. Client process/TCP drain
controls do not establish server transaction rollback or row-lock release.
Before wiring the supplier, qualify delayed connection/query/lock/COMMIT cases
against disposable PostgreSQL, verify backend and lock drain, and verify the
static worker/protocol assets in the exact hosted Next build and file trace.
Source tests, schema assertions and signed synthetic fixtures cannot replace
those gates or activate account creation.
Legacy employee address migration
The internal-accounts page has a separate legacy address migration dialog. Migration changes the original UUID’s@xwf.tuturuuu.com address to the same
localpart at @tuturuuu.com, preserving its identity and linked data; RESTORE
instead re-enables a previously suspended managed employee at its existing
address. Neither flow creates a replacement account. Migration does not repair
verification or claim/provision somebody else’s mailbox. It requires existing
approved active source and destination mailboxes owned by the original UUID,
email-provider readiness, revision zero and no CREATE/RESTORE registry ambiguity.
A separate bounded exception supports a confirmed legacy account whose sole
Google identity already verifies the exact canonical destination with matching
provider ID/subject. The explicit Web address-migrations/prepare endpoint may
first adopt an empty, unowned, disabled canonical personal mailbox, then requires
committed ownership readback before a fresh migration binding. Quarantined,
archived, populated, shared or owned mailboxes remain unavailable. This path
needs no source mailbox and permits only GoTrue’s one verified email identity
addition while preserving the original Google identity/data exactly. Completion
stores distinct actual before/after fingerprints. See the supplier contract and
qualification. The
Google provider and Web state-flow regressions plus the separate 30-assertion SQL
packet cover this exception with the stated fixture boundaries.
Web migration availability follows current root administrator permission,
configuration and fresh SQL/provider readiness. Neither composition nor
reauthorization consults an optional activation environment flag; unset or false
legacy migration flag values do not block an otherwise authorized operation.
The operator can supply the existing operation UUID before the first action;
leaving it blank creates a new operation only for a new intent. The first inspect
or explicit preparation freezes and retains the exact operation UUID, target UUID,
source, destination and revision, including after denial, dialog reopening and
same-session remount. The locked fields cannot mint a replacement operation.
Mailbox preparation is an explicit, separate administrator action. It requires
retyping the exact target UUID and both addresses and calls only the existing
address-migrations/prepare endpoint. Neither inspect nor migrate silently
prepares a mailbox. Preparation acknowledgement is shown separately and requires
inspection before migration. Migration requires both exact address confirmations
again and a fresh authorization/readiness inspection before its single request.
Recovery distinguishes unattempted, prepared, uncertain inspection/preparation
and dispatched migration receipts. Unknown preparation stays inspect-only until
inspection positively observes exact readiness, which may unlock migration only.
Denied, forbidden or invalid inspections never clear the preparation fence or
allow another preparation. A dispatched migration, including an old
bare recovery tuple, never regains dispatch permission, even after a ready or
denied inspection. Unknown reads cannot remove either write fence. Independently
observed completion is required. Recovery storage is scoped to actor/workspace
and this browser session; changing actor/workspace retires the old workflow.
No password or token is requested.
This decision applies only to the Infrastructure operator surface and Web
migration endpoints; CREATE/RESTORE keep their existing contracts. The
address-migration-session.test.ts, address-migration-dialog.test.tsx, Web
migration runtime tests and typed consumer tests cover these boundaries with
fixtures. Hosted mail ownership/delivery, full-schema qualification,
exact-commit CI and the named real account’s preservation remain separate gates.
See the migration runbook.
Employee POST origin boundary
Web owns CREATE, RESTORE/reconcile and address-migration POST handlers behind Infrastructure’s external rewrite. Next preserves the browserOrigin while
changing the destination Host, so the request URL alone cannot identify the
browser’s origin. A configured production Infrastructure origin is accepted only
with a cryptographically verified app-session bearer targeted to infra.
Forwarded host/protocol headers never grant this exception. Actor, root membership,
permission and operation checks remain required independently.
Foreign origins and cross-site fetch metadata remain denied. Direct Web requests
retain their existing same-origin and non-browser bearer behavior. Migration
continues to reject missing-origin cookie requests. No runtime flag is enabled by
this boundary. employee-request-origin.test.ts covers signed tokens, wrong app
and forged credentials, spoofed forwarding headers and all three active adapters;
it does not certify production Auth, SQL or provider actions.
Feedback schema admission
The feedback schema candidate reuses the canonical employee registry. Staff eligibility requires an active registry tuple matching the confirmed current corporate email, no current ban and a Boolean employee-onboarding marker; the service-only wrapper delegates to the same private assertion used by inbox reads. A domain match alone grants no access. Reports remain private; ordinary actors receive only their own content-free receipt, and staff reads grant no management capability. This schema scope does not change employee CREATE or RESTORE rules. The active Web routes/api/v1/product-feedback, /{id} and /eligibility
now bind the existing read factories to the schema-backed service. The staff
inbox at /{workspace}/feedback and its navigation entry require fresh eligibility;
workspace permissions alone do not grant access. English and Vietnamese views
support title search, bounded cursor pages, inbox/resolved/archive filters and
revision/updated/archive state. Detail text is rendered as plain text. The current
contract is intentionally read only; no status mutations, media URLs or reporter
identities are disclosed by the metadata/detail RPCs. A detail 404 or transient
failure stays inside the selected report while the list remains usable; 401/403
hides the list and cached private detail. Other list/eligibility failures show a
load error. Component regressions cover these distinctions. Navigation starts
staff eligibility only after workspace permission succeeds, overlapping preference
reads. Navigation and page share React request-scoped memoization, with no result
retained across requests; scheduling/denial tests preserve the admission guard.
PRODUCT_FEEDBACK_STAFF_INBOX_ENABLED remains default off. Auth and RPC reads
share a ten-second invocation allowance, with the existing SQL three-second
statement and 500 ms lock limits; there are no retries. PT403 maps to a sanitized
403; schema/provider faults map to 503. Synthetic service composition regressions
exercise current identity and SQL denials through the real PostgREST serializer;
they do not establish hosted database or browser acceptance.
Feedback CLI --json errors use one sanitized { error: { code, status, message } } object on stderr, empty stdout and exit code 1, including invalid
arguments and missing credentials. Argument validation precedes configuration
and network work. Provider details and credentials never enter this projection.
Regression coverage: feedback-entry.test.ts drives the actual source entrypoint;
feedback.test.ts also covers client-construction and transport failures.
Feedback availability remains off pending separate activation. The default-off
hosted feedback profile retains the original105 rollback assertions plus correlation31, for106 after the canonical
employee foundation. Its eligibility fixture constructs synthetic identities without
personal membership by temporarily suppressing only the named personal-workspace
bootstrap trigger, then requiring its exact normal state restored before assertions.
This does not prove canonical employee signup lacks membership; that behavior remains
a separate parent audit item. The retained older277 result does not qualify this new278 profile or causal phase.
The profile flag selects test packets only; every disposable profile applies the
full tracked migration snapshot. It does not activate feedback or prevent schema
application in other profiles, whose results do not qualify feedback coverage.
See the schema qualification runbook
for the exact hosted profile, full-history requirement and remaining evidence.
The optional default-OFF feedback causal profile tests eight single-removal
counterfactuals only in the owned hosted database, requiring exact targeted RED,
transaction rollback/catalog equality and restoration GREEN. Synthetic tests and
source hashes are not SQL proof. The domain-regexp check has a structural redundancy
disposition, not observed mutation coverage; ACL/registry availability remain ordinary
denial coverage. No production staff predicate or feature flag is changed.
Rejected first employee creation
The default for an unknown employee CREATE is to retain the original operation and prohibit replay. In the root Infrastructure account dialog, the original administrator may explicitly adjudicate a terminal rejection of the first Auth attempt at unknown/version 2. This exception requires retained evidence, an explicit no-request-in-flight attestation and independent SQL absence checks; nearby logs or absence alone do not prove rejection. A failed adjudication remains bound to its original event, evidence digest and identity tuple. After a fresh matching eligible readback, the administrator may explicitly retry that same adjudication and attest again. A committed readback enables the original CREATE without another adjudication; fenced or changed identities remain blocked. Old references without the retained tuple remain inspectable but cannot be retried. The recovery helper and rendered dialog regressions cover this distinction. A committed one-time repair preserves the UUID, intent and history and returns reserved/version 3. Matching audit readback unlocks a fresh password field for one explicit normal CREATE submission with the original UUID, email and name. Neither closing the form nor losing the repair response clears that reference. Uncertain repairs stay fenced for explicit readback. Later phases, revoked operations and other actors/workspaces are excluded. Route, recovery helper and dialog regressions enforce this rule; the optional disposable Web session fixture exercises authenticated adjudication and CREATE end to end. Older interrupted employee creation requests without a saved browser reference can be loaded under Advanced recovery using their original operation ID. The server supplies and validates the account identity. Loading only observes the request; a fenced or unavailable request cannot create a replacement account. Audited recovery still requires explicit administrator action and a fresh temporary password. Regression coverage:employee-original-operation-resume.test.ts.
CLI recovery of an existing employee CREATE
Web exposes the explicitly scopedemployees/operations/{operationId}/cli-recovery GET/POST endpoint for the
original administrator when browser recovery is unavailable. This exception
accepts only a verified platform CLI access bearer with CLI origin and current
required-MFA proof. It freshly checks the corporate domain, persisted root MEMBER
membership, manage_internal_accounts, and confirmed, unbanned current Auth
identity. It grants no CLI access to ordinary employee creation, availability,
management, RESTORE or address migration routes and issues no new credentials.
Every request binds the path to Idempotency-Key. GET inspects only an owned
original operation; missing, foreign and fenced operations cannot be resumed.
POST accepts only adjudicate with the existing full explicit attestation and
evidence digest, or resume with the complete freshly read retry_ready
version-3 tuple and a fresh validated temporary password. Resume preserves the
original actor, operation, target UUID, email, name and audit identity; it rereads
that tuple before the durable claim. Unknown/pending state never admits replay.
Adjudication never automatically submits CREATE. A lost acknowledgement requires
inspection and retention of the same event/evidence reference.
Use the portable inspectEmployeeCliRecovery and submitEmployeeCliRecovery
helpers from @tuturuuu/internal-api/infrastructure. Operator setup and the
single-dispatch CLI authentication example are in the
employee qualification runbook.
Regression coverage: employee-cli-recovery-authorization.test.ts,
employee-cli-recovery-boundary.test.ts, employee-cli-recovery.test.ts, and the
existing Infrastructure authorization/runtime and rejection boundary regressions.
Hosted authentication, exact Web build CI and account delivery remain separate
release-owner checks.
Managed employee profile edits
The existing Edit profile → Save profile action supports active, consistently managed employee names and usernames. The service authenticates the current request; SQL independently requires a fresh root employee administrator. The atomic transaction updates the managed registry, public display name, private full name and canonical personal mailbox display/sender names, advancing the registry revision and appending an immutable rename receipt. It never changes UUID, email, Auth credentials, grants, membership or account access. Administrator Infrastructure profile edits allow any nonempty username length; public self-service remains 5–32 characters. The guarded managed and unmanaged SQL entrypoints provide this exception. Changed usernames retain lowercase letters, digits and underscores, must start with a letter or digit, and reject reserved names. NULL clears the username. PostgreSQL B-tree key size and storage limits still apply; this is not a guarantee that arbitrarily large values fit. The managed SQL writer uses an ungranted backend/transaction/actor/target/handle capability with fresh root authority. Onlyusers.handle and handles.value
length enforcement admits that exception; bare service writes cannot mint it.
Exact reservation ownership, uniqueness and cooldowns remain enforced. Previously
owned handles stay reserved, unlike the legacy unmanaged writer’s release of old
handles. NULL or foreign reservations are never adopted. Failed writes roll back profile, mailbox, handle,
quota, revision, capability and receipt changes.
Legacy unmanaged Infrastructure edits use a separate private atomic SQL entrypoint
with fresh root authority, exact target/email admission and nullable name/username
preimage comparison. Exact @tuturuuu.com eligibility includes disabled and
unconfirmed targets. Managed registry, intent, onboarding, CREATE, RESTORE or
address-migration evidence excludes this path. Its protected transaction context
admits the same username length exception without bypassing syntax, reservations
or quotas. The transaction releases only the target’s previous owned handle and
appends an immutable operation receipt; failures roll everything back. Independent
operation inspection verifies committed current state after success or a lost
acknowledgement, without another write. Legacy edits do not change managed names,
mailbox state or employee provenance. Regression coverage includes
employee-unmanaged-profile-usernames.sql and the versioned legacy HTTP packet.
Pending/inconsistent employees and unresolved CREATE, RESTORE or address
operations cannot be renamed. Original CREATE names, intent and journal remain
historical evidence. Terminal active CREATE observations expose the real current
displayName and, after complete SQL provenance/readiness proof, a separate
creationDisplayName binding the original request. Pending and unknown operations
retain strict original-name proof. A rename makes old RESTORE revision receipts
stale; a new RESTORE uses the new revision and current name. Lost acknowledgements
are inspected by their original internal operation reference, without a second
write or a new confirmation step.
Regression coverage: employee-managed-profile.sql,
employee-admin-profile-usernames.sql, managed-profile transport
checks, and read-only CREATE observation/client negative controls. Hosted
qualification and production acceptance are separate delivery gates.
Platform administration permissions
Infrastructure API handlers and server actions enforce the same root-workspace permissions as their corresponding administrative operations. An employee email or root membership alone does not grant platform administration.- AI whitelist changes require
manage_workspace_rolesin the root workspace. - Managed-cron domain administration requires root
manage_workspace_rolesormanage_workspace_secrets. - AI-credit configuration, grants, abuse-control mutations, entity-limit changes,
manual post-email queue drains, and project GitHub synchronization require root
manage_workspace_roles. - Queue inspection and entity-limit reads retain
view_infrastructure. Devbox control snapshots require root membership andview_infrastructure.
apps/admin/src/lib/platform-admin-boundaries.test.ts.
Entity-limit reads and all four entity-limit server actions additionally require
root-workspace MEMBER membership. Root guests are denied even when guest-default
permissions grant the corresponding read or mutation permission. This preserves
the previous membership fence without changing other administration endpoints.
Regression coverage: apps/admin/src/lib/entity-limit-membership.test.ts.
Dedicated infrastructure cron authorization
The GET jobs at/api/cron/infrastructure/docker-recovery-alerts,
sample-resources and sync-trust-cache accept a single Bearer credential.
The server compares fixed-size SHA-256 digests with Node’s timingSafeEqual before
job effects or log draining. Cookies and sessions grant no access. Missing or
invalid credentials, including missing server configuration, return 401.
CRON_SECRET takes precedence over VERCEL_CRON_SECRET; an explicitly empty
primary secret disables authorization. Responses contain only an ok status,
including job failures; caught error payloads are excluded from logs.
Calendar cron routes remain outside this dedicated exception allowlist.
Regression coverage: apps/admin/src/lib/infrastructure-cron-auth.test.ts
executes the actual handlers with fixture job suppliers; the colocated Docker
recovery tests cover email delivery and persisted incident watermarks.
Build metadata access
Infrastructure GET/api/build-info requires root workspace MEMBER eligibility
and view_infrastructure on every request. Signed-out requests return 401;
authenticated actors missing either requirement receive 403. An Authorization
header selects bearer verification exclusively, including when a valid cookie
session exists. Eligible requests retain the build payload and no-store headers.
The app name and platform version make this an ADMIN diagnostic surface. This
rule applies to Infrastructure; other apps retain their owning access contracts.
Regression coverage: apps/admin/src/app/api/build-info/route.test.ts
executes the handler, ADMIN helper and metadata factory with fixture suppliers.
Prelogin logout
Infrastructure logout accepts POST with an exact own-origin Origin header and absent or same-origin Fetch Metadata intent. This requirement applies with or without cookies and bearer headers. Rejected intent returns 403 before session cookie deletion; GET returns 405 with Allow POST and no cookie effects. Successful logout retains shared app-session and Supabase cookie deletion. Browser responses redirect to relative/login; JSON clients receive { success: true }.
Cross-app trusted origins do not grant this prelogin exception. Handler-effect
coverage is in apps/admin/src/app/api/auth/logout/route.test.ts;
router dispatch and hosted runtime acceptance require separate validation.