Step 6.7 — packaged standalone-build verification (tools/package.ps1)
Date: 2026-09-15
Host: Windows (win32, Windows_NT 10.0.26200), PowerShell shell
Source tree:   G:/.vibe/SciFi-XZBT        (working tree; HEAD 179b9db + uncommitted 6.7B/contract work)
Artifact:      G:/.vibe/SciFi-XZBT/dist/SciFiAmbientDisplay_V179b9db.html
Fixture mirror: G:/.vibe/XZBT-NGN/test-fixtures/reference-exhibits/scifi/dist/SciFiAmbientDisplay_V179b9db.html
Server: a pre-existing `npm start` server (node server/serve.js) was already running on
        http://127.0.0.1:4173. A second instance started for this pass failed with
        EADDRINUSE and exited; the served state was unchanged, and this pass neither
        started nor stopped the server.
Method: the real build tool, then the artifact examined structurally, loaded from file://,
        and handshaked over the same HTTP path NGN serves fixtures from. No test doubles.

====================================================================
1. Build
====================================================================
pre-build artifact (what the build replaces):
  SciFiAmbientDisplay_V179b9db.html  890902 bytes  2026-09-13 19:48
  sha256 B441820627D3FB23994D129B7425D781797E705867AC02967F96846B243435D4
  (byte-identical content retained as dist/SciFiAmbientDisplay_Va723f46=1.html)

command:
  powershell -ExecutionPolicy Bypass -File .\tools\package.ps1 -Force

log:
  G:\.vibe\SciFi-XZBT\tools\package.ps1 : Output file already exists:
    G:\.vibe\SciFi-XZBT\dist\SciFiAmbientDisplay_V179b9db.html
  WARNING: -Force specified; overwriting existing file.
  Packaging SciFi Ambient Display from G:\.vibe\SciFi-XZBT...
    -> Commit: 179b9db
    -> Inlining CSS: css/style.css
    -> Inlining JS:  js/audio.js
    -> Inlining JS:  js/config.js
    -> Inlining JS:  js/core-animations.js
    -> Inlining JS:  js/visualizer.js
    -> Inlining JS:  js/observation-bezels.js
    -> Inlining JS:  js/observation-engine.js
    -> Inlining JS:  js/control-bus.js
    -> Inlining JS:  js/surface-mode.js
    -> Inlining JS:  js/surface-bus.js
    -> Inlining JS:  js/generative-experience.js
    -> Inlining JS:  js/contract-adapter.js
    -> Inlining JS:  js/app.js
  Build Successful!
  Output: G:\.vibe\SciFi-XZBT\dist\SciFiAmbientDisplay_V179b9db.html (899.15 KB, 23514 lines)
  exit code: 0   (the already-exists message is a non-terminating Write-Error)

post-build artifact:
  SciFiAmbientDisplay_V179b9db.html  920730 bytes  2026-09-14 19:50
  sha256 DFD9A91CB04CABD7BD6AAA53DA0FA7A641DBB21E3B3E11FAF3EC75946D6FA271

====================================================================
2. Structural verification (node, against the built file)
====================================================================
--- inlined block check (built file must contain each source file verbatim) ---
INLINED  css/style.css                  62183 chars  @ 880
INLINED  js/audio.js                   238766 chars  @ 84546
INLINED  js/config.js                   66319 chars  @ 323336
INLINED  js/core-animations.js          10765 chars  @ 389679
INLINED  js/visualizer.js               25230 chars  @ 400468
INLINED  js/observation-bezels.js       17163 chars  @ 425722
INLINED  js/observation-engine.js      132667 chars  @ 442909
INLINED  js/control-bus.js               1535 chars  @ 575600
INLINED  js/surface-mode.js              3475 chars  @ 577159
INLINED  js/surface-bus.js               9562 chars  @ 580658
INLINED  js/generative-experience.js    48465 chars  @ 590244
INLINED  js/contract-adapter.js         34834 chars  @ 638733
INLINED  js/app.js                     223459 chars  @ 673591

--- external asset references (must all be 0) ---
{"script_src":0,"link_href":0,"img_src":0}
script wrappers: 12  style wrappers: 1

--- fix markers in the packaged file ---
{"presence_type_check":true,"stale_exact_gate_absent":true,"contract_minor_3":true,
 "version_530":true,"header_v53":true,"surface_mode":true,"surface_bus":true,
 "doctype":true,"closes_html":true}
script order matches index.html order: true
all blocks byte-identical to source: true
sha256: DFD9A91CB04CABD7BD6AAA53DA0FA7A641DBB21E3B3E11FAF3EC75946D6FA271

====================================================================
3. Fixture mirror
====================================================================
copy: source dist -> test-fixtures/reference-exhibits/scifi/dist/ (same filename -Force)
source dist sha256:  DFD9A91CB04CABD7BD6AAA53DA0FA7A641DBB21E3B3E11FAF3EC75946D6FA271
fixture dist sha256: DFD9A91CB04CABD7BD6AAA53DA0FA7A641DBB21E3B3E11FAF3EC75946D6FA271
byte-identical: True (920730 bytes)

====================================================================
4. Runtime verification (real browser)
====================================================================
4a. file:// load (standalone, no server, no NGN)
  title:      "Sci-Fi Ambience Generator - Publish Build v14co"
  readyState: complete
  globals:    XZBTContractAdapter: function; XZBTSurfaceMode: object;
              XZBTSurfaceBus: object; window.xzbtContractAdapter: present
  adapter:    contractMajor 5, contractMinor 3, version "5.3.0",
              surfaces ["surface.console", "surface.observation"]
  runtime self-containment: 12 <script> elements, 0 with src, 0 <link> elements,
              1 stylesheet (the inlined <style>)
  rendering:  body themed ("theme-lcars-tng xzbt-tv-aspect xzbt-tv-letterbox"),
              4 canvases (2 visible, e.g. 634x140 and 266x240), 8 visible buttons
              (MUTE + 7 preset buttons), visible text includes
              "STARFLIGHT / INTERPRISE-G: MAIN BRIDGE / STARSHIP PRESETS",
              layout engaged (scroll dimensions > 200px)
  handshake probe from file://: no reply - the adapter's origin guard rejects the
              same-window self-post (Chrome reports e.origin "null" for file://
              documents while window.location.origin is "file://"). Designed
              same-origin/self safety filter, not a defect; NGN attaches
              exhibits over http:// only.

4b. served over http://127.0.0.1:4173/test-fixtures/reference-exhibits/scifi/dist/...
  sent (same-origin host simulation, advisory tag "5.3"):
    {xzbt:'5.3', type:'hello',    requestId:'pkg-hello-1',    supportedContractMajors:[5]}
    {xzbt:'5.3', type:'describe', requestId:'pkg-describe-1', sessionId:<from hello>}
    {xzbt:'5.3', type:'state.get',requestId:'pkg-state-1',    sessionId:<from hello>}
  received (in order): hello.result, describe.result, state.result
    hello.result:    contract {major:5, minor:3}; exhibit.version "5.3.0";
                     sessionId present
    describe.result: 63 targets; surfaces ["surface.console","surface.observation"];
                     contract.minor 3
    state.result:    ok; stateRevision 0; values present
  adapter after handshake: contractMajor 5, contractMinor 3, sessionActive true,
                     mode "console"
  (the pre-fix build dropped every one of these messages at the inbound gate)

====================================================================
5. Post-pass status (2026-09-15)
====================================================================
NGN full suite (node --test):          154 tests, 154 pass, 0 fail, 0 skipped
tests/postmessage-interop.test.js:     7 tests, 7 pass, 0 fail
SciFi-XZBT contract harness:           21 Tests | 21 Passed | 0 Failed
SciFi-XZBT real-adapter suite:         32 Tests | 32 Passed | 0 Failed
python devlog_editor.py --validate:    devlog is valid
git diff --check (XZBT-NGN):           clean (all pending changes, incl. this pass's files)
git diff --check (SciFi-XZBT):         pre-existing trailing whitespace on four
                                       6.7B-added script lines in index.html;
                                       mirrored by design in the fixture copy,
                                       not introduced or changed by this pass
source/fixture index.html identical:   True
