@malloy-publisher/server 0.0.214 → 0.0.215

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/server.mjs CHANGED
@@ -248857,8 +248857,12 @@ class MaterializationService {
248857
248857
  }
248858
248858
  async executeInstructedBuild(compiled, instructions, seedEntries, signal) {
248859
248859
  const { graphs, sources, connectionDigests, connections } = compiled;
248860
+ const bySourceID = new Map;
248860
248861
  const byBuildId = new Map;
248861
248862
  for (const instruction of instructions) {
248863
+ if (instruction.sourceID) {
248864
+ bySourceID.set(instruction.sourceID, instruction);
248865
+ }
248862
248866
  byBuildId.set(instruction.buildId, instruction);
248863
248867
  }
248864
248868
  const manifest = new Manifest;
@@ -248878,7 +248882,7 @@ class MaterializationService {
248878
248882
  if (signal.aborted)
248879
248883
  throw new Error("Build cancelled");
248880
248884
  const buildId = computeBuildId(persistSource, connectionDigests);
248881
- const instruction = byBuildId.get(buildId);
248885
+ const instruction = bySourceID.get(persistSource.sourceID) ?? byBuildId.get(buildId);
248882
248886
  if (!instruction)
248883
248887
  continue;
248884
248888
  const entry = await this.buildOneSource(persistSource, instruction, connection, connectionDigests, manifest);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@malloy-publisher/server",
3
3
  "description": "Malloy Publisher Server",
4
- "version": "0.0.214",
4
+ "version": "0.0.215",
5
5
  "main": "dist/server.mjs",
6
6
  "bin": {
7
7
  "malloy-publisher": "dist/server.mjs"
@@ -560,8 +560,20 @@ export class MaterializationService {
560
560
  ): Promise<Record<string, ManifestEntry>> {
561
561
  const { graphs, sources, connectionDigests, connections } = compiled;
562
562
 
563
+ // Index instructions by sourceID (the stable per-source handle) so the
564
+ // build no longer recomputes the buildId to find an instruction.
565
+ // Recomputing it here forced a caller's buildId to equal the publisher's
566
+ // content hash, so a caller that derives buildIds by any other scheme
567
+ // would have its sources silently skipped (the recomputed buildId would
568
+ // not match the instruction). buildId is treated as opaque, caller-assigned
569
+ // identity. A buildId index is kept as a fallback for instructions without
570
+ // a sourceID (e.g. standalone auto-run).
571
+ const bySourceID = new Map<string, BuildInstruction>();
563
572
  const byBuildId = new Map<string, BuildInstruction>();
564
573
  for (const instruction of instructions) {
574
+ if (instruction.sourceID) {
575
+ bySourceID.set(instruction.sourceID, instruction);
576
+ }
565
577
  byBuildId.set(instruction.buildId, instruction);
566
578
  }
567
579
 
@@ -587,8 +599,15 @@ export class MaterializationService {
587
599
  for (const persistSource of iterGraphSources(graph, sources)) {
588
600
  if (signal.aborted) throw new Error("Build cancelled");
589
601
 
602
+ // The manifest is keyed by the content buildId — what Malloy
603
+ // recomputes to resolve upstream persist references during SQL
604
+ // generation — independent of the instruction's identity buildId.
590
605
  const buildId = computeBuildId(persistSource, connectionDigests);
591
- const instruction = byBuildId.get(buildId);
606
+ // Prefer sourceID matching (so the caller's buildId scheme stays
607
+ // opaque to the build); fall back to buildId for instructions
608
+ // without a sourceID (auto-run).
609
+ const instruction =
610
+ bySourceID.get(persistSource.sourceID) ?? byBuildId.get(buildId);
592
611
  if (!instruction) continue;
593
612
 
594
613
  const entry = await this.buildOneSource(