Skip to content

Commit d5345de

Browse files
test(server): tear the anonymous id write at the file handle atomic saves now use
AI-assisted; verified with the tests and tools listed above.
1 parent c6d3f1c commit d5345de

1 file changed

Lines changed: 19 additions & 14 deletions

File tree

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

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -105,21 +105,26 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("telemetry identi
105105
const path = yield* Path.Path;
106106
const tornWrites = FileSystem.FileSystem.of({
107107
...fileSystem,
108-
writeFileString: (filePath, data, options) =>
109-
fileSystem
110-
.writeFileString(filePath, data.slice(0, Math.floor(data.length / 2)), options)
111-
.pipe(
112-
Effect.andThen(
113-
Effect.fail(
114-
PlatformError.systemError({
115-
_tag: "WriteZero",
116-
module: "FileSystem",
117-
method: "writeFileString",
118-
pathOrDescriptor: filePath,
119-
}),
120-
),
121-
),
108+
open: (filePath, options) =>
109+
fileSystem.open(filePath, options).pipe(
110+
Effect.map((file): FileSystem.File =>
111+
Object.assign(Object.create(file), {
112+
writeAll: (buffer: Uint8Array) =>
113+
file.writeAll(buffer.subarray(0, Math.floor(buffer.length / 2))).pipe(
114+
Effect.andThen(
115+
Effect.fail(
116+
PlatformError.systemError({
117+
_tag: "WriteZero",
118+
module: "FileSystem",
119+
method: "writeAll",
120+
pathOrDescriptor: filePath,
121+
}),
122+
),
123+
),
124+
),
125+
}),
122126
),
127+
),
123128
});
124129

125130
const identity = yield* Identify.getTelemetryIdentityForHome(

0 commit comments

Comments
 (0)