Skip to content

Commit 736248e

Browse files
committed
chore(mobile): merge current main into composer reset fix
2 parents c2cda99 + 4b87a45 commit 736248e

272 files changed

Lines changed: 12485 additions & 23240 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.pnpmfile.cjs‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@
22
// Keep other platforms native; release scripts set their own architectures.
33
module.exports = {
44
hooks: {
5-
// `typescript` is @tsc-rs/typescript (the catalog entry). Its npm version (0.8.x) is outside
6-
// vite-plus-core's typescript peer range, so pnpm gave the vite-plus that @effect/vitest
7-
// imports apps/marketing's [email protected] instead, and tests loaded a second vitest.
8-
readPackage(pkg) {
9-
if (pkg.name === "@voidzero-dev/vite-plus-core" && pkg.peerDependencies?.typescript) {
10-
pkg.peerDependencies.typescript = "*";
11-
}
12-
return pkg;
13-
},
145
updateConfig(config) {
156
// oxlint-disable-next-line t3code/no-global-process-runtime -- pnpm loads this file before any Effect runtime exists.
167
if (process.platform !== "win32") return config;

‎.vscode/extensions.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"recommendations": ["oxc.oxc-vscode"]
2+
"recommendations": ["oxc.oxc-vscode", "TypeScriptTeam.native-preview"]
33
}

‎.vscode/settings.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"source.fixAll.oxc": "always"
66
},
77
"oxc.unusedDisableDirectives": "warn",
8-
"js/ts.tsdk.path": "node_modules/typescript/lib",
8+
"js/ts.experimental.useTsgo": true,
9+
"js/ts.tsdk.path": ".vscode/tsdk",
910
"typescript.preferences.autoImportFileExcludePatterns": [".repos/**"],
1011
"javascript.preferences.autoImportFileExcludePatterns": [".repos/**"],
1112
"files.watcherExclude": {

‎.vscode/tsdk/tsgo‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
# VS Code's TypeScript 7 extension starts `<tsdk>/tsgo --lsp --stdio`. Exec Effect's patched tsrs
3+
# directly: through the effect-tsgo Node launcher, the LSP's stdin read intermittently fails (EAGAIN).
4+
exec "$(cd "$(dirname "$0")/../.." && node -e '
5+
const { createRequire } = require("node:module");
6+
const fs = require("node:fs");
7+
const path = require("node:path");
8+
const platform = `@effect/tsgo-${process.platform}-${process.arch}/package.json`;
9+
const dir = path.join(path.dirname(createRequire(require.resolve("@effect/tsgo/package.json")).resolve(platform)), "artifacts/tsrs");
10+
process.stdout.write(path.join(dir, fs.readdirSync(dir).sort().at(-1), "tsrs"));
11+
')" "$@"

‎AGENTS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ An empty database is a bad test. Seed your worktree's `.t3` with a copy of real
100100

101101
- Before you push, run `vp run check:changed`. It runs CI's fast checks for changed files: format, lint, knip, typecheck of affected packages and dependents, tests beside changes, and the cross-file checks those miss. CI still runs the full test suites.
102102
- While you iterate, run `vp test run <files>`. For big files, add `-t "<name>"`.
103-
- Use `vp run typecheck`, not `npx tsc`; it caches per package. Both run tsc-rs (`typescript` is the `@tsc-rs/typescript` drop-in).
103+
- Use `vp run typecheck`; it caches per package. Each package runs `effect-tsgo tsrs --noEmit`, the Rust TypeScript 7 checker with Effect's diagnostics built in. There is no `typescript` package to run.
104104
- Run `node -e` snippets from `apps/server` or the owning package. `effect` does not resolve from the repo root.
105105
- Test behavior that can break, such as orchestration and event-sourcing, provider protocol translation, auth and permission guards, persistence and migrations, external-format parsing, race fixes, and the logic a bug fix changed. Leave out tests for what types already guarantee, trivial logic, copy text, smoke runs, mock-call mirrors, callback wiring, and props rendered to static markup.
106106
- Extend before you add. When an existing test or table covers the behavior, add a row or an assertion there. Write a new `it` only when no case fits.

‎apps/desktop/src/app/DesktopManagedPolicy.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ export const layerTest = (policy?: ManagedPolicyDocument | ManagedPolicyFileErro
5656
DesktopManagedPolicy.of({
5757
read:
5858
policy === undefined
59-
? // @effect-diagnostics-next-line effectSucceedWithVoid:off - No policy is undefined, not void.
60-
Effect.succeed(undefined)
59+
? Effect.undefined
6160
: isManagedPolicyFileError(policy)
6261
? Effect.fail(policy)
6362
: Effect.succeed({ source: "/test/policy.json", document: policy }),

‎apps/desktop/src/backend/DesktopBackendConfiguration.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,10 @@ describe("DesktopBackendConfiguration", () => {
262262
);
263263
assert.equal(
264264
first.bootstrap.desktopBootstrapToken,
265-
currentDesktopBootstrapToken(
265+
yield* currentDesktopBootstrapToken(
266266
first.bootstrap.desktopBootstrapSecret ?? "",
267267
yield* Clock.currentTimeMillis,
268-
),
268+
).pipe(Effect.provide(NodeCrypto.layerMac)),
269269
);
270270
assert.equal(
271271
yield* configuration.currentBootstrapToken,

‎apps/desktop/src/backend/DesktopBackendConfiguration.ts‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { currentDesktopBootstrapToken } from "@t3tools/shared/desktopBootstrapTo
55
import * as Clock from "effect/Clock";
66
import * as Context from "effect/Context";
77
import * as SecureRandom from "effect/crypto/SecureRandom";
8+
import * as Mac from "effect/crypto/Mac";
89
import * as Effect from "effect/Effect";
910
import * as Hex from "effect/encoding/Hex";
1011
import * as FileSystem from "effect/FileSystem";
@@ -723,6 +724,7 @@ export const make = Effect.gen(function* () {
723724
const wslEnvironment = yield* DesktopWslEnvironment.DesktopWslEnvironment;
724725
const wslServerTree = yield* DesktopWslServerTree.DesktopWslServerTree;
725726
const settings = yield* DesktopAppSettings.DesktopAppSettings;
727+
const mac = yield* Mac.Mac;
726728
const random = yield* SecureRandom.SecureRandom;
727729
// Random generation yields; serialize it so concurrent backends cannot capture distinct bootstrap secrets.
728730
const secretRef = yield* SynchronizedRef.make(Option.none<string>());
@@ -741,10 +743,10 @@ export const make = Effect.gen(function* () {
741743

742744
const sharedInputs = Effect.gen(function* () {
743745
const bootstrapSecret = yield* getOrCreateBootstrapSecret;
744-
const bootstrapToken = currentDesktopBootstrapToken(
746+
const bootstrapToken = yield* currentDesktopBootstrapToken(
745747
bootstrapSecret,
746748
yield* Clock.currentTimeMillis,
747-
);
749+
).pipe(Effect.provideService(Mac.Mac, mac));
748750
const observabilitySettings = yield* readBackendObservabilitySettings.pipe(
749751
Effect.provideService(FileSystem.FileSystem, fileSystem),
750752
Effect.provideService(DesktopEnvironment.DesktopEnvironment, environment),
@@ -806,7 +808,9 @@ export const make = Effect.gen(function* () {
806808

807809
const currentBootstrapToken = Effect.gen(function* () {
808810
const secret = yield* getOrCreateBootstrapSecret;
809-
return currentDesktopBootstrapToken(secret, yield* Clock.currentTimeMillis);
811+
return yield* currentDesktopBootstrapToken(secret, yield* Clock.currentTimeMillis).pipe(
812+
Effect.provideService(Mac.Mac, mac),
813+
);
810814
});
811815

812816
return DesktopBackendConfiguration.of({

‎apps/desktop/src/backend/DesktopLocalEnvironmentAuth.test.ts‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as NodeCrypto from "@effect/platform-node/NodeCrypto";
12
import { assert, describe, it } from "@effect/vitest";
23
import * as Deferred from "effect/Deferred";
34
import * as Duration from "effect/Duration";
@@ -80,7 +81,7 @@ describe("DesktopLocalEnvironmentAuth", () => {
8081
]),
8182
} as unknown as DesktopBackendPool.DesktopBackendPool["Service"]);
8283
const layerTest = DesktopLocalEnvironmentAuth.layer.pipe(
83-
Layer.provide(Layer.mergeAll(layerPool, layerHttpClient)),
84+
Layer.provide(Layer.mergeAll(layerPool, layerHttpClient, NodeCrypto.layerMac)),
8485
);
8586

8687
const [first, second] = yield* Effect.gen(function* () {
@@ -151,14 +152,17 @@ describe("DesktopLocalEnvironmentAuth", () => {
151152
}).pipe(
152153
Effect.provide(
153154
DesktopLocalEnvironmentAuth.layer.pipe(
154-
Layer.provide(Layer.mergeAll(poolLayer, httpClientLayer)),
155+
Layer.provide(Layer.mergeAll(poolLayer, httpClientLayer, NodeCrypto.layerMac)),
155156
),
156157
),
157158
);
158159

159160
assert.strictEqual(
160161
yield* Ref.get(presented),
161-
currentDesktopBootstrapToken("desktop-secret", DESKTOP_BOOTSTRAP_TOKEN_WINDOW_MS * 2 + 1),
162+
yield* currentDesktopBootstrapToken(
163+
"desktop-secret",
164+
DESKTOP_BOOTSTRAP_TOKEN_WINDOW_MS * 2 + 1,
165+
).pipe(Effect.provide(NodeCrypto.layerMac)),
162166
);
163167
}).pipe(Effect.provide(TestClock.layer())),
164168
);
@@ -205,7 +209,7 @@ describe("DesktopLocalEnvironmentAuth", () => {
205209
const auth = yield* DesktopLocalEnvironmentAuth.DesktopLocalEnvironmentAuth.pipe(
206210
Effect.provide(
207211
DesktopLocalEnvironmentAuth.layer.pipe(
208-
Layer.provide(Layer.mergeAll(layerPool, layerHttpClient)),
212+
Layer.provide(Layer.mergeAll(layerPool, layerHttpClient, NodeCrypto.layerMac)),
209213
),
210214
),
211215
);

‎apps/desktop/src/backend/DesktopLocalEnvironmentAuth.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { currentDesktopBootstrapToken } from "@t3tools/shared/desktopBootstrapTo
55
import * as Clock from "effect/Clock";
66
import * as Context from "effect/Context";
77
import * as Duration from "effect/Duration";
8+
import * as Mac from "effect/crypto/Mac";
89
import * as Effect from "effect/Effect";
910
import * as Layer from "effect/Layer";
1011
import * as Option from "effect/Option";
@@ -67,6 +68,7 @@ export class DesktopLocalEnvironmentAuth extends Context.Service<
6768
export const make = Effect.gen(function* () {
6869
const pool = yield* DesktopBackendPool.DesktopBackendPool;
6970
const httpClient = yield* HttpClient.HttpClient;
71+
const mac = yield* Mac.Mac;
7072
const tokenRef = yield* Ref.make(Option.none<string>());
7173
const mutex = yield* Semaphore.make(1);
7274

@@ -93,7 +95,9 @@ export const make = Effect.gen(function* () {
9395
const credential =
9496
secret === undefined
9597
? config.bootstrap.desktopBootstrapToken
96-
: currentDesktopBootstrapToken(secret, yield* Clock.currentTimeMillis);
98+
: yield* currentDesktopBootstrapToken(secret, yield* Clock.currentTimeMillis).pipe(
99+
Effect.provideService(Mac.Mac, mac),
100+
);
97101
if (!credential) {
98102
return yield* new DesktopLocalEnvironmentAuthBackendNotConfiguredError();
99103
}

0 commit comments

Comments
 (0)