docs(production): standardiserad produktionsberedskap och gap-analys

Lägger docs/production-readiness.md och siax/production-gaps.json enligt SIAX Master Definition of Done. Underlag: git-, kod- och live-evidens 2026-11-11. Nivån är evidensbaserad, inte ett leveransgodkännande.
This commit is contained in:
2026-11-10 09:15:21 +01:00
parent 0fda8cae48
commit 2bee8eb778
6135 changed files with 4 additions and 1718997 deletions
-54
View File
@@ -1,54 +0,0 @@
/**
* Thin `fetch` wrapper that aborts after a deadline.
*
* Used by OAuth token endpoints where a hung provider would otherwise hold
* the request thread indefinitely. The Skatteverket callback handler also
* relies on `TimeoutError` to distinguish a hung token exchange (where the
* 5-minute BankID auth code may expire mid-call) from other failures.
*/
export class TimeoutError extends Error {
readonly name = 'TimeoutError'
}
export function isTimeoutError(error: unknown): boolean {
return (
error instanceof Error &&
(error.name === 'TimeoutError' || error.name === 'AbortError')
)
}
export const OAUTH_TIMEOUT_MS = 10_000
export const OAUTH_REVOKE_TIMEOUT_MS = 5_000
export const SKATTEVERKET_EXCHANGE_TIMEOUT_MS = 8_000
interface FetchWithTimeoutOptions {
timeoutMs: number
description: string
}
export async function fetchWithTimeout(
input: RequestInfo | URL,
init: RequestInit,
options: FetchWithTimeoutOptions,
): Promise<Response> {
const { timeoutMs, description } = options
const timeoutSignal = AbortSignal.timeout(timeoutMs)
const signal = init.signal
? AbortSignal.any([init.signal, timeoutSignal])
: timeoutSignal
try {
return await fetch(input, { ...init, signal })
} catch (err) {
if (
timeoutSignal.aborted &&
err instanceof Error &&
(err.name === 'TimeoutError' || err.name === 'AbortError')
) {
throw new TimeoutError(`${description} timed out after ${timeoutMs}ms`)
}
throw err
}
}