Skip to content

Commit 70fbd6c

Browse files
committed
feat(toilscript): emit toil.surface / toilstream.catalog / toildaemon.catalog (M1 Phase 0)
Increment 2: custom-section metadata emission, byte-exact to RECONCILIATION-DECISIONS Part 5. - buildToilSurface / buildToilStreamCatalog / buildToilDaemonCatalog in dbcatalog.ts (CatWriter gains u64), attached in compiler.ts after the toildb sections in the fixed order: toildb.catalog -> toildb.types -> toil.surface -> toilstream|toildaemon. - @scheduled spec parser: interval (30s/5m/1h/1d -> interval_ms, kind 0) and 5-field cron (-> minute/hour/dom/month/dow bitmasks, kind 1); diagnostics 9010/9011 wired. - Coherence hashes: data_coherence and pair_coherence computed over shared @DaTa types so a hot pass and a cold pass produce identical values (verified by test); fingerprint is mode-distinguishing. - toil.surface is suppressed only for bare non-Toil AS modules in legacy mode (mirrors how toildb.catalog behaves), so the stock compiler fixtures stay byte-identical; any real toil artifact (or explicit --targetMode) emits it. - build_id/abi_version and the export-name fingerprint component are stubbed pending the codegen/export increment. - tests/streams/catalog.mjs: ~80 byte-decode assertions; full compiler suite green.
1 parent aa794b4 commit 70fbd6c

3 files changed

Lines changed: 1262 additions & 1 deletion

File tree

src/compiler.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ import {
2121

2222
import {
2323
buildToilDbCatalog,
24-
buildToilDbTypes
24+
buildToilDbTypes,
25+
buildToilSurface,
26+
buildToilStreamCatalog,
27+
buildToilDaemonCatalog
2528
} from "./dbcatalog";
2629

2730
import {
@@ -821,6 +824,26 @@ export class Compiler extends DiagnosticEmitter {
821824
}
822825
}
823826

827+
// Streams + daemon surface sections (spec 03 sections 6/7/8, Part 5 order:
828+
// toildb.catalog -> toildb.types -> toil.surface -> stream|daemon catalog).
829+
// `toil.surface` is emitted in EVERY mode INCLUDING legacy (targetMode null,
830+
// stamped as a hot artifact, Part 5 / doc 02 AN-2), so the host has the
831+
// target mode + surface flags + the hot/cold coherence hash.
832+
let targetMode = this.options.targetMode;
833+
let surface = buildToilSurface(program, targetMode);
834+
if (surface != null) module.addCustomSection("toil.surface", surface);
835+
if (targetMode != "cold") {
836+
// hot or legacy: any @stream class -> toilstream.catalog.
837+
let streamCat = buildToilStreamCatalog(program);
838+
if (streamCat != null) module.addCustomSection("toilstream.catalog", streamCat);
839+
}
840+
if (targetMode == "cold") {
841+
// cold: a @daemon class -> toildaemon.catalog (parses @scheduled specs,
842+
// may fire diagnostics 9010/9011).
843+
let daemonCat = buildToilDaemonCatalog(program);
844+
if (daemonCat != null) module.addCustomSection("toildaemon.catalog", daemonCat);
845+
}
846+
824847
return module;
825848
}
826849

0 commit comments

Comments
 (0)