Skip to content

Commit 08dc817

Browse files
committed
Merge branch 'main' of https://github.com/typetorch/cli
2 parents 82155e8 + 533aec6 commit 08dc817

4 files changed

Lines changed: 28 additions & 0 deletions

File tree

‎src/kernelpatch-task.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,11 +595,18 @@ local function describeTree(root, phase, refs)
595595
return table.concat(lines, "\n"), count
596596
end
597597
598+
-- Services the engine fills per session and never saves into the place (their children differ between the check task
599+
-- and the save task, e.g. Stats.PerformanceStats): left out of the outside manifest.
600+
local SESSION_SERVICES = { Stats = true }
601+
598602
-- The outside manifest: per service (its attributes and tags) and per top-level child that isn't a slot (descriptor
599603
-- hash, and the hash of its serialized bytes when serialize is set).
600604
local function manifest(phase, serialize, refs)
601605
local m = { entries = {}, keys = {}, services = 0, subtrees = 0, instances = 0, unserializable = 0, unreadable = 0 }
602606
for _, service in childrenOf(game) or {} do
607+
if SESSION_SERVICES[service.ClassName] then
608+
continue
609+
end
603610
m.services += 1
604611
local serviceKey = service.ClassName .. "|" .. service.Name
605612
local serviceMarks = attributesOf(service) .. "|" .. tagsOf(service)

‎test/fixtures/kernel-luau/harness.luau‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
-- tamperOnSetting reading HttpService.HttpEnabled changes Workspace.Lobby.Step1 (an engine side effect)
1212
-- noEncoding no EncodingService mock (the script falls back to FNV)
1313
-- unstableBytes SerializeInstancesAsync appends a counter (bytes differ on every read)
14+
-- statsNoise Stats gets a PerformanceStats child stamped with this run (differs in every task session)
1415
-- Writes {result, calls} as JSON to <out.json>.
1516
local roblox = require("@lune/roblox")
1617
local fs = require("@lune/fs")
@@ -23,6 +24,17 @@ local source = fs.readFile(args[1])
2324
local dm = roblox.deserializePlace(fs.readFile(args[2]))
2425
local options = serde.decode("json", fs.readFile(args[4]))
2526
local calls = { save = 0, deserialize = 0, serialize = 0, hash = 0 }
27+
if options.statsNoise then
28+
local stats = dm:GetService("Stats")
29+
local old = stats:FindFirstChild("PerformanceStats")
30+
if old then
31+
old:Destroy()
32+
end
33+
local perf = roblox.Instance.new("Folder")
34+
perf.Name = "PerformanceStats"
35+
perf:SetAttribute("Session", string.format("%.6f", os.clock()) .. "-" .. tostring(math.random(1, 1e9)))
36+
perf.Parent = stats
37+
end
2638

2739
local function hexToBuffer(hex)
2840
local out = buffer.create(#hex // 2)

‎test/fixtures/kernel-luau/lune-cloud.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export interface HarnessOptions {
6262
tamperOnSetting?: boolean;
6363
noEncoding?: boolean;
6464
unstableBytes?: boolean;
65+
statsNoise?: boolean;
6566
}
6667

6768
/** Runs a task script in the harness; returns the result, the engine calls, and the saved place (if any). */

‎test/kernel-luau.test.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,14 @@ describe.skipIf(!hasLune)("kernel deploy --engine luau (fake Open Cloud, tasks i
423423
expect(no.records).toEqual([]);
424424
});
425425

426+
test("Stats (filled by the engine per session, never saved) differs between check and save: still saved and verified", async () => {
427+
const cloud = fakeCloud(place("game-installed.rbxl"), { statsNoise: true });
428+
const { json, error } = await quiet(() => luauDeploy(deployInput({ yes: true }), makeDeps(cloud.oc)));
429+
expect(error).toBeUndefined();
430+
expect(json).toMatchObject({ placeVersionAfter: 58, verify: { ok: true, problems: [] } });
431+
expect(cloud.tasks[0].script).toContain("SESSION_SERVICES");
432+
});
433+
426434
test("someone published after the check: nothing saved", async () => {
427435
const cloud = fakeCloud(place("game-installed.rbxl"), { raceTo: 58 });
428436
const { error } = await quiet(() => luauDeploy(deployInput({ yes: true }), makeDeps(cloud.oc)));

0 commit comments

Comments
 (0)