@threenative/runtime-native 0.3.3 → 0.3.4

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.
@@ -258,6 +258,18 @@ export function parseConsumerPlaytestReport(stdout, target, declaredFamilies = [
258
258
  throw consumerError('ROW_MALFORMED', 'the playtest diagnostics are malformed.');
259
259
  }
260
260
  const diagnostics = rawDiagnostics.map((item) => item.code);
261
+ if (
262
+ parsed.assertionResults === undefined &&
263
+ rawDiagnostics.some((diagnostic) => diagnostic.severity === 'error')
264
+ ) {
265
+ return {
266
+ assertionIds: ['diagnostics'],
267
+ assertions: 1,
268
+ diagnostics,
269
+ failures: diagnostics,
270
+ pass: false,
271
+ };
272
+ }
261
273
  if (diagnostics.some((code) => code.endsWith('UNSUPPORTED_ON_TARGET'))) {
262
274
  throw consumerError(
263
275
  'SCENARIO_NOT_CROSS_TARGET',
@@ -474,6 +486,28 @@ function defaultConsumerRunner(
474
486
  return { ...result, stderr: result.stderr ?? '', stdout: result.stdout ?? '' };
475
487
  }
476
488
 
489
+ /**
490
+ * What a failing runner said about itself. The harness writes its failure report to stderr as
491
+ * `{ diagnostics: [{ code, message, severity }], pass: false }`, so that is where the real cause
492
+ * lives; the raw tail is the fallback, so a runner that crashed before it could format a report
493
+ * still contributes its own words. Never returns empty — a diagnosis with nothing in it is the
494
+ * failure this exists to prevent.
495
+ */
496
+ function consumerRunnerFailureDetail(stderr) {
497
+ const text = stderr.trim();
498
+ let parsed;
499
+ try {
500
+ parsed = JSON.parse(text);
501
+ } catch {
502
+ parsed = undefined;
503
+ }
504
+ const diagnostics = Array.isArray(parsed?.diagnostics) ? parsed.diagnostics : [];
505
+ const named = diagnostics
506
+ .filter((item) => item !== null && typeof item === 'object' && nonEmptyString(item.code))
507
+ .map((item) => `${item.code}${nonEmptyString(item.message) ? `: ${item.message}` : ''}`);
508
+ return named.length > 0 ? named.join('; ') : `no JSON failure report; stderr: ${text.slice(-2000) || '(empty)'}`;
509
+ }
510
+
477
511
  export function verifyStarterConsumerGameplay(options = {}) {
478
512
  const target = options.target;
479
513
  if (!CONSUMER_REQUIRED_TARGETS.includes(target)) {
@@ -596,7 +630,7 @@ export function verifyStarterConsumerGameplay(options = {}) {
596
630
  options.activity ?? 'com.threenative.runtime.MystralActivity',
597
631
  );
598
632
  } else {
599
- args.push('--executable', artifact, '--host-arg', '--windowed');
633
+ args.push('--executable', artifact, '--host-arg', '--windowed', '--no-screenshots');
600
634
  }
601
635
  try {
602
636
  if (android) {
@@ -616,7 +650,29 @@ export function verifyStarterConsumerGameplay(options = {}) {
616
650
  `the '${target}' process did not complete: ${result.error?.message ?? result.signal ?? result.status}.`,
617
651
  );
618
652
  }
619
- const report = parseConsumerPlaytestReport(result.stdout ?? '', target, declaredFamilies);
653
+ // Exit 1 is "the run evaluated assertions and some failed" and the report naming which ones is
654
+ // on STDOUT; exit 2 (and 75) is "it never reached assertions" and that reason is on STDERR.
655
+ // Checking the status first and reading only stderr therefore reported `stderr: (empty)` for
656
+ // every failing assertion — both scaffolded-starter lanes failed on an assertion with nothing
657
+ // naming it. Read the report when there is one; fall back to stderr only when there is not.
658
+ let report;
659
+ try {
660
+ report = parseConsumerPlaytestReport(result.stdout ?? '', target, declaredFamilies);
661
+ } catch (error) {
662
+ if (result.status === 0) throw error;
663
+ throw consumerError(
664
+ 'RUNNER_FAILED',
665
+ `the '${target}' runner exited ${result.status}: ${consumerRunnerFailureDetail(result.stderr ?? '')}`,
666
+ );
667
+ }
668
+ // A nonzero exit outranks its own report: a process that ended 1 with a green report has not
669
+ // passed, whatever the JSON claims. The report is read for the diagnosis, never for the verdict.
670
+ if (result.status !== 0 && report.pass) {
671
+ throw consumerError(
672
+ 'RUNNER_FAILED',
673
+ `the '${target}' runner exited ${result.status} although its report claims ${report.assertions} passing assertion(s); the process verdict outranks a report it did not exit 0 on.`,
674
+ );
675
+ }
620
676
  Object.assign(row, {
621
677
  assertionIds: report.assertionIds,
622
678
  assertions: report.assertions,
@@ -624,12 +680,6 @@ export function verifyStarterConsumerGameplay(options = {}) {
624
680
  pass: report.pass,
625
681
  log: log.slice(-4000),
626
682
  });
627
- if (result.status !== 0 && report.pass) {
628
- throw consumerError(
629
- 'RUNNER_FAILED',
630
- `the '${target}' runner reported pass but exited ${result.status}.`,
631
- );
632
- }
633
683
  if (hashFile(artifact) !== artifactHash) {
634
684
  throw consumerError('ARTIFACT_MISMATCH', 'the consumer artifact changed during the run.');
635
685
  }
@@ -9,6 +9,7 @@ import { PNG } from 'pngjs';
9
9
 
10
10
  import { parseLinkedLibraries, resolveContainer } from './desktop-distribution.mjs';
11
11
  import { inspectContainerBrand } from './inspect-container-brand.mjs';
12
+ import { inspectMacosIcon } from './inspect-macos-icon.mjs';
12
13
 
13
14
  const READY_MARKER = 'TN_NATIVE_SMOKE_READY:webgpu';
14
15
  const ASSET_MARKER = 'TN_NATIVE_STARTER_ASSETS_LOADED:texture,glb';
@@ -317,7 +318,7 @@ export function verifyStarterDesktop({ frames = 300, project = process.cwd() } =
317
318
  * resolved first, so a tampered or incomplete payload never reaches the launch.
318
319
  */
319
320
  /**
320
- * Resolve what the container records and what brand it carries, without running anything.
321
+ * Resolve the container and inspect its brand without launching the game.
321
322
  *
322
323
  * Brand is judged before anything launches: a container that carries the wrong identity must not
323
324
  * be rescued by a green frame, and its failure names the surface, not the launch.
@@ -328,6 +329,14 @@ function inspectContainer(containerRoot, config, projectRoot) {
328
329
  config === undefined
329
330
  ? null
330
331
  : inspectContainerBrand(containerRoot, config, { project: projectRoot });
332
+ // inspectContainerBrand owns metadata/provenance. A release-verifier pass additionally needs
333
+ // the final macOS payload decoded: a matching source hash cannot prove an ICNS conversion.
334
+ if (brand?.icon !== undefined && manifest.platform.startsWith('darwin-')) {
335
+ brand.icon.macos = inspectMacosIcon(
336
+ join(containerRoot, brand.icon.path),
337
+ resolve(projectRoot, config.app.icon),
338
+ );
339
+ }
331
340
  return { brand, manifest };
332
341
  }
333
342
 
@@ -335,7 +344,8 @@ function inspectContainer(containerRoot, config, projectRoot) {
335
344
  * Inspect a distributed container's brand on a host that cannot launch it.
336
345
  *
337
346
  * The Windows CI leg packages a real `.exe` with real PE resources but has no interactive desktop
338
- * to run it on, and a macOS `.app` can be inspected from anywhere. Integrity records are resolved
347
+ * to run it on. macOS icon-content inspection needs macOS iconutil/sips, but no GUI session.
348
+ * Integrity records are resolved
339
349
  * first either way, so this is not a weaker check than the launching path — only a shorter one.
340
350
  */
341
351
  export function verifyContainerBrand({ root, config, project = process.cwd() } = {}) {