Skip to content

Commit 194f838

Browse files
juliusmarmingeJulius Marmingeclaude
authored
chore: audit lint directives and move plugin allowlists into config (pingdotgg#9300)
Co-authored-by: Julius Marminge <[email protected]> Co-authored-by: Claude Fable 5 <[email protected]>
1 parent ec44bc5 commit 194f838

21 files changed

Lines changed: 258 additions & 231 deletions

‎apps/desktop/src/preview-pip-preload.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// @effect-diagnostics globalDate:off - This isolated Electron preload does not run inside an Effect runtime.
21
import type { DesktopPreviewRecordingFrame } from "@t3tools/contracts";
32
import { contextBridge, ipcRenderer } from "electron";
43

‎apps/mobile/metro.config.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ config.resolver = {
3636
new RegExp(`${escapedWorkspaceRoot}[/\\\\]\\.t3[/\\\\].*`),
3737
],
3838
extraNodeModules: {
39-
// oxlint-disable-next-line unicorn/no-useless-fallback-in-spread
40-
...(config.resolver?.extraNodeModules ?? {}),
39+
...config.resolver?.extraNodeModules,
4140
shiki: mobileShikiRoot,
4241
"@shikijs/core": resolveShikiDependencyRoot("@shikijs/core"),
4342
"@shikijs/engine-javascript": resolveShikiDependencyRoot("@shikijs/engine-javascript"),

‎apps/mobile/modules/t3-markdown-text/src/MarkdownTextPrimitive.tsx‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ const TextAncestorContext = React.createContext<[boolean, ViewStyle]>([
99
StyleSheet.create({}),
1010
]);
1111

12-
const textDefaults: TextProps = {
12+
const textDefaults = {
1313
allowFontScaling: true,
1414
selectable: true,
15-
};
15+
} satisfies TextProps;
1616

1717
const useTextAncestorContext = () => React.useContext(TextAncestorContext);
1818

@@ -28,7 +28,11 @@ export type ContextMenuActionEvent = {
2828
nativeEvent: { target: number; actionIdentifier: string };
2929
};
3030

31-
export type MarkdownTextPrimitiveProps = TextProps & {
31+
/**
32+
* `onTextLayout` is not offered: the native view reports plain line strings
33+
* while the React Native Text fallback reports measured `TextLayoutLine`s.
34+
*/
35+
export type MarkdownTextPrimitiveProps = Omit<TextProps, "onTextLayout"> & {
3236
uiTextView?: boolean;
3337
contextMenuConfig?: string;
3438
onContextMenuAction?: (event: ContextMenuActionEvent) => void;
@@ -75,16 +79,14 @@ function MarkdownTextPrimitiveChild({ style, children, ...rest }: MarkdownTextPr
7579
});
7680

7781
if (!isAncestor) {
82+
// Press handlers are delivered by the text runs; the container never sees them.
83+
const { onPress: _onPress, onLongPress: _onLongPress, ...containerProps } = rest;
7884
return (
7985
<TextAncestorContext.Provider value={contextValue}>
8086
<T3MarkdownTextNativeComponent
8187
{...textDefaults}
82-
{...rest}
83-
// ellipsizeMode={rest.ellipsizeMode ?? rest.lineBreakMode ?? 'tail'}
88+
{...containerProps}
8489
style={[flattenedStyle]}
85-
// @ts-expect-error Weirdness
86-
onPress={undefined}
87-
onLongPress={undefined}
8890
>
8991
{nativeChildren}
9092
</T3MarkdownTextNativeComponent>

‎apps/server/scripts/migrate-dev-db.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
* cursors never rewind.
2525
*/
2626

27-
// @effect-diagnostics nodeBuiltinImport:off - node:os resolves the shared T3 home guard.
2827
import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
2928
import * as NodeServices from "@effect/platform-node/NodeServices";
3029
import * as NodeOS from "node:os";

‎apps/server/scripts/t3-sqlite-state.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env node
22

3-
// @effect-diagnostics nodeBuiltinImport:off - node:os resolves the shared T3 home guard.
43
import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
54
import * as NodeServices from "@effect/platform-node/NodeServices";
65
import * as NodeOS from "node:os";

‎apps/server/src/assets/AttachmentUpload.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// @effect-diagnostics nodeBuiltinImport:off
21
import * as NodeCrypto from "node:crypto";
32

43
import {

‎apps/server/src/http.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ export function downloadContentDisposition(fileName?: string): string {
7373
return "attachment";
7474
}
7575
// toWellFormed: encodeURIComponent throws URIError on unpaired surrogates.
76-
// eslint-disable-next-line no-control-regex -- Header filenames must strip ASCII controls.
77-
const sanitized = fileName.toWellFormed().replace(/[\u0000-\u001f"\\]/g, "_");
76+
const sanitized = fileName.toWellFormed().replace(/[\p{Cc}"\\]/gu, "_");
7877
const asciiFallback = sanitized.replace(/[^\u0020-\u007e]/g, "_");
7978
const needsExtended = asciiFallback !== sanitized;
8079
const extendedName = encodeURIComponent(sanitized).replace(

‎apps/server/src/relay/AgentAwarenessRelay.test.ts‎

Lines changed: 37 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -358,58 +358,45 @@ describe.sequential("signRelayAgentActivityPublishProof", () => {
358358
).toEqual([activeThreadId]);
359359
});
360360

361-
it("signs the activity publish JWT and rejects tampering", async () => {
362-
const keyPair = NodeCrypto.generateKeyPairSync("ed25519", {
363-
privateKeyEncoding: { format: "pem", type: "pkcs8" },
364-
publicKeyEncoding: { format: "pem", type: "spki" },
365-
});
366-
const payload = {
367-
iss: "t3-env:env",
368-
aud: "https://relay.example.test",
369-
sub: "env",
370-
jti: "nonce-1",
371-
iat: 100,
372-
exp: 200,
373-
environmentId: state.environmentId,
374-
threadId: state.threadId,
375-
state,
376-
} satisfies RelayAgentActivityPublishProofPayload;
377-
const proof = await Effect.runPromise(
378-
AgentAwarenessRelay.signRelayAgentActivityPublishProof({
361+
it.effect("signs the activity publish JWT and rejects tampering", () =>
362+
Effect.gen(function* () {
363+
const keyPair = NodeCrypto.generateKeyPairSync("ed25519", {
364+
privateKeyEncoding: { format: "pem", type: "pkcs8" },
365+
publicKeyEncoding: { format: "pem", type: "spki" },
366+
});
367+
const payload = {
368+
iss: "t3-env:env",
369+
aud: "https://relay.example.test",
370+
sub: "env",
371+
jti: "nonce-1",
372+
iat: 100,
373+
exp: 200,
374+
environmentId: state.environmentId,
375+
threadId: state.threadId,
376+
state,
377+
} satisfies RelayAgentActivityPublishProofPayload;
378+
const proof = yield* AgentAwarenessRelay.signRelayAgentActivityPublishProof({
379379
privateKey: keyPair.privateKey,
380380
payload,
381-
}),
382-
);
383-
384-
await expect(
385-
Effect.runPromise(
386-
verifyRelayJwt({
387-
publicKey: keyPair.publicKey,
388-
token: proof,
389-
typ: RELAY_ACTIVITY_PUBLISH_TYP,
390-
issuer: "t3-env:env",
391-
audience: "https://relay.example.test",
392-
nowEpochSeconds: 150,
393-
}),
394-
),
395-
).resolves.toMatchObject({ jti: "nonce-1", state });
396-
await expect(
397-
Effect.runPromise(
381+
});
382+
const verify = (token: string) =>
398383
verifyRelayJwt({
399384
publicKey: keyPair.publicKey,
400-
token: (() => {
401-
const [header, body, signature = ""] = proof.split(".");
402-
const corruptedSignature = `${signature.startsWith("a") ? "b" : "a"}${signature.slice(1)}`;
403-
return `${header}.${body}.${corruptedSignature}`;
404-
})(),
385+
token,
405386
typ: RELAY_ACTIVITY_PUBLISH_TYP,
406387
issuer: "t3-env:env",
407388
audience: "https://relay.example.test",
408389
nowEpochSeconds: 150,
409-
}),
410-
),
411-
).rejects.toBeDefined();
412-
});
390+
});
391+
392+
expect(yield* verify(proof)).toMatchObject({ jti: "nonce-1", state });
393+
394+
const [header, body, signature = ""] = proof.split(".");
395+
const corruptedSignature = `${signature.startsWith("a") ? "b" : "a"}${signature.slice(1)}`;
396+
const rejection = yield* Effect.flip(verify(`${header}.${body}.${corruptedSignature}`));
397+
expect(rejection).toBeDefined();
398+
}),
399+
);
413400

414401
it.effect("keeps the orchestration listener armed until relay config is installed", () =>
415402
Effect.scoped(
@@ -557,10 +544,11 @@ describe.sequential("signRelayAgentActivityPublishProof", () => {
557544
Effect.scoped(
558545
Effect.gen(function* () {
559546
const originalFetch = globalThis.fetch;
560-
const context = yield* Effect.context<never>();
561-
const runFork = Effect.runForkWith(context);
562547
const events = yield* Queue.unbounded<OrchestrationEvent>();
563-
const fetchSeen = yield* Deferred.make<URL>();
548+
let resolveFetchSeen: (url: URL) => void = () => {};
549+
const fetchSeen = new Promise<URL>((resolve) => {
550+
resolveFetchSeen = resolve;
551+
});
564552
const userSpans: Array<string> = [];
565553
const productSpans: Array<string> = [];
566554
const collectingTracer = (spans: Array<string>) =>
@@ -648,7 +636,7 @@ describe.sequential("signRelayAgentActivityPublishProof", () => {
648636
? input
649637
: (input as unknown as { readonly url: string }).url,
650638
);
651-
runFork(Deferred.succeed(fetchSeen, url));
639+
resolveFetchSeen(url);
652640
return Promise.resolve(Response.json({ ok: true, deliveries: [] }));
653641
}) as unknown as typeof fetch;
654642
yield* Effect.addFinalizer(() =>
@@ -707,7 +695,7 @@ describe.sequential("signRelayAgentActivityPublishProof", () => {
707695
occurredAt: now,
708696
} as unknown as OrchestrationEvent);
709697

710-
const url = yield* Deferred.await(fetchSeen).pipe(Effect.timeout("2 seconds"));
698+
const url = yield* Effect.promise(() => fetchSeen).pipe(Effect.timeout("2 seconds"));
711699
expect(url.origin).toBe("https://transport.example.test");
712700
expect(productSpans).toContain("makePublishProof");
713701
expect(userSpans).not.toContain("makePublishProof");

‎apps/server/src/server.test.ts‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ import * as Effect from "effect/Effect";
5656
import * as FileSystem from "effect/FileSystem";
5757
import * as Fiber from "effect/Fiber";
5858
import * as Layer from "effect/Layer";
59-
import * as ManagedRuntime from "effect/ManagedRuntime";
6059
import * as Option from "effect/Option";
6160
import * as Path from "effect/Path";
6261
import * as PubSub from "effect/PubSub";
@@ -398,7 +397,9 @@ const makeBrowserOtlpPayload = (spanName: string) =>
398397
({ close }) => Effect.promise(close),
399398
);
400399

401-
const runtime = ManagedRuntime.make(
400+
// The exporter's batch fiber is forked while the layer builds and ticks on
401+
// a wall-clock interval, so the whole tracer runs on the live clock.
402+
yield* Layer.build(
402403
OtlpTracer.layer({
403404
url: collector.url,
404405
exportInterval: "10 millis",
@@ -411,14 +412,13 @@ const makeBrowserOtlpPayload = (spanName: string) =>
411412
},
412413
},
413414
}).pipe(Layer.provide(browserOtlpTracingLayer)),
415+
).pipe(
416+
Effect.flatMap((tracing) =>
417+
Effect.void.pipe(Effect.withSpan(spanName), Effect.provideContext(tracing)),
418+
),
419+
TestClock.withLive,
414420
);
415421

416-
try {
417-
yield* Effect.promise(() => runtime.runPromise(Effect.void.pipe(Effect.withSpan(spanName))));
418-
} finally {
419-
yield* Effect.promise(() => runtime.dispose());
420-
}
421-
422422
const request = yield* Effect.raceFirst(
423423
Effect.promise(() => collector.firstRequest).pipe(Effect.orDie),
424424
Effect.sleep(Duration.seconds(1)).pipe(

‎apps/server/src/serviceLauncher.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// @effect-diagnostics nodeBuiltinImport:off
2-
// @effect-diagnostics globalDate:off
32
// @effect-diagnostics globalTimers:off
43
// This file is shipped as a standalone bundle and copied to a stable path by
54
// `t3 service update`. Keep runtime imports limited to Node built-ins.

0 commit comments

Comments
 (0)