Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.
HTML agent-skillsai-agentsarchitecture-diagramclaude-codeclaude-skillscodexcoding-agentsdeepseek-harnessdeveloper-toolsdiagramsdiagrams-as-codedsh-pluginflowchartllmmermaidopencodesequence-diagramsoftware-architecturesystem-designvisualization
test: shorten core feedback and remove implementation snapshots
tt-a1i692dd9a0da6a
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex d24ed192..3a5f7106 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -4,6 +4,7 @@ on:push:branches: [main, dev]pull_request:+ workflow_dispatch:# Cancel obsolete PR runs, but never interrupt main verification/deployment.concurrency:@@ -16,6 +17,14 @@ jobs:outputs:scope: ${{ steps.classify.outputs.scope }}website: ${{ steps.classify.outputs.website }}+ generated: ${{ steps.classify.outputs.generated }}+ browser: ${{ steps.classify.outputs.browser }}+ webm: ${{ steps.classify.outputs.webm }}+ package: ${{ steps.classify.outputs.package }}+ windows: ${{ steps.classify.outputs.windows }}+ manifest: ${{ steps.classify.outputs.manifest }}+ owners: ${{ steps.classify.outputs.owners }}+ changedTests: ${{ steps.classify.outputs.changedTests }}steps:# Classification compares two trees, not their shared history.- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0@@ -29,6 +38,15 @@ jobs:run: |[[ "$CI_BASE_SHA" =~ ^[0-9a-f]{40}$ ]] || exit 1git fetch --no-tags --depth=1 origin "$CI_BASE_SHA"+ - name: Fetch dev push comparison base when available+ if: github.event_name == 'push' && github.ref == 'refs/heads/dev'+ shell: bash+ env:+ CI_BASE_SHA: ${{ github.event.before }}+ run: |+ if [[ "$CI_BASE_SHA" =~ ^[0-9a-f]{40}$ ]] && [[ ! "$CI_BASE_SHA" =~ ^0+$ ]]; then+ git fetch --no-tags --depth=1 origin "$CI_BASE_SHA" || echo 'Comparison base unavailable; classification requires full CI.'+ fi- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0with:node-version: 22@@ -37,7 +55,8 @@ jobs:run: node scripts/ci-scope.mjsenv:CI_EVENT_NAME: ${{ github.event_name }}- CI_BASE_SHA: ${{ github.event.pull_request.base.sha }}+ CI_BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}+ CI_REF: ${{ github.ref }}- name: Check README content for documentation-only changesif: steps.classify.outputs.scope == 'docs'run: node --test test/readme-showcase.test.mjs@@ -58,11 +77,11 @@ jobs:shell: bashrun: |test "$SCOPE_RESULT" = success- case "$CI_SCOPE" in docs|full) ;; *) exit 1 ;; esac+ case "$CI_SCOPE" in docs|core|full) ;; *) exit 1 ;; esac- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0- if: needs.scope.outputs.scope == 'full'+ if: needs.scope.outputs.scope != 'docs'- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0- if: needs.scope.outputs.scope == 'full'+ if: needs.scope.outputs.scope != 'docs'with:node-version: ${{ matrix.node-version }}cache: npm@@ -70,14 +89,26 @@ jobs:package-lock.jsonarchify/package-lock.json- name: Install renderer dependencies- if: needs.scope.outputs.scope == 'full'+ if: needs.scope.outputs.scope != 'docs'run: npm ci && npm --prefix archify ci- name: Complete regression suite on canonical Nodeif: needs.scope.outputs.scope == 'full' && matrix.node-version == 22+ run: npm run test:full+ - name: Core public CLI contracts+ if: needs.scope.outputs.scope == 'core' && matrix.node-version == 22run: npm test- name: Supported Node runtime compatibility- if: needs.scope.outputs.scope == 'full' && matrix.node-version != 22+ if: needs.scope.outputs.scope != 'docs' && matrix.node-version != 22run: npm run test:compat+ - name: Generated outputs and representative goldens+ if: needs.scope.outputs.scope != 'full' && needs.scope.outputs.generated == 'true' && matrix.node-version == 22+ run: npm run test:generated+ - name: Changed tests and owned regression suites+ if: needs.scope.outputs.scope == 'core' && matrix.node-version == 22+ run: npm run test:affected+ env:+ CI_TEST_OWNERS: ${{ needs.scope.outputs.owners }}+ CI_CHANGED_TESTS: ${{ needs.scope.outputs.changedTests }}- name: Verify community Hermes adapterif: needs.scope.outputs.scope == 'full' && matrix.node-version == 22run: node --test integrations/hermes-agent/test/plugin-contract.test.mjs@@ -98,25 +129,25 @@ jobs:shell: bashrun: |test "$SCOPE_RESULT" = success- case "$CI_SCOPE" in docs|full) ;; *) exit 1 ;; esac+ case "$CI_SCOPE" in docs|core|full) ;; *) exit 1 ;; esac- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0- if: needs.scope.outputs.scope == 'full'+ if: needs.scope.outputs.browser == 'true'- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0- if: needs.scope.outputs.scope == 'full'+ if: needs.scope.outputs.browser == 'true'with:node-version: 22- name: Provision a known Chrome runtime- if: needs.scope.outputs.scope == 'full'+ if: needs.scope.outputs.browser == 'true'id: setup-chromeuses: browser-actions/setup-chrome@48ad923757ca74d66703209fe939badbdf80f2f4 # v2.2.0with:chrome-version: stableinstall-dependencies: true- name: Install browser test dependencies- if: needs.scope.outputs.scope == 'full'+ if: needs.scope.outputs.browser == 'true'run: npm ci --ignore-scripts --no-audit --no-fund && npm --prefix archify ci --ignore-scripts- name: Run shared browser regression gate- if: needs.scope.outputs.scope == 'full'+ if: needs.scope.outputs.browser == 'true'run: npm run test:browser -- --shard=${{ matrix.shard }}/2env:ARCHIFY_CHROME: ${{ steps.setup-chrome.outputs.chrome-path }}@@ -135,25 +166,25 @@ jobs:shell: bashrun: |test "$SCOPE_RESULT" = success- case "$CI_SCOPE" in docs|full) ;; *) exit 1 ;; esac+ case "$CI_SCOPE" in docs|core|full) ;; *) exit 1 ;; esac- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0- if: needs.scope.outputs.scope == 'full'+ if: needs.scope.outputs.webm == 'true'- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0- if: needs.scope.outputs.scope == 'full'+ if: needs.scope.outputs.webm == 'true'with:node-version: 22- name: Provision a known Chrome runtime- if: needs.scope.outputs.scope == 'full'+ if: needs.scope.outputs.webm == 'true'id: setup-chromeuses: browser-actions/setup-chrome@48ad923757ca74d66703209fe939badbdf80f2f4 # v2.2.0with:chrome-version: stableinstall-dependencies: true- name: Install the WebM decoder- if: needs.scope.outputs.scope == 'full'+ if: needs.scope.outputs.webm == 'true'run: sudo apt-get update && sudo apt-get install --no-install-recommends -y ffmpeg- name: Decode a real motion export and reject static frames- if: needs.scope.outputs.scope == 'full'+ if: needs.scope.outputs.webm == 'true'run: npm run test:webmenv:ARCHIFY_CHROME: ${{ steps.setup-chrome.outputs.chrome-path }}@@ -172,7 +203,7 @@ jobs:shell: bashrun: |test "$SCOPE_RESULT" = success- case "$CI_SCOPE" in docs|full) ;; *) exit 1 ;; esac+ case "$CI_SCOPE" in docs|core|full) ;; *) exit 1 ;; esactest "$BROWSER_RESULT" = successtest "$WEBM_RESULT" = success@@ -189,15 +220,15 @@ jobs:shell: bashrun: |test "$SCOPE_RESULT" = success- case "$CI_SCOPE" in docs|full) ;; *) exit 1 ;; esac+ case "$CI_SCOPE" in docs|core|full) ;; *) exit 1 ;; esac- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0- if: needs.scope.outputs.scope == 'full'+ if: needs.scope.outputs.package == 'true'- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0- if: needs.scope.outputs.scope == 'full'+ if: needs.scope.outputs.package == 'true'with:node-version: 22- name: Rebuild archify.zip and compare exact bytes- if: needs.scope.outputs.scope == 'full'+ if: needs.scope.outputs.package == 'true'run: |scripts/build-zip.sh /tmp/fresh.zipif ! cmp -s /tmp/fresh.zip archify.zip; then@@ -218,15 +249,15 @@ jobs:shell: bashrun: |test "$SCOPE_RESULT" = success- case "$CI_SCOPE" in docs|full) ;; *) exit 1 ;; esac+ case "$CI_SCOPE" in docs|core|full) ;; *) exit 1 ;; esac- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0- if: needs.scope.outputs.scope == 'full'+ if: needs.scope.outputs.manifest == 'true'- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0- if: needs.scope.outputs.scope == 'full'+ if: needs.scope.outputs.manifest == 'true'with:node-version: 22- name: Public notifier manifest must reference an existing stable Release- if: needs.scope.outputs.scope == 'full'+ if: needs.scope.outputs.manifest == 'true'env:GH_TOKEN: ${{ github.token }}run: |@@ -292,15 +323,15 @@ jobs:shell: bashrun: |test "$SCOPE_RESULT" = success- case "$CI_SCOPE" in docs|full) ;; *) exit 1 ;; esac+ case "$CI_SCOPE" in docs|core|full) ;; *) exit 1 ;; esac- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0- if: needs.scope.outputs.scope == 'full'+ if: needs.scope.outputs.package == 'true'- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0- if: needs.scope.outputs.scope == 'full'+ if: needs.scope.outputs.package == 'true'with:node-version: 22- name: Extract packaged skill- if: needs.scope.outputs.scope == 'full' && (runner.os != 'Windows')+ if: needs.scope.outputs.package == 'true' && (runner.os != 'Windows')run: |set -euo pipefailpackage_root="$RUNNER_TEMP/archify-package"@@ -308,26 +339,26 @@ jobs:mkdir -p "$package_root"unzip -q archify.zip -d "$package_root"- name: Extract packaged skill- if: needs.scope.outputs.scope == 'full' && (runner.os == 'Windows')+ if: needs.scope.outputs.package == 'true' && (runner.os == 'Windows')shell: pwshrun: |$packageRoot = Join-Path $env:RUNNER_TEMP 'archify-package'if (Test-Path $packageRoot) { Remove-Item -Recurse -Force $packageRoot }Expand-Archive -Path archify.zip -DestinationPath $packageRoot- name: Validate packaged skill without installing dependencies- if: needs.scope.outputs.scope == 'full'+ if: needs.scope.outputs.package == 'true'run: node scripts/package-smoke.mjs- name: Install delivery-lock test dependencies- if: needs.scope.outputs.scope == 'full' && runner.os != 'Linux'+ if: needs.scope.outputs.windows == 'true' && runner.os != 'Linux'run: npm ci --ignore-scripts && npm --prefix archify ci --ignore-scripts- name: Verify delivery-lock ownership with real subprocesses- if: needs.scope.outputs.scope == 'full' && runner.os != 'Linux'+ if: needs.scope.outputs.windows == 'true' && runner.os != 'Linux'run: >-node --test--test-name-pattern="cli: portable delivery lock:"test/cli.test.mjs- name: Verify macOS opener stays behind delivery-lock release- if: needs.scope.outputs.scope == 'full' && runner.os == 'macOS'+ if: needs.scope.outputs.windows == 'true' && runner.os == 'macOS'run: >-node --test--test-name-pattern="cli: lock release failure does not invoke the requested opener"@@ -407,28 +438,28 @@ jobs:shell: bashrun: |test "$SCOPE_RESULT" = success- case "$CI_SCOPE" in docs|full) ;; *) exit 1 ;; esac+ case "$CI_SCOPE" in docs|core|full) ;; *) exit 1 ;; esac- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0- if: needs.scope.outputs.scope == 'full'+ if: needs.scope.outputs.windows == 'true'- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0- if: needs.scope.outputs.scope == 'full'+ if: needs.scope.outputs.windows == 'true'with:node-version: ${{ matrix.node-version }}- name: Install test dependencies- if: needs.scope.outputs.scope == 'full'+ if: needs.scope.outputs.windows == 'true'run: npm ci --ignore-scripts && npm --prefix archify ci --ignore-scripts- name: Provision controlled Windows path fixtures- if: needs.scope.outputs.scope == 'full'+ if: needs.scope.outputs.windows == 'true'shell: pwshrun: scripts/windows-path-fixtures.ps1 -NodeVersion '${{ matrix.node-version }}'- name: Verify maintained Windows path contracts- if: needs.scope.outputs.scope == 'full'+ if: needs.scope.outputs.windows == 'true'run: node scripts/run-windows-path-tests.mjsenv:ARCHIFY_REQUIRE_WINDOWS_8DOT3: '1'ARCHIFY_REQUIRE_WINDOWS_REAL_PATHS: '1'- name: Clean up controlled Windows path fixtures- if: ${{ always() && needs.scope.outputs.scope == 'full' }}+ if: ${{ always() && needs.scope.outputs.windows == 'true' }}shell: pwshrun: scripts/windows-path-fixtures.ps1 -NodeVersion '${{ matrix.node-version }}' -Cleanupdiff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex b927e7a0..140fd01f 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -53,7 +53,7 @@ jobs:- name: Install renderer dependenciesrun: npm ci && npm --prefix archify ci- name: Complete regression suite on canonical Node before releasing- run: npm test+ run: npm run test:full- name: Provision a known Chrome runtimeid: setup-chromeuses: browser-actions/setup-chrome@48ad923757ca74d66703209fe939badbdf80f2f4 # v2.2.0diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex c3e80c40..640d5f58 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -38,13 +38,32 @@ Use [the PR template](.github/PULL_REQUEST_TEMPLATE.md); link existing receiptsSkill instructions, authored examples, build inputs, and generated-site sources are behavioral inputs even when they look like documentation. Policy changes need process review; runtime evidence depends on whether they affect runtime inputs.-Start with focused checks for the affected behavior. Use the full `npm test` suite from the repository root when shared behavior, broad changes, or findings require wider coverage. Final review needs sufficient evidence for the impact above; relevant CI results can supply that coverage without repeating the same run locally. Identify the revision and coverage of reused results, and explain material gaps. Required remote CI and branch protection still apply.--### Documentation-only CI--Pull requests changing only `README.md`, `README_EN.md`, `README_ZH.md`, or PNG/SVG files directly under `docs/assets/community/` run the existing README checks once on Node 22. Required CI job names remain present, but their unrelated runtime, browser, and package steps do not run. A failed scope classification or README check fails those required jobs.--Any other changed path (including tests, Skill instructions, templates, generated diagrams, dependencies, and workflow configuration) keeps full CI. Empty change sets also use full CI. Pushes to `main` always run the complete suite. New pushes cancel obsolete CI runs for the same PR; main runs are not cancelled.+Start with `npm test` for the core product smoke or focused checks for the affected behavior. Use `npm run test:full` when shared infrastructure, broad changes, or findings require wider coverage. Final review needs sufficient evidence for the impact above; relevant CI results can supply that coverage without repeating the same run locally. Identify the revision and coverage of reused results, and explain material gaps. Required remote CI and branch protection still apply.++Tests should protect a user outcome or a real failure boundary. Prefer rendered+content, successful interaction, preserved authored intent, and bounded work to+matching implementation source or freezing automatic layout coordinates. A+better automatic route, clearer copy, or equivalent refactor should not fail a+test merely because it differs from the old implementation. Delete redundant+source assertions when a behavior test owns that protection. Keep explicit+geometry, compatibility, accessibility, failure cleanup, and protection against+lost or corrupted output as observable contracts.++### CI by affected responsibility++CI uses the ownership groups in `scripts/ci-scope.mjs`. Product changes run core+CLI coverage on the maintained Node versions and the affected regression suites.+Renderer and Viewer changes also run the real browser gate and generated-output+checks. Filesystem, process, dependency, build, and workflow changes retain the+full regression and relevant Windows/package gates. New or modified test files+are executed; test helpers and fixtures take the conservative full path.+Repository prose and website-only changes use their own checks.++Unknown paths, an empty comparison, and an unavailable development-push base+select full coverage. An invalid PR comparison fails classification. Required+job names remain present, and a failed classification cannot turn into successful+skips. Main pushes and manual CI runs use complete coverage; releases explicitly+run `test:full`. New pushes cancel obsolete CI runs for the same PR.## Product and compatibility contracts@@ -62,6 +81,7 @@ The renderer package is in `archify/`; repository tests and their dependencies l```shnpm cinpm --prefix archify ci+npm testnpm run test:focus -- test/geometry.test.mjs```@@ -82,28 +102,21 @@ npm run test:focus -- test/cli.test.mjs '--test-name-pattern=cli: validate'Nested tests follow Node's filtering rules: include their parent test names inthe pattern as well. Check the reported pass/skip counts for the intended cases.-`npm test` still runs all generated-output checks, golden comparisons, and every-discovered test suite. CI runs that complete suite once on canonical Node 22.-The Node 18, 20, and 24 checks run `npm run test:compat`: all golden comparisons-across the ten diagram types, followed by the maintained whole suites for CLI,-schema compatibility, processes, paths, atomic output, preview, update, and-diagnostics. The compatibility inventory is in-`scripts/compat-test-inventory.mjs`; it also retains the complete package-gate-suite for filesystem failures and noncanonical archive-toolchain rejection.-Repository content, generator, and installation regressions remain in the-complete Node 22 run. This preserves every regression in its owning gate while-testing the maintained Node runtimes; it does not repeat every regression on-every Node major. Tags retain the complete Node 22 suite, and both workflows-retain their real Windows path, browser, WebM, and package gates.--Use `npm run test:compat -- --list` to inspect the compatibility suites without-running them; a normal compatibility run also runs the golden harness first.-Exact file and test-name selections are supported through the shared runner,-but a selected pass covers only that selection plus the golden harness.-`test:focus` remains the development command that omits the golden pass.+| Command | What it establishes |+| --- | --- |+| `npm test` / `npm run test:core` | Ten diagram types run through the public CLI, frozen v1 inputs remain usable, delivery receipts bind the actual files, and failed delivery preserves the previous artifact. No browser or perceptual acceptance is implied. |+| `npm run test:focus -- test/<name>.test.mjs` | Only the selected behavior or regression. |+| `npm run test:generated` | Viewer, brand marks, validators, release identity, and checked-in examples match their authoritative sources. Freshness does not establish visual quality. |+| `npm run test:full` | Generated checks followed by every discovered Node test file, including the detailed process, filesystem, installation, and failure matrices. |++The Node 18, 20, and 24 compatibility lanes run the same core product smoke via+`test:compat`. Detailed fault-injection matrices run on canonical Node 22 when+their responsibility is affected and in complete verification. The separate+browser, WebM, Windows, and package gates retain their distinct claims. Do not+repeat an unchanged complete run locally just because CI is also running it.The test runners accept `--concurrency=N` to tune the number of simultaneous-test files on Node 18.19+, for example `npm test -- --concurrency=4`. Headless+test files on Node 18.19+, for example `npm run test:focus -- test/geometry.test.mjs --concurrency=4`. Headlessrepository and compatibility runs default to the available CPU count, cappedat 4. Setting `ARCHIFY_CHROME` or running `test:browser` keeps the default at 2.Older Node versions that lack this concurrency option retain Node's default.@@ -131,8 +144,8 @@ ARCHIFY_CHROME="/path/to/chrome" npm run test:browser```This command requires a usable Chrome/Chromium and fails when none is available.-Its maintained file list is in `scripts/run-browser-tests.mjs`; add new browser-suites there so both workflows keep the same coverage. Ordinary `npm test`+Its maintained file list is in `scripts/browser-test-inventory.mjs`; add new browser+suites there so both workflows keep the same coverage. `npm run test:full`retains optional browser skips. Real WebM decoding and site-language integrationremain in the separate `npm run test:webm` gate used by both workflows.@@ -146,7 +159,7 @@ combined with explicit files or test-name filtering; every maintained file runsin exactly one shard, and every executing shard still requires Chrome.Only set `ARCHIFY_CHROME` for the browser run when you also plan to run the full-browser gate: many browser suites are included in `npm test` and would otherwise+browser gate: many browser suites are included in `test:full` and would otherwiseexecute again. The canonical regression suite, Node compatibility matrix, andrequired browser gate establish their respective coverage. Reuse the applicablefinal-head CI results instead of repeating an unchanged full suite locally.@@ -155,7 +168,8 @@ final-head CI results instead of repeating an unchanged full suite locally.Viewer maintenance starts in [`viewer/`](viewer/README.md). Edit its sourcefiles, then run `npm run generate:viewer` from `archify/`; the delivered template-is generated and its freshness is checked by `npm test`.+is generated and its freshness is checked by `npm run test:generated` (also part+of `test:full`).Published artifacts must be reproducible from tracked content. Use a tracked-only, symlink-safe staging path or explicit allowlist, with negative coverage for untracked files and external symlinks. Test the extracted package outside the repository on the affected advertised hosts.@@ -183,7 +197,7 @@ Use this single checklist in the release PR or its linked release record. Link e1. [ ] **Scope and revision.** Record the intended version/channel, release scope, final source SHA, comparison base, release notes, known issues, and required integration follow-ups. Follow the `dev` trial-use → `main` promotion process below. Pin evidence to its tested SHA; refresh the record when the candidate changes.2. [ ] **Identity and build.** Verify package/Skill identity and generated outputs using the candidate revision's existing checks. Use the canonical Node/zlib toolchain above for `scripts/build-zip.sh`; confirm the committed `archify.zip` matches the clean tracked-source build. Do not change versions or regenerate unrelated artifacts in ordinary feature PRs. Preserve the previous stable manifest until the new stable Release exists.-3. [ ] **Final-head validation.** Account for the latest target base and verify required CI at the final candidate: identity and ZIP gates, schema/renderer tests, installation parser and real Skills CLI discovery, package smoke on Linux/macOS/Windows, browser/WebM checks, and affected website checks. Record run URLs, SHA, real-use evidence, and any skipped or unavailable checks; an earlier green head or zero checks is not final acceptance. Use commands from that revision's manifests/workflows: current `dev` installs root and renderer dependencies and runs `npm test`, `npm run test:browser`, and `npm run test:webm` at the repository root (see [Local setup](#local-setup-and-verification)); older `main`/release revisions may run these from `archify/`. Website commands run in `website/`. Do not transplant a command or its working directory across revisions without checking.+3. [ ] **Final-head validation.** Account for the latest target base and verify required CI at the final candidate: identity and ZIP gates, schema/renderer tests, installation parser and real Skills CLI discovery, package smoke on Linux/macOS/Windows, browser/WebM checks, and affected website checks. Record run URLs, SHA, real-use evidence, and any skipped or unavailable checks; an earlier green head or zero checks is not final acceptance. Use commands from that revision's manifests/workflows: current `dev` installs root and renderer dependencies and runs `npm run test:full`, `npm run test:browser`, and `npm run test:webm` at the repository root (see [Local setup](#local-setup-and-verification)); older `main`/release revisions may run these from `archify/`. Website commands run in `website/`. Do not transplant a command or its working directory across revisions without checking.4. [ ] **Authorized publication.** Confirm authorization for the exact release version/channel and source SHA before pushing a release tag. Stable `v<version>` tags must be annotated and resolve to the verified commit; the workflow checks tag/package identity and the release channel. Verify the resulting GitHub Release and its `archify.zip` asset, digest, and expected stable/prerelease status. Do not overwrite existing versions, tags, or assets to repair a release. Installing or updating a user's live installation requires its own authorization.5. [ ] **Manifest, website, and integrations.** After the stable Release exists, publish `docs/skill-updates/archify/stable.json` in a follow-up commit through the normal branch process. Retain the `published-update-manifest` result that compares the actual Release ZIP, tagged archive, digest, and tagged Skill tree; wait for the gated `main` Pages deployment. Development/prerelease tags do not advance the stable notifier. Complete the [DSH synchronization checklist](#release-checklist-dsh-synchronization) or record an explicit deferral. Evaluate other integrations by their actual distribution mechanism: [Hermes](integrations/hermes-agent/README.md#install-shows-up-in-available-skills) installs the main Skill identifier; do not invent a separate Hermes release simply because Archify changed. Record any documentation/compatibility update or indexing lag that needs follow-up.6. [ ] **Public acceptance and closure.** Check the public download and advertised installation/discovery paths against the released artifact in an isolated environment, without changing live user installations. Verify the public stable manifest, Pages version, installation instructions, and community catalog source/evidence/compatibility links describe what users can actually obtain; distinguish published, pending, and explicitly deferred integration versions. Record the final release/tag/SHA, asset digest, CI and deployment receipts, public acceptance result, and every remaining owner/follow-up. Only describe each channel as complete after its own verification.diff --git a/package.json b/package.jsonindex 4621e5c6..949a9983 100644--- a/package.json+++ b/package.json@@ -6,11 +6,15 @@"node": ">=18"},"scripts": {- "test": "npm --prefix archify run check:viewer && npm --prefix archify run check:brand-marks && npm --prefix archify run check:validators && npm --prefix archify run check:release-identity && node test/golden.mjs && node scripts/run-tests.mjs",+ "test": "npm run test:core","test:focus": "node scripts/run-tests.mjs --require-files",- "test:compat": "node scripts/run-compat-tests.mjs",+ "test:compat": "npm run test:core","test:browser": "node scripts/run-browser-tests.mjs",- "test:webm": "node test/webm-artifact.smoke.mjs && node --test test/site-language-integration.mjs"+ "test:webm": "node test/webm-artifact.smoke.mjs && node --test test/site-language-integration.mjs",+ "test:core": "node scripts/run-tests.mjs test/core-smoke.test.mjs",+ "test:generated": "npm --prefix archify run check:viewer && npm --prefix archify run check:brand-marks && npm --prefix archify run check:validators && npm --prefix archify run check:release-identity && node test/golden.mjs",+ "test:full": "npm run test:generated && node scripts/run-tests.mjs",+ "test:affected": "node scripts/run-affected-tests.mjs"},"devDependencies": {"ajv": "^8.17.1",diff --git a/scripts/browser-test-inventory.mjs b/scripts/browser-test-inventory.mjsnew file mode 100644index 00000000..63dcc530--- /dev/null+++ b/scripts/browser-test-inventory.mjs@@ -0,0 +1,36 @@+// Shared by PR CI and tag releases. WebM decoding stays in test:webm.+// Adjacent heavy suites use opposite indices for CI's two modulo shards.+export const browserTestFiles = [+ 'finalize-browser.test.mjs',+ 'desktop-reader-browser.test.mjs',+ 'reader-readability-maintained-browser.test.mjs',+ 'reader-layout-browser.test.mjs',+ 'reader-layout-settle-browser.test.mjs',+ 'reader-cards-overflow-browser.test.mjs',+ 'joint-layout-browser.test.mjs',+ 'sequence-header-clearance.test.mjs',+ 'sequence-width-default-browser.test.mjs',+ 'compact-header-clearance.test.mjs',+ 'architecture-reading-size-browser.test.mjs',+ 'export-cleanup-browser.test.mjs',+ 'i18n.test.mjs',+ 'offline-font-browser.test.mjs',+ 'viewer-chrome-layout.test.mjs',+ 'semantic-radar.test.mjs',+ 'viewer-camera-browser.test.mjs',+ 'motion-governor-browser.test.mjs',+ 'finder-browser.test.mjs',+ 'intent-trace-browser.test.mjs',+ 'semantic-lens-browser.test.mjs',+ 'route-probe-browser.test.mjs',+ 'focus-browser.test.mjs',+ 'crossover-state-browser.test.mjs',+ 'semantic-passport-move-browser.test.mjs',+ 'export-browser.test.mjs',+ 'viewer-identifiers-browser.test.mjs',+ 'repository-evidence.test.mjs',+ 'repository-evidence-types-browser.test.mjs',+ 'tree-branches-browser.test.mjs',+ 'class-motion-browser.test.mjs',+ 'dataflow-label-visibility-browser.test.mjs',+];diff --git a/scripts/ci-scope.mjs b/scripts/ci-scope.mjsindex ae0255bb..066f6d55 100644--- a/scripts/ci-scope.mjs+++ b/scripts/ci-scope.mjs@@ -2,26 +2,88 @@import { execFileSync } from 'node:child_process';import fs from 'node:fs';import { pathToFileURL } from 'node:url';+import { browserTestFiles } from './browser-test-inventory.mjs';-// Deliberately narrow: unknown paths, test changes, and authoring inputs run full CI.+const modes = 'architecture|workflow|sequence|dataflow|lifecycle|erd|class|tree|timeline|waterfall';+const rendererPath = new RegExp(`^archify/(?:renderers/(${modes})/|schemas/(${modes})\\.schema\\.json$)`);+const renderShared = /^(geometry|utils|i18n|route-quality|diagnostics|brand-marks|generated-validators|legend|layout-report|engineering-profiles|validator|generated-brand-marks|desktop-readability|text-fit|svg-path-analysis|automatic-labels|spatial-grid)\.mjs$/;+const gates = ['generated', 'browser', 'webm', 'package', 'windows', 'manifest', 'website'];export function classifyPaths(paths) {- return paths.length > 0 && paths.every(path =>- /^(README(?:_EN|_ZH)?\.md|docs\/assets\/community\/[^/]+\.(?:png|svg))$/.test(path)- ) ? 'docs' : 'full';+ const plan = { scope: 'core', owners: [], changedTests: [], ...Object.fromEntries(gates.map(name => [name, false])) };+ const full = () => ({ ...plan, scope: 'full', ...Object.fromEntries(gates.map(name => [name, true])) });+ if (!paths.length) return full();+ const own = owner => { if (!plan.owners.includes(owner)) plan.owners.push(owner); };+ let archiveChanged = false;+ let requireFull = false;+ for (const name of paths) {+ if (/^(docs|examples|archify\/examples)\/.*\.(html|svg)$/.test(name) && !name.startsWith('docs/assets/community/')) own('artifact');+ if (/^examples\/checkout-platform-delta\.(html|receipt\.json)$/.test(name)) own('delta');+ if (name === 'archify.zip') { archiveChanged = true; plan.package = true; continue; }+ if (/^test\/[^/]+\.test\.mjs$/.test(name)) {+ plan.changedTests.push(name);+ if (browserTestFiles.includes(name.slice(5)) || name.endsWith('-browser.test.mjs')) {+ plan.browser = true;+ if (!plan.changedTests.includes('test/browser-gate.test.mjs')) plan.changedTests.push('test/browser-gate.test.mjs');+ }+ continue;+ }+ if (/^README(?:_EN|_ZH)?\.md$/.test(name)) { own('readme'); continue; }+ if (/^(CONTRIBUTING|REVIEWING|AGENTS|CODE_OF_CONDUCT|SECURITY)\.md$/.test(name)) continue;+ if (/^docs\/assets\/community\/[^/]+\.(png|svg)$/.test(name)) continue;+ if (/^(website\/|docs\/)/.test(name)) {+ plan.website = true;+ if (/^docs\/(gallery(?:\/|\.html$)|guide\.html$|start\.html$)/.test(name)) own('site');+ if (/^docs\/skill-updates\//.test(name)) plan.manifest = true;+ continue;+ }+ const renderer = name.match(rendererPath);+ if (renderer) {+ own(renderer[1] || renderer[2]);+ if (renderer[2]) own('schema');+ plan.generated = plan.browser = plan.package = true;+ continue;+ }+ if (name.startsWith('archify/renderers/shared/') && renderShared.test(name.slice('archify/renderers/shared/'.length))) {+ own('renderer'); plan.generated = plan.browser = plan.package = true; continue;+ }+ if (/^(viewer\/|archify\/assets\/)/.test(name)) {+ own('viewer'); plan.generated = plan.browser = plan.webm = plan.package = true; continue;+ }+ if (/^archify\/(SKILL\.md$|references\/|recipes\/|examples\/)/.test(name)) {+ own('authoring'); plan.generated = plan.package = true;+ if (name.startsWith('archify/recipes/')) plan.website = true;+ continue;+ }+ if (/^examples\//.test(name)) { plan.generated = true; continue; }+ // Build inputs, dependencies, workflow/runner changes, filesystem/CLI helpers,+ // test fixtures and every unknown path require the complete gates.+ requireFull = true;+ }+ if (requireFull) return full();+ if (archiveChanged && !plan.owners.some(owner => ['renderer', 'viewer', 'authoring', 'schema', ...modes.split('|')].includes(owner))) return full();+ if (plan.owners.every(owner => owner === 'readme') && !plan.changedTests.length && !gates.some(name => plan[name])) plan.scope = 'docs';+ return plan;}-if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {- let scope = 'full';- let website = true;- if (process.env.CI_EVENT_NAME === 'pull_request') {- const base = process.env.CI_BASE_SHA;- if (!/^[0-9a-f]{40}$/.test(base || '')) throw new Error('Missing or invalid PR base SHA');- // Include both sides of renames so a runtime file moved into docs cannot bypass CI.- const diff = execFileSync('git', ['diff', '--no-renames', '--name-only', '-z', base, 'HEAD'], { encoding: 'utf8' });- const paths = diff.split('\0').filter(Boolean);- scope = classifyPaths(paths);- website = paths.some(path => /^(website\/|docs\/|scripts\/|archify\/(recipes\/|package\.json)|test\/site-language-continuity\.test\.mjs|package(?:-lock)?\.json|\.github\/workflows\/ci\.yml)/.test(path));+export function comparisonPlan({ event, ref, base }, git = args => execFileSync('git', args, { encoding: 'utf8' })) {+ if (event === 'workflow_dispatch' || (event === 'push' && ref === 'refs/heads/main')) return classifyPaths([]);+ if (!['pull_request', 'push'].includes(event)) return classifyPaths([]);+ if (!/^[0-9a-f]{40}$/.test(base || '') || /^0+$/.test(base)) {+ if (event === 'push') return classifyPaths([]);+ throw new Error('Missing or invalid PR base SHA');+ }+ try {+ // Renames retain both source and destination owners; compare trees, not merge-base.+ return classifyPaths(git(['diff', '--no-renames', '--name-only', '-z', base, 'HEAD']).split('\0').filter(Boolean));+ } catch (error) {+ if (event === 'push') return classifyPaths([]);+ throw error;}- console.log(`CI scope: ${scope}`);- if (process.env.GITHUB_OUTPUT) fs.appendFileSync(process.env.GITHUB_OUTPUT, `scope=${scope}\nwebsite=${website}\n`);+}++if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {+ const plan = comparisonPlan({ event: process.env.CI_EVENT_NAME, ref: process.env.CI_REF, base: process.env.CI_BASE_SHA });+ console.log(`CI plan: ${JSON.stringify(plan)}`);+ if (process.env.GITHUB_OUTPUT) fs.appendFileSync(process.env.GITHUB_OUTPUT,+ Object.entries(plan).map(([name, value]) => `${name}=${Array.isArray(value) ? JSON.stringify(value) : value}\n`).join(''));}diff --git a/scripts/compat-test-inventory.mjs b/scripts/compat-test-inventory.mjsdeleted file mode 100644index dd060176..00000000--- a/scripts/compat-test-inventory.mjs+++ /dev/null@@ -1,70 +0,0 @@-import fs from 'node:fs';-import path from 'node:path';--// The complete regression suite runs on canonical Node 22. Other maintained-// Node lanes repeat goldens and these process, filesystem, schema and CLI-// contracts; do not infer compatibility coverage from changed source paths.-export const compatibilityTestFiles = Object.freeze([- 'test/artifact-receipt-flush.test.mjs',- 'test/atomic-output-recovery.test.mjs',- 'test/base-input-compatibility.test.mjs',- 'test/brand-content-encoding.test.mjs',- 'test/brand-marks.test.mjs',- 'test/chrome-pipe-transport.test.mjs',- 'test/cli-output-types.test.mjs',- 'test/cli.test.mjs',- 'test/compatibility-gate.test.mjs',- 'test/delivery-contract.test.mjs',- 'test/delivery-sidecar-path.test.mjs',- 'test/delivery-update.test.mjs',- 'test/finalize-browser-lifecycle.test.mjs',- 'test/finalize-paths.test.mjs',- 'test/finalize.test.mjs',- 'test/generate-validators.test.mjs',- 'test/meta-output-contract.test.mjs',- 'test/native-output-path.test.mjs',- 'test/open-artifact.test.mjs',- 'test/output-path.test.mjs',- 'test/path-boundary-contract.test.mjs',- 'test/path-semantics.test.mjs',- 'test/portable-path.test.mjs',- 'test/preview-contract.test.mjs',- 'test/preview-force-stop.test.mjs',- 'test/preview.test.mjs',- 'test/release-package-gates.test.mjs',- 'test/render-failure-diagnostics.test.mjs',- 'test/render-output-checks.test.mjs',- 'test/renderer-atomic-write.test.mjs',- 'test/renderer-diagnostic-boundary.test.mjs',- 'test/renderer-import-isolation.test.mjs',- 'test/repair-receipt.test.mjs',- 'test/repair-rounds.test.mjs',- 'test/repository-evidence-replacement.test.mjs',- 'test/repository-evidence-types.test.mjs',- 'test/repository-evidence.test.mjs',- 'test/repository-test-runner.test.mjs',- 'test/sidecar-path-length.test.mjs',- 'test/temp-cleanup.test.mjs',- 'test/update-contract.test.mjs',- 'test/update-notifier.test.mjs',- 'test/v1-compatibility.test.mjs',- 'test/validate-next-action.test.mjs',- 'test/visual-check.test.mjs',- 'test/workflow-migration.test.mjs',-]);--export function validateCompatibilityInventory(repoRoot, files = compatibilityTestFiles) {- if (files.length === 0) throw new Error('Compatibility inventory must not be empty');- const seen = new Set();- for (const file of files) {- if (typeof file !== 'string' || !/^test\/[a-z0-9-]+\.test\.mjs$/.test(file)) {- throw new Error(`Invalid compatibility test file: ${file}`);- }- if (seen.has(file)) throw new Error(`Duplicate compatibility test file: ${file}`);- seen.add(file);- if (!fs.existsSync(path.join(repoRoot, file)) || !fs.statSync(path.join(repoRoot, file)).isFile()) {- throw new Error(`Missing compatibility test file: ${file}`);- }- }- return files;-}diff --git a/scripts/run-affected-tests.mjs b/scripts/run-affected-tests.mjsnew file mode 100644index 00000000..f8a76851--- /dev/null+++ b/scripts/run-affected-tests.mjs@@ -0,0 +1,39 @@+#!/usr/bin/env node+import fs from 'node:fs';+import path from 'node:path';+import { fileURLToPath } from 'node:url';+import { spawnSync } from 'node:child_process';++const root = fileURLToPath(new URL('../', import.meta.url));+const mode = /^(architecture|workflow|sequence|dataflow|lifecycle|erd|class|tree|timeline|waterfall)-/;+// A few broad ownership families, not a source-to-test dependency graph.+const shared = /^(geometry|spatial-grid|svg-path-analysis|layout-rules|engineering-profile|legend-contract|render-|renderer-(?:diagnostic|import)|route-|authored-|spread-|text-|base-input-|v1-|brand-|semantic-legend)/;+const viewer = /^(viewer-|reader-|desktop-|semantic-|finder|focus|intent-|crossover-|animation|export-|motion-|offline-|i18n|relationship-|share-|reach-|presentation)/;+export function selectAffectedTests(owners, changed, available) {+ if (!Array.isArray(owners) || !Array.isArray(changed)) throw new Error('CI test selection must contain arrays');+ const allowed = new Set(['renderer', 'viewer', 'authoring', 'schema', 'site', 'artifact', 'delta', 'readme', 'architecture', 'workflow', 'sequence', 'dataflow', 'lifecycle', 'erd', 'class', 'tree', 'timeline', 'waterfall']);+ if (owners.some(owner => !allowed.has(owner))) throw new Error('Unknown CI test owner');+ if (changed.some(name => !/^test\/[^/]+\.test\.mjs$/.test(name))) throw new Error('Invalid changed test path');+ return available.filter(file => {+ const name = path.basename(file);+ return changed.includes(file) || owners.some(owner =>+ owner === 'renderer' ? mode.test(name) || shared.test(name)+ : owner === 'viewer' ? viewer.test(name)+ : owner === 'authoring' ? /^(authoring-|skill-|diagram-guide|delivery-contract|workflow-semantic-contract|ordinary-model-floor|guide|gallery|start-page)/.test(name)+ : owner === 'site' ? /^(gallery|guide-page|start-page|generated-artifact-xml)\.test\.mjs$/.test(name)+ : owner === 'artifact' ? name === 'generated-artifact-xml.test.mjs'+ : owner === 'delta' ? name === 'architecture-delta.test.mjs'+ : owner === 'schema' ? /^(generate-validators|base-input-|v1-|workflow-migration)/.test(name)+ : owner === 'readme' ? name === 'readme-showcase.test.mjs'+ : name.startsWith(`${owner}-`) || shared.test(name));+ }).sort();+}+if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {+ const available = fs.readdirSync(path.join(root, 'test')).filter(name => name.endsWith('.test.mjs')).map(name => `test/${name}`);+ const files = selectAffectedTests(JSON.parse(process.env.CI_TEST_OWNERS || '[]'), JSON.parse(process.env.CI_CHANGED_TESTS || '[]'), available);+ if (files.length) {+ const result = spawnSync(process.execPath, ['scripts/run-tests.mjs', ...files], { cwd: root, stdio: 'inherit' });+ if (result.error) throw result.error;+ process.exitCode = result.signal ? 1 : (result.status ?? 1);+ } else console.log('No additional owned regression suites; core gate remains required.');+}diff --git a/scripts/run-browser-tests.mjs b/scripts/run-browser-tests.mjsindex ebbd95c3..ab34c71a 100644--- a/scripts/run-browser-tests.mjs+++ b/scripts/run-browser-tests.mjs@@ -6,43 +6,9 @@ import { fileURLToPath } from 'node:url';import { findChrome } from '../archify/bin/visual-check.mjs';import { testRunnerOptions } from './test-runner-options.mjs';+import { browserTestFiles as testFiles } from './browser-test-inventory.mjs';+const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');-// Shared by PR CI and tag releases. WebM decoding stays in test:webm.-// Adjacent heavy suites use opposite indices for CI's two modulo shards.-const testFiles = [- 'finalize-browser.test.mjs',- 'desktop-reader-browser.test.mjs',- 'reader-readability-maintained-browser.test.mjs',- 'reader-layout-browser.test.mjs',- 'reader-layout-settle-browser.test.mjs',- 'reader-cards-overflow-browser.test.mjs',- 'joint-layout-browser.test.mjs',- 'sequence-header-clearance.test.mjs',- 'sequence-width-default-browser.test.mjs',- 'compact-header-clearance.test.mjs',- 'architecture-reading-size-browser.test.mjs',- 'export-cleanup-browser.test.mjs',- 'i18n.test.mjs',- 'offline-font-browser.test.mjs',- 'viewer-chrome-layout.test.mjs',- 'semantic-radar.test.mjs',- 'viewer-camera-browser.test.mjs',- 'motion-governor-browser.test.mjs',- 'finder-browser.test.mjs',- 'intent-trace-browser.test.mjs',- 'semantic-lens-browser.test.mjs',- 'route-probe-browser.test.mjs',- 'focus-browser.test.mjs',- 'crossover-state-browser.test.mjs',- 'semantic-passport-move-browser.test.mjs',- 'export-browser.test.mjs',- 'viewer-identifiers-browser.test.mjs',- 'repository-evidence.test.mjs',- 'repository-evidence-types-browser.test.mjs',- 'tree-branches-browser.test.mjs',- 'class-motion-browser.test.mjs',- 'dataflow-label-visibility-browser.test.mjs',-];let options;let shard;diff --git a/scripts/run-compat-tests.mjs b/scripts/run-compat-tests.mjsdeleted file mode 100644index 4969f3ef..00000000--- a/scripts/run-compat-tests.mjs+++ /dev/null@@ -1,40 +0,0 @@-#!/usr/bin/env node--import { spawnSync } from 'node:child_process';-import path from 'node:path';-import { fileURLToPath } from 'node:url';-import { validateCompatibilityInventory } from './compat-test-inventory.mjs';-import { testRunnerOptions } from './test-runner-options.mjs';--const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');-const argv = process.argv.slice(2);-let options;-try {- options = testRunnerOptions(argv, {- repoRoot, testFiles: validateCompatibilityInventory(repoRoot),- });-} catch (error) {- console.error(error.message);- process.exit(1);-}-if (options.list) {- console.log(options.files.join('\n'));- process.exit(0);-}--console.error(`Compatibility tests: golden outputs plus ${options.files.length} runtime suites`);-// Delegate to the existing runner so compatibility tests have the same option-// handling, isolated update cache, cleanup and child-failure behavior.-const runnerFlags = argv.filter(argument => argument.startsWith('--'));-for (const args of [- ['test/golden.mjs'],- ['scripts/run-tests.mjs', ...runnerFlags, ...options.files],-]) {- const result = spawnSync(process.execPath, args, { cwd: repoRoot, stdio: 'inherit' });- if (result.error) throw result.error;- if (result.signal) console.error(`compatibility test runner terminated by ${result.signal}`);- if (result.signal || result.status !== 0) {- process.exitCode = result.signal ? 1 : (result.status ?? 1);- break;- }-}diff --git a/test/adaptive-reader-layout.test.mjs b/test/adaptive-reader-layout.test.mjsindex 86e4a342..76a91844 100644--- a/test/adaptive-reader-layout.test.mjs+++ b/test/adaptive-reader-layout.test.mjs@@ -20,64 +20,11 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));const skillRoot = path.resolve(__dirname, '..', 'archify');const template = fs.readFileSync(path.join(skillRoot, 'assets', 'template.html'), 'utf8');const skill = fs.readFileSync(path.join(skillRoot, 'references/authoring-defaults.md'), 'utf8');-const architectureRenderer = fs.readFileSync(path.join(skillRoot, 'renderers', 'architecture', 'render-architecture.mjs'), 'utf8');-const reader = template.slice(- template.indexOf('Adaptive Reader Shell'),- template.indexOf('Archify.view = (function ()'),-);--test('wide desktop diagrams use one height-budgeted reader shell instead of breakpoint jumps', () => {- assert.match(template, /max-width: var\(--archify-reader-width, 1440px\)/);- assert.doesNotMatch(template, /@media \(min-width: 1680px\)[\s\S]{0,180}\.container/);- assert.doesNotMatch(template, /@media \(min-width: 1920px\)[\s\S]{0,180}\.container/);- assert.match(reader, /var WIDE_RATIO = 1\.55/);- assert.match(reader, /var MAX_READER_WIDTH = 1920/);- assert.match(reader, /var availableSvgHeight = Math\.max\(1, window\.innerHeight - fixedHeight\)/);- assert.match(reader, /var desiredWidth = availableSvgHeight \* ratio \+ chrome\.diagramX/);- assert.match(reader, /html\.style\.setProperty\('--archify-reader-width', Math\.max\(rounded, shellFloor\) \+ 'px'\)/);- assert.match(reader, /html\.style\.setProperty\('--archify-diagram-max-width'/);- assert.equal((template.match(/<meta name="archify-reader-contract" content="declared-wide-v1">/g) || []).length, 1);-});--test('compiler-measured intrinsic tall workflows reuse the height budget without widening eligibility', () => {- assert.match(reader, /var readerFit = svg && svg\.getAttribute\('data-reader-fit'\)/);- assert.match(reader, /var widthFirstReading = readerFit === 'width-first'/);- assert.match(reader, /var measuredHeightFit = readerFit === 'intrinsic-height' \|\| widthFirstReading/);- assert.doesNotMatch(reader, /data-sequence-column-fit|data-waterfall-ui/);- assert.match(reader, /ratio >= WIDE_RATIO \|\| measuredHeightFit/);- assert.match(reader, /var MIN_PROJECTED_NODE_TEXT_PX = 6/);- assert.match(reader, /viewBox\.width \* minimumReadableScale\(\) \+ chrome\.diagramX/);- assert.match(reader, /measuredHeightFit &&[\s\S]{0,100}ratio < WIDE_RATIO[\s\S]{0,120}readableWidth/);- assert.match(reader, /Math\.max\(Math\.ceil\(minWidth \|\| 0\), Math\.round\(width\)\)/);- assert.match(reader, /lastWidth > Math\.ceil\(minWidth\)/);- assert.doesNotMatch(reader, /function eligible\(\)[\s\S]{0,240}ratio > 0/);-});--test('context relationship labels join the readable floor in every reader', () => {- assert.match(reader, /g\[data-detail="context"\] text/);- assert.match(reader, /text\.closest\('\[data-edge-from\]\[data-edge-to\]'\)/);- assert.match(reader, /\? requestedMinimumText\s*: MIN_PROJECTED_NODE_TEXT_PX;/);- assert.match(reader, /measuredHeightFit && ratio >= WIDE_RATIO && Number\.isFinite\(declaredMinimumText\)/);- assert.match(reader, /measuredHeightFit && ratio < WIDE_RATIO[\s\S]{0,60}\? readableWidth/);- assert.match(reader, /Math\.max\(MIN_READER_WIDTH, readableWidth\)/);- assert.match(reader, /if \(measuredHeightFit && ratio < WIDE_RATIO\)[\s\S]{0,120}minWidth = Math\.min\(readableMinimumWidth, viewportCap\)/);- assert.match(reader, /else if \(measuredHeightFit && ratio >= WIDE_RATIO && Number\.isFinite\(declaredMinimumText\)\)[\s\S]{0,140}minWidth = Math\.min\(readableMinimumWidth, maxWidth\)/);- assert.match(reader, /var maxWidth = Math\.min\(MAX_READER_WIDTH, viewportCap\)/);- assert.match(reader, /ratio >= WIDE_RATIO && Number\.isFinite\(declaredMinimumText\)/);- assert.equal(DESKTOP_READER_MIN_WIDTH, 960);- assert.equal(MIN_PROJECTED_NODE_TEXT_PX, 6);-});-test('desktop readability budget matches the minimum adaptive reader at 1440 by 900', () => {assert.deepEqual(DESKTOP_READABILITY_VIEWPORT, { width: 1440, height: 900 });assert.equal(DESKTOP_READER_MIN_WIDTH, 960);assert.equal(DESKTOP_READER_HORIZONTAL_CHROME, 30);assert.equal(DESKTOP_READER_DIAGRAM_WIDTH, 930);- assert.match(reader, new RegExp(`var MIN_READER_WIDTH = ${DESKTOP_READER_MIN_WIDTH}`));- assert.match(template, /html\[data-nav-stage-rail="true"\] body \{ padding-block: 0\.375rem; \}/);- assert.match(template, /@media \(min-width: 768px\) and \(max-height: 1100px\)[\s\S]*?\.diagram-container \{[\s\S]*?padding: 0\.875rem;[\s\S]*?padding-bottom: calc\(0\.875rem \+ var\(--archify-nav-reserve\)\);/);- assert.match(template, /@media \(min-width: 768px\) and \(max-height: 920px\)[\s\S]*?body \{ padding-block: 1\.25rem; \}/);- assert.match(template, /\.diagram-container \{[\s\S]*?border: 1px solid var\(--panel-border\)/);});test('desktop readability source floor is the inverse of the projected-size gate', () => {@@ -112,27 +59,13 @@ test('declared-wide budget is additive and reports a cap without changing the leminimumSourceTextPx: 8,requestedMinimumTextPx: 7.5,}), null, 'narrow diagrams remain on the legacy checker path');- assert.match(architectureRenderer, /minimumReadableSourceTextPx\(budgetViewBoxWidth\) \+ 1e-6/);- assert.match(architectureRenderer, /minimumReadableSourceTextPx\(finalViewBoxWidth\)/);- assert.doesNotMatch(architectureRenderer, /declaredWideReadabilityBudget/);-});--test('adaptive width preserves canonical SVG geometry and yields to specialized viewer modes', () => {- assert.match(reader, /window\.innerWidth >= MIN_DESKTOP_WIDTH/);- assert.match(reader, /html\.getAttribute\('data-embed'\) !== 'true'/);- assert.match(reader, /html\.getAttribute\('data-present'\) !== 'true'/);- assert.match(reader, /window\.matchMedia\('print'\)\.matches/);- assert.doesNotMatch(reader, /svg\.setAttribute\(['"](?:viewBox|width|height)/);- assert.doesNotMatch(reader, /svg\.style\.(?:width|height)/);- assert.doesNotMatch(reader, /overflow\s*=\s*['"]hidden/);});-test('reader remeasures real content and reduces width before allowing desktop page overflow', () => {- assert.match(reader, /document\.fonts\.ready\.then\(schedule\)/);- assert.match(reader, /new ResizeObserver\(schedule\)/);- assert.match(reader, /new MutationObserver\(schedule\)/);- assert.match(reader, /document\.documentElement\.scrollHeight/);- assert.match(reader, /lastWidth - overflow \* ratio - 4/);+// Browser ownership, geometry and settling live in reader-layout-browser and+// reader-readability-maintained-browser; these checks keep the public declaration+// and authoring documentation aligned without prescribing the scheduler's code.+test('reader declaration and authoring guidance preserve the public readability contract', () => {+ assert.equal((template.match(/<meta name="archify-reader-contract" content="declared-wide-v1">/g) || []).length, 1);assert.match(skill, /Automated browser evidence\]\(delivery-contract\.md#automated-browser-evidence\)/);assert.match(skill, /intrinsic-height page scroll/);const delivery = fs.readFileSync(path.join(skillRoot, 'references/delivery-contract.md'), 'utf8');@@ -142,12 +75,3 @@ test('reader remeasures real content and reduces width before allowing desktop passert.match(authoring, /Generate one responsive artifact for laptops and external displays/);assert.match(authoring, /preserv(?:e|ing) the authored SVG\/viewBox, proportions, semantic geometry/);});--test('reader exposes an explicit stable-dimensions contract for browser evidence', () => {- assert.match(reader, /function stableSnapshot\(\)/);- assert.match(reader, /function whenStable\(\)/);- assert.match(reader, /document\.fonts && document\.fonts\.ready/);- assert.match(reader, /Math\.ceil\(document\.body\.scrollHeight\)/);- assert.match(reader, /stableFrames >= 3/);- assert.match(reader, /whenStable: whenStable/);-});diff --git a/test/architecture-readable-routing.test.mjs b/test/architecture-readable-routing.test.mjsindex 20320d2f..0ead7869 100644--- a/test/architecture-readable-routing.test.mjs+++ b/test/architecture-readable-routing.test.mjs@@ -33,7 +33,8 @@ test('architecture improves complete-scene crossings and bends without extra gri}));const routes = routers.map((router) => connections.map((conn) => router.pathFor(conn).points));assert.equal(crossings(routes[0]), 10, 'fixture exposes the first-legal-route regression');- assert.equal(crossings(routes[1]), 9);+ assert.ok(crossings(routes[1]) <= 9 && crossings(routes[1]) < crossings(routes[0]),+ 'automatic routing may improve beyond the accepted crossing budget');const metrics = routes.map((points) => routeBudgetMetrics({ routedRelations: points.map((route) => ({ points: route })) }));assert.ok(metrics[1].routesOverSuggestedBends < metrics[0].routesOverSuggestedBends);assert.ok(metrics[1].maxStretch <= metrics[0].maxStretch);@@ -42,7 +43,8 @@ test('architecture improves complete-scene crossings and bends without extra griassert.ok(x >= Math.min(...scene.map((point) => point[0])) && x <= Math.max(...scene.map((point) => point[0])));assert.ok(y >= Math.min(...scene.map((point) => point[1])) && y <= Math.max(...scene.map((point) => point[1])));}- assert.equal(routers[1].routingMetrics().gridSearchCount, routers[0].routingMetrics().gridSearchCount);+ assert.ok(routers[1].routingMetrics().gridSearchCount <= routers[0].routingMetrics().gridSearchCount,+ 'readability must not require extra grid searches');assert.ok(routers[1].routingMetrics().readabilityCandidateCount <= connections.length * 16);assert.equal(JSON.stringify({ boxes: [...boxes], connections }), before);});diff --git a/test/authoring-safety-contract.test.mjs b/test/authoring-safety-contract.test.mjsindex 46ad05cc..d8399c9f 100644--- a/test/authoring-safety-contract.test.mjs+++ b/test/authoring-safety-contract.test.mjs@@ -12,7 +12,6 @@ const authoringContract = fs.readFileSync(path.join(skillRoot, 'references', 'authoring-contract.md'),'utf8',);-const schemaReadme = fs.readFileSync(path.join(skillRoot, 'schemas', 'README.md'), 'utf8');test('semantic relationship labels are preserved and deletion is not a geometry repair', () => {assert.match(authoringDefaults, /Relationship labels carry meaning/);@@ -30,13 +29,6 @@ test('semantic relationship labels are preserved and deletion is not a geometry}});-test('schema policy documents the workflow v1/v2 and lifecycle v3 compatibility boundaries', () => {- assert.match(schemaReadme, /Workflow[^\n]*schema versions? 1 and 2/i);- assert.match(schemaReadme, /Lifecycle accepts only version 3/i);- assert.match(schemaReadme, /other three[^\n]*schema_version[^\n]*1/i);- assert.doesNotMatch(schemaReadme, /schema_version` is `"const": 1`/);-});-test('deployment ownership stays explicit, fact-backed, and cannot be removed to pass', () => {assert.match(authoringDefaults, /`meta\.engineering_profile` for an ordinary system overview/);assert.match(authoringDefaults, /engineering profile\]\(authoring-contract\.md#engineering-profile-default\)/);@@ -56,7 +48,6 @@ test('visual-check stays a pending sidecar receipt instead of a polish claim', (assert.match(deliveryContract, /Both browser commands inspect the exact delivered HTML without modifying or rerendering it/);assert.match(deliveryContract, /visual-check <output\.html> --summary/);- assert.match(deliveryContract, /1440×900[\s\S]*1600×1000[\s\S]*1920×1080[\s\S]*2048×1320/);assert.match(deliveryContract, /visualReview: "pending"/);assert.match(deliveryContract, /never changes.*delivered|without (?:rerendering or )?modifying/i);});diff --git a/test/browser-gate.test.mjs b/test/browser-gate.test.mjsindex a61e0087..a03ce646 100644--- a/test/browser-gate.test.mjs+++ b/test/browser-gate.test.mjs@@ -205,7 +205,7 @@ test('sharded browser gates retain Chrome requirements and propagate child failu}});-test('CI media aggregate fails closed for either child and keeps docs-only scope validation', () => {+test('CI media gates fail closed and run only for their affected responsibility', () => {const jobs = parse(fs.readFileSync(path.join(repoRoot, '.github/workflows/ci.yml'), 'utf8')).jobs;assert.equal(jobs['browser-regression'].strategy['fail-fast'], false);assert.deepEqual(jobs['browser-regression'].strategy.matrix.shard, [1, 2]);@@ -221,7 +221,7 @@ test('CI media aggregate fails closed for either child and keeps docs-only scopeBROWSER_RESULT: 'success', WEBM_RESULT: 'success', ...overrides,},});- for (const scope of ['full', 'docs']) assert.equal(runAggregate({ CI_SCOPE: scope }).status, 0);+ for (const scope of ['full', 'core', 'docs']) assert.equal(runAggregate({ CI_SCOPE: scope }).status, 0);for (const key of ['SCOPE_RESULT', 'BROWSER_RESULT', 'WEBM_RESULT']) {for (const result of ['failure', 'skipped', 'cancelled', '']) {assert.notEqual(runAggregate({ [key]: result }).status, 0, `${key}=${result} must fail closed`);@@ -233,9 +233,16 @@ test('CI media aggregate fails closed for either child and keeps docs-only scopeassert.equal(job.needs, 'scope');assert.equal(job.if, 'always() && !cancelled()');assert.equal(job.steps[0].env.SCOPE_RESULT, '${{ needs.scope.result }}');- assert.match(job.steps[0].run, /test "\$SCOPE_RESULT" = success/);- assert.match(job.steps[0].run, /docs\|full/);- for (const runtimeStep of job.steps.slice(1)) assert.equal(runtimeStep.if, "needs.scope.outputs.scope == 'full'");+ const scopeCheck = (scope, result = 'success') => spawnSync('bash', ['-e', '-c', job.steps[0].run], {+ env: { ...process.env, SCOPE_RESULT: result, CI_SCOPE: scope },+ }).status;+ for (const scope of ['docs', 'core', 'full']) assert.equal(scopeCheck(scope), 0);+ assert.notEqual(scopeCheck('unknown'), 0);+ assert.notEqual(scopeCheck('core', 'failure'), 0);+ const responsibility = name === 'browser-regression' ? 'browser' : 'webm';+ for (const runtimeStep of job.steps.slice(1)) {+ assert.equal(runtimeStep.if, `needs.scope.outputs.${responsibility} == 'true'`);+ }}});diff --git a/test/ci-scope.test.mjs b/test/ci-scope.test.mjsindex ef6c40cd..6c6e10a3 100644--- a/test/ci-scope.test.mjs+++ b/test/ci-scope.test.mjs@@ -1,134 +1,132 @@-import { test } from 'node:test';+import test from 'node:test';import assert from 'node:assert/strict';-import { classifyPaths } from '../scripts/ci-scope.mjs';+import fs from 'node:fs';+import os from 'node:os';+import path from 'node:path';+import { execFileSync, spawnSync } from 'node:child_process';+import { parse } from 'yaml';+import { classifyPaths, comparisonPlan } from '../scripts/ci-scope.mjs';+import { selectAffectedTests } from '../scripts/run-affected-tests.mjs';++const workflow = parse(fs.readFileSync(new URL('../.github/workflows/ci.yml', import.meta.url), 'utf8'));-test('community documentation takes the fast path', () => {- assert.equal(classifyPaths(['README.md', 'README_EN.md', 'README_ZH.md', 'docs/assets/community/qq.svg', 'docs/assets/community/wechat-qr.png']), 'docs');+test('owned changes add their real gates without requiring every unrelated lane', () => {+ assert.equal(classifyPaths(['README.md', 'docs/assets/community/qq.svg']).scope, 'docs');+ const render = classifyPaths(['archify/renderers/workflow/render-workflow.mjs']);+ assert.equal(render.scope, 'core');+ assert.deepEqual(render.owners, ['workflow']);+ assert.ok(render.generated && render.browser && render.package);+ assert.equal(render.windows, false);+ assert.equal(classifyPaths(['archify/renderers/workflow/render-workflow.mjs', 'archify.zip']).scope, 'core');+ assert.equal(classifyPaths(['archify.zip']).scope, 'full');+ const newBrowser = classifyPaths(['test/new-browser.test.mjs']);+ assert.equal(newBrowser.browser, true);+ assert.ok(newBrowser.changedTests.includes('test/browser-gate.test.mjs'));+ const mixed = classifyPaths(['package-lock.json', 'test/new-browser.test.mjs']);+ assert.equal(mixed.scope, 'full');+ assert.ok(mixed.changedTests.includes('test/browser-gate.test.mjs'));+ const viewer = classifyPaths(['viewer/toolbar.mjs', 'archify.zip']);+ assert.ok(viewer.browser && viewer.webm);+ const website = classifyPaths(['website/src/pages/index.astro']);+ assert.ok(website.website);+ assert.equal(website.browser, false);+ assert.equal(website.package, false);+ assert.ok(classifyPaths(['docs/skill-updates/archify/stable.json']).manifest);});-test('unknown, mixed, and behavior-bearing changes retain full CI', () => {- for (const path of ['archify/SKILL.md', 'archify/assets/template.html', 'test/readme-showcase.test.mjs', '.github/workflows/ci.yml', 'scripts/ci-scope.mjs', 'docs/guide.html', 'docs/assets/community/script.js', 'README-other.md']) {- assert.equal(classifyPaths(['README.md', path]), 'full', path);+test('recipe, schema and shared renderer owners include their real source consumers', () => {+ const available = ['test/guide.test.mjs', 'test/guide-page.test.mjs', 'test/gallery.test.mjs', 'test/start-page.test.mjs', 'test/engineering-profile.test.mjs', 'test/legend-contract.test.mjs', 'test/generate-validators.test.mjs'];+ const recipe = classifyPaths(['archify/recipes/scenarios.mjs']);+ assert.equal(recipe.scope, 'core');+ assert.equal(recipe.website, true);+ assert.deepEqual(selectAffectedTests(recipe.owners, [], available), available.slice(0, 4).sort());+ const shared = classifyPaths(['archify/renderers/shared/engineering-profiles.mjs', 'archify/renderers/shared/legend.mjs']);+ const selected = selectAffectedTests(shared.owners, [], available);+ assert.ok(selected.includes('test/engineering-profile.test.mjs'));+ assert.ok(selected.includes('test/legend-contract.test.mjs'));+ const schema = classifyPaths(['archify/schemas/workflow.schema.json']);+ assert.equal(schema.scope, 'core');+ assert.ok(selectAffectedTests(schema.owners, [], available).includes('test/generate-validators.test.mjs'));+});++test('checked artifacts retain XML integrity and compare artifact regression coverage', () => {+ const available = ['test/generated-artifact-xml.test.mjs', 'test/architecture-delta.test.mjs'];+ for (const name of ['examples/checkout-platform-delta.html', 'docs/guide.html', 'archify/examples/rendered.html', 'docs/assets/example.svg']) {+ const plan = classifyPaths([name]);+ assert.equal(plan.scope, 'core');+ assert.ok(selectAffectedTests(plan.owners, [], available).includes('test/generated-artifact-xml.test.mjs'), name);}- assert.equal(classifyPaths([]), 'full');- // --no-renames reports the old runtime path as well as the new documentation path.- assert.equal(classifyPaths(['archify/bin/archify.mjs', 'docs/assets/community/example.svg']), 'full');+ const delta = classifyPaths(['examples/checkout-platform-delta.html']);+ assert.ok(selectAffectedTests(delta.owners, [], available).includes('test/architecture-delta.test.mjs'));});-// Exercise Git and output handling, not just the path allowlist.-import fs from 'node:fs';-import os from 'node:os';-import path from 'node:path';-import { execFileSync, spawnSync } from 'node:child_process';-import { fileURLToPath, pathToFileURL } from 'node:url';-const script = fileURLToPath(new URL('../scripts/ci-scope.mjs', import.meta.url));+test('generated site outputs retain proof and handoff consumer checks', () => {+ const available = ['test/gallery.test.mjs', 'test/guide-page.test.mjs', 'test/start-page.test.mjs', 'test/generated-artifact-xml.test.mjs'];+ for (const name of ['docs/gallery/manifest.json', 'docs/gallery.html', 'docs/guide.html', 'docs/start.html']) {+ const plan = classifyPaths([name]);+ assert.equal(plan.scope, 'core');+ assert.equal(plan.website, true);+ assert.deepEqual(selectAffectedTests(plan.owners, [], available), available.slice().sort(), name);+ }+ assert.ok(!classifyPaths(['docs/assets/ordinary.png']).owners.includes('site'));+});-test('scope CLI handles documentation, renames, main pushes, and invalid bases', () => {- const root = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-ci-scope-'));- try {- const git = (...args) => execFileSync('git', args, { cwd: root, encoding: 'utf8' }).trim();- git('init', '-q');- git('config', 'user.name', 'CI Test');- git('config', 'user.email', '[email protected]');- fs.writeFileSync(path.join(root, 'README.md'), 'before');- fs.writeFileSync(path.join(root, 'runtime.js'), 'runtime');- git('add', '.'); git('commit', '-qm', 'base');- const base = git('rev-parse', 'HEAD');- fs.writeFileSync(path.join(root, 'README.md'), 'after');- git('add', '.'); git('commit', '-qm', 'docs');- const output = path.join(root, 'output');- const run = (event, sha = base) => {- fs.writeFileSync(output, '');- const result = spawnSync(process.execPath, [script], { cwd: root, env: { ...process.env, CI_EVENT_NAME: event, CI_BASE_SHA: sha, GITHUB_OUTPUT: output } });- return { status: result.status, output: fs.readFileSync(output, 'utf8') };- };- assert.deepEqual(run('pull_request'), { status: 0, output: 'scope=docs\nwebsite=false\n' });- assert.deepEqual(run('push'), { status: 0, output: 'scope=full\nwebsite=true\n' });- assert.notEqual(run('pull_request', 'bad').status, 0);- assert.deepEqual(run('pull_request', 'f'.repeat(40)), { status: 1, output: '' });- git('mv', 'runtime.js', 'README_EN.md');- git('commit', '-qm', 'rename runtime into docs');- assert.deepEqual(run('pull_request'), { status: 0, output: 'scope=full\nwebsite=false\n' });- fs.mkdirSync(path.join(root, 'website'));- fs.writeFileSync(path.join(root, 'website', 'astro.config.mjs'), 'export default {};');- git('add', 'website'); git('commit', '-qm', 'website change');- assert.deepEqual(run('pull_request'), { status: 0, output: 'scope=full\nwebsite=true\n' });- } finally {- fs.rmSync(root, { recursive: true, force: true });+test('unknown and delivery/build/fixture changes conservatively require every gate', () => {+ for (const paths of [[], ['unknown.txt'], ['scripts/ci-scope.mjs'], ['package-lock.json'], ['.github/workflows/ci.yml'], ['archify/bin/archify.mjs'], ['archify/renderers/shared/atomic-output.mjs'], ['test/fixtures/input.json'], ['test/helpers.mjs']]) {+ const plan = classifyPaths(paths);+ assert.equal(plan.scope, 'full', `${paths}`);+ for (const gate of ['generated', 'browser', 'webm', 'package', 'windows', 'manifest', 'website']) assert.equal(plan[gate], true, `${paths}: ${gate}`);}});-test('scope workflow fetches only the exact base for a shallow PR merge checkout', () => {- const workflow = fs.readFileSync(new URL('../.github/workflows/ci.yml', import.meta.url), 'utf8');- const scopeJob = workflow.split('\n test:')[0];- assert.match(scopeJob, /fetch-depth: 1/);- assert.doesNotMatch(scopeJob, /fetch-depth: 0/);- const fetchStep = scopeJob.match(/ - name: Fetch PR comparison base\n([\s\S]*?) - uses:/)?.[1];- assert.ok(fetchStep, 'scope job must fetch the PR base before classification');- assert.match(fetchStep, /if: github.event_name == 'pull_request'/);- const fetchScript = fetchStep.split(' run: |\n')[1].split('\n')- .filter(line => line.trim()).map(line => line.slice(10)).join('\n');- const root = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-ci-scope-shallow-'));+test('new changed tests run, deleted tests do not, and invalid selectors fail', () => {+ const changed = ['test/new-behavior.test.mjs', 'test/deleted.test.mjs'];+ const plan = classifyPaths(changed);+ assert.equal(plan.scope, 'core');+ const available = ['test/new-behavior.test.mjs', 'test/workflow-compiler.test.mjs', 'test/update-notifier.test.mjs'];+ assert.deepEqual(selectAffectedTests([], plan.changedTests, available), ['test/new-behavior.test.mjs']);+ assert.deepEqual(selectAffectedTests(['workflow'], changed, available), ['test/new-behavior.test.mjs', 'test/workflow-compiler.test.mjs']);+ assert.throws(() => selectAffectedTests(['unknown'], [], available));+ assert.throws(() => selectAffectedTests([], ['../outside.test.mjs'], available));+});++test('main/manual are exhaustive; invalid dev base falls back to full but PR base fails', () => {+ const fail = () => { throw new Error('base not found'); };+ assert.equal(comparisonPlan({ event: 'workflow_dispatch' }).scope, 'full');+ assert.equal(comparisonPlan({ event: 'push', ref: 'refs/heads/main' }).scope, 'full');+ assert.equal(comparisonPlan({ event: 'push', ref: 'refs/heads/dev', base: '0'.repeat(40) }).scope, 'full');+ assert.equal(comparisonPlan({ event: 'push', ref: 'refs/heads/dev', base: 'a'.repeat(40) }, fail).scope, 'full');+ assert.throws(() => comparisonPlan({ event: 'pull_request', base: 'bad' }));+ assert.throws(() => comparisonPlan({ event: 'pull_request', base: 'a'.repeat(40) }, fail));+});++test('real Git comparison retains rename source ownership and detects added tests', () => {+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-scope-'));try {- const origin = path.join(root, 'origin');- const checkout = path.join(root, 'checkout');- fs.mkdirSync(origin);- const git = (cwd, ...args) => execFileSync('git', args, { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim();- git(origin, 'init', '-q');- git(origin, 'config', 'user.name', 'CI Test');- git(origin, 'config', 'user.email', '[email protected]');- fs.writeFileSync(path.join(origin, 'README.md'), 'before');- fs.writeFileSync(path.join(origin, 'runtime.js'), 'before');- fs.mkdirSync(path.join(origin, 'website'));- fs.writeFileSync(path.join(origin, 'website', 'config.js'), 'before');- git(origin, 'add', '.'); git(origin, 'commit', '-qm', 'common ancestor');- git(origin, 'branch', 'pr');- // The PR is behind the base: merge checkout incorporates base-only changes.- fs.writeFileSync(path.join(origin, 'runtime.js'), 'base change');- fs.writeFileSync(path.join(origin, 'website', 'config.js'), 'base change');- git(origin, 'add', '.'); git(origin, 'commit', '-qm', 'base advance');- const base = git(origin, 'rev-parse', 'HEAD');- git(origin, 'tag', 'unrelated-tag');- git(origin, 'checkout', '-q', 'pr');- fs.writeFileSync(path.join(origin, 'README.md'), 'PR docs change');- git(origin, 'add', '.'); git(origin, 'commit', '-qm', 'PR docs');- git(origin, 'merge', '--no-ff', '-qm', 'PR merge checkout', base);- git(root, 'clone', '-q', '--no-tags', '--depth=1', '--branch=pr', pathToFileURL(origin).href, checkout);- assert.equal(git(checkout, 'rev-parse', '--is-shallow-repository'), 'true');- assert.notEqual(spawnSync('git', ['cat-file', '-e', base], { cwd: checkout }).status, 0);- const output = path.join(root, 'output');- const run = (cwd, event = 'pull_request', sha = base, fetchBase = true) => {- fs.writeFileSync(output, '');- const env = { ...process.env, CI_EVENT_NAME: event, CI_BASE_SHA: sha, GITHUB_OUTPUT: output };- const fetch = event === 'pull_request' && fetchBase ? spawnSync('bash', ['-e', '-c', fetchScript], { cwd, env }) : { status: 0 };- const result = fetch.status === 0 ? spawnSync(process.execPath, [script], { cwd, env }) : fetch;- return { status: result.status, output: fs.readFileSync(output, 'utf8') };- };- assert.deepEqual(run(checkout), { status: 0, output: 'scope=docs\nwebsite=false\n' });- assert.deepEqual(run(checkout), run(origin, 'pull_request', base, false), 'shallow and full history must classify the same merge tree');- assert.equal(git(checkout, 'rev-parse', '--is-shallow-repository'), 'true');- assert.equal(git(checkout, 'branch', '-r'), 'origin/pr', 'fetch must not collect other branches');- assert.equal(git(checkout, 'tag'), '', 'fetch must not collect tags');- for (const sha of ['bad', 'f'.repeat(40)]) {- const result = run(checkout, 'pull_request', sha);- assert.notEqual(result.status, 0);- assert.equal(result.output, '', 'failed base fetch must not emit a successful classification');+ const git = args => execFileSync('git', args, { cwd: root, encoding: 'utf8' });+ git(['init', '-q']); git(['config', 'user.name', 'Test']); git(['config', 'user.email', '[email protected]']);+ fs.writeFileSync(path.join(root, 'runtime.js'), 'runtime');+ git(['add', '.']); git(['commit', '-qm', 'base']);+ const base = git(['rev-parse', 'HEAD']).trim();+ git(['mv', 'runtime.js', 'README.md']); git(['commit', '-qm', 'rename']);+ assert.equal(comparisonPlan({ event: 'pull_request', base }, git).scope, 'full');+ const renamed = git(['rev-parse', 'HEAD']).trim();+ fs.mkdirSync(path.join(root, 'test')); fs.writeFileSync(path.join(root, 'test/new.test.mjs'), '// new');+ git(['add', '.']); git(['commit', '-qm', 'new test']);+ assert.deepEqual(comparisonPlan({ event: 'push', ref: 'refs/heads/dev', base: renamed }, git).changedTests, ['test/new.test.mjs']);+ } finally { fs.rmSync(root, { recursive: true, force: true }); }+});++test('required jobs fail when classification fails or returns an unknown scope', () => {+ for (const name of ['test', 'browser-regression', 'webm-decode', 'zip-freshness', 'published-update-manifest', 'package-smoke', 'windows-test-portability']) {+ const step = workflow.jobs[name].steps.find(step => step.name === 'Require successful scope checks');+ assert.ok(step, name);+ for (const [result, scope, status] of [['success', 'core', 0], ['success', 'full', 0], ['failure', 'core', 1], ['success', '', 1], ['success', 'unknown', 1]]) {+ const run = spawnSync('bash', ['-e', '-c', step.run], { env: { ...process.env, SCOPE_RESULT: result, CI_SCOPE: scope } });+ assert.equal(run.status, status, `${name}: ${result}/${scope}`);}- assert.deepEqual(run(checkout, 'push', 'bad'), { status: 0, output: 'scope=full\nwebsite=true\n' });- git(checkout, 'config', 'user.name', 'CI Test');- git(checkout, 'config', 'user.email', '[email protected]');- fs.mkdirSync(path.join(checkout, 'docs', 'assets', 'community'), { recursive: true });- fs.writeFileSync(path.join(checkout, 'docs', 'assets', 'community', 'image.svg'), '<svg/>');- git(checkout, 'add', '.'); git(checkout, 'commit', '-qm', 'community image');- assert.deepEqual(run(checkout), { status: 0, output: 'scope=docs\nwebsite=true\n' });- fs.writeFileSync(path.join(checkout, 'website', 'config.js'), 'PR website change');- git(checkout, 'add', '.'); git(checkout, 'commit', '-qm', 'website');- assert.deepEqual(run(checkout), { status: 0, output: 'scope=full\nwebsite=true\n' });- git(checkout, 'remote', 'set-url', 'origin', pathToFileURL(path.join(root, 'unavailable')).href);- const unavailable = run(checkout);- assert.notEqual(unavailable.status, 0);- assert.equal(unavailable.output, '', 'unavailable remote must fail even with a cached base');- } finally {- fs.rmSync(root, { recursive: true, force: true });}+ const fetch = workflow.jobs.scope.steps.find(step => step.name === 'Fetch PR comparison base');+ assert.ok(fetch.run.includes('--depth=1') && fetch.run.includes('--no-tags'));+ assert.equal(fetch.if, "github.event_name == 'pull_request'");});diff --git a/test/compatibility-gate.test.mjs b/test/compatibility-gate.test.mjsindex e581469c..b8d20414 100644--- a/test/compatibility-gate.test.mjs+++ b/test/compatibility-gate.test.mjs@@ -1,160 +1,32 @@import test from 'node:test';import assert from 'node:assert/strict';-import { spawnSync } from 'node:child_process';import fs from 'node:fs';-import os from 'node:os';-import path from 'node:path';-import { fileURLToPath } from 'node:url';import { parse } from 'yaml';-import {- compatibilityTestFiles,- validateCompatibilityInventory,-} from '../scripts/compat-test-inventory.mjs';-const repoRoot = fileURLToPath(new URL('../', import.meta.url));-const runner = path.join(repoRoot, 'scripts/run-compat-tests.mjs');-const [major, minor] = process.versions.node.split('.').map(Number);-const supportsConcurrency = major > 18 || (major === 18 && minor >= 19);-const supportsNamePattern = major > 18 || (major === 18 && minor >= 11);+const manifest = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf8'));+const ci = parse(fs.readFileSync(new URL('../.github/workflows/ci.yml', import.meta.url), 'utf8'));+const release = parse(fs.readFileSync(new URL('../.github/workflows/release.yml', import.meta.url), 'utf8'));-function interceptedRun(t, args = [], outcomes = [{ status: 0 }, { status: 0 }]) {- const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-compat-gate-'));- t.after(() => fs.rmSync(directory, { recursive: true, force: true }));- const preload = path.join(directory, 'capture.cjs');- fs.writeFileSync(preload, `-const childProcess = require('node:child_process');-const outcomes = ${JSON.stringify(outcomes)};-let invocation = 0;-childProcess.spawnSync = (command, args, options) => {- console.log(JSON.stringify({ command, args, cwd: options.cwd }));- const result = outcomes[invocation++] || { status: 0 };- if (result.error) result.error = new Error(result.error);- return result;-};-require('node:module').syncBuiltinESMExports();-`);- return spawnSync(process.execPath, ['--require', preload, runner, ...args], {- cwd: directory, encoding: 'utf8',- });-}--function calls(result) {- return result.stdout.trim() ? result.stdout.trim().split('\n').map(line => JSON.parse(line)) : [];-}--test('compatibility inventory is nonempty, unique, and names existing regression suites', () => {- assert.equal(validateCompatibilityInventory(repoRoot), compatibilityTestFiles);- assert.throws(() => validateCompatibilityInventory(repoRoot, []), /must not be empty/);- const file = compatibilityTestFiles[0];- assert.throws(() => validateCompatibilityInventory(repoRoot, [file, file]), /Duplicate/);- assert.throws(() => validateCompatibilityInventory(repoRoot, ['test/missing-compat.test.mjs']), /Missing/);- for (const unsafe of ['../test/cli.test.mjs', 'test/golden.mjs', path.join(repoRoot, file)]) {- assert.throws(() => validateCompatibilityInventory(repoRoot, [unsafe]), /Invalid/);- }-});--test('compatibility retains whole runtime-sensitive suites and the noncanonical ZIP contract', () => {- for (const name of [- 'cli', 'preview', 'preview-force-stop', 'update-notifier', 'update-contract',- 'finalize', 'finalize-browser-lifecycle', 'renderer-import-isolation',- 'renderer-diagnostic-boundary', 'render-failure-diagnostics',- 'atomic-output-recovery', 'renderer-atomic-write', 'artifact-receipt-flush',- 'path-semantics', 'path-boundary-contract', 'native-output-path', 'output-path',- 'portable-path', 'delivery-sidecar-path', 'sidecar-path-length',- 'generate-validators', 'v1-compatibility', 'base-input-compatibility',- 'workflow-migration', 'release-package-gates',- 'brand-marks', 'brand-content-encoding',- ]) assert.ok(compatibilityTestFiles.includes(`test/${name}.test.mjs`), `${name} must retain compatibility coverage`);+test('default and compatibility share the real public CLI core while full discovers every suite', () => {+ assert.equal(manifest.scripts.test, 'npm run test:core');+ assert.equal(manifest.scripts['test:compat'], 'npm run test:core');+ assert.match(manifest.scripts['test:core'], /core-smoke\.test\.mjs/);+ assert.match(manifest.scripts['test:full'], /test:generated/);+ assert.match(manifest.scripts['test:full'], /run-tests\.mjs$/);+ assert.ok(!manifest.scripts['test:core'].includes('golden'));});-test('compatibility runs all goldens before delegating its exact inventory from an unrelated cwd', (t) => {- const result = interceptedRun(t);- assert.equal(result.status, 0, result.stderr);- const observed = calls(result);- assert.deepEqual(observed.map(call => call.args), [- ['test/golden.mjs'], ['scripts/run-tests.mjs', ...compatibilityTestFiles],- ]);- for (const call of observed) {- assert.equal(call.command, process.execPath);- assert.equal(fs.realpathSync(call.cwd), fs.realpathSync(repoRoot));- }- assert.match(result.stderr, /Compatibility tests: golden outputs plus \d+ runtime suites/);-});--test('compatibility listing starts neither goldens nor child tests', (t) => {- const result = interceptedRun(t, ['--list']);- assert.equal(result.status, 0, result.stderr);- assert.deepEqual(result.stdout.trim().split('\n'), compatibilityTestFiles);- assert.equal(result.stderr, '');-});--test('compatibility rejects unknown suites and invalid options before any execution', (t) => {- for (const args of [- ['test/gallery.test.mjs'], ['test/missing.test.mjs'], ['--unknown'],- ['--concurrency=0'], ['--test-name-pattern='], ['--test-name-pattern=['],- ]) {- const result = interceptedRun(t, args);- assert.equal(result.status, 1, result.stderr);- assert.equal(result.stdout, '');- }-});--test('compatibility forwards shared runner options and exact selections without filtering goldens', (t) => {- const file = 'test/cli.test.mjs';- const flags = [- ...(supportsConcurrency ? ['--concurrency=1'] : []),- ...(supportsNamePattern ? ['--test-name-pattern=cli: validate'] : []),- ];- const result = interceptedRun(t, [path.join(repoRoot, file), file, ...flags]);- assert.equal(result.status, 0, result.stderr);- assert.deepEqual(calls(result).map(call => call.args), [- ['test/golden.mjs'], ['scripts/run-tests.mjs', ...flags, file],- ]);-});--for (const stage of [0, 1]) {- for (const outcome of [{ status: 7 }, { status: null }, { signal: 'SIGTERM' }, { error: 'spawn failed' }]) {- test(`compatibility propagates ${stage === 0 ? 'golden' : 'suite'} failure (${outcome.error || outcome.signal || outcome.status})`, (t) => {- const outcomes = [{ status: 0 }, { status: 0 }];- outcomes[stage] = outcome;- const result = interceptedRun(t, [], outcomes);- assert.equal(result.status, outcome.signal || outcome.error ? 1 : (outcome.status ?? 1), result.stderr);- assert.equal(calls(result).length, stage + 1, 'a failed golden must not start compatibility suites');- if (outcome.signal) assert.match(result.stderr, /terminated by SIGTERM/);- if (outcome.error) assert.match(result.stderr, /spawn failed/);- });- }-}--test('compatibility goldens cover every advertised diagram type', () => {- const source = fs.readFileSync(path.join(repoRoot, 'test/golden.mjs'), 'utf8');- const fixtures = source.match(/const GOLDEN = \[([\s\S]*?)\n\];/)?.[1];- assert.ok(fixtures, 'golden harness must declare its representative rendered fixtures');- const modes = new Set([...fixtures.matchAll(/\['([a-z]+)',/g)].map(match => match[1]));- assert.deepEqual([...modes].sort(), [- 'architecture', 'class', 'dataflow', 'erd', 'lifecycle',- 'sequence', 'timeline', 'tree', 'waterfall', 'workflow',- ]);+test('generated checks have one explicit entrypoint separate from core feedback', () => {+ const checks = manifest.scripts['test:generated'];+ for (const required of ['check:viewer', 'check:brand-marks', 'check:validators', 'check:release-identity', 'test/golden.mjs']) assert.ok(checks.includes(required));});-test('CI keeps all Node check names while separating canonical regressions and compatibility', () => {- const manifest = JSON.parse(fs.readFileSync(path.join(repoRoot, 'package.json'), 'utf8'));- assert.equal(manifest.scripts['test:compat'], 'node scripts/run-compat-tests.mjs');- assert.match(manifest.scripts.test, /check:viewer/);- assert.match(manifest.scripts.test, /check:brand-marks/);- assert.match(manifest.scripts.test, /check:validators/);- assert.match(manifest.scripts.test, /check:release-identity/);- assert.match(manifest.scripts.test, /node test\/golden\.mjs/);- assert.match(manifest.scripts.test, /node scripts\/run-tests\.mjs$/);- const ci = parse(fs.readFileSync(path.join(repoRoot, '.github/workflows/ci.yml'), 'utf8'));- const job = ci.jobs.test;- assert.deepEqual(job.strategy.matrix['node-version'], [18, 20, 22, 24]);- assert.equal(job.name, undefined, 'preserve generated matrix check names');- const full = job.steps.find(step => step.run === 'npm test');- const compatibility = job.steps.find(step => step.run === 'npm run test:compat');- assert.equal(full?.if, "needs.scope.outputs.scope == 'full' && matrix.node-version == 22");- assert.equal(compatibility?.if, "needs.scope.outputs.scope == 'full' && matrix.node-version != 22");- const release = parse(fs.readFileSync(path.join(repoRoot, '.github/workflows/release.yml'), 'utf8'));- assert.equal(release.jobs.release.steps.find(step => step.with?.['node-version'])?.with['node-version'], 22);- assert.equal(release.jobs.release.steps.filter(step => step.run === 'npm test').length, 1);+test('all maintained Node check names remain and publication uses exhaustive verification', () => {+ assert.deepEqual(ci.jobs.test.strategy.matrix['node-version'], [18, 20, 22, 24]);+ assert.equal(ci.jobs.test.name, undefined);+ const full = ci.jobs.test.steps.find(step => step.run === 'npm run test:full');+ assert.ok(full && full.if.includes("scope == 'full'") && full.if.includes('== 22'));+ assert.ok(ci.jobs.test.steps.some(step => step.run === 'npm run test:compat'));+ assert.ok(release.jobs.release.steps.some(step => step.run === 'npm run test:full'));+ assert.ok(!release.jobs.release.steps.some(step => step.run === 'npm test'));});diff --git a/test/core-smoke.test.mjs b/test/core-smoke.test.mjsnew file mode 100644index 00000000..edee2a19--- /dev/null+++ b/test/core-smoke.test.mjs@@ -0,0 +1,226 @@+import test from 'node:test';+import assert from 'node:assert/strict';+import { spawnSync } from 'node:child_process';+import { createHash } from 'node:crypto';+import fs from 'node:fs';+import os from 'node:os';+import path from 'node:path';+import { fileURLToPath } from 'node:url';+import { parse } from 'parse5';++const skillRoot = fileURLToPath(new URL('../archify/', import.meta.url));+const cli = path.join(skillRoot, 'bin/archify.mjs');+const examples = [+ ['architecture', 'web-app.architecture.json', 'components'],+ ['workflow', 'agent-tool-call.workflow.json', 'nodes'],+ ['sequence', 'cache-miss-request.sequence.json', 'participants'],+ ['dataflow', 'product-analytics.dataflow.json', 'nodes'],+ ['lifecycle', 'agent-run.lifecycle.json', 'states'],+ ['erd', 'orders.erd.json', 'entities'],+ ['tree', 'payment-platform.tree.json', 'nodes'],+ ['class', 'payments.class.json', 'types'],+ ['timeline', 'payment-incident.timeline.json', 'events'],+ ['waterfall', 'checkout-request.waterfall.json', 'spans'],+];++function identity(file) {+ const bytes = fs.readFileSync(file);+ return { sha256: createHash('sha256').update(bytes).digest('hex'), bytes: bytes.length };+}++function descendants(node) {+ return [node, ...(node.childNodes || []).flatMap(descendants)];+}++function attribute(node, name) {+ return node.attrs?.find((entry) => entry.name === name)?.value;+}++function assertDiagram(output, document, collection) {+ const elements = descendants(parse(fs.readFileSync(output, 'utf8')));+ const svg = elements.find((node) => node.tagName === 'svg' && attribute(node, 'role') === 'img');+ assert.ok(svg, 'the HTML must contain an accessible diagram SVG');+ const viewBox = attribute(svg, 'viewBox')?.trim().split(/\s+/).map(Number);+ assert.equal(viewBox?.length, 4, 'SVG must have a usable viewBox');+ assert.ok(viewBox.every(Number.isFinite) && viewBox[2] > 0 && viewBox[3] > 0);+ const contents = descendants(svg);+ for (const item of document[collection]) {+ const node = contents.find((entry) => attribute(entry, 'data-node-id') === item.id);+ assert.ok(node, `SVG is missing authored ${document.diagram_type} node ${item.id}`);+ const parts = descendants(node);+ assert.ok(parts.some((part) => ['rect', 'path', 'circle', 'polygon'].includes(part.tagName)),+ `authored node ${item.id} must contain actual SVG geometry`);+ const text = parts.filter((part) => part.tagName === 'text')+ .map((part) => descendants(part).filter((child) => child.nodeName === '#text')+ .map((child) => child.value).join('')).join(' ');+ assert.ok(text.trim(), `authored node ${item.id} must contain SVG text`);+ // Ignore line wrapping and whitespace while retaining the authored words.+ const label = item.label ?? item.name ?? item.title;+ assert.ok(text.replace(/\s+/g, '').includes(label.replace(/\s+/g, '')),+ `authored node ${item.id} must retain its label in SVG text`);+ }+ for (const edge of document.connections || document.edges || document.messages || document.flows || document.transitions || document.relationships || []) {+ assert.ok(contents.some((node) => attribute(node, 'data-edge-from') === edge.from+ && attribute(node, 'data-edge-to') === edge.to),+ `SVG is missing authored connection ${edge.from} → ${edge.to}`);+ }+}++function assertDiagnostic(receipt, code) {+ assert.equal(receipt.ok, false);+ const diagnostic = receipt.diagnostics.find((entry) => entry.code === code);+ assert.ok(diagnostic, `missing ${code}: ${JSON.stringify(receipt.diagnostics)}`);+ assert.equal(diagnostic.severity, 'error');+ assert.ok(diagnostic.subject && typeof diagnostic.subject === 'object');+ assert.ok(diagnostic.evidence && typeof diagnostic.evidence === 'object');+ assert.ok(diagnostic.supportedFixes.length > 0, 'failure must give a repair action');+ return diagnostic;+}++test('core smoke: public CLI diagrams, compatibility and delivery safety', async (t) => {+ const workspace = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'archify-core-')));+ t.after(() => fs.rmSync(workspace, { recursive: true, force: true }));+ const runtimeTmp = path.join(workspace, 'runtime-temp');+ fs.mkdirSync(runtimeTmp);+ const env = {+ ...process.env,+ ARCHIFY_UPDATE_CHECK_DISABLED: '1',+ TMPDIR: runtimeTmp,+ TMP: runtimeTmp,+ TEMP: runtimeTmp,+ };+ function run(args, cwd = workspace, status = 0) {+ const result = spawnSync(process.execPath, [cli, ...args], {+ cwd, env, encoding: 'utf8', maxBuffer: 16 * 1024 * 1024, timeout: 60_000,+ });+ assert.ifError(result.error);+ assert.equal(result.status, status, `${args.join(' ')}\n${result.stderr}\n${result.stdout}`);+ assert.deepEqual(fs.readdirSync(runtimeTmp), [], 'CLI must clean its private temporary outputs');+ return result;+ }+ function receipt(args, cwd, status) {+ return JSON.parse(run(args, cwd, status).stdout);+ }+ function assertNoStaging(directory) {+ assert.deepEqual(fs.readdirSync(directory).filter((name) => name.startsWith('.archify-')+ || name.endsWith('.delivery-lock.json')), [], 'completed attempt must release locks and staging');+ }+ let workflow;++ for (const [type, filename, collection] of examples) {+ await t.test(`${type}: validate, render and deliver the official example`, () => {+ const directory = path.join(workspace, `${type} 空间 Ω`);+ fs.mkdirSync(directory);+ const input = path.join(directory, `输入 ${filename}`);+ fs.copyFileSync(path.join(skillRoot, 'examples', filename), input);+ const document = JSON.parse(fs.readFileSync(input, 'utf8'));+ assert.equal(document.diagram_type, type);++ const validation = receipt(['validate', type, input, '--json'], directory);+ assert.equal(validation.ok, true);+ assert.equal(validation.command, 'validate');+ assert.equal(validation.type, type);+ assert.equal(validation.candidateFrozen, true);+ assert.equal(validation.candidate.path, input);+ assert.deepEqual({ sha256: validation.candidate.sha256, bytes: validation.candidate.bytes }, identity(input));+ assert.ok(validation.checks.length > 0 && validation.checks.every((check) => check.ok));++ const rendered = path.join(directory, 'rendered.html');+ run(['render', type, input, rendered], directory);+ assertDiagram(rendered, document, collection);++ const output = path.join(directory, '交付 diagram.html');+ const delivered = receipt(['deliver', type, input, output, '--json'], directory);+ assert.equal(delivered.ok, true);+ assert.equal(delivered.command, 'deliver');+ assert.equal(delivered.type, type);+ assert.equal(delivered.input, input);+ assert.equal(delivered.output, output);+ assert.deepEqual(delivered.specification, identity(input));+ assert.deepEqual(delivered.artifact, identity(output));+ assert.equal(delivered.validation.checksPassed, delivered.validation.checkCount);+ assert.ok(delivered.validation.checkCount > 0);+ assert.equal(delivered.validation.errors, 0);+ assertDiagram(output, document, collection);++ const sidecar = output.replace(/\.html$/, '.delivery.json');+ const provenance = JSON.parse(fs.readFileSync(sidecar, 'utf8'));+ assert.equal(provenance.schemaVersion, 1);+ assert.equal(provenance.status, 'current');+ assert.equal(provenance.command, 'deliver');+ assert.equal(provenance.type, type);+ assert.ok(provenance.receiptId && provenance.receiptId === delivered.receiptId);+ assert.equal(provenance.input, input);+ assert.equal(provenance.output, output);+ assert.deepEqual(provenance.specification, identity(input));+ assert.deepEqual(provenance.artifact, identity(output));+ assert.deepEqual(fs.readdirSync(directory).sort(), [path.basename(input), path.basename(rendered), path.basename(output), path.basename(sidecar)].sort());+ if (type === 'workflow') workflow = { directory, input, output, sidecar, document };+ });+ }++ for (const [type, filename, collection] of examples.slice(0, 4)) {+ await t.test(`${type}: frozen schema-v1 input remains valid and renderable`, () => {+ const input = fileURLToPath(new URL(`./fixtures/v1-baseline/${filename}`, import.meta.url));+ const document = JSON.parse(fs.readFileSync(input, 'utf8'));+ assert.equal(document.schema_version, 1);+ const validated = receipt(['validate', type, input, '--json']);+ assert.equal(validated.ok, true);+ assert.equal(validated.type, type);+ assert.ok(validated.checks.every((check) => check.ok));+ const output = path.join(workspace, `v1-${type}.html`);+ run(['render', type, input, output]);+ assertDiagram(output, document, collection);+ });+ }++ await t.test('unknown diagram types return a structured diagnostic', () => {+ const failed = receipt(['validate', 'unknown', 'ignored.json', '--json'], workspace, 2);+ const diagnostic = assertDiagnostic(failed, 'cli/unknown-diagram-type');+ assert.equal(diagnostic.subject.type, 'unknown');+ assert.deepEqual(new Set(diagnostic.evidence.supportedTypes), new Set(examples.map(([type]) => type)));+ });++ await t.test('strict provenance binds the delivered artifact bytes', (t) => {+ if (!workflow) return t.skip('requires the official workflow delivery that failed above');+ const checked = receipt(['check', workflow.output, '--require-provenance']);+ assert.equal(checked.ok, true);+ assert.equal(checked.provenance, 'current');+ const original = fs.readFileSync(workflow.output);+ try {+ fs.appendFileSync(workflow.output, '\n<!-- changed after delivery -->\n');+ const failed = receipt(['check', workflow.output, '--require-provenance'], workspace, 1);+ const diagnostic = assertDiagnostic(failed, 'delivery/provenance-mismatch');+ assert.equal(diagnostic.evidence.expectedSha256, createHash('sha256').update(original).digest('hex'));+ assert.equal(diagnostic.evidence.actualSha256, identity(workflow.output).sha256);+ assert.notEqual(diagnostic.evidence.actualSha256, diagnostic.evidence.expectedSha256);+ } finally {+ fs.writeFileSync(workflow.output, original);+ }+ });++ await t.test('invalid schema preserves the last artifact and marks its delivery as failed', (t) => {+ if (!workflow) return t.skip('requires the official workflow delivery that failed above');+ const invalid = structuredClone(workflow.document);+ invalid.nodes[0].unexpected = true;+ const input = path.join(workflow.directory, 'invalid.workflow.json');+ fs.writeFileSync(input, JSON.stringify(invalid));+ const prior = fs.readFileSync(workflow.output);+ const validated = receipt(['validate', 'workflow', input, '--json'], workspace, 1);+ const diagnostic = assertDiagnostic(validated, 'schema/additionalProperties');+ assert.equal(diagnostic.subject.identity, invalid.nodes[0].id);+ assert.equal(diagnostic.evidence.additionalProperty, 'unexpected');+ const failed = receipt(['deliver', 'workflow', input, workflow.output, '--json'], workspace, 1);+ assertDiagnostic(failed, 'schema/additionalProperties');+ assert.deepEqual(fs.readFileSync(workflow.output), prior);+ const provenance = JSON.parse(fs.readFileSync(workflow.sidecar, 'utf8'));+ assert.equal(provenance.status, 'failed');+ assert.equal(provenance.receiptId, failed.receiptId);+ assert.deepEqual(provenance.artifact, identity(workflow.output));+ const checked = receipt(['check', workflow.output, '--require-provenance'], workspace, 1);+ assertDiagnostic(checked, 'delivery/provenance-failed');+ // The failure record/journal is intentional recovery evidence; temporary+ // publication directories and completed-attempt locks must be gone.+ assertNoStaging(workflow.directory);+ });+});diff --git a/test/crossover-state-browser.test.mjs b/test/crossover-state-browser.test.mjsindex ac7d36f5..1d5775dd 100644--- a/test/crossover-state-browser.test.mjs+++ b/test/crossover-state-browser.test.mjs@@ -129,7 +129,7 @@ test('automatic crossover masks follow live relationship state without becomingconst focusTransition = await samplePairs(8);assertTimedPairs(focusTransition);assert.equal(focusTransition.some((sample) => sample.some((relation) => relation.edgeTransition)), true);- await run(`new Promise(resolve => setTimeout(resolve, 220))`, true);+ await run(`Promise.all([...document.querySelectorAll('[data-graph-role="automatic-crossover"]')].flatMap(wrapper => wrapper.getAnimations({subtree:true})).filter(animation => animation.transitionProperty === 'opacity').map(animation => animation.finished))`, true);const focus = await pairedOpacity();assertPaired(focus, { horizontal: 1, vertical: 0.13 });assert.deepEqual(focus.map((relation) => relation.id), ['horizontal', 'vertical']);diff --git a/test/diagram-guide.test.mjs b/test/diagram-guide.test.mjsindex 82937101..9d2129eb 100644--- a/test/diagram-guide.test.mjs+++ b/test/diagram-guide.test.mjs@@ -37,50 +37,8 @@ test('all typed renderers inherit one viewer-only Diagram Guide', () => {const html = render(mode, example);assert.match(html, /id="diagram-guide" hidden role="dialog" aria-modal="false" aria-labelledby="diagram-guide-title"/, mode);assert.match(html, /id="btn-diagram-guide"[^>]+aria-label="Open diagram guide"[^>]+aria-haspopup="dialog"[^>]+aria-expanded="false"/, mode);- assert.match(html, /Archify\.guide = \(function \(\)/, mode);- assert.match(html, /Diagram Guide — a factual command deck over existing interactions/, mode);assert.doesNotMatch(canonicalSvg(html), /diagram-guide|Archify\.guide|Explore this system/, mode);}});-test('Diagram Guide reports compiled semantic facts', () => {- const html = render('workflow', CASES.workflow);- assert.match(html, /svg\.querySelectorAll\('\[data-node-id\]'\)\.length/);- assert.match(html, /svg\.querySelectorAll\('\[data-edge-from\]\[data-edge-to\]'\)/);- assert.match(html, /edge\.getAttribute\('data-edge-key'\)/);-});--test('Diagram Guide delegates its task rows to existing production interactions', () => {- const html = render('architecture', CASES.architecture);- assert.match(html, /if \(action === 'find'\) return Archify\.finder\.open\(\)/);- assert.match(html, /if \(action === 'route'\) return Archify\.routeProbe\.begin\(\{ focusNode: true \}\)/);- assert.match(html, /if \(action === 'map'\) return Archify\.radar\.open\(\)/);- assert.match(html, /if \(action === 'present'\) return Archify\.presentation\.enter\(\)/);- assert.match(html, /if \(action === 'export'\) return Archify\.exportMenu\.open\(\)/);- assert.match(html, /if \(action === 'theme'\) return Archify\.theme\.toggle\(\)/);- assert.match(html, /if \(action === 'reset'\) return Archify\.view\.reset\(\)/);- assert.match(html, /Archify\.finder\.close\(\{ restoreFocus: false \}\)/);- assert.match(html, /Archify\.radar\.close\(\{ restoreFocus: false \}\)/);- assert.match(html, /event\.stopPropagation\(\);[\s\S]+execute\(button\.getAttribute\('data-guide-action'\)\)/);-});--test('Diagram Guide is keyboard-first, mobile-contained, motion-safe, and embed-clean', () => {- const html = render('sequence', CASES.sequence);- assert.match(html, /e\.key === '\?'/);- assert.match(html, /Archify\.guide\.toggle\(\)/);- assert.match(html, /event\.key === 'ArrowRight'/);- assert.match(html, /event\.key === 'ArrowDown'/);- assert.match(html, /event\.key === 'Home'/);- assert.match(html, /event\.key === 'End'/);- assert.match(html, /event\.key === 'Escape' \|\| event\.key === '\?'/);- assert.match(html, /html\.setAttribute\('data-guide-open', 'true'\)/);- assert.match(html, /html\.getAttribute\('data-guide-open'\) === 'true'/);- assert.match(html, /html\[data-embed="true"\] \.diagram-guide/);- assert.match(html, /data-wide-diagram="true"\] \.diagram-guide/);- assert.match(html, /\.route-probe\[data-guide-open="true"\]/);- assert.match(html, /@media \(prefers-reduced-motion: reduce\)[\s\S]+\.diagram-guide/);- assert.match(html, /class="diagram-guide no-print"/);- assert.doesNotMatch(canonicalSvg(html), /data-guide-open|diagram-guide/);-});-process.on('exit', () => fs.rmSync(tmp, { recursive: true, force: true }));diff --git a/test/export-browser.test.mjs b/test/export-browser.test.mjsindex 20a311ce..54d558f3 100644--- a/test/export-browser.test.mjs+++ b/test/export-browser.test.mjs@@ -127,6 +127,22 @@ test('Export preserves menu, clipboard, semantic cards and recording lifecycles'assert.deepEqual(await run('Object.keys(Archify.exportMenu).sort()'), ['close','downloadReachShareCard','downloadRouteShareCard','isOpen','open','run','shareCard','syncReachShare','syncRouteShare'].sort());assert.deepEqual(await run('Object.keys(Archify.motion).sort()'), ['canRecord','recordWebm']);assert.deepEqual(await run(`[...document.querySelectorAll('#export-menu [data-format="jpeg"],#export-menu [data-format="webp"],#export-menu [data-format="webm"],#export-menu [data-action="copy"]')].map(e=>e.disabled)`), [true,true,true,true]);+ const controls = await run(`(() => {+ const visible = element => { const r = element.getBoundingClientRect(); return r.width > 0 && r.height > 0 && getComputedStyle(element).visibility !== 'hidden'; };+ const facts = element => { const r = element.getBoundingClientRect(); return { id: element.id, width: r.width, height: r.height, name: (element.getAttribute('aria-label') || element.textContent).trim(), tabIndex: element.tabIndex }; };+ return {+ toolbar: [...document.querySelectorAll('#btn-theme, #btn-preset, #btn-present, #btn-export')].filter(visible).map(facts),+ dock: [...document.querySelectorAll('.diagram-nav button')].filter(visible).map(facts),+ };+ })()`);+ assert.equal(controls.toolbar.length, 4, 'primary controls remain visible');+ assert.ok(controls.toolbar.every(control => control.height >= 44 && control.name && control.tabIndex >= 0), JSON.stringify(controls));+ if (width <= 720) assert.ok(controls.dock.every(control => control.width >= 44 && control.height >= 44 && control.name && control.tabIndex >= 0), JSON.stringify(controls));+ await run("document.getElementById('btn-theme').focus()");+ await key('Tab', 'Tab', 9);+ const nextControl = await run('document.activeElement.id');+ assert.ok(nextControl !== 'btn-theme' && controls.toolbar.some(control => control.id === nextControl),+ 'native Tab reaches another named toolbar control without freezing their order');await run(`document.getElementById('btn-export').focus()`);await key('ArrowUp', 'ArrowUp', 38);const last = await run(`document.activeElement.dataset.format||document.activeElement.dataset.action`);@@ -154,6 +170,8 @@ test('Export preserves menu, clipboard, semantic cards and recording lifecycles'assert.equal(await run('Archify.preset.isOpen()'), false);await run('Archify.semanticLens.open();Archify.exportMenu.open()');assert.equal(await run('Archify.semanticLens.isOpen()'), false);+ const menu = await run(`(() => { const r = document.getElementById('export-menu').getBoundingClientRect(); return { left: r.left, right: r.right, top: r.top, bottom: r.bottom, width: innerWidth, height: innerHeight }; })()`);+ assert.ok(menu.left >= -1 && menu.right <= menu.width + 1 && menu.top >= -1 && menu.bottom <= menu.height + 1, JSON.stringify(menu));const state = await record('menu-' + width);assert.equal(state.open, true);assert.equal(state.expanded, 'true');assert.deepEqual(state.console, []);}@@ -170,6 +188,16 @@ test('Export preserves menu, clipboard, semantic cards and recording lifecycles'const shot = await send('Page.captureScreenshot', { format: 'png' });fs.writeFileSync(path.join(evidence, theme + '-menu.png'), Buffer.from(shot.data, 'base64'));}+ await run('Archify.exportMenu.close(false); Archify.view.zoomOut()');+ await run('Archify.layoutStability.whenStable()');+ const indicator = await run(`(() => { const detail = document.querySelector('[data-view-detail]'), percent = document.querySelector('[data-view-percent]'); return { detailVisible: !detail.hidden, detail: detail.textContent.trim(), percent: percent.textContent, scale: Archify.view.state().scale }; })()`);+ assert.equal(indicator.detailVisible, true);+ assert.ok(indicator.detail && !indicator.detail.includes('%'), 'detail has its own label');+ assert.equal(indicator.percent, Math.round(indicator.scale * 100) + '%');+ assert.notEqual(indicator.percent, '100%');+ await click('[data-view="reset"]');+ await run('Archify.layoutStability.whenStable()');+ assert.deepEqual(await run("({detailHidden: document.querySelector('[data-view-detail]').hidden, percent: document.querySelector('[data-view-percent]').textContent})"), { detailHidden: true, percent: '100%' });}});@@ -284,7 +312,9 @@ test('Export preserves menu, clipboard, semantic cards and recording lifecycles'fs.writeFileSync(svgFile, svgText);const figure = await run(`(()=>{const v=document.querySelector('.diagram-container svg').viewBox.baseVal;const sub=(document.querySelector('.header .subtitle')||{}).textContent;const header=document.querySelector('.header h1')?32+(sub&&sub.trim()?24:0)+18:0;return [(v.width+104)*4,(v.height+104+header)*4];})()`);const rasterSizes = [];- for (const format of ['png', 'jpeg', 'webp']) {+ // All modes exercise real raster sizing. Shared MIME/quality encoding+ // branches additionally run on architecture in both themes.+ for (const format of mode === 'architecture' ? ['png', 'jpeg', 'webp'] : ['png']) {await run(`Archify.exportMenu.run('${format}')`);const result = await run(`(async()=>{const blob=exportDownloads.at(-1).blob;const image=await createImageBitmap(blob);const dimensions=[image.width,image.height];image.close();return {dimensions,type:blob.type};})()`);assert.deepEqual(result.dimensions, figure, `${mode} ${theme} ${format}: native 4x framed raster`);diff --git a/test/finder.test.mjs b/test/finder.test.mjsdeleted file mode 100644index 068c6960..00000000--- a/test/finder.test.mjs+++ /dev/null@@ -1,103 +0,0 @@-import { test } from 'node:test';-import assert from 'node:assert/strict';-import { execFileSync } from 'node:child_process';-import fs from 'node:fs';-import os from 'node:os';-import path from 'node:path';-import { fileURLToPath } from 'node:url';--const __dirname = path.dirname(fileURLToPath(import.meta.url));-const skillRoot = path.resolve(__dirname, '..', 'archify');-const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-finder-'));--const CASES = {- architecture: 'web-app.architecture.json',- workflow: 'agent-tool-call.workflow.json',- sequence: 'cache-miss-request.sequence.json',- dataflow: 'product-analytics.dataflow.json',- lifecycle: 'agent-run.lifecycle.json',-};--function render(mode, example) {- const output = path.join(tmp, `${mode}.html`);- execFileSync(process.execPath, [- path.join(skillRoot, `renderers/${mode}/render-${mode}.mjs`),- path.join(skillRoot, 'examples', example),- output,- ]);- return fs.readFileSync(output, 'utf8');-}--function svg(html) {- return html.match(/<svg\b[\s\S]*?<\/svg>/)?.[0] || '';-}--test('all typed renderers ship the same geometry-neutral node finder', () => {- for (const [mode, example] of Object.entries(CASES)) {- const html = render(mode, example);- assert.match(html, /id="btn-node-finder"[^>]+aria-label="Find a node"[^>]+aria-haspopup="dialog"/, mode);- assert.match(html, /id="node-finder" hidden role="dialog" aria-modal="false"/, mode);- assert.match(html, /id="node-finder-input" type="search"/, mode);- assert.match(html, /Archify\.finder = \(function \(\)/, mode);- assert.match(html, /svg\.querySelectorAll\('\[data-node-id\]'\)/, mode);- assert.doesNotMatch(svg(html), /node-finder|Archify\.finder|Find a node/, mode);- }-});--test('finder searches semantic ids and labels, then delegates to focus and reveal', () => {- const html = render('architecture', CASES.architecture);- assert.match(html, /search: \(id \+ ' ' \+ label \+ ' ' \+ type \+ ' ' \+ sublabel \+ ' ' \+ context \+ ' ' \+ tag \+ ' ' \+ sourceSearch \+ ' ' \+ text\)\.toLowerCase\(\)/);- assert.match(html, /item\.search\.indexOf\(query\) !== -1/);- assert.match(html, /Archify\.view\.reset\(\{ automatic: true \}\)/);- assert.match(html, /Archify\.focus\.set\(id, \{ toggle: false \}\)/);- assert.match(html, /Archify\.view\.reveal\(\[id\], \{ includeNeighbors: true, reason: 'finder' \}\)/);- assert.match(html, /item\.node\.focus\(\{ preventScroll: true \}\)/);- assert.match(html, /var key = from \+ '\\u0000' \+ to/);-});--test('finder presents one focused search control and a structured result list', () => {- const html = render('architecture', CASES.architecture);- assert.match(html, /id="node-finder-input"[^>]+aria-label="Search diagram nodes"/);- assert.match(html, /\.node-finder-search:focus-within\s*\{/);- assert.match(html, /\.node-finder-input:focus-visible\s*\{\s*outline:\s*none;/);- assert.match(html, /\.node-finder\s*\{[\s\S]*?display:\s*flex;[\s\S]*?max-height:\s*calc\(100% - 2rem\);/);- assert.match(html, /\.node-finder-results\s*\{[\s\S]*?flex:\s*1 1 auto;[\s\S]*?min-height:\s*0;/);- assert.match(html, /\.node-finder-result:not\(:last-child\)\s*\{/);- assert.match(html, /context\.kind === 'focus'\s*\? viewerCount\('viewer\.finder\.link', item\.links\)/);- assert.match(html, /\[viewerKindLabel\(item\.type\), item\.id, item\.sublabel, item\.tag\]/);- assert.doesNotMatch(html, /\[item\.type, item\.context, item\.sublabel, item\.tag, item\.id\]/);- assert.match(html, /viewerText\('viewer\.finder\.status\.filtered'/);-});--test('finder becomes a contextual Route Probe endpoint picker without changing semantic focus', () => {- const html = render('workflow', CASES.workflow);- assert.match(html, /function resolveContext\(options\)/);- assert.match(html, /Archify\.routeProbe\.finderContext\(\)/);- assert.match(html, /context\.allowedIds\.indexOf\(item\.id\) !== -1/);- assert.match(html, /context\.kind === 'route-source' \|\| context\.kind === 'route-target'/);- assert.match(html, /Archify\.routeProbe\.choose\(id\)/);- assert.match(html, /reason: 'route-pick'/);- assert.match(html, /data-context="route-source"/);- assert.match(html, /data-context="route-target"/);- assert.match(html, /viewerText\('viewer\.finder\.result\.routeTarget'/);- assert.match(html, /links: badge/);- assert.match(html, /viewerText\('viewer\.finder\.status\.all'/);-});--test('finder is keyboard accessible, mobile-pinned, and subordinate to embed mode', () => {- const html = render('workflow', CASES.workflow);- assert.match(html, /e\.key === '\/'/);- assert.match(html, /Archify\.finder\.open\(\)/);- assert.match(html, /event\.key === 'ArrowDown'/);- assert.match(html, /event\.key === 'ArrowUp'/);- assert.match(html, /event\.key === 'Escape'/);- assert.match(html, /event\.stopPropagation\(\)/);- assert.match(html, /Archify\.exportMenu\.isOpen\(\)\) Archify\.exportMenu\.close\(false\)/);- assert.match(html, /data-wide-diagram="true"\] \.node-finder/);- assert.match(html, /html\[data-embed="true"\] \.node-finder/);- assert.match(html, /html\.getAttribute\('data-embed'\) === 'true'/);- assert.match(html, /data-node-finder-trigger/);- assert.match(html, /!event\.target\.closest\('\[data-node-finder-trigger\]'\)/);-});--process.on('exit', () => fs.rmSync(tmp, { recursive: true, force: true }));diff --git a/test/focus-browser.test.mjs b/test/focus-browser.test.mjsindex 77925c61..22cb2646 100644--- a/test/focus-browser.test.mjs+++ b/test/focus-browser.test.mjs@@ -189,7 +189,42 @@ test('Focus preserves semantic selection, relationships, reachability and sharedassert.equal(r.copied,!['false','throw'].includes(mode));assert.equal(r.hash,'#focus=cdn&reach=downstream');assert.match(r.query,/keep=yes/);assert.equal(r.remaining,0);assert.equal(r.label,r.copied?'Copied':'Copy failed');records.push({scenario:'copy-'+mode,...r});await run(`focusWait(()=>document.getElementById('btn-focus-copy').textContent===viewerText('viewer.passport.copy'))`);}- await load();await run(`Archify.focus.inspectRelationshipById('edge-d');Object.defineProperty(navigator,'clipboard',{configurable:true,value:{writeText:value=>{window.copiedFocusUrl=value;return Promise.resolve();}}})`);assert.equal(await run('Archify.focus.copyLink()'),true);assert.equal(await run('new URL(copiedFocusUrl).hash'),'#relation=edge-d');await run('Archify.focus.clear()');await run('new Promise(resolve=>setTimeout(resolve,1650))');assert.equal(await run(`document.getElementById('btn-focus-copy').textContent`),await run(`viewerText('viewer.passport.copy')`));assert.equal(await run('Archify.focus.copyLink()'),false);+ await load();+ const clearedFeedback = await run(`(async () => {+ Archify.focus.inspectRelationshipById('edge-d');+ let copiedUrl;+ Object.defineProperty(navigator, 'clipboard', { configurable: true, value: {+ writeText: value => { copiedUrl = value; return Promise.resolve(); }+ } });+ // Capture only this copy call's delayed feedback. Replay production's+ // callback after clear rather than prescribing its delay or navigating+ // away before a stale callback can run.+ const schedule = window.setTimeout, callbacks = [];+ let copied, copiedLabel;+ window.setTimeout = (callback, delay, ...args) => {+ callbacks.push(() => callback(...args));+ return callbacks.length;+ };+ try {+ copied = await Archify.focus.copyLink();+ copiedLabel = document.getElementById('btn-focus-copy').textContent;+ } finally { window.setTimeout = schedule; }+ Archify.focus.clear();+ for (const callback of callbacks) callback();+ const button = document.getElementById('btn-focus-copy');+ return { copied, hash: new URL(copiedUrl).hash, copiedLabel,+ callbackCount: callbacks.length, label: button.textContent,+ aria: button.getAttribute('aria-label'), canCopy: await Archify.focus.copyLink(),+ defaultLabel: viewerText('viewer.passport.copy'), defaultAria: viewerText('viewer.passport.copy.focus') };+ })()`);+ assert.equal(clearedFeedback.copied, true);+ assert.equal(clearedFeedback.hash, '#relation=edge-d');+ assert.equal(clearedFeedback.copiedLabel, 'Copied');+ assert.ok(clearedFeedback.callbackCount > 0, 'copy feedback must actually execute after clear');+ assert.equal(clearedFeedback.label, clearedFeedback.defaultLabel);+ assert.equal(clearedFeedback.aria, clearedFeedback.defaultAria);+ assert.equal(clearedFeedback.canCopy, false);+});await t.test('real pulse completion and motion transitions preserve static relationship state',async()=>{await load('graph',{reduced:false});await run(`Archify.focus.inspectRelationshipById('edge-d')`);assert.equal(await run(`document.querySelectorAll('[data-relationship-pulse-overlay]').length`),1);diff --git a/test/generate-viewer.test.mjs b/test/generate-viewer.test.mjsindex a22bca27..f9297f7a 100644--- a/test/generate-viewer.test.mjs+++ b/test/generate-viewer.test.mjs@@ -135,19 +135,6 @@ test('a missing generated template is stale and can be regenerated', (t) => {assert.equal(f.run('--check').status, 0);});-test('viewer.css owns the complete main style block', (t) => {- const f = fixture(t);- const shell = fs.readFileSync(f.shell, 'utf8');- const markerIndex = shell.indexOf(viewerCssMarker);- assert.notEqual(markerIndex, -1);- const afterMarker = shell.slice(markerIndex + viewerCssMarker.length);- assert.match(afterMarker, /^\n\s*<\/style>/);- const css = fs.readFileSync(f.viewerCss, 'utf8');- assert.match(css, /@media print \{/);- assert.match(css, /@media \(prefers-reduced-motion: reduce\) \{/);- assert.match(css, /\n\}\n$/);-});-test('assembly failure matrix preserves a valid artifact', { concurrency: false }, async (t) => {const f = fixture(t);// Marker rejection depends on source structure, not production bundle size.diff --git a/test/guide-page.test.mjs b/test/guide-page.test.mjsindex 7002521f..6e32cdd0 100644--- a/test/guide-page.test.mjs+++ b/test/guide-page.test.mjs@@ -39,22 +39,13 @@ test('guide page: ships bilingual recipes and syntactically valid interaction costaticVersionLabel?.[1],`Scenario guide / ${releaseIdentity} / v${packageVersion}`,);- assert.match(html, /Question-first diagramming/);- assert.match(html, /先问题,后图表/);- assert.match(html, /archify guide "your scenario"|archify guide "your scenario"/);const dataMatch = html.match(/<script id="guide-data" type="application\/json">([\s\S]*?)<\/script>/);assert.ok(dataMatch);const data = JSON.parse(dataMatch[1]);- assert.equal(data.length, 13);- assert.equal(data.filter((recipe) => recipe.type === 'workflow').length, 3);assert.ok(data.every((recipe) => recipe.en.prompt && recipe.zh.prompt && recipe.proof));assert.ok(data.some((recipe) => recipe.id === 'layout-repair'));- assert.match(html, /13 small, opinionated starting points\./);- assert.match(html, /13 个小而专的起点。/);assert.match(html, /gallery\.html#proof-/);- assert.match(html, /Open verified example/);- assert.match(html, /打开验证成品/);const scriptMatch = html.match(/<script>\n([\s\S]*?)\n <\/script>\n<\/body>/);assert.ok(scriptMatch);diff --git a/test/guide.test.mjs b/test/guide.test.mjsindex bb49098e..d762c088 100644--- a/test/guide.test.mjs+++ b/test/guide.test.mjs@@ -8,30 +8,25 @@ import {recommendScenario,} from '../archify/recipes/scenarios.mjs';-test('guide: exposes 13 unique recipes across every diagram type, including repair', () => {- assert.equal(SCENARIO_RECIPES.length, 13);- assert.equal(new Set(SCENARIO_RECIPES.map((recipe) => recipe.id)).size, 13);- assert.deepEqual(- Object.fromEntries(['architecture', 'workflow', 'sequence', 'dataflow', 'lifecycle', 'erd'].map((type) => [- type,- SCENARIO_RECIPES.filter((recipe) => recipe.type === type).length,- ])),- { architecture: 3, workflow: 3, sequence: 2, dataflow: 2, lifecycle: 2, erd: 1 },- );+test('guide: exposes unique recipes across the supported guide diagram types', () => {+ assert.equal(new Set(SCENARIO_RECIPES.map((recipe) => recipe.id)).size, SCENARIO_RECIPES.length);+ for (const type of ['architecture', 'workflow', 'sequence', 'dataflow', 'lifecycle', 'erd']) {+ assert.ok(SCENARIO_RECIPES.some((recipe) => recipe.type === type), type);+ }});test('guide: every recipe has complete English and Chinese decision copy', () => {for (const recipe of SCENARIO_RECIPES) {assert.match(recipe.id, /^[a-z0-9]+(?:-[a-z0-9]+)*$/);- assert.ok(recipe.signals.length >= 8, recipe.id);+ assert.ok(recipe.signals.length > 0, recipe.id);assert.ok(['classic', 'signal-flow', 'blueprint', 'editorial'].includes(recipe.presentation.preset), recipe.id);for (const lang of ['en', 'zh']) {const copy = recipe[lang];- assert.ok(copy.title.length >= 4, `${recipe.id}.${lang}.title`);+ assert.ok(copy.title.trim(), `${recipe.id}.${lang}.title`);for (const field of ['question', 'summary', 'useWhen', 'avoidWhen', 'prompt']) {- assert.ok(copy[field].length > 10, `${recipe.id}.${lang}.${field}`);+ assert.ok(copy[field].trim(), `${recipe.id}.${lang}.${field}`);}- assert.equal(copy.include.length, 4, `${recipe.id}.${lang}.include`);+ assert.ok(copy.include.length > 0 && copy.include.every((entry) => entry.trim()), `${recipe.id}.${lang}.include`);}}});@@ -39,8 +34,13 @@ test('guide: every recipe has complete English and Chinese decision copy', () =>test('guide: language detection and localization are deterministic', () => {assert.equal(detectGuideLanguage('show an API request'), 'en');assert.equal(detectGuideLanguage('展示 API 请求'), 'zh');- assert.equal(listScenarioRecipes('zh')[0].title, '系统总览');- assert.equal(listScenarioRecipes('en')[0].title, 'System overview');+ for (const lang of ['en', 'zh']) {+ const localized = listScenarioRecipes(lang);+ assert.equal(localized.length, SCENARIO_RECIPES.length);+ for (const recipe of SCENARIO_RECIPES) {+ assert.equal(localized.find((entry) => entry.id === recipe.id)?.title, recipe[lang].title);+ }+ }});test('guide: representative scenarios map to specialized recipes', () => {@@ -103,7 +103,6 @@ test('guide: exact ids win and unknown questions fall back honestly', () => {test('guide: public data includes both languages and weighted signals', () => {const data = publicGuideData();- assert.equal(data.length, 13);for (const recipe of data) {assert.ok(recipe.en.title);assert.ok(recipe.zh.title);diff --git a/test/intent-trace.test.mjs b/test/intent-trace.test.mjsdeleted file mode 100644index 0a9a4603..00000000--- a/test/intent-trace.test.mjs+++ /dev/null@@ -1,110 +0,0 @@-import { test } from 'node:test';-import assert from 'node:assert/strict';-import { execFileSync } from 'node:child_process';-import fs from 'node:fs';-import os from 'node:os';-import path from 'node:path';-import { fileURLToPath } from 'node:url';--const __dirname = path.dirname(fileURLToPath(import.meta.url));-const skillRoot = path.resolve(__dirname, '..', 'archify');-const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-intent-trace-'));--const CASES = {- architecture: 'web-app.architecture.json',- workflow: 'agent-tool-call.workflow.json',- sequence: 'cache-miss-request.sequence.json',- dataflow: 'product-analytics.dataflow.json',- lifecycle: 'agent-run.lifecycle.json',-};--function render(mode, example) {- const output = path.join(tmp, `${mode}.html`);- execFileSync(process.execPath, [- path.join(skillRoot, `renderers/${mode}/render-${mode}.mjs`),- path.join(skillRoot, 'examples', example),- output,- ]);- return fs.readFileSync(output, 'utf8');-}--function canonicalSvg(html) {- return html.match(/<svg\b[\s\S]*?<\/svg>/)?.[0] || '';-}--test('all typed renderers inherit one geometry-neutral Intent Trace', () => {- for (const [mode, example] of Object.entries(CASES)) {- const html = render(mode, example);- assert.match(html, /Archify\.intentTrace = \(function \(\)/, mode);- assert.match(html, /id="intent-trace-status" role="status" aria-live="polite" aria-atomic="true"/, mode);- assert.match(html, /svg\.setAttribute\('data-intent-trace-active', id\)/, mode);- assert.match(html, /data-intent-trace-overlay/, mode);- assert.equal((html.match(/<svg\b/g) || []).length, 1, `${mode} keeps one static canonical SVG`);- assert.doesNotMatch(canonicalSvg(html), /data-intent-trace|intent-trace-flow/, mode);- }-});--test('Intent Trace derives exact one-hop direction from stable renderer relationships', () => {- const html = render('workflow', CASES.workflow);- assert.match(html, /function show\(id, options\)/);- assert.match(html, /if \(from !== id && to !== id\) return/);- assert.match(html, /direction = from === id && to === id \? 'loop' : \(from === id \? 'out' : 'in'\)/);- assert.match(html, /related\[from\] = true/);- assert.match(html, /related\[to\] = true/);- assert.match(html, /edge\.setAttribute\('data-intent-trace-match', ''\)/);- assert.match(html, /node\.setAttribute\('data-intent-trace-selected', ''\)/);- assert.match(html, /clone\.setAttribute\('data-direction', direction\)/);- assert.match(html, /counts\[direction\] \+= 1/);-});--test('Intent Trace keeps incoming and outgoing motion on authored source-to-target geometry', () => {- for (const [mode, example] of Object.entries(CASES)) {- const html = render(mode, example);- const incomingRule = html.match(/\.intent-trace-flow\[data-direction="in"\]\s*\{[\s\S]*?\}/)?.[0] || '';- assert.ok(incomingRule, `${mode}: expected the incoming Intent Trace style`);- assert.doesNotMatch(- incomingRule,- /animation-direction\s*:\s*reverse/,- `${mode}: incoming authored geometry must not be replayed from target to source`,- );- assert.match(incomingRule, /animation-direction\s*:\s*normal/, mode);- assert.match(html, /function traceGeometry\(shape, direction\)[\s\S]+shape\.cloneNode\(false\)/, mode);- assert.match(html, /@keyframes archify-intent-trace-flow[\s\S]+stroke-dashoffset: -1/, mode);- }-});--test('Intent Trace separates hover, keyboard, touch, and committed focus', () => {- const html = render('sequence', CASES.sequence);- assert.match(html, /window\.matchMedia\('\(hover: hover\) and \(pointer: fine\)'\)/);- assert.match(html, /event\.pointerType === 'touch'/);- assert.match(html, /addEventListener\('pointerover'/);- assert.match(html, /addEventListener\('pointerout'/);- assert.match(html, /addEventListener\('focusin'/);- assert.match(html, /addEventListener\('focusout'/);- assert.match(html, /show\(node\.getAttribute\('data-node-id'\), \{ announce: true \}\)/);- assert.match(html, /Press Enter for details/);- assert.match(html, /html\.getAttribute\('data-embed'\) === 'true'/);- assert.match(html, /container\.classList\.contains\('is-panning'\)/);- assert.match(html, /svg\.hasAttribute\('data-relationship-preview-active'\)/);- assert.match(html, /Archify\.focus\.active\(\)/);- assert.match(html, /Archify\.intentTrace\.clear\(\{ announce: false \}\)/);- assert.match(html, /e\.key === 'Escape' && Archify\.intentTrace\.active\(\)/);-});--test('Intent Trace normalizes motion, respects reduced motion, and exports cleanly', () => {- const html = render('architecture', CASES.architecture);- assert.match(html, /clone\.setAttribute\('pathLength', '1'\)/);- assert.match(html, /\.intent-trace-flow\[data-direction="out"\]/);- assert.match(html, /\.intent-trace-flow\[data-direction="in"\]/);- assert.match(html, /\.intent-trace-flow\[data-direction="loop"\]/);- assert.match(html, /@keyframes archify-intent-trace-flow/);- assert.match(html, /animation: archify-intent-trace-flow 1\.15s linear 1 both/);- assert.match(html, /@media \(prefers-reduced-motion: reduce\)[\s\S]+\.intent-trace-flow \{[\s\S]+animation: none !important/);- assert.match(html, /clone\.removeAttribute\('data-intent-trace-active'\)/);- assert.match(html, /clone\.querySelectorAll\('\[data-intent-trace-overlay\]'\)/);- assert.match(html, /clone\.querySelectorAll\('\[data-intent-trace-match\], \[data-intent-trace-selected\]'\)/);- assert.match(html, /!clone\.hasAttribute\('data-intent-trace-active'\)/);- assert.doesNotMatch(canonicalSvg(html), /data-intent-trace|intent-trace-flow/);-});--process.on('exit', () => fs.rmSync(tmp, { recursive: true, force: true }));diff --git a/test/motion-governor.test.mjs b/test/motion-governor.test.mjsdeleted file mode 100644index f9ae7091..00000000--- a/test/motion-governor.test.mjs+++ /dev/null@@ -1,105 +0,0 @@-import { test } from 'node:test';-import assert from 'node:assert/strict';-import { execFileSync } from 'node:child_process';-import fs from 'node:fs';-import os from 'node:os';-import path from 'node:path';-import { fileURLToPath } from 'node:url';--const __dirname = path.dirname(fileURLToPath(import.meta.url));-const skillRoot = path.resolve(__dirname, '..', 'archify');-const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-motion-governor-'));--const CASES = {- architecture: 'web-app.architecture.json',- workflow: 'agent-tool-call.workflow.json',- sequence: 'cache-miss-request.sequence.json',- dataflow: 'product-analytics.dataflow.json',- lifecycle: 'agent-run.lifecycle.json',-};--function render(mode, example, animation = 'trace') {- const doc = JSON.parse(fs.readFileSync(path.join(skillRoot, 'examples', example), 'utf8'));- doc.meta = { ...doc.meta };- if (animation) doc.meta.animation = animation;- else delete doc.meta.animation;- const input = path.join(tmp, `${mode}-${animation || 'static'}.json`);- const output = path.join(tmp, `${mode}-${animation || 'static'}.html`);- fs.writeFileSync(input, JSON.stringify(doc));- execFileSync('node', [path.join(skillRoot, `renderers/${mode}/render-${mode}.mjs`), input, output], {- stdio: ['ignore', 'ignore', 'pipe'],- });- return fs.readFileSync(output, 'utf8');-}--function svgBlock(html) {- return html.match(/<svg\b[\s\S]*?<\/svg>/)?.[0] || '';-}--test('all renderers inherit one viewer-only Live/Still Motion Governor', () => {- for (const [mode, example] of Object.entries(CASES)) {- const html = render(mode, example);- assert.match(html, /id="btn-motion"[^>]+hidden[^>]+aria-label="Pause motion"/, mode);- assert.match(html, /Archify\.motionGovernor = \(function \(\)/, mode);- assert.match(html, /var capable = !!\(svg && svg\.getAttribute\('data-animation'\) === 'trace'\)/, mode);- assert.match(svgBlock(html), /data-animation="trace"/, mode);- assert.doesNotMatch(svgBlock(html), /data-motion-(?:capable|owner)|motion-control/, mode);- }-});--test('static artifacts stay truly still while trace artifacts opt into ambient motion', () => {- const html = render('architecture', CASES.architecture, null);- const svg = svgBlock(html);- assert.doesNotMatch(svg, /data-animation=/);- assert.match(html, /\.pulse-dot \{[\s\S]*?animation: none;/);- assert.match(html, /html\[data-motion-capable="true"\] \.pulse-dot \{ animation: pulse 2s infinite; \}/);- assert.match(html, /html\[data-motion-capable="true"\]\[data-preset="signal-flow"\]\[data-ambient-motion="running"\] \.diagram-container::before/);- assert.match(html, /if \(!capable\) \{[\s\S]*?btn\.hidden = true;[\s\S]*?capable: false/);- assert.match(html, /html\.setAttribute\('data-motion-capable', 'true'\);[\s\S]*?btn\.hidden = false/);-});--test('reader pause is persistent, explicit, and reduced-motion aware', () => {- const html = render('workflow', CASES.workflow);- assert.match(html, /var STORAGE_KEY = 'archify-motion'/);- assert.match(html, /localStorage\.setItem\(STORAGE_KEY, 'still'\)/);- assert.match(html, /localStorage\.removeItem\(STORAGE_KEY\)/);- assert.match(html, /html\.setAttribute\('data-motion', paused \? 'still' : 'live'\)/);- assert.match(html, /btn\.setAttribute\('aria-pressed', paused \? 'false' : 'true'\)/);- assert.match(html, /Motion paused by reduced-motion preference/);- assert.match(html, /motionQuery\.addEventListener\('change', render\)/);- assert.match(html, /document\.addEventListener\('visibilitychange', syncVisibility\)/);- assert.match(html, /\.pulse-dot \{ animation: none !important; \}/);-});--test('strong semantic intent receives the single motion budget', () => {- const html = render('workflow', CASES.workflow);- assert.match(html, /data-route-picking'[\s\S]*?return 'route'/);- assert.match(html, /data-lens-active'\)\) return 'lens'/);- assert.match(html, /data-relationship-preview-active'\)\) return 'relationship'/);- assert.match(html, /data-intent-trace-active'\)\) return 'intent'/);- assert.match(html, /data-focus-active'\)\) return 'focus'/);- assert.match(html, /data-legend-preview-active'\)\) return 'legend'/);- assert.match(html, /new MutationObserver\(function \(\) \{ publishOwner\(\); \}\)/);- assert.match(html, /html\[data-motion-owner\] svg\[data-animation="trace"\] \[data-animate\]/);- assert.match(html, /function claim\(next, cleanup\)[\s\S]*?return ownerToken/);- assert.match(html, /function release\(token\)[\s\S]*?token !== ownerToken/);- assert.match(html, /function clearClaim\(preempted\)[\s\S]*?try \{ cleanup\(\); \} catch/);- assert.match(html, /function claim\(next, cleanup\)[\s\S]*?clearClaim\(true\)/);- assert.match(html, /animation: archify-route-probe-flow 1\.1s[\s\S]*?1 both/);- assert.doesNotMatch(html, /archify-route-probe-flow[^;]*infinite/);-});--test('motion control is mobile-contained, embed-safe, and export-neutral', () => {- const html = render('sequence', CASES.sequence);- assert.match(html, /\.toolbar #btn-motion\[hidden\] \{ display: none !important; \}/);- assert.match(html, /\.toolbar button \{[\s\S]*?min-height: 2\.75rem;/);- assert.match(html, /@media \(max-width: 360px\) \{[\s\S]*?\.toolbar #btn-motion \{ min-width: 4\.4rem;/);- assert.match(html, /#theme-label, #preset-label, #present-label \{ display: none; \}/);- assert.match(html, /html\[data-embed="true"\] \.diagram-container::before/);- assert.match(html, /html\[data-share-playback="true"\] \.diagram-container::before/);- assert.match(html, /Still also parks bounded[\s\S]*?viewer signals without discarding their static meaning/);- assert.match(html, /recordExportReceipt\('svg', blob, d\.canonicalStateClean\)/);- assert.doesNotMatch(svgBlock(html), /btn-motion|data-motion=|data-motion-owner/);-});--process.on('exit', () => fs.rmSync(tmp, { recursive: true, force: true }));diff --git a/test/presentation.test.mjs b/test/presentation.test.mjsindex 7c248d4f..9007f0f4 100644--- a/test/presentation.test.mjs+++ b/test/presentation.test.mjs@@ -36,36 +36,9 @@ test('all typed renderers ship the same presentation stage contract', () => {for (const [mode, example] of Object.entries(CASES)) {const html = render(mode, example);assert.match(html, /id="btn-present"[^>]+aria-label="Enter presentation stage"[^>]+aria-pressed="false"/, mode);- assert.match(html, /Archify\.presentation = \(function \(\)/, mode);- assert.match(html, /enter: function \(\) \{ return setActive\(true\); \}/, mode);- assert.match(html, /exit: function \(\) \{ return setActive\(false\); \}/, mode);- assert.match(html, /html\[data-present="true"\]:not\(\[data-embed="true"\]\) \.diagram-container/, mode);- assert.match(html, /height: 100dvh/, mode);- assert.match(html, /\.cards \{ display: none; \}/, mode);assert.doesNotMatch(html.match(/<html[^>]*>/)?.[0] || '', /data-present=/, mode);assert.doesNotMatch(svg(html), /data-present|btn-present|Presentation Stage/, mode);}});-test('presentation stage supports direct links and preserves view hashes', () => {- const html = render('architecture', CASES.architecture);- assert.match(html, /get\('present'\) === '1'/);- assert.match(html, /document\.documentElement\.setAttribute\('data-present', 'true'\)/);- assert.match(html, /url\.searchParams\.set\('present', '1'\)/);- assert.match(html, /url\.searchParams\.delete\('present'\)/);- assert.match(html, /url\.pathname \+ url\.search \+ url\.hash/);- assert.match(html, /Embed mode wins when both query parameters are present/);-});--test('presentation keyboard behavior exits in layers and remains accessible', () => {- const html = render('workflow', CASES.workflow);- assert.match(html, /e\.defaultPrevented\) return/);- assert.match(html, /e\.key === 'f' \|\| e\.key === 'F'/);- assert.match(html, /Archify\.presentation\.toggle\(\)/);- assert.match(html, /e\.key === 'Escape' && Archify\.focus\.active\(\)/);- assert.match(html, /e\.key === 'Escape' && Archify\.presentation\.active\(\)/);- assert.match(html, /btn\.setAttribute\('aria-pressed', next \? 'true' : 'false'\)/);- assert.match(html, /Exit presentation stage \(F or Escape\)/);-});-process.on('exit', () => fs.rmSync(tmp, { recursive: true, force: true }));diff --git a/test/reader-layout-browser.test.mjs b/test/reader-layout-browser.test.mjsindex 0e983059..6a0928e9 100644--- a/test/reader-layout-browser.test.mjs+++ b/test/reader-layout-browser.test.mjs@@ -144,9 +144,10 @@ test('Reader Layout preserves final-artifact behavior across its ownership boundassert.equal(state.shape, wide ? 'wide' : null);}- await t.test('five modes initialize, export clean SVG, and honor themes and reduced motion', async () => {+ await t.test('five modes initialize and export clean SVG; a representative reader honors both themes and reduced motion', async () => {for (const [mode, file] of Object.entries(artifacts)) {- for (const theme of ['dark', 'light']) {+ // Mode seams remain complete; shared theme/reduced-motion behavior uses one representative.+ for (const theme of mode === 'architecture' ? ['dark', 'light'] : ['dark']) {await load(file, { theme, reduced: theme === 'light' });const state = await snapshot(`${mode}-${theme}`);assert.equal(state.theme, theme);@@ -186,6 +187,31 @@ test('Reader Layout preserves final-artifact behavior across its ownership bound}});+ await t.test('Guide and presentation keyboard controls preserve focus, URL context and authored geometry', async () => {+ await load(artifacts.architecture, { query: '&keep=yes#reader-context' });+ const before = await snapshot('guide-presentation-before');+ async function key(key, code, windowsVirtualKeyCode) {+ await send('Input.dispatchKeyEvent', { type: 'keyDown', key, code, windowsVirtualKeyCode });+ await send('Input.dispatchKeyEvent', { type: 'keyUp', key, code, windowsVirtualKeyCode });+ }+ await evaluate("document.getElementById('btn-present').focus()");+ await key('?', 'Slash', 191);+ await evaluate('new Promise(resolve => requestAnimationFrame(resolve))', true);+ assert.equal(await evaluate("!document.getElementById('diagram-guide').hidden && document.getElementById('diagram-guide').contains(document.activeElement)"), true);+ await key('Escape', 'Escape', 27);+ assert.equal(await evaluate("document.getElementById('diagram-guide').hidden"), true);+ assert.equal(await evaluate('document.activeElement.id'), 'btn-present');+ await key('f', 'KeyF', 70);+ await stable();+ assert.deepEqual(await evaluate("({active: Archify.presentation.active(), pressed: document.getElementById('btn-present').getAttribute('aria-pressed'), present: new URL(location.href).searchParams.get('present'), keep: new URL(location.href).searchParams.get('keep'), hash: location.hash})"),+ { active: true, pressed: 'true', present: '1', keep: 'yes', hash: '#reader-context' });+ await key('Escape', 'Escape', 27);+ await stable();+ assert.equal(await evaluate('Archify.presentation.active()'), false);+ assert.deepEqual(await evaluate("[new URL(location.href).searchParams.get('present'), new URL(location.href).searchParams.get('keep'), location.hash]"), [null, 'yes', '#reader-context']);+ assert.deepEqual((await snapshot('guide-presentation-return')).geometry, before.geometry);+ });+await t.test('ratio and desktop thresholds preserve shape while clearing temporary state', async () => {await load(variant('intrinsic-ratio-1.549', { ratio: 1.549 }));const intrinsic = await snapshot('intrinsic-ratio-1.549');@@ -504,7 +530,7 @@ test('Reader Layout preserves final-artifact behavior across its ownership boundassert.deepEqual(capped.geometry, initial.geometry);});- await t.test('long automatic sequences and waterfalls favor reading width while small canvases cap enlargement', async () => {+ await t.test('automatic width-first content favors reading width while small canvases cap enlargement', async () => {function readerFixture(name, width, height, attributes) {const original = fs.readFileSync(artifacts.architecture, 'utf8');const svgStart = original.indexOf('<svg');@@ -524,8 +550,9 @@ test('Reader Layout preserves final-artifact behavior across its ownership boundreturn file;}const samples = [- ['sequence', 1100, 2400, 'width-first'],- ['waterfall', 1100, 2400, 'width-first'],+ // Family names do not alter this synthetic SVG. Real sequence and+ // waterfall declarations are exercised by the following renderer case.+ ['width-first-tall', 1100, 2400, 'width-first'],['small-erd', 456, 270, 'intrinsic-height'],];for (const [name, width, height, fit] of samples) {diff --git a/test/relationship-direct-explorer.test.mjs b/test/relationship-direct-explorer.test.mjsdeleted file mode 100644index a3c11cdf..00000000--- a/test/relationship-direct-explorer.test.mjs+++ /dev/null@@ -1,114 +0,0 @@-import { test } from 'node:test';-import assert from 'node:assert/strict';-import { spawnSync } from 'node:child_process';-import fs from 'node:fs';-import os from 'node:os';-import path from 'node:path';-import { fileURLToPath } from 'node:url';--const __dirname = path.dirname(fileURLToPath(import.meta.url));-const skillRoot = path.resolve(__dirname, '..', 'archify');-const template = fs.readFileSync(path.join(skillRoot, 'assets', 'template.html'), 'utf8');-const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-relationship-direct-explorer-'));--const CASES = {- architecture: 'web-app.architecture.json',- workflow: 'agent-tool-call.workflow.json',- sequence: 'cache-miss-request.sequence.json',- dataflow: 'product-analytics.dataflow.json',- lifecycle: 'agent-run.lifecycle.json',-};--function render(mode, example) {- const output = path.join(tmp, `${mode}.html`);- const result = spawnSync(process.execPath, [- path.join(skillRoot, `renderers/${mode}/render-${mode}.mjs`),- path.join(skillRoot, 'examples', example),- output,- ], { encoding: 'utf8' });- return { result, html: fs.existsSync(output) ? fs.readFileSync(output, 'utf8') : '' };-}--function canonicalSvg(html) {- return html.match(/<svg\b[\s\S]*?<\/svg>/)?.[0] || '';-}--test('all five renderers inherit one viewer-only Direct Relationship Explorer', () => {- for (const [mode, example] of Object.entries(CASES)) {- const { result, html } = render(mode, example);- assert.equal(result.status, 0, result.stderr);- assert.match(html, /function installRelationshipHitTargets\(\)/, mode);- assert.match(html, /data-relationship-hit-overlay/, mode);- assert.match(html, /className \|\| 'relationship-hit-rail'/, mode);- assert.doesNotMatch(canonicalSvg(html), /relationship-hit-(?:overlay|target|rail)|data-relationship-direct-active/, mode);- }-});--test('one roving target represents each exact stable edge key and authored direction', () => {- assert.match(template, /function relationshipHitRecords\(\)/);- assert.match(template, /var recordsByKey = \{\}/);- assert.match(template, /existing\.invalid = true/);- assert.match(template, /filter\(function \(record\) \{ return !record\.invalid/);- assert.match(template, /data-relationship-key/);- assert.match(template, /data-relationship-from/);- assert.match(template, /data-relationship-to/);- assert.match(template, /target\.setAttribute\('role', 'button'\)/);- assert.match(template, /relationshipHitOverlay\.setAttribute\('role', 'group'\)/);- assert.match(template, /target\.setAttribute\('aria-describedby', relationshipHelp\.id\)/);- assert.match(template, /target\.setAttribute\('tabindex', index === 0 \? '0' : '-1'\)/);- assert.match(template, /viewerText\('viewer\.passport\.relationship\.inspect'/);- assert.match(template, /relationshipEdgeShapes\(edge\)/);- assert.match(template, /shape\.cloneNode\(false\)/);- assert.match(template, /\.relationship-hit-rail \{[\s\S]*stroke: transparent;[\s\S]*stroke-width: 24/);-});--test('fine-pointer and keyboard intent preview the exact edge before activation', () => {- assert.match(template, /function directRelationshipBlocked\(\)/);- assert.match(template, /function scheduleDirectRelationshipPreview\(target\)/);- assert.match(template, /if \(pinnedRelationshipKey \|\| hoveredRelationship !== target/);- assert.match(template, /previewRelationship\(target, \{ direct: true \}\)/);- assert.match(template, /event\.pointerType === 'touch'/);- assert.match(template, /finePointerQuery && !finePointerQuery\.matches/);- assert.match(template, /addEventListener\('pointerover'/);- assert.match(template, /addEventListener\('pointerout'/);- assert.match(template, /addEventListener\('focusin'/);- assert.match(template, /addEventListener\('focusout'/);- assert.match(template, /data-relationship-direct-active/);- assert.match(template, /\.relationship-hit-target:focus-visible \.relationship-focus-rail/);-});--test('activation opens the existing source passport and pins its exact relationship row', () => {- assert.match(template, /function inspectRelationship\(key, options\)/);- assert.match(template, /if \(directPreviewTimer\) window\.clearTimeout\(directPreviewTimer\)/);- assert.match(template, /if \(pinnedRelationshipKey === key\)/);- assert.match(template, /set\(record\.from, \{ toggle: false, updateUrl: false \}\)/);- assert.match(template, /relationshipList\.querySelectorAll\('\[data-relationship-key\]'\)/);- assert.match(template, /pinnedRelationship = row/);- assert.match(template, /pinnedRelationshipKey = key/);- assert.match(template, /data-relationship-pin-active/);- assert.match(template, /function clearRelationshipPreview\(options\)/);- assert.match(template, /clearRelationshipPreview\(\{ clearPin: true \}\)/);- assert.match(template, /copyBtn\.textContent = viewerText\('viewer\.passport\.copyNode'\)/);- assert.match(template, /previewRelationship\(row\)/);- assert.match(template, /inspectRelationship: inspectRelationship/);- assert.match(template, /event\.key !== 'ArrowRight'/);- assert.match(template, /event\.key !== 'ArrowLeft'/);- assert.match(template, /event\.key !== 'Home'/);- assert.match(template, /event\.key !== 'End'/);- assert.match(template, /event\.key === 'Enter' \|\| event\.key === ' '/);-});--test('direct relationship targets support one-tap touch, yield to stronger states, and stay export-clean', () => {- assert.match(template, /html\.getAttribute\('data-embed'\) === 'true'/);- assert.match(template, /svg\.hasAttribute\('data-route-active'\)/);- assert.match(template, /svg\.hasAttribute\('data-lens-active'\)/);- assert.match(template, /event\.target\.closest\('\[data-relationship-hit-key\]'\)/);- assert.match(template, /@media \(hover: none\), \(pointer: coarse\)[\s\S]*\.relationship-hit-rail \{ stroke-width: 24/);- assert.match(template, /@media print \{[\s\S]*\.relationship-hit-overlay/);- assert.match(template, /clone\.removeAttribute\('data-relationship-direct-active'\)/);- assert.match(template, /clone\.removeAttribute\('data-relationship-pin-active'\)/);- assert.match(template, /clone\.querySelectorAll\('\[data-relationship-hit-overlay\]'\)/);- assert.match(template, /\[data-relationship-hit-overlay\][^']*\[data-relationship-pulse-overlay\]/);-});--process.on('exit', () => fs.rmSync(tmp, { recursive: true, force: true }));diff --git a/test/relationship-lens.test.mjs b/test/relationship-lens.test.mjsindex 746fdc7f..645e88a6 100644--- a/test/relationship-lens.test.mjs+++ b/test/relationship-lens.test.mjs@@ -61,68 +61,4 @@ test('all typed renderers expose named, stable relationships without changing ge}});-test('relationship lens groups incoming, outgoing, and self-loop paths and follows neighbors', () => {- const html = render('architecture', CASES.architecture.example);- assert.match(html, /id="focus-chip" hidden role="region" aria-labelledby="relationship-lens-title"/);- assert.match(html, /id="relationship-lens-list" aria-label="Connected relationships"/);- assert.match(html, /function relationshipsFor\(id, byId\)/);- assert.match(html, /direction = from === id && to === id \? 'loop' : \(from === id \? 'out' : 'in'\)/);- assert.match(html, /\{ id: 'out', label: viewerText\('viewer\.passport\.relationship\.group\.out'\) \}/);- assert.match(html, /\{ id: 'in', label: viewerText\('viewer\.passport\.relationship\.group\.in'\) \}/);- assert.match(html, /data-relationship-target/);- assert.match(html, /data-relationship-key/);- assert.match(html, /data-relationship-from/);- assert.match(html, /data-relationship-to/);- assert.match(html, /set\(id, \{ toggle: false \}\)/);- assert.match(html, /Archify\.view\.reveal\(\[id\], \{ includeNeighbors: true, reason: 'relationship' \}\)/);- assert.doesNotMatch(svg(html), /relationship-lens|Connected relationships/);-});--test('relationship preview precisely links pointer and keyboard rows to an edge and its endpoints', () => {- const html = render('sequence', CASES.sequence.example);- const diagram = svg(html);- assert.match(html, /function previewRelationship\(button, options\)/);- assert.match(html, /edge\.getAttribute\('data-edge-key'\) === key/);- assert.match(html, /data-relationship-preview-source/);- assert.match(html, /data-relationship-preview-target/);- assert.match(html, /addEventListener\('pointerover'/);- assert.match(html, /addEventListener\('pointerout'/);- assert.match(html, /addEventListener\('focusin'/);- assert.match(html, /addEventListener\('focusout'/);- assert.match(html, /pinnedRelationship \|\| focusedRelationship \|\| hoveredRelationship/);- assert.doesNotMatch(diagram, /data-relationship-preview(?:-active|-node|-source|-target)?=/);-});--test('relationship preview is export-clean and visually geometry-neutral', () => {- const html = render('dataflow', CASES.dataflow.example);- assert.match(html, /clone\.removeAttribute\('data-relationship-preview-active'\)/);- assert.match(html, /clone\.querySelectorAll\('\[data-relationship-preview\], \[data-relationship-preview-node\], \[data-relationship-preview-source\], \[data-relationship-preview-target\]'\)/);- assert.match(html, /!clone\.hasAttribute\('data-relationship-preview-active'\)/);- assert.match(html, /Relationship Preview is temporary exploration state layered on top of/);- assert.doesNotMatch(html, /data-relationship-preview[^\n{]*\{[^}]*\b(?:x|y|transform)\s*:/);-});--test('relationship lens is keyboard navigable, mobile-pinned, and excluded from embed and print', () => {- const html = render('workflow', CASES.workflow.example);- assert.match(html, /event\.key !== 'ArrowDown'/);- assert.match(html, /event\.key !== 'ArrowUp'/);- assert.match(html, /event\.key !== 'Home'/);- assert.match(html, /event\.key !== 'End'/);- assert.match(html, /buttons\[index\]\.focus\(\)/);- assert.match(html, /data-wide-diagram="true"\] \.focus-chip/);- assert.match(html, /\.focus-chip\[data-relationship-previewing="true"\] \.relationship-lens-list/);- assert.match(html, /\.relationship-lens-row:not\(\[data-preview-active="true"\]\)/);- assert.match(html, /var mobile = window\.innerWidth <= 720/);- assert.match(html, /previewingOnMobile = mobile && chip\.getAttribute\('data-relationship-previewing'\) === 'true'/);- assert.match(html, /nodeCenter < \(visibleTop \+ visibleBottom\) \/ 2 \? pinnedBottom : pinnedTop/);- assert.match(html, /html\[data-embed="true"\] \.focus-chip/);- assert.match(html, /\.toolbar, \.diagram-nav, \.focus-chip, \.archify-toast/);- assert.match(html, /chip\.hidden = options\.hideChip === true \|\| normalized\.length !== 1 \|\| selectionMode/);- assert.match(html, /event\.target\.closest\('\.diagram-nav, \.focus-chip, \.node-finder, \.diagram-guide, \.overview-map, \.route-probe, \.semantic-lens'\)/);- assert.match(html, /function placeRelationshipLens\(\)/);- assert.match(html, /visibleTop = Math\.max\(padding, -containerRect\.top \+ padding\)/);- assert.match(html, /window\.addEventListener\('scroll', requestLensPlacement, \{ passive: true \}\)/);- assert.match(html, /container\.addEventListener\('scroll', requestLensPlacement, \{ passive: true \}\)/);-});-process.on('exit', () => fs.rmSync(tmp, { recursive: true, force: true }));diff --git a/test/relationship-permalink.test.mjs b/test/relationship-permalink.test.mjsindex 52095312..312e86eb 100644--- a/test/relationship-permalink.test.mjs+++ b/test/relationship-permalink.test.mjs@@ -66,8 +66,6 @@ test('authored relationship identity and readable-v2 compiler keys survive sourcrelationshipKey(second.html, 'request-chat'),relationshipKey(first.html, 'request-chat'),);- assert.match(first.html, /'#relation=' \+ encodeURIComponent\(record\.id\)/);- assert.match(second.html, /'#relation=' \+ encodeURIComponent\(record\.id\)/);});test('relationship ids stay optional and duplicate ids fail closed in the shared zero-install path', () => {@@ -99,31 +97,11 @@ test('relationship id syntax is schema-checked before viewer output is written',assert.equal(html, '');});-test('the viewer restores and copies stable relation links without exposing numeric keys', () => {- const { result, html } = run('workflow', fixture('workflow'), 'viewer');- assert.equal(result.status, 0, result.stderr);- assert.match(html, /var edgeId = edge\.getAttribute\('data-edge-id'\) \|\| ''/);- assert.match(html, /target\.setAttribute\('data-relationship-id', record\.id\)/);- assert.match(html, /button\.setAttribute\('data-relationship-id', relationship\.id\)/);- assert.match(html, /copyBtn\.textContent = viewerText\('viewer\.passport\.copyRelation'\)/);- assert.match(html, /'#relation=' \+ encodeURIComponent\(record\.id\)/);- assert.match(html, /var relation = params\.get\('relation'\)/);- assert.match(html, /inspectRelationshipById\(relation, \{ updateUrl: false, toggle: false \}\)/);- assert.match(html, /if \(html\.getAttribute\('data-embed'\) === 'true'\) return false/);- assert.match(html, /if \(html\.getAttribute\('data-embed'\) === 'true' \|\|\s*!inspectRelationshipById/);- assert.match(html, /if \(!reveal\(\)\) requestAnimationFrame\(reveal\)/);- assert.match(html, /inspectRelationshipById: inspectRelationshipById/);- assert.match(html, /id: record\.id \|\| null, key: record\.key/);- assert.doesNotMatch(html, /'#relation=' \+ encodeURIComponent\(record\.key\)/);-});--test('runtime overlays drop durable edge ids while canonical SVG keeps authored identity', () => {+test('canonical SVG keeps authored identity without runtime relationship overlays', () => {const { result, html } = run('architecture', fixture('architecture'), 'export-boundary');assert.equal(result.status, 0, result.stderr);assert.match(canonicalSvg(html), /data-edge-id="users-to-cdn"/);assert.doesNotMatch(canonicalSvg(html), /data-relationship-hit-overlay|data-relationship-id=/);- assert.ok((html.match(/clone\.removeAttribute\('data-edge-id'\)/g) || []).length >= 6);- assert.match(html, /querySelectorAll\('\[data-relationship-hit-overlay\]'\)/);});process.on('exit', () => fs.rmSync(tmp, { recursive: true, force: true }));diff --git a/test/relationship-pulse.test.mjs b/test/relationship-pulse.test.mjsdeleted file mode 100644index 79f0e3cb..00000000--- a/test/relationship-pulse.test.mjs+++ /dev/null@@ -1,122 +0,0 @@-import { test } from 'node:test';-import assert from 'node:assert/strict';-import { execFileSync } from 'node:child_process';-import fs from 'node:fs';-import os from 'node:os';-import path from 'node:path';-import { fileURLToPath } from 'node:url';--const __dirname = path.dirname(fileURLToPath(import.meta.url));-const skillRoot = path.resolve(__dirname, '..', 'archify');-const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-relationship-pulse-'));--const CASES = {- architecture: 'web-app.architecture.json',- workflow: 'agent-tool-call.workflow.json',- sequence: 'cache-miss-request.sequence.json',- dataflow: 'product-analytics.dataflow.json',- lifecycle: 'agent-run.lifecycle.json',-};--function render(mode, example) {- const output = path.join(tmp, `${mode}.html`);- execFileSync(process.execPath, [- path.join(skillRoot, `renderers/${mode}/render-${mode}.mjs`),- path.join(skillRoot, 'examples', example),- output,- ]);- return fs.readFileSync(output, 'utf8');-}--function canonicalSvg(html) {- return html.match(/<svg\b[\s\S]*?<\/svg>/)?.[0] || '';-}--test('all typed renderers inherit one exact-edge Directional Flow Pulse', () => {- for (const [mode, example] of Object.entries(CASES)) {- const html = render(mode, example);- assert.match(html, /function renderRelationshipPulse\(key\)/, mode);- assert.match(html, /function relationshipTokenKind\(edge\)/, mode);- assert.match(html, /function relationshipTokenGeometry\(shape, kind, key, options\)/, mode);- assert.match(html, /data-relationship-pulse-overlay/, mode);- assert.match(html, /setAttribute\('class', 'relationship-flow-pulse'\)/, mode);- assert.doesNotMatch(canonicalSvg(html), /relationship-flow-(?:pulse|token)|data-relationship-(?:pulse|token)/, mode);- }-});--test('pulse clones only the previewed authored geometry and keeps source-to-target direction', () => {- const html = render('sequence', CASES.sequence);- assert.match(html, /edge\.getAttribute\('data-edge-key'\) === key/);- assert.match(html, /function relationshipEdgeShapes\(edge\)/);- assert.match(html, /shape\.cloneNode\(false\)/);- assert.match(html, /clone\.removeAttribute\('marker-end'\)/);- assert.match(html, /clone\.removeAttribute\('data-edge-key'\)/);- assert.match(html, /clone\.removeAttribute\('filter'\)/);- assert.match(html, /clone\.setAttribute\('pathLength', '1'\)/);- assert.match(html, /overlay\.setAttribute\('data-relationship-pulse-key', key\)/);- assert.match(html, /function relationshipTokenPath\(shape\)/);- assert.match(html, /tagName === 'path'.+shape\.getAttribute\('d'\)/s);- assert.match(html, /tagName === 'line'/);- assert.match(html, /tagName === 'polyline' && shape\.points/);- assert.match(html, /motion\.setAttribute\('path', pathData\)/);- assert.match(html, /motion\.setAttribute\('rotate', 'auto'\)/);- assert.match(html, /svg\.insertBefore\(overlay, firstNode\)/);- assert.match(html, /stroke-dashoffset: -1/);-});--test('semantic token classification is evidence-based and fail-closed', () => {- const html = render('lifecycle', CASES.lifecycle);- assert.match(html, /a-security.+sourceKind === 'security'.+targetKind === 'failure'.+return 'security'/s);- assert.match(html, /a-dashed.+sourceKind === 'messagebus'.+targetKind === 'messagebus'.+return 'event'/s);- assert.match(html, /sourceKind === 'database' \|\| targetKind === 'database'.+return 'data'/s);- assert.match(html, /targetKind === 'waiting' \|\| targetKind === 'success'.+return 'state'/s);- assert.match(html, /return 'call';/);- assert.doesNotMatch(html, /relationshipTokenKind[\s\S]{0,1800}data-edge-label/);-});--test('semantic tokens use five distinct inline SVG cues on one finite timing owner', () => {- const html = render('workflow', CASES.workflow);- assert.match(html, /data-token-kind', kind/);- assert.match(html, /kind === 'data'[\s\S]+kind === 'event'[\s\S]+kind === 'security'[\s\S]+kind === 'state'/);- assert.match(html, /document\.createElementNS\(svgNamespace, 'animateMotion'\)/);- assert.match(html, /motion\.setAttribute\('dur', options\.duration \|\| '1\.2s'\)/);- assert.match(html, /animation: archify-relationship-token-life 1\.2s linear 1 both/);- assert.match(html, /semantic-flow-token-halo/);- assert.match(html, /Archify\.flowTokens = \{/);- assert.match(html, /data-relationship-token-kind', tokenKind/);- assert.match(html, /var tokenAdded = false/);- assert.doesNotMatch(html, /relationship-flow-token[^}]+infinite/);-});--test('pulse is finite, event-owned, preset-aware, touch-safe, and motion-safe', () => {- const html = render('architecture', CASES.architecture);- assert.match(html, /animation: archify-relationship-pulse 1\.2s linear 1 both/);- assert.match(html, /@keyframes archify-relationship-token-life/);- assert.doesNotMatch(html, /relationship-flow-pulse[^}]+infinite/);- assert.match(html, /var activeRelationshipPreview = null/);- assert.match(html, /if \(next === activeRelationshipPreview\) return/);- assert.match(html, /event\.pointerType === 'touch'/);- assert.match(html, /finePointerQuery && !finePointerQuery\.matches/);- assert.match(html, /Archify\.motionGovernor && Archify\.motionGovernor\.isPaused\(\)/);- assert.match(html, /document\.hidden/);- assert.match(html, /addEventListener\('animationcancel', finishPulse/);- assert.match(html, /reducedMotionQuery\.addEventListener\('change', syncRelationshipMotionPreference\)/);- assert.match(html, /if \(event\.matches\) removeRelationshipPulse\(\)/);- assert.match(html, /document\.addEventListener\('visibilitychange'/);- assert.match(html, /html\[data-embed="true"\] \.relationship-pulse-overlay/);- assert.match(html, /svg\[data-preset="signal-flow"\] \.relationship-flow-pulse/);- assert.match(html, /svg\[data-preset="blueprint"\] \.relationship-flow-pulse/);- assert.match(html, /@media \(prefers-reduced-motion: reduce\)[\s\S]+\.relationship-pulse-overlay \{ display: none !important; \}/);-});--test('pulse has one owner and never enters print or canonical exports', () => {- const html = render('dataflow', CASES.dataflow);- assert.match(html, /function removeRelationshipPulse\(\)/);- assert.match(html, /svg\.querySelectorAll\('\[data-relationship-pulse-overlay\]'\)/);- assert.match(html, /@media print \{[\s\S]+\.relationship-pulse-overlay \{ display: none !important; \}/);- assert.match(html, /clone\.querySelectorAll\('\[data-relationship-pulse-overlay\]'\)/);- assert.match(html, /\[data-relationship-pulse-overlay\],[^']*\[data-relationship-preview\]/);- assert.doesNotMatch(canonicalSvg(html), /relationship-flow-(?:pulse|token)|data-relationship-(?:pulse|token)/);-});--process.on('exit', () => fs.rmSync(tmp, { recursive: true, force: true }));diff --git a/test/release-package-gates.test.mjs b/test/release-package-gates.test.mjsindex 8c11e474..fda3958d 100644--- a/test/release-package-gates.test.mjs+++ b/test/release-package-gates.test.mjs@@ -1694,7 +1694,7 @@ test('CI and tagged releases share the maintained Windows path contract on Nodeassert.match(job, /npm ci --ignore-scripts/);assert.match(job, /node scripts\/run-windows-path-tests\.mjs/);assert.match(job, label === 'CI'- ? /name: Provision controlled Windows path fixtures\n\s+if: needs\.scope\.outputs\.scope == 'full'\n\s+shell: pwsh/+ ? /name: Provision controlled Windows path fixtures\n\s+if: needs\.scope\.outputs\.windows == 'true'\n\s+shell: pwsh/: /name: Provision controlled Windows path fixtures\n\s+shell: pwsh/);assert.match(job,@@ -1703,7 +1703,7 @@ test('CI and tagged releases share the maintained Windows path contract on Nodeassert.match(job,label === 'CI'- ? /name: Clean up controlled Windows path fixtures\n\s+if: \$\{\{ always\(\) && needs\.scope\.outputs\.scope == 'full' \}\}/+ ? /name: Clean up controlled Windows path fixtures\n\s+if: \$\{\{ always\(\) && needs\.scope\.outputs\.windows == 'true' \}\}/: /name: Clean up controlled Windows path fixtures\n\s+if: \$\{\{ always\(\) \}\}/,);assert.match(diff --git a/test/route-journey.test.mjs b/test/route-journey.test.mjsdeleted file mode 100644index e6989e72..00000000--- a/test/route-journey.test.mjs+++ /dev/null@@ -1,125 +0,0 @@-import { test } from 'node:test';-import assert from 'node:assert/strict';-import { spawnSync } from 'node:child_process';-import fs from 'node:fs';-import os from 'node:os';-import path from 'node:path';-import { fileURLToPath } from 'node:url';--const __dirname = path.dirname(fileURLToPath(import.meta.url));-const skillRoot = path.resolve(__dirname, '..', 'archify');-const template = fs.readFileSync(path.join(skillRoot, 'assets', 'template.html'), 'utf8');-const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-route-journey-'));--const CASES = {- architecture: 'web-app.architecture.json',- workflow: 'agent-tool-call.workflow.json',- sequence: 'cache-miss-request.sequence.json',- dataflow: 'product-analytics.dataflow.json',- lifecycle: 'agent-run.lifecycle.json',-};--function render(mode, example) {- const input = path.join(skillRoot, 'examples', example);- const output = path.join(tmp, `${mode}.html`);- const result = spawnSync(process.execPath, [- path.join(skillRoot, `renderers/${mode}/render-${mode}.mjs`),- input,- output,- ], { encoding: 'utf8' });- return { result, html: fs.existsSync(output) ? fs.readFileSync(output, 'utf8') : '' };-}--function canonicalSvg(html) {- return html.match(/<svg\b[\s\S]*?<\/svg>/)?.[0] || '';-}--test('all five renderers inherit native Route Journey controls outside canonical SVG', () => {- for (const [mode, example] of Object.entries(CASES)) {- const { result, html } = render(mode, example);- assert.equal(result.status, 0, result.stderr);- assert.match(html, /id="route-journey-controls" hidden role="group" aria-label="Route journey controls"/i, mode);- assert.match(html, /id="route-journey-prev"[^>]+aria-label="Previous route position"/i, mode);- assert.match(html, /id="route-journey-play"[^>]+aria-label="Play route journey"[^>]+aria-pressed="false"/i, mode);- assert.match(html, /id="route-journey-next"[^>]+aria-label="Next route position"/i, mode);- assert.match(html, /id="route-journey-overview"[^>]+aria-label="Show complete route overview"/i, mode);- assert.match(html, /document\.createElement\(options\.interactive === true \? 'button' : 'span'\)/, mode);- assert.doesNotMatch(canonicalSvg(html), /data-route-journey|route-journey-(?:flow|overlay)/, mode);- }-});--test('a position owns its exact ordered incoming edge while the full route remains authored truth', () => {- assert.match(template, /activeNodeIds = result\.nodes\.slice\(\)/);- assert.match(template, /activeEdges = result\.edges\.slice\(\)/);- assert.match(template, /activeEdges\.forEach\(function \(edge, step\) \{[\s\S]*?var destination = step \+ 1/);- assert.match(template, /destination === journeyIndex \? 'current' : 'future'/);- assert.match(template, /edge\.setAttribute\('data-route-journey-current', ''\)/);- assert.match(template, /journeyIndex > 0\) renderJourneyPulse\(activeEdges\[journeyIndex - 1\]\)/);- assert.match(template, /node\.setAttribute\('data-route-match', ''\)/);- assert.match(template, /edge\.setAttribute\('data-route-match', ''\)/);- assert.match(template, /svg\.setAttribute\('data-route-journey', \(journeyIndex \+ 1\) \+ '\/' \+ activeNodeIds\.length\)/);- assert.doesNotMatch(template, /renderJourneyPulse\([\s\S]{0,120}querySelector\(.*data-edge-from/);-});--test('route chips provide one roving tab stop, native activation, and manual ownership', () => {- assert.match(template, /item\.setAttribute\('data-route-journey-index', String\(index\)\)/);- assert.match(template, /item\.setAttribute\('tabindex', index === 0 \? '0' : '-1'\)/);- assert.match(template, /item\.setAttribute\('aria-label', viewerText\('viewer\.route\.position'/);- assert.match(template, /path\.addEventListener\('focusin'[\s\S]*?pauseJourney\(\{ preserveElapsed: true \}\)/);- assert.match(template, /path\.addEventListener\('keydown'[\s\S]*?event\.key === 'ArrowRight'/);- assert.match(template, /else if \(event\.key === 'Home'\) next = 0/);- assert.match(template, /else if \(event\.key === 'End'\) next = activeNodeIds\.length - 1/);- assert.match(template, /event\.key === 'Enter' \|\| event\.key === ' '/);- assert.match(template, /selectJourneyIndex\(Number\(button\.getAttribute\('data-route-journey-index'\)\)\)/);- assert.match(template, /button\.setAttribute\('aria-current', 'step'\)/);-});--test('playback is explicit, finite, resumable, and never leaks position into the route URL', () => {- assert.match(template, /var JOURNEY_DWELL_MS = 1100/);- assert.match(template, /journeyGeneration \+= 1/);- assert.match(template, /generation !== journeyGeneration \|\| !journeyPlaying/);- assert.match(template, /JOURNEY_DWELL_MS - journeyElapsedMs/);- assert.match(template, /preserveElapsed: options\.complete !== true/);- assert.match(template, /journeyIndex >= activeNodeIds\.length - 1[\s\S]*?pauseJourney\(\{ complete: true/);- assert.match(template, /applyJourneyState\(journeyIndex \+ 1[\s\S]*?journeyElapsedMs = 0;[\s\S]*?scheduleJourney\(\)/);- assert.doesNotMatch(template, /journeyTimer\s*=\s*(?:window\.)?setInterval/);- assert.match(template, /function playJourney\(\)[\s\S]*?if \(journeyIndex < 0\) applyJourneyState\(0/);- assert.match(template, /function syncFromHash\(\)[\s\S]*?choose\(parts\[1\], \{ updateUrl: false \}\)/);- assert.match(template, /'#route=' \+ encodeURIComponent\(startId\) \+ '~' \+ encodeURIComponent\(endId\)/);- assert.doesNotMatch(template, /#route=[^'\n]*journey/);-});--test('motion, camera, layered Escape, mobile, print, and embed boundaries stay explicit', () => {- assert.match(template, /Archify\.motionGovernor\.capable === true[\s\S]*?!Archify\.motionGovernor\.isPaused\(\)/);- assert.match(template, /Archify\.motionGovernor\.claim\('route'/);- assert.match(template, /reason: 'route-journey',[\s\S]*?maxScale: 1\.65,[\s\S]*?padding: 64,[\s\S]*?duration: 360/);- assert.match(template, /Archify\.routeProbe\.pauseJourney\(\{ preserveElapsed: true, reason: reason \|\| 'manual' \}\)/);- assert.match(template, /event\.target\.closest\('\.diagram-nav, \.focus-chip, \.node-finder, \.diagram-guide, \.overview-map, \.route-probe, \.semantic-lens'\)/);- assert.match(template, /reason: 'guide'/);- assert.match(template, /window\.addEventListener\('beforeprint'[\s\S]*?pauseJourney/);- assert.match(template, /function escapeRoute\(options\)[\s\S]*?return 'paused'[\s\S]*?return 'overview'[\s\S]*?return 'cleared'/);- assert.match(template, /Archify\.routeProbe\.escape\(\{ restoreFocus: true \}\)/);- assert.match(template, /\.route-probe\[data-route-dock="top"\] \{\s*top: 1rem;\s*bottom: auto;/);- assert.match(template, /function updateDocking\(\) \{\s*if \(panel\.hidden\)/);- assert.doesNotMatch(template, /if \(panel\.hidden \|\| window\.innerWidth > 720\)/);- assert.match(template, /@media \(max-width: 720px\)[\s\S]*?\.route-probe-node \{ min-height: 2\.75rem !important; \}/);- assert.match(template, /\.route-journey-controls button \{ min-height: 2\.75rem; \}/);- assert.match(template, /@media print[\s\S]*?\.route-probe-overlay, \.route-journey-overlay \{ display: none !important; \}/);- assert.match(template, /svg\[data-route-active\] \[data-node-id\],[\s\S]*?filter: none !important/);- assert.match(template, /html\[data-embed="true"\][\s\S]*?\.route-probe/);- assert.match(template, /html\[data-motion="still"\] \.route-journey-flow/);- assert.match(template, /@media \(prefers-reduced-motion: reduce\)[\s\S]*?\.route-journey-overlay/);-});--test('standalone export strips every journey attribute and transient pulse', () => {- const cleanup = template.match(/function cleanExportClone\(clone\) \{[\s\S]*?\n \}/)?.[0] || '';- assert.match(template, /var canonicalStateClean = cleanExportClone\(clone\);/);- assert.match(cleanup, /clone\.removeAttribute\('data-route-journey'\)/);- assert.match(cleanup, /clone\.querySelectorAll\('\[data-route-journey-overlay\]'\)/);- assert.match(cleanup, /el\.removeAttribute\('data-route-journey-state'\)/);- assert.match(cleanup, /el\.removeAttribute\('data-route-journey-current'\)/);- assert.match(cleanup, /!clone\.hasAttribute\('data-route-journey'\)/);- assert.match(cleanup, /return !clone[\s\S]*?\[data-route-journey-overlay\][\s\S]*?\[data-route-journey-current\]/);-});--process.on('exit', () => fs.rmSync(tmp, { recursive: true, force: true }));diff --git a/test/route-probe.test.mjs b/test/route-probe.test.mjsdeleted file mode 100644index 7a7b8a85..00000000--- a/test/route-probe.test.mjs+++ /dev/null@@ -1,114 +0,0 @@-import { test } from 'node:test';-import assert from 'node:assert/strict';-import { execFileSync } from 'node:child_process';-import fs from 'node:fs';-import os from 'node:os';-import path from 'node:path';-import { fileURLToPath } from 'node:url';--const __dirname = path.dirname(fileURLToPath(import.meta.url));-const skillRoot = path.resolve(__dirname, '..', 'archify');-const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-route-probe-'));--const CASES = {- architecture: 'web-app.architecture.json',- workflow: 'agent-tool-call.workflow.json',- sequence: 'cache-miss-request.sequence.json',- dataflow: 'product-analytics.dataflow.json',- lifecycle: 'agent-run.lifecycle.json',-};--function render(mode, example) {- const output = path.join(tmp, `${mode}.html`);- execFileSync(process.execPath, [- path.join(skillRoot, `renderers/${mode}/render-${mode}.mjs`),- path.join(skillRoot, 'examples', example),- output,- ]);- return fs.readFileSync(output, 'utf8');-}--function canonicalSvg(html) {- return html.match(/<svg\b[\s\S]*?<\/svg>/)?.[0] || '';-}--test('all typed renderers inherit one viewer-only Route Probe', () => {- for (const [mode, example] of Object.entries(CASES)) {- const html = render(mode, example);- assert.match(html, /id="route-probe" hidden role="region" aria-labelledby="route-probe-title"/, mode);- assert.match(html, /id="btn-route-probe"[^>]+aria-label="Trace a directed route"[^>]+aria-pressed="false"[^>]+aria-controls="route-probe"/, mode);- assert.match(html, /Archify\.routeProbe = \(function \(\)/, mode);- assert.match(html, /Route Probe — shortest directed path over compiled semantics/, mode);- assert.equal((html.match(/<svg\b/g) || []).length, 1, `${mode} keeps one static canonical SVG`);- assert.doesNotMatch(canonicalSvg(html), /data-route-|route-probe-flow/, mode);- }-});--test('Route Probe uses deterministic authored-direction BFS and exposes reachability first', () => {- const html = render('workflow', CASES.workflow);- assert.match(html, /function outgoingByNode\(\)/);- assert.match(html, /var from = edge\.getAttribute\('data-edge-from'\)/);- assert.match(html, /var to = edge\.getAttribute\('data-edge-to'\)/);- assert.match(html, /if \(!byId\[from\] \|\| !byId\[to\] \|\| from === to\) return/);- assert.match(html, /outgoing\[from\]\.push\(\{ edge: edge, to: to \}\)/);- assert.match(html, /function reachableFrom\(source\)/);- assert.match(html, /data-route-candidate/);- assert.match(html, /function shortestDirectedPath\(source, target\)/);- assert.match(html, /var queue = \[source\]/);- assert.match(html, /previous\[link\.to\] = \{ from: queue\[cursor\], edge: link\.edge \}/);- assert.match(html, /routeEdges\.unshift\(step\.edge\)/);- assert.match(html, /nodeIds\.unshift\(step\.from\)/);-});--test('Route Probe turns a two-node question into a readable route receipt and stable link', () => {- const html = render('architecture', CASES.architecture);- assert.match(html, /svg\.setAttribute\('data-route-picking', 'target'\)/);- assert.match(html, /svg\.setAttribute\('data-route-active', startId \+ '~' \+ endId\)/);- assert.match(html, /node\.setAttribute\('data-route-step', String\(step\)\)/);- assert.match(html, /edge\.setAttribute\('data-route-match', ''\)/);- assert.match(html, /clone\.setAttribute\('pathLength', '1'\)/);- assert.match(html, /clone\.style\.setProperty\('--route-step', String\(step\)\)/);- assert.match(html, /#route=' \+ encodeURIComponent\(startId\) \+ '~' \+ encodeURIComponent\(endId\)/);- assert.match(html, /new URLSearchParams\(location\.hash\.replace/);- assert.match(html, /Archify\.view\.reveal\(result\.nodes, \{ includeNeighbors: false, reason: 'route' \}\)/);- assert.match(html, /shortest path/);-});--test('Route Probe hands large-diagram endpoint selection to a reachability-aware Finder', () => {- const html = render('dataflow', CASES.dataflow);- assert.match(html, /id="route-probe-find"[^>]+aria-label="Find a route start"[^>]+data-node-finder-trigger/);- assert.match(html, /function hopDistancesFrom\(source\)/);- assert.match(html, /kind: 'route-source'/);- assert.match(html, /outgoing\[id\] && outgoing\[id\]\.length/);- assert.match(html, /kind: 'route-target'/);- assert.match(html, /Object\.keys\(distances\)\.filter/);- assert.match(html, /targetBadges\[id\] = viewerCount\('viewer\.route\.hop', distances\[id\]\)/);- assert.match(html, /Archify\.finder\.open\(\{ context: context \}\)/);- assert.match(html, /findBtn\.textContent = viewerText\('viewer\.route\.destination\.find'\)/);- assert.match(html, /panel\.setAttribute\('data-finder-open', 'true'\)/);- assert.match(html, /\.route-probe\[data-finder-open="true"\]/);-});--test('Route Probe keeps pointer, keyboard, motion, embed, and export boundaries explicit', () => {- const html = render('sequence', CASES.sequence);- assert.match(html, /svg\.addEventListener\('click', interceptSelection, true\)/);- assert.match(html, /svg\.addEventListener\('keydown', interceptSelection, true\)/);- assert.match(html, /event\.key !== 'Enter' && event\.key !== ' '/);- assert.match(html, /e\.key === 'r' \|\| e\.key === 'R'/);- assert.match(html, /e\.key === 'Escape' && Archify\.routeProbe\.active\(\)/);- assert.match(html, /html\[data-embed="true"\] \.route-probe/);- assert.match(html, /html\.getAttribute\('data-embed'\) === 'true'/);- assert.match(html, /\.route-probe\[data-route-dock="top"\]/);- assert.match(html, /function overlapArea\(a, b\)/);- assert.match(html, /score\(topCandidate\) <= score\(bottomCandidate\)/);- assert.match(html, /container\.addEventListener\('scroll', updateDocking, \{ passive: true \}\)/);- assert.match(html, /@keyframes archify-route-probe-flow/);- assert.match(html, /@media \(prefers-reduced-motion: reduce\)[\s\S]+\.route-probe-flow \{[\s\S]+animation: none !important/);- assert.match(html, /clone\.removeAttribute\('data-route-picking'\)/);- assert.match(html, /clone\.removeAttribute\('data-route-active'\)/);- assert.match(html, /clone\.querySelectorAll\('\[data-route-probe-overlay\]'\)/);- assert.match(html, /!clone\.hasAttribute\('data-route-active'\)/);- assert.doesNotMatch(canonicalSvg(html), /data-route-|route-probe-flow/);-});--process.on('exit', () => fs.rmSync(tmp, { recursive: true, force: true }));diff --git a/test/semantic-camera.test.mjs b/test/semantic-camera.test.mjsdeleted file mode 100644index 544648bf..00000000--- a/test/semantic-camera.test.mjs+++ /dev/null@@ -1,86 +0,0 @@-import { test } from 'node:test';-import assert from 'node:assert/strict';-import { execFileSync } from 'node:child_process';-import fs from 'node:fs';-import os from 'node:os';-import path from 'node:path';-import { fileURLToPath } from 'node:url';--const __dirname = path.dirname(fileURLToPath(import.meta.url));-const skillRoot = path.resolve(__dirname, '..', 'archify');-const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-semantic-camera-'));--const CASES = {- architecture: 'web-app.architecture.json',- workflow: 'agent-tool-call.workflow.json',- sequence: 'cache-miss-request.sequence.json',- dataflow: 'product-analytics.dataflow.json',- lifecycle: 'agent-run.lifecycle.json',-};--function render(mode, example) {- const output = path.join(tmp, `${mode}.html`);- execFileSync(process.execPath, [- path.join(skillRoot, `renderers/${mode}/render-${mode}.mjs`),- path.join(skillRoot, 'examples', example),- output,- ]);- return fs.readFileSync(output, 'utf8');-}--function svg(html) {- return html.match(/<svg\b[\s\S]*?<\/svg>/)?.[0] || '';-}--test('all typed renderers ship the same geometry-neutral semantic camera', () => {- for (const [mode, example] of Object.entries(CASES)) {- const html = render(mode, example);- assert.match(html, /function frameDesktop\(ids, options\)/, mode);- assert.match(html, /function semanticIds\(ids, includeNeighbors\)/, mode);- assert.match(html, /if \(seeds\[from\] \|\| seeds\[to\]\) \{ wanted\[from\] = true; wanted\[to\] = true; \}/, mode);- assert.match(html, /contentScale = Math\.min\(svgWidth \/ viewBox\.width, svgHeight \/ viewBox\.height\)/, mode);- assert.match(html, /targetScale = Math\.max\(1, Math\.min\(maxScale, targetScale\)\)/, mode);- assert.match(html, /visibleTop = Math\.max\(0, -containerRect\.top\)/, mode);- assert.match(html, /visibleBottom - visibleTop >= 240/, mode);- assert.match(html, /data-camera-mode/, mode);- assert.match(html, /data-camera-indicator/, mode);- assert.match(html, /var resolvedLevel = semantic \? viewerText\('viewer\.nav\.level\.auto'\) : levelLabel/, mode);- assert.match(html, /is-camera-moving/, mode);- assert.match(html, /cubic-bezier\(0\.22, 1, 0\.36, 1\)/, mode);- assert.doesNotMatch(svg(html), /data-camera-mode|is-camera-moving|AUTO /, mode);- }-});--test('semantic camera follows reader intent but yields to manual navigation', () => {- const html = render('workflow', CASES.workflow);- assert.match(html, /reveal\(\[id\], \{ includeNeighbors: true, reason: 'focus' \}\)/);- assert.match(html, /reveal\(\[id\], \{ includeNeighbors: true, reason: 'relationship' \}\)/);- assert.match(html, /reveal\(\[id\], \{ includeNeighbors: true, reason: 'finder' \}\)/);- assert.match(html, /function interruptCamera\(reason\)/);- assert.match(html, /container\.addEventListener\('pointerdown',[\s\S]+interruptCamera\(\)/);- assert.match(html, /\.overview-map, \.route-probe, \.semantic-lens/);- assert.match(html, /window\.innerWidth <= 720 && container\.hasAttribute\('data-wide-diagram'\) && Date\.now\(\) > autoScrollUntil/);- assert.match(html, /reset\(\{ automatic: true \}\)/);- assert.match(html, /routeReceipt\.hasAttribute\('data-route-journey'\)/);- assert.match(html, /receiptBottom \+ 24/);-});--test('semantic camera keeps mobile on its contained scroll model and respects reduced motion', () => {- const html = render('sequence', CASES.sequence);- assert.match(html, /if \(window\.innerWidth > 720\) return frameDesktop\(ids, options\)/);- assert.match(html, /if \(!container\.hasAttribute\('data-wide-diagram'\)\) \{[\s\S]+cameraReceipt\(\{ scale: 1, x: 0, y: 0, mode: 'semantic' \}/);- assert.match(html, /state\.scale = 1;[\s\S]+state\.x = 0;[\s\S]+state\.y = 0;[\s\S]+state\.mode = 'semantic';[\s\S]+apply\(\)/);- assert.match(html, /autoScrollUntil = Date\.now\(\) \+ \(instant \? 50 : 470\)/);- assert.match(html, /behavior: instant \? 'auto' : 'smooth'/);- assert.match(html, /svg \[data-node-id\], svg \[data-edge-from\], svg \[data-detail\], svg \[data-detail-anchor\], svg \[data-legend-hit\], svg \{ transition: none !important; \}/);-});--test('semantic camera remains outside canonical SVG export state', () => {- const html = render('architecture', CASES.architecture);- assert.match(html, /clone\.style\.removeProperty\('transform'\)/);- assert.match(html, /clone\.removeAttribute\('data-view-scale'\)/);- assert.match(html, /!clone\.style\.getPropertyValue\('transform'\)/);- assert.doesNotMatch(svg(html), /style="[^"]*transform|data-view-scale|data-camera-mode/);-});--process.on('exit', () => fs.rmSync(tmp, { recursive: true, force: true }));diff --git a/test/semantic-lens.test.mjs b/test/semantic-lens.test.mjsdeleted file mode 100644index 9495cc5e..00000000--- a/test/semantic-lens.test.mjs+++ /dev/null@@ -1,102 +0,0 @@-import { test } from 'node:test';-import assert from 'node:assert/strict';-import { execFileSync } from 'node:child_process';-import fs from 'node:fs';-import os from 'node:os';-import path from 'node:path';-import { fileURLToPath } from 'node:url';--const __dirname = path.dirname(fileURLToPath(import.meta.url));-const skillRoot = path.resolve(__dirname, '..', 'archify');-const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-semantic-lens-'));--const CASES = {- architecture: 'web-app.architecture.json',- workflow: 'agent-tool-call.workflow.json',- sequence: 'cache-miss-request.sequence.json',- dataflow: 'product-analytics.dataflow.json',- lifecycle: 'agent-run.lifecycle.json',-};--function render(mode, example) {- const output = path.join(tmp, `${mode}.html`);- execFileSync(process.execPath, [- path.join(skillRoot, `renderers/${mode}/render-${mode}.mjs`),- path.join(skillRoot, 'examples', example),- output,- ]);- return fs.readFileSync(output, 'utf8');-}--function canonicalSvg(html) {- return html.match(/<svg\b[\s\S]*?<\/svg>/)?.[0] || '';-}--test('all typed renderers inherit one viewer-only Semantic Lens', () => {- for (const [mode, example] of Object.entries(CASES)) {- const html = render(mode, example);- assert.match(html, /id="semantic-lens" hidden role="dialog" aria-modal="false" aria-labelledby="semantic-lens-title"/, mode);- assert.match(html, /id="btn-semantic-lens"[^>]+aria-label="Open semantic lens"[^>]+aria-expanded="false"[^>]+aria-controls="semantic-lens"/, mode);- assert.match(html, /Archify\.semanticLens = \(function \(\)/, mode);- assert.match(html, /svg\.querySelectorAll\('\[data-node-id\]\[data-node-kind\]'\)/, mode);- assert.doesNotMatch(canonicalSvg(html), /semantic-lens-overlay|data-lens-active|data-lens-match/, mode);- }-});--test('Semantic Lens derives honest kind counts and compares at most two roles', () => {- const html = render('workflow', CASES.workflow);- assert.match(html, /function collectKinds\(\)/);- assert.match(html, /kind\.nodes\.push\(node\)/);- assert.match(html, /Choose up to two semantic kinds/);- assert.match(html, /if \(selectedKinds\.length >= 2\) return false/);- assert.match(html, /var crossKind = selectedKinds\.length === 2/);- assert.match(html, /fromKind === selectedKinds\[0\] && toKind === selectedKinds\[1\]/);- assert.match(html, /fromKind === selectedKinds\[1\] && toKind === selectedKinds\[0\]/);- assert.match(html, /direct relationship/);- assert.match(html, /data-lens-peer/);- assert.match(html, /data-lens-selected/);-});--test('Semantic Lens is shareable and yields cleanly to stronger reader intent', () => {- const html = render('architecture', CASES.architecture);- assert.match(html, /#lens=/);- assert.match(html, /params\.get\('lens'\)/);- assert.match(html, /window\.addEventListener\('hashchange', syncFromHash\)/);- assert.match(html, /event\.composedPath\(\)/);- assert.match(html, /eventPath\.indexOf\(panel\) >= 0/);- assert.match(html, /Archify\.semanticLens\.clear\(\{ updateUrl: false/);- assert.match(html, /Archify\.focus\.clear\(\{ updateUrl: false, preserveView: true \}\)/);- assert.match(html, /Archify\.routeProbe\.clear\(\{ updateUrl: false, restoreFocus: false \}\)/);- assert.match(html, /if \(action === 'lens'\) return Archify\.semanticLens\.open\(\)/);- assert.match(html, /e\.key === 'l' \|\| e\.key === 'L'/);- assert.match(html, /e\.key === 'Escape' && Archify\.semanticLens\.isOpen\(\)/);- assert.match(html, /e\.key === 'Escape' && Archify\.semanticLens\.active\(\)/);-});--test('Semantic Lens preserves Reading Depth, mobile containment, print, embed, and export boundaries', () => {- const html = render('dataflow', CASES.dataflow);- assert.match(html, /svg\[data-lens-active\] \[data-lens-match\] \[data-detail\]/);- assert.match(html, /svg\[data-lens-active\] \[data-lens-match\] \[data-detail-anchor\]/);- assert.match(html, /html\[data-embed="true"\] \.semantic-lens/);- assert.match(html, /data-wide-diagram="true"\] \.semantic-lens/);- assert.match(html, /@media print \{[\s\S]+svg\[data-lens-active\] \[data-node-id\][\s\S]+opacity: 1 !important/);- assert.match(html, /clone\.removeAttribute\('data-lens-active'\)/);- assert.match(html, /\[data-lens-match\], \[data-lens-selected\], \[data-lens-peer\]/);- assert.match(html, /clone\.querySelectorAll\('[^']*\[data-lens-match\][^']*\[data-lens-selected\][^']*\[data-lens-peer\][^']*'\)\.length === 0/);- assert.match(html, /class="semantic-lens no-print"/);- assert.doesNotMatch(canonicalSvg(html), /data-lens-active|data-lens-match|data-lens-selected|data-lens-peer/);-});--test('Semantic Lens docks away from selected nodes without breaking mobile containment', () => {- const html = render('architecture', CASES.architecture);- assert.match(html, /function overlapArea\(a, b\)/);- assert.match(html, /function dockPanel\(byId\)/);- assert.match(html, /selectedKinds\.indexOf\(byId\[id\]\.getAttribute\('data-node-kind'\)/);- assert.match(html, /var side = leftScore < rightScore \? 'left' : 'right'/);- assert.match(html, /panel\.setAttribute\('data-dock-side', side\)/);- assert.match(html, /\.semantic-lens\[data-dock-side="left"\]/);- assert.match(html, /@media \(max-width: 720px\)[\s\S]+\.semantic-lens\[data-dock-side\] \{ left: auto; right: 0\.5rem; \}/);- assert.match(html, /window\.addEventListener\('resize'/);-});--process.on('exit', () => fs.rmSync(tmp, { recursive: true, force: true }));diff --git a/test/semantic-zoom.test.mjs b/test/semantic-zoom.test.mjsindex 72413bf1..c5aa1886 100644--- a/test/semantic-zoom.test.mjs+++ b/test/semantic-zoom.test.mjs@@ -28,10 +28,6 @@ function render(mode, example) {return fs.readFileSync(output, 'utf8');}-function svg(html) {- return html.match(/<svg\b[\s\S]*?<\/svg>/)?.[0] || '';-}-test('all typed renderers emit explicit context and fine reading-depth semantics', () => {for (const [mode, example] of Object.entries(CASES)) {const html = render(mode, example);@@ -43,43 +39,4 @@ test('all typed renderers emit explicit context and fine reading-depth semantics}});-test('semantic zoom exposes MAP, READ, and FULL at deterministic thresholds', () => {- const html = render('workflow', CASES.workflow);- assert.match(html, /function detailLevel\(\)/);- assert.match(html, /if \(state\.mode === 'semantic'\) return 'full'/);- assert.match(html, /if \(state\.scale >= 1\.75\) return 'full'/);- assert.match(html, /if \(state\.scale >= 1\) return 'read'/);- assert.match(html, /return 'map'/);- assert.match(html, /container\.setAttribute\('data-detail-level', detail\)/);- assert.match(html, /var levelLabel = viewerText\('viewer\.nav\.level\.' \+ detail\)/);- assert.match(html, /var resolvedLevel = semantic \? viewerText\('viewer\.nav\.level\.auto'\) : levelLabel/);- assert.match(html, /Zoom in to reveal relationship labels and node context/);- assert.match(html, /Zoom in again to reveal tags and annotations/);- assert.match(html, /Full diagram detail/);-});--test('reading depth stays quiet at overview and yields to semantic intent', () => {- const html = render('architecture', CASES.architecture);- assert.match(html, /\.diagram-container\[data-detail-level="map"\] svg \[data-detail="context"\]/);- assert.match(html, /\.diagram-container\[data-detail-level="map"\] svg \[data-detail="fine"\]/);- assert.match(html, /\.diagram-container\[data-detail-level="read"\] svg \[data-detail="fine"\]/);- assert.match(html, /\.diagram-container\[data-detail-level="map"\] svg \[data-detail-anchor\]/);- assert.match(html, /svg\[data-focus-active\] \[data-focus-match\] \[data-detail\]/);- assert.match(html, /svg\[data-intent-trace-active\] \[data-intent-trace-match\] \[data-detail\]/);- assert.match(html, /svg\[data-route-active\] \[data-route-match\] \[data-detail\]/);- assert.match(html, /svg\[data-relationship-preview-active\] \[data-relationship-preview\] \[data-detail\]/);-});--test('semantic zoom is motion-safe and full-fidelity in print and export', () => {- const html = render('dataflow', CASES.dataflow);- assert.match(html, /\[data-detail\] \{ transition: opacity 160ms ease/);- assert.match(html, /@media print \{[\s\S]+\.diagram-container svg \[data-detail\] \{[\s\S]+opacity: 1 !important/);- assert.match(html, /@media \(prefers-reduced-motion: reduce\)[\s\S]+svg \[data-detail\]/);- assert.match(html, /clone\.querySelectorAll\('\[data-detail\], \[data-detail-anchor\]'\)/);- assert.match(html, /el\.removeAttribute\('data-detail'\)/);- assert.match(html, /el\.removeAttribute\('data-detail-anchor'\)/);- assert.match(html, /clone\.querySelectorAll\('[^']*\[data-detail\][^']*\[data-detail-anchor\][^']*'\)\.length === 0/);- assert.doesNotMatch(svg(html), /data-detail-level=/);-});-process.on('exit', () => fs.rmSync(tmp, { recursive: true, force: true }));diff --git a/test/settled-flow.test.mjs b/test/settled-flow.test.mjsindex 64c67ee4..f11cebe7 100644--- a/test/settled-flow.test.mjs+++ b/test/settled-flow.test.mjs@@ -1,97 +1,18 @@import { test } from 'node:test';import assert from 'node:assert/strict';-import { execFileSync } from 'node:child_process';-import fs from 'node:fs';-import os from 'node:os';-import path from 'node:path';-import { fileURLToPath } from 'node:url';import { animateAttr } from '../archify/renderers/shared/cli.mjs';-const __dirname = path.dirname(fileURLToPath(import.meta.url));-const skillRoot = path.resolve(__dirname, '..', 'archify');-const template = fs.readFileSync(path.join(skillRoot, 'assets', 'template.html'), 'utf8');-const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-settled-flow-'));--const CASES = {- architecture: 'web-app.architecture.json',- workflow: 'agent-tool-call.workflow.json',- sequence: 'cache-miss-request.sequence.json',- dataflow: 'product-analytics.dataflow.json',- lifecycle: 'agent-run.lifecycle.json',-};--function render(mode, example) {- const doc = JSON.parse(fs.readFileSync(path.join(skillRoot, 'examples', example), 'utf8'));- doc.meta = { ...doc.meta, animation: 'trace' };- const input = path.join(tmp, `${mode}.json`);- const output = path.join(tmp, `${mode}.html`);- fs.writeFileSync(input, JSON.stringify(doc));- execFileSync('node', [path.join(skillRoot, `renderers/${mode}/render-${mode}.mjs`), input, output], {- stdio: ['ignore', 'ignore', 'pipe'],- });- return fs.readFileSync(output, 'utf8');-}--test('all five renderers inherit one finite running-to-settled ambient contract', () => {- for (const [mode, example] of Object.entries(CASES)) {- const html = render(mode, example);- assert.match(html, /data-ambient-motion/, mode);- assert.match(html, /function startAmbient\(\)/, mode);- assert.match(html, /function settleAmbient\(reason\)/, mode);- assert.match(html, /animation: archify-edge-flow [^;]+ 1;/, mode);- assert.match(html, /animation: archify-node-pulse [^;]+ 1;/, mode);- assert.doesNotMatch(html, /animation: archify-edge-flow [^;]+ infinite/, mode);- assert.doesNotMatch(html, /animation: archify-node-pulse [^;]+ infinite/, mode);+test('trace animation delay stays finite, ordered and within the existing waiting budget', () => {+ for (const kind of ['edge', 'node']) {+ const steps = [0, 1, 8, 99].map((index) => {+ const attributes = animateAttr({ animation: 'trace' }, kind, index);+ assert.match(attributes, new RegExp(`data-animate="${kind}"`));+ const step = Number(attributes.match(/--step:\s*([^";\s]+)/)?.[1]);+ assert.ok(Number.isFinite(step) && step >= 0, `${kind}: finite non-negative delay`);+ assert.ok(step <= Math.min(index, 12), `${kind}: delay must not exceed the waiting budget`);+ return step;+ });+ assert.ok(steps.every((step, index) => index === 0 || step >= steps[index - 1]), `${kind}: authored order`);+ assert.equal(animateAttr({}, kind, 99), '');}});--test('settled flow restores authored security and async dash semantics', () => {- assert.match(template, /\.a-security\s*\{[^}]*stroke-dasharray:\s*5,5/);- assert.match(template, /\.a-dashed\s*\{[^}]*stroke-dasharray:\s*4,4/);- assert.match(template, /@keyframes archify-edge-flow\s*\{[\s\S]*?stroke-dasharray:\s*10 8/);- assert.match(template, /100%\s*\{\s*stroke-dashoffset:\s*0;\s*opacity:\s*1;\s*\}/);- const runningRule = template.match(/html\[data-ambient-motion="running"\][^{]+\[data-animate="edge"\][^{]*\{([^}]*)\}/)?.[1] || '';- assert.ok(runningRule, 'running edge rule missing');- assert.doesNotMatch(runningRule, /stroke-dasharray|stroke-dashoffset/);-});--test('ambient ownership is generation-bounded and cannot replay after settle', () => {- assert.match(template, /var ambientStarted = false/);- assert.match(template, /var ambientPending = new Set\(\)/);- assert.match(template, /if \(ambientStarted \|\| !capable\) return false/);- assert.match(template, /ambientStarted = true;[\s\S]*?html\.setAttribute\('data-ambient-motion', 'running'\)/);- assert.match(template, /ambientPending\.delete\(event\.target\)/);- assert.match(template, /if \(!ambientPending\.size\) settleAmbient\('complete'\)/);- assert.match(template, /svg\.addEventListener\('animationend', onAmbientBoundary, true\)/);- assert.match(template, /svg\.addEventListener\('animationcancel', onAmbientBoundary, true\)/);- assert.match(template, /if \(paused \|\| owner \|\| html\.hasAttribute\('data-embed'\)/);- assert.doesNotMatch(template, /setInterval\([^)]*ambient|addEventListener\('scroll'[^)]*ambient/);-});--test('animation delay is capped without changing normal authored order', () => {- assert.equal(animateAttr({ animation: 'trace' }, 'edge', 0), ' data-animate="edge" style="--step:0"');- assert.equal(animateAttr({ animation: 'trace' }, 'node', 8), ' data-animate="node" style="--step:8"');- assert.equal(animateAttr({ animation: 'trace' }, 'edge', 99), ' data-animate="edge" style="--step:12"');- assert.equal(animateAttr({}, 'edge', 99), '');-});--test('only the WebM canvas scene opts into a repeatable finite motion timeline', () => {- assert.match(template, /var motionScene = createMotionScene\(svg\)/);- assert.match(template, /drawMotionFrame\(ctx, backgroundImage, motionScene, elapsed\)/);- assert.match(template, /var data = serializeSvg\(scale\);/);- assert.match(template, /getPointAtLength/);- assert.doesNotMatch(template, /serializeSvg\(1, \{ autoTheme: true, motion: true \}\)/);-});--test('Still, reduced motion, embed, share, hidden state, and stronger intent settle ambient flow', () => {- assert.match(template, /reducedMotion\(\)/);- assert.match(template, /html\.hasAttribute\('data-embed'\)/);- assert.match(template, /html\.hasAttribute\('data-share-playback'\)/);- assert.match(template, /html\.hasAttribute\('data-document-hidden'\)/);- assert.match(template, /paused \|\| owner/);- assert.match(template, /settleAmbient\('suppressed'\)/);- assert.match(template, /html\[data-motion="still"\] svg\[data-animation="trace"\] \[data-animate\]/);- assert.match(template, /@media \(prefers-reduced-motion: reduce\)/);-});--process.on('exit', () => fs.rmSync(tmp, { recursive: true, force: true }));diff --git a/test/toolbar-polish.test.mjs b/test/toolbar-polish.test.mjsdeleted file mode 100644index 6d506471..00000000--- a/test/toolbar-polish.test.mjs+++ /dev/null@@ -1,60 +0,0 @@-import { test } from 'node:test';-import assert from 'node:assert/strict';-import fs from 'node:fs';-import path from 'node:path';-import { fileURLToPath } from 'node:url';--const __dirname = path.dirname(fileURLToPath(import.meta.url));-const template = fs.readFileSync(path.resolve(__dirname, '../archify/assets/template.html'), 'utf8');--test('toolbar groups tools in one capsule beside a single primary export, aligned with the reader column', () => {- assert.match(template, /\.toolbar \{[\s\S]*?top: var\(--archify-page-top\);[\s\S]*?right: max\(1rem, calc\(\(100vw - min\(100vw - 4rem, var\(--archify-reader-width, 1440px\)\)\) \/ 2\)\);/);- assert.match(template, /<div class="toolbar-group">\s*<button id="btn-theme"[\s\S]*?id="btn-present"[\s\S]*?<\/button>\s*<\/div>\s*<div class="export-wrap">/);- assert.match(template, /\.toolbar button \{[\s\S]*?background: transparent;[\s\S]*?min-height: 2\.75rem;/, 'ghost controls keep a 44px hit area');- assert.match(template, /\.toolbar #btn-export::before \{[\s\S]*?background: var\(--text\);/, 'export is the one filled primary action');- assert.match(template, /button\[aria-expanded="true"\]/);- assert.doesNotMatch(template, /\.preset-wrap::before,[\s\S]*?\.export-wrap::before/);- assert.match(template, /<span id="theme-icon" class="toolbar-icon"/);- assert.match(template, /<span id="present-icon" class="toolbar-icon"/);- assert.doesNotMatch(template.match(/<div class="toolbar"[\s\S]*?<div class="container">/)?.[0] || '', /<svg\b/);- assert.doesNotMatch(template, /icon\.textContent =/);-});--test('export menu has grouped, single-column rows and a zoom-safe width', () => {- const sectionCss = template.match(/\.export-menu-section \{[\s\S]*?\}/)?.[0] || '';- assert.match(template, /class="export-menu-section" role="group" aria-label="\{\{i18n:viewer\.export\.share\}\}"/);- assert.match(template, /class="export-menu-section" role="group" aria-label="\{\{i18n:viewer\.export\.raster\}\}"/);- assert.match(template, /class="export-menu-section" role="group" aria-label="\{\{i18n:viewer\.export\.vectorMotion\}\}"/);- assert.match(template, /class="export-menu-header" role="presentation"/);- assert.match(template, /\.toolbar \.export-menu \{[\s\S]*?width: 19rem;[\s\S]*?max-width: calc\(100vw - 2rem\);/);- assert.match(template, /\.export-menu-section \{[\s\S]*?grid-template-columns: minmax\(0, 1fr\);/);- assert.doesNotMatch(sectionCss, /repeat\(2/);- assert.match(template, /\.toolbar \.export-menu button \{[\s\S]*?grid-template-columns: 1rem minmax\(0, 1fr\);[\s\S]*?white-space: nowrap;/);- assert.match(template, /\.toolbar \.export-menu button::before \{[\s\S]*?position: static;/, 'the row glyph stays in its grid column');- assert.match(template, /\.export-item-copy \{[\s\S]*?display: flex;[\s\S]*?justify-content: space-between;/);-});--test('mobile menus share one viewport-safe placement and disabled exports remain explicit', () => {- assert.match(template, /@media \(max-width: 720px\)[\s\S]*?\.toolbar \.preset-menu,[\s\S]*?\.toolbar \.export-menu \{[\s\S]*?position: fixed;/);- assert.match(template, /\.toolbar \.export-menu button:disabled \{[\s\S]*?cursor: not-allowed;/);- assert.doesNotMatch(template, /it\.style\.opacity = '0\.5'/);-});--test('diagram view dock stays compact on desktop and touch-safe on narrow screens', () => {- assert.match(template, /\.diagram-nav \{[\s\S]*?padding: 0\.25rem;[\s\S]*?border-radius: 0\.75rem;/);- assert.match(template, /\.diagram-nav button \{[\s\S]*?min-width: 2rem;[\s\S]*?height: 2rem;/);- assert.match(template, /@media \(max-width: 720px\)[\s\S]*?\.diagram-nav button \{[\s\S]*?min-width: 2\.75rem;[\s\S]*?height: 2\.75rem;/);- assert.match(template, /class="diagram-nav-icon find"/);- assert.match(template, /class="diagram-nav-icon guide"/);- assert.match(template, /class="diagram-nav-icon minus"/);- assert.match(template, /class="diagram-nav-icon plus"/);-});--test('diagram view reset separates semantic detail from zoom percentage', () => {- assert.match(template, /data-view="reset"[\s\S]*?data-view-detail hidden>\{\{i18n:viewer\.nav\.read\}\}<[\s\S]*?data-view-percent>100%</);- assert.match(template, /var resolvedLevel = semantic \? viewerText\('viewer\.nav\.level\.auto'\) : levelLabel;/);- assert.match(template, /var showDetailLevel = semantic \|\| detail !== 'read';/);- assert.match(template, /resetDetailLabel\.hidden = !showDetailLevel/);- assert.match(template, /resetPercentLabel\.textContent = percent/);- assert.match(template, /resetBtn\.toggleAttribute\('data-detail-visible', showDetailLevel\)/);-});diff --git a/test/viewer-chrome-layout.test.mjs b/test/viewer-chrome-layout.test.mjsindex d34754b0..f8ed9bf6 100644--- a/test/viewer-chrome-layout.test.mjs+++ b/test/viewer-chrome-layout.test.mjs@@ -713,17 +713,14 @@ test('localized multiline Legends remain clear across required viewports, themesskip: chromePath ? false : 'Set ARCHIFY_CHROME to run the real browser regression.',}, async () => {const browser = new ChromeVisualBrowser(chromePath);- const viewports = [[1440, 900], [1600, 1000], [1920, 1080], [2048, 1320]];- const cases = viewports.flatMap(([width, height]) => (- ['light', 'dark'].flatMap((theme) => (- ['classic', 'signal-flow', 'blueprint', 'editorial'].map((preset) => ({- width,- height,- theme,- preset,- }))- ))- ));+ // Cover every supported viewport and every theme/preset pair without the+ // 32-state Cartesian product of shared collision code.+ const cases = [+ [1440, 900, 'light', 'classic'], [1440, 900, 'dark', 'signal-flow'],+ [1600, 1000, 'light', 'blueprint'], [1600, 1000, 'dark', 'editorial'],+ [1920, 1080, 'dark', 'classic'], [1920, 1080, 'light', 'signal-flow'],+ [2048, 1320, 'dark', 'blueprint'], [2048, 1320, 'light', 'editorial'],+ ].map(([width, height, theme, preset]) => ({ width, height, theme, preset }));try {const sessionId = await load(browser, render('architecture', CASES.architecture), { width: 1920, height: 1080 });await evaluate(browser, sessionId, `(function () {diff --git a/viewer/README.md b/viewer/README.mdindex 4259244e..b23dde3e 100644--- a/viewer/README.md+++ b/viewer/README.md@@ -18,8 +18,8 @@ unchanged by all ten renderers and the installed Skill. These maintainersources live outside the packaged `archify/` directory.From `archify/`, run `npm run generate:viewer` after editing any source.-`npm run check:viewer` verifies freshness without writing; `npm test` includes-that check. Shared Viewer changes also require rebuilding the checked-in+`npm run check:viewer` verifies freshness without writing; root+`npm run test:generated` and `npm run test:full` include that check. Shared Viewer changes also require rebuilding the checked-inCheckout comparison from its tracked snapshots. From the repository root, run:```sh@@ -495,7 +495,7 @@ Focus/Route active queries are runtime lookups; Route initializes later.never claims or releases an owner. Export Cleanup strips cloned Intent state,while Intent clears the live diagram. Neither dependency moves into this file.-`intent-trace.test.mjs` retains generated-output checks. The browser test covers+`intent-trace-browser.test.mjs` coversfive-mode initialization, real pointer/native focus handoffs, bounded timercleanup, isolated timer and SVG fixtures, blockers and actual callers, real CSScompletion, Motion ownership, reduced motion, themes and SVG export. Fixtures@@ -556,8 +556,7 @@ position. Its interface is `open`, `close`, `toggle`, `select`, `isOpen`,handling, Guide and Route callers remain outside Finder. The dialog staysnon-modal; no focus trap or keyboard adapter is introduced.-`finder.test.mjs` retains generated-output checks; `finder-browser.test.mjs`-exercises five-mode initialization, trusted keyboard/mouse input, real Route+`finder-browser.test.mjs` exercises five-mode initialization, trusted keyboard/mouse input, real Routesource/target collaboration, retained context, panel cleanup, themes, constrainedlayout, reduced motion and SVG export. Its metadata fixture isolates searchinputs; it does not claim repository verification or brand-rendering coverage.