Files
Edwin He b0becdc002 feat: shard managed-server host + session traffic by host_id (server + web) (#2037)
Server-side changes:
- Add WRONG_REPLICA error code (400) to errors.py for host-sharding misroutes
- Thread host_id through RunnerRouter to classify misses as WRONG_REPLICA (keyless re-addressable) vs RUNNER_UNAVAILABLE
- Add WrongReplicaWSError exception and WS_CLOSE_WRONG_REPLICA (4400) for terminal attach
- Guard session send/stream routes against wrong-replica routing to raise WRONG_REPLICA before healing attempts
- Guard session create against wrong-replica routing of host-bound creates
- Wire host_registry and host_store into RunnerRouter in app.py for classifier functionality
- Replace host-offline HTTPExceptions with _host_absent_error classifier on all host-scoped routes

Web-side changes:
- Add full slice-key keying to authenticatedFetch: X-Databricks-Omnigent-Slice-Key header on host/session-scoped requests
- Implement session→host_id map (sessionHost.ts) for client-side routing
- Add host-resolve bootstrap to prevent early requests from keyless fallback on fresh page load
- Implement keyless-host demotion (evidence-based sticky fallback for keyless-routed hosts)
- Handle wrong_replica 400 response with keyless re-address retry in fetch wrapper
- Port terminal-attach WS slice-key keying and 4400 close handler (next steps beyond this commit)

Excludes: SAFE gates, DATABRICKS-PATCH markers, live-state fields, CLI client files.

Signed-off-by: Edwin He <41037314+Edwinhe03@users.noreply.github.com>
2026-08-13 01:36:44 +00:00

128 lines
4.2 KiB
JSON

{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["react", "react-hooks", "typescript", "import"],
"categories": {
"correctness": "error",
"suspicious": "warn",
"perf": "warn"
},
"rules": {
"react/react-in-jsx-scope": "off",
"import/no-unassigned-import": "off",
"import/newline-after-import": "error",
"import/no-cycle": "error",
"import/no-duplicates": "error",
"no-empty": "error",
"no-fallthrough": "error",
"no-multi-assign": "error",
"no-param-reassign": "error",
"no-promise-executor-return": "error",
"no-restricted-globals": [
"error",
{
"name": "fetch",
"message": "Don't call the bare global fetch(). Use hostFetch (@/lib/host) or authenticatedFetch (@/lib/identity) so requests route through the embed host transport. The only allowed bare fetch() is the choke point in src/lib/host.ts."
}
],
"no-throw-literal": "error",
"no-unreachable-loop": "error",
"no-useless-assignment": "error",
"prefer-object-has-own": "error",
"react/button-has-type": "error",
"react/jsx-no-useless-fragment": "error",
"react/no-react-children": "error",
"react-hooks/rules-of-hooks": "error",
"typescript/array-type": "error",
"typescript/consistent-generic-constructors": "error",
"typescript/consistent-type-definitions": "error",
"typescript/consistent-type-imports": "error",
"typescript/method-signature-style": "error",
"typescript/no-dynamic-delete": "error",
"typescript/no-explicit-any": "error",
"typescript/no-import-type-side-effects": "error",
"typescript/no-inferrable-types": "error",
"no-restricted-imports": [
"error",
{
"paths": [
{
"name": "@/lib/host",
"importNames": ["hostFetch"],
"message": "Don't call hostFetch directly — use authenticatedFetch (@/lib/identity), which stamps the auth + Dicer slice-key headers so host-scoped requests reach the replica holding the session's runner tunnel. hostFetch is the low-level transport; the only allowed direct users are the authenticatedFetch choke point and the /v1/info bootstrap in capabilities.ts."
},
{
"name": "react-router-dom",
"importNames": [
"useNavigate",
"useParams",
"useSearchParams",
"useLocation",
"Link",
"Outlet"
],
"message": "Import routing primitives (useNavigate/useParams/useSearchParams/useLocation/Link/Outlet) from @/lib/routing — the routing IoC seam the embed overrides. Route/Routes/BrowserRouter/MemoryRouter are structural and may stay on react-router-dom."
},
{
"name": "react-router",
"importNames": [
"useNavigate",
"useParams",
"useSearchParams",
"useLocation",
"Link",
"Outlet"
],
"message": "Import routing primitives (useNavigate/useParams/useSearchParams/useLocation/Link/Outlet) from @/lib/routing — the routing IoC seam the embed overrides."
}
]
}
]
},
"overrides": [
{
"files": ["src/lib/host.ts", "src/lib/accountsApi.ts"],
"rules": {
"no-restricted-globals": "off"
}
},
{
"files": ["src/lib/routing.tsx"],
"rules": {
"no-restricted-imports": "off"
}
},
{
"files": ["src/lib/identity.ts", "src/lib/capabilities.ts"],
"rules": {
"no-restricted-imports": "off"
}
},
{
"files": ["src/lib/identity.ts", "src/lib/sessionHost.ts"],
"rules": {
"no-underscore-dangle": "off"
}
},
{
"files": ["**/*.test.ts", "**/*.test.tsx"],
"rules": {
"no-restricted-globals": "off",
"no-restricted-imports": "off"
}
},
{
"files": ["electron/**"],
"rules": {
"no-restricted-globals": "off"
}
},
{
"files": ["sw-src/**"],
"rules": {
"no-restricted-globals": "off"
}
}
],
"ignorePatterns": ["dist", "node_modules", "src/components/ui", "src/components/ai-elements"]
}