Skip to content

Commit a5e5c1b

Browse files
phasenullclaude
andcommitted
Framework version everywhere it can be checked (0.7.4): a built-in Fleet column, ext_start's fw, the dev panel
- live-debug: every server declares the built-in column tt_framework ("Framework", FRAMEWORK_VERSION) first, so the Fleet page shows which framework each server runs (kernel 0.5.7, no kernel release). It takes one of the kernel's 16 slots: games get 15, and tt_ names are reserved. - Extended recordings: recording_meta ext_start carries fw (the framework version). - Dev panel: a Framework line on the client page and on the server status (facts.framework). - Tests: live-debug (the built-in column, the 15 limit, the reserved prefix), analytics-server (ext_start fw). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 075b991 commit a5e5c1b

11 files changed

Lines changed: 68 additions & 22 deletions

File tree

‎README.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,9 @@ TypeTorch.runDetached(() => store.StartSessionAsync(`Player_${userId}`)).then((p
426426
second while the page is open; a sample at most 16 KB of JSON (bigger is dropped).
427427
- Getters and samplers run on kernel threads under pcall with a short deadline (a column that throws, yields or
428428
returns anything else is empty): keep them cheap, don't yield.
429-
- Names `^[a-z][a-z0-9_]{0,31}$`; at most 16 columns, 32 commands and 8 streams; labels at most 40 characters,
429+
- Framework 0.7.4: every server also has the built-in column `tt_framework` (**Framework**, its TypeTorch framework
430+
version, shown on the Fleet page by default). It takes one of the kernel's 16 slots, and `tt_` names are reserved.
431+
- Names `^[a-z][a-z0-9_]{0,31}$`; at most 15 columns, 32 commands and 8 streams; labels at most 40 characters,
430432
descriptions 200. A bad name or option, a duplicate or one past a limit throws at once; each call returns a
431433
function that removes the entry (give it to a trove). Registrations in one frame reach the kernel as one
432434
declaration; ones made before the generation is bound (module top level) are sent when it is.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@typetorch/framework",
3-
"version": "0.7.3",
3+
"version": "0.7.4",
44
"description": "TypeTorch framework for roblox-ts: hot-swappable modules (dependency injection, lifecycle, troves), guarded networking, hot assets and the in-game dev menu. Ships inside every TypeTorch artifact.",
55
"license": "MIT",
66
"author": "TypeTorch",

‎scripts/test-analytics-server.luau‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,8 @@ function TS.import(_, parent, ...)
373373
end
374374
if parent == outFolder then
375375
-- The real launch-token code (pure) for the join row's verdict.
376-
if internals[path] == nil and (path == "notifications/token" or path == "util/sha256") then
377-
local folder = { Name = path:match("^[^/]+"), Parent = outFolder }
376+
if internals[path] == nil and (path == "notifications/token" or path == "util/sha256" or path == "version") then
377+
local folder = if path:find("/") then { Name = path:match("^[^/]+"), Parent = outFolder } else outFolder
378378
local script = { Name = path:match("[^/]+$"), Parent = folder }
379379
G[script] = TS
380380
internals[path] = luau.load(fs.readFile(base .. path .. ".luau"), {
@@ -1094,6 +1094,9 @@ do
10941094
check("ext: one tt-ext-1 row", #rows == 1 and rows[1].pid == onPid and rows[1].chunk == 0 and rows[1].n == 2, #rows)
10951095
check("ext: the row decodes", rows[1] and #X.decodeExtChunk(C.fromBase64(rows[1].data)).records == 2)
10961096
check("ext: ext_start row", #rowsNamed(store().events.rows, "recording_meta", "ext_start") == 1)
1097+
local starts = rowsNamed(store().events.rows, "recording_meta", "ext_start")
1098+
local fw = starts[1] and serde.decode("json", starts[1].props).fw
1099+
check("ext: ext_start names the framework version (0.7.4, fw)", type(fw) == "string" and fw:match("^%d+%.%d+%.%d+") ~= nil, fw)
10971100
task.wait(0.3)
10981101
raw["__tt/an"](on, "xrec", 1, 500, 0, X.ExtWriter.new():take(true), true, "window")
10991102
local ends = rowsNamed(store().events.rows, "recording_meta", "ext_end")

‎scripts/test-live-debug.luau‎

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,20 @@ local function settle()
3131
end
3232
end
3333

34-
local env = setmetatable({ task = task, script = {} }, { __index = _G })
34+
-- 0.7.4: live-debug imports version.luau (FRAMEWORK_VERSION, the built-in column) through roblox-ts's TS.import.
35+
local VERSION = luau.load(fs.readFile(`{root}out/version.luau`), { debugName = "version" })()
36+
local liveScript = { Name = "live-debug", Parent = {} }
37+
local env = setmetatable({
38+
task = task,
39+
script = liveScript,
40+
_G = { [liveScript] = {
41+
import = function(_, _, ...)
42+
local names = { ... }
43+
assert(names[#names] == "version", "unexpected import " .. tostring(names[#names]))
44+
return VERSION
45+
end,
46+
} },
47+
}, { __index = _G })
3548
local L = luau.load(fs.readFile(`{root}out/live-debug.luau`), { debugName = "live-debug", environment = env })()
3649
local remoteDebug, fleet = L.remoteDebug, L.fleet
3750

@@ -79,12 +92,15 @@ end, "type must be"))
7992
-- Limits and duplicates
8093
do
8194
local removers = {}
82-
for index = 1, 16 do
95+
for index = 1, 15 do
8396
table.insert(removers, fleet:column(`c{index}`, function() end))
8497
end
85-
check("limit: a 17th column throws", throws(function()
86-
fleet:column("c17", function() end)
87-
end, "at most 16 columns"))
98+
check("limit: a 16th game column throws (the built-in tt_framework takes the kernel's 16th slot)", throws(function()
99+
fleet:column("c16", function() end)
100+
end, "at most 15 columns"))
101+
check("reserved: a tt_ column throws", throws(function()
102+
fleet:column("tt_framework", function() end)
103+
end, "reserved"))
88104
check("duplicate: throws", throws(function()
89105
fleet:column("c1", function() end)
90106
end, "already registered"))
@@ -162,7 +178,8 @@ fleet:column("current_map", function()
162178
return mapName
163179
end, { label = "Map", type = "string" })
164180
L.bindLiveDebug("server", kernel)
165-
check("bind: handlers installed and the early registration declared at once", typeof(kernel.command) == "function" and typeof(kernel.column) == "function" and typeof(kernel.stream) == "function" and #kernel.declared == 1 and kernel.declared[1].columns[1].name == "current_map")
181+
check("bind: handlers installed and the early registration declared at once", typeof(kernel.command) == "function" and typeof(kernel.column) == "function" and typeof(kernel.stream) == "function" and #kernel.declared == 1 and kernel.declared[1].columns[2].name == "current_map")
182+
check("bind: the built-in tt_framework column is declared first", kernel.declared[1].columns[1].name == "tt_framework" and kernel.declared[1].columns[1].label == "Framework" and kernel.declared[1].columns[1].type == "string")
166183
check("supported on 0.5.7", remoteDebug:supported() == true)
167184

168185
local calls = {}
@@ -183,7 +200,7 @@ check("registrations in one frame are declared once, deferred", #kernel.declared
183200
settle()
184201
check("...then one declaration", #kernel.declared == 2, #kernel.declared)
185202
local decl = kernel.declared[2]
186-
check("declaration: columns in order with label and type", #decl.columns == 2 and decl.columns[1].name == "current_map" and decl.columns[1].label == "Map" and decl.columns[1].type == "string" and decl.columns[2].name == "in_round" and decl.columns[2].type == "bool")
203+
check("declaration: columns in order with label and type", #decl.columns == 3 and decl.columns[2].name == "current_map" and decl.columns[2].label == "Map" and decl.columns[2].type == "string" and decl.columns[3].name == "in_round" and decl.columns[3].type == "bool")
187204
check("declaration: commands with label and description", #decl.commands == 1 and decl.commands[1].name == "round_state" and decl.commands[1].label == "Round" and decl.commands[1].description == "The current round")
188205
check("declaration: streams with hz, kind (json by default) and label", #decl.streams == 2 and decl.streams[1].hz == 2 and decl.streams[1].kind == "points" and decl.streams[1].label == "Loot" and decl.streams[2].kind == "json")
189206

@@ -196,6 +213,7 @@ check("command handler: an unknown name throws", throws(function()
196213
kernel.command("nope", {}, caller)
197214
end, "unknown command"))
198215
check("column handler: the getter's value", kernel.column("current_map") == "Lobby" and kernel.column("in_round") == true and kernel.column("nope") == nil)
216+
check("column handler: tt_framework is this framework's version", kernel.column("tt_framework") == VERSION.FRAMEWORK_VERSION and #VERSION.FRAMEWORK_VERSION > 0)
199217
mapName = "HedgeMaze"
200218
check("column handler: read live", kernel.column("current_map") == "HedgeMaze")
201219
check("stream handler: the sampler's value", kernel.stream("loot").points[1].x == 1 and kernel.stream("state").phase == "intermission" and kernel.stream("nope") == nil)
@@ -208,7 +226,7 @@ fleet:column("score", function()
208226
return 5
209227
end)
210228
fleet:columnsChanged()
211-
check("columnsChanged: pending declarations go first", #kernel.declared == before + 1 and kernel.changed == 2 and #kernel.declared[#kernel.declared].columns == 3)
229+
check("columnsChanged: pending declarations go first", #kernel.declared == before + 1 and kernel.changed == 2 and #kernel.declared[#kernel.declared].columns == 4)
212230
settle()
213231
check("...and not twice", #kernel.declared == before + 1)
214232

‎src/analytics/SCHEMA.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ one codec filter on `codec`.
8080
| state | `screen` | `to`, `from` (`""` = none). Client: ScreenGuis in PlayerGui (Enabled), GuiObjects tagged `TTScreen` (Visible), `screen()` |
8181
| experiment | `<experiment>` | `variant`, `variants` (count), `vi` (the variant's 1-based position in the game's list; 0.7.1+), `forced?` (the settings or the player's own dev pick chose it). Once per session when assigned or changed, and again when the same variant becomes or stops being forced. At most 32 experiments per session: a 33rd `experiment()` returns the control (the first variant) and warns. A client's experiment calls count against its event budget (below) |
8282
| recording_meta | `start` | `share` (the recorded share then), `secs?` (the window then: `recordSeconds`, or `extended.seconds` for an extended session; frameworks before it leave it out and used 60) |
83-
| recording_meta | `ext_start` | plans/36, the first tt-ext-1 chunk arrived: `secs` (`extended.seconds`) |
83+
| recording_meta | `ext_start` | plans/36, the first tt-ext-1 chunk arrived: `secs` (`extended.seconds`), `fw` (the framework version, 0.7.4+) |
8484
| recording_meta | `ext_end` | `chunks`, `bytes`, `why`: as `end`'s (`window`, `left`, `cap` = 2 MB or 200 chunks, `end`) |
8585
| recording_meta | `end` | `chunks`, `bytes`, `why`: `window` (`recordSeconds`, default 60 s, after the first input), `cap` (10 min, or the recording's 256 KB / 80 chunks), `left`, `end` |
8686
| fleet | `heartbeat` | The kernel's `fleetStatus()` (kernel 0.3.2+), every 60 ± 10 s and once at each generation start. pid `""` |

‎src/analytics/server.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ import {
8181
} from "./settings";
8282
import { registerAnalyticsStatus } from "./status";
8383
import { buildRequests, estimateEventBytes, estimateRecordingBytes, type SinkRequest } from "./sinks";
84+
import { FRAMEWORK_VERSION } from "../version";
8485

8586
/**
8687
* The server half of the analytics engine (plans/16): player ids, sessions, the automatic collectors (joins, tech
@@ -1490,7 +1491,7 @@ export class ServerAnalytics {
14901491
const t = nowMs() - age - math.floor(math.clamp(player.GetNetworkPing(), 0, 2) * 500);
14911492
if (!ext.started) {
14921493
ext.started = true;
1493-
this.emit(session, "recording_meta", "ext_start", encodeProps({ secs: settings.extended.seconds }), "server", t);
1494+
this.emit(session, "recording_meta", "ext_start", encodeProps({ secs: settings.extended.seconds, fw: FRAMEWORK_VERSION }), "server", t);
14941495
}
14951496
ext.chunk = chunk + 1;
14961497
ext.bytes += size;

‎src/devtools/client.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import {
3434
} from "./build-actions";
3535
import type { ClientDispatcher, LeafStats } from "../net/runtime";
3636
import { DEV_GUI_GENERATION, DEV_GUI_NAME, sweepStaleMenus } from "../runtime/dev-gui";
37+
import { FRAMEWORK_VERSION } from "../version";
3738
import { runningModules } from "../runtime/registry";
3839
import { bump, popIn, popOut } from "../ui";
3940
import { ExplorerPersist, mountExplorer } from "./explorer";
@@ -840,6 +841,7 @@ export function startDevtoolsClient(kernel: ClientKernel, dispatcher: ClientDisp
840841
page.field("Branch", str(kernel.branch));
841842
page.field("Channel", channelText(kernel));
842843
page.field("Kernel", `${kernel.kernelVersion} (API ${kernel.kernelApi})`);
844+
page.field("Framework", FRAMEWORK_VERSION);
843845
/** The server's times as of the status reply (os.clock() then); the loop below adds the time since. */
844846
let serverTimes: { at: number; generation?: number; server?: number; builtAt?: number; running: TextBox; up: TextBox; built: TextBox } | undefined;
845847
/** "2026-10-05 17:51:37 UTC (8m ago)". */
@@ -977,6 +979,8 @@ export function startDevtoolsClient(kernel: ClientKernel, dispatcher: ClientDisp
977979
// Kernel 0.3.8: TypeTorch.runDetached jobs ("2 running (oldest 4 s), 1 failed").
978980
if (status.detached !== undefined) body.field("Detached jobs", detachedText(status.detached), status.detached.failed > 0 ? COLORS.warn : COLORS.text);
979981
body.field("Kernel", `${status.kernelVersion}${status.kernelBuild !== undefined ? `@${status.kernelBuild}` : ""} (API ${status.kernelApi})`);
982+
// Framework 0.7.4: the server's framework ("-" before 0.7.4).
983+
body.field("Framework", (reply as StatusReply).facts?.framework ?? "-");
980984
if (status.registryError !== undefined) body.field("Registry error", status.registryError, COLORS.bad);
981985

982986
body.section("Last deploy message");

‎src/devtools/health.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ export interface ServerFacts {
7171
* "owner_switch_only", "owners_only"). Absent from older frameworks (go by the rules).
7272
*/
7373
access?: string;
74+
/** Framework 0.7.4: the server's framework version (FRAMEWORK_VERSION). Absent from older frameworks. */
75+
framework?: string;
7476
}
7577

7678
/** "0.2.0" < "0.2.1"; missing parts count as 0, non-numbers as 0. */

‎src/devtools/server.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { countBudget } from "../budget";
66
import { normalRole } from "../kernel";
77
import type { ServerDispatcher } from "../net/runtime";
88
import { runningModules } from "../runtime/registry";
9+
import { FRAMEWORK_VERSION } from "../version";
910
import { DevAccess } from "./access";
1011
import { registerRemoteClaude } from "./claude";
1112
import { registerExplorerOps } from "./explorer-server";
@@ -58,7 +59,7 @@ function serverFacts(kernel: ServerKernel): ServerFacts {
5859
if (loadstringWorks === undefined) {
5960
loadstringWorks = loadstringAvailable();
6061
}
61-
return { loadstring: loadstringWorks, http: HttpService.HttpEnabled, experiments: kernelHasExperiments(kernel), assets: assetFacts(), analytics: analyticsStatus() };
62+
return { loadstring: loadstringWorks, http: HttpService.HttpEnabled, experiments: kernelHasExperiments(kernel), assets: assetFacts(), analytics: analyticsStatus(), framework: FRAMEWORK_VERSION };
6263
}
6364

6465
const LOG_KINDS = new Set(["output", "info", "warning", "error"]);

‎src/live-debug.ts‎

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { Trove } from "@rbxts/trove";
22
import type { DebugDeclarations, RemoteDebugCaller, ServerKernel } from "./kernel";
3+
import { FRAMEWORK_VERSION } from "./version";
34

45
/**
56
* Framework 0.7.1 (plans/34): LIVE DEBUG, the game's half. A game declares, for the backend explorer's server page and
@@ -22,15 +23,24 @@ import type { DebugDeclarations, RemoteDebugCaller, ServerKernel } from "./kerne
2223
* game state stored with the server row: NEVER put player names, UserIds or other personal data in a column.
2324
* - Getters and samplers run on kernel threads under pcall with a short deadline: keep them cheap and don't yield.
2425
*
25-
* Names: `^[a-z][a-z0-9_]{0,31}$`; at most 16 columns, 32 commands and 8 streams; labels at most 40 characters,
26+
* Framework 0.7.4: every server also declares the built-in column `tt_framework` ("Framework", this framework's version),
27+
* first, so the Fleet page shows which framework each server runs. It takes one of the kernel's 16 column slots: a game
28+
* declares at most 15, and names starting with `tt_` are reserved.
29+
*
30+
* Names: `^[a-z][a-z0-9_]{0,31}$`; at most 15 game columns, 32 commands and 8 streams; labels at most 40 characters,
2631
* descriptions 200. A bad name or option, a duplicate or one past a limit throws at once. Each call returns a function
2732
* that removes the entry (for a trove). Server only (a client throws). Needs kernel 0.5.7 (`api:debugDeclare`); on older
2833
* kernels and in edit mode everything is accepted and checked, and nothing reaches the backend.
2934
*/
3035

3136
/** The first kernel with `api:debugDeclare`. */
3237
export const LIVE_DEBUG_KERNEL = "0.5.7";
33-
export const LIVE_DEBUG_LIMITS = { columns: 16, commands: 32, streams: 8, label: 40, description: 200, hzMin: 0.2, hzMax: 4 };
38+
/** Framework 0.7.4: the built-in Fleet column with this framework's version (declared first, before the game's). */
39+
export const FRAMEWORK_COLUMN = "tt_framework";
40+
/** Column names a game can't use (the framework's own). */
41+
export const RESERVED_COLUMN_PREFIX = "tt_";
42+
/** `columns` counts the game's; the kernel's limit is one more (the built-in column). */
43+
export const LIVE_DEBUG_LIMITS = { columns: 15, commands: 32, streams: 8, label: 40, description: 200, hzMin: 0.2, hzMax: 4 };
3444

3545
export interface DebugCommandOptions {
3646
/** The button's text (at most 40 characters; default: the name). */
@@ -138,10 +148,13 @@ function remove<T>(map: Map<string, T>, list: string[], name: string, entry: T)
138148
/** The kernel's view of the current declarations. */
139149
export function debugDeclarations(): DebugDeclarations {
140150
return {
141-
columns: order.columns.map((name) => {
142-
const column = columns.get(name)!;
143-
return { name, label: column.label, type: column.type };
144-
}),
151+
columns: [
152+
{ name: FRAMEWORK_COLUMN, label: "Framework", type: "string" as const },
153+
...order.columns.map((name) => {
154+
const column = columns.get(name)!;
155+
return { name, label: column.label, type: column.type };
156+
}),
157+
],
145158
commands: order.commands.map((name) => {
146159
const command = commands.get(name)!;
147160
return { name, label: command.label, description: command.description };
@@ -224,6 +237,7 @@ export const fleet: FleetApi = {
224237
const what = "fleet.column";
225238
checkServer(what);
226239
checkName(what, name);
240+
if (name.sub(1, RESERVED_COLUMN_PREFIX.size()) === RESERVED_COLUMN_PREFIX) error(`${what}: names starting with ${RESERVED_COLUMN_PREFIX} are reserved (got ${name})`, 2);
227241
if (!typeIs(getter, "function")) error(`${what}: pass a getter function`, 2);
228242
if (options !== undefined && !typeIs(options, "table")) error(`${what}: options must be a table`, 2);
229243
const label = checkText(what, "label", options?.label, LIVE_DEBUG_LIMITS.label);
@@ -265,6 +279,7 @@ export function bindLiveDebug(realm: "server" | "client", kernel: unknown, _trov
265279
}
266280
if (typeIs(methods.onDebugColumn, "function")) {
267281
api.onDebugColumn!((name) => {
282+
if (name === FRAMEWORK_COLUMN) return FRAMEWORK_VERSION;
268283
const column = columns.get(name);
269284
return column ? column.getter() : undefined;
270285
});

0 commit comments

Comments
 (0)