fix: use transport activity for stale health

This commit is contained in:
Peter Steinberger
2026-04-22 02:56:32 +01:00
parent 270003aefd
commit d8d0380297
29 changed files with 192 additions and 122 deletions

View File

@@ -34,4 +34,16 @@ describe("projectSafeChannelAccountSnapshotFields", () => {
baseUrl: "https://chat.example.test/",
});
});
it("preserves non-secret transport liveness timestamps", () => {
const snapshot = projectSafeChannelAccountSnapshotFields({
lastInboundAt: 123,
lastTransportActivityAt: 456,
});
expect(snapshot).toEqual({
lastInboundAt: 123,
lastTransportActivityAt: 456,
});
});
});

View File

@@ -186,6 +186,9 @@ export function projectSafeChannelAccountSnapshotFields(
...(readNumber(record, "lastInboundAt") !== undefined
? { lastInboundAt: readNumber(record, "lastInboundAt") }
: {}),
...(readNumber(record, "lastTransportActivityAt") !== undefined
? { lastTransportActivityAt: readNumber(record, "lastTransportActivityAt") }
: {}),
...(healthState ? { healthState } : {}),
...(mode ? { mode } : {}),
...(dmPolicy ? { dmPolicy } : {}),

View File

@@ -172,9 +172,6 @@ export type ChannelGroupAdapter = {
export type ChannelStatusAdapter<ResolvedAccount, Probe = unknown, Audit = unknown> = {
defaultRuntime?: ChannelAccountSnapshot;
skipStaleSocketHealthCheck?: boolean;
/** Runtime `mode` values where `lastEventAt` can prove connected socket liveness. */
staleSocketHealthCheckModes?: readonly string[];
buildChannelSummary?: BivariantCallback<
(params: {
account: ResolvedAccount;

View File

@@ -199,6 +199,7 @@ export type ChannelAccountSnapshot = {
| null;
lastMessageAt?: number | null;
lastEventAt?: number | null;
lastTransportActivityAt?: number | null;
lastError?: string | null;
healthState?: string;
lastStartAt?: number | null;