test: Add browser dist e2e test and document RDF 1.2 support level - #1954
Open
jeswr wants to merge 4 commits into
Open
test: Add browser dist e2e test and document RDF 1.2 support level#1954jeswr wants to merge 4 commits into
jeswr wants to merge 4 commits into
Conversation
Serve the release artifact shape (bundle/latest/index.js and bundle/latest/dynamic-import.js, generated with the same bundle:latest release script the release workflow uses) and assert a reasoning round-trip in firefox and chromium for both documented consumption paths: a plain script tag and an ES module dynamic import. Uses deterministic page.waitForFunction waits and try/finally browser cleanup rather than fixed sleeps. Closes #7 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
EYE's RDF 1.1/1.2 parsing is experimental (official support targets the N3 spec; n3gen in eyeling is the recommended conversion path), and the supported behaviour follows RDF 1.2 semantics: annotation syntax desugars to blank-node reifiers with triple terms only as rdf:reifies objects, consistently between N3.js v2 and EYE. Follow-up to #1854 / #1853. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Member
Author
|
Please avoid duplicating logic that can be found in https://github.com/eyereasoner/eye-js/blob/main/examples/prebuilt/index.html |
…te page Per review: the script-tag dist test now loads examples/prebuilt/index.html itself -- clicking its Execute button like a user would -- instead of a test-only page that duplicated the example's reasoning round-trip. The server rewrites the example's GitHub Pages script src to the locally built release artifact at serve time (failing loudly if the src is not found, so the test can never silently fall back to the published bundle), which makes the example the single source of truth and puts it under test. The dynamic-import page stays minimal because no example consumes latest/dynamic-import.js (the rollup example bundles the npm package); a comment now records that. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
jeswr
marked this pull request as ready for review
July 4, 2026 21:31
jeswr
enabled auto-merge (squash)
July 4, 2026 21:31
jeswr
disabled auto-merge
July 4, 2026 22:05
This was referenced Jul 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🚧 DRAFT — for @jeswr to review first
Closes #7
Follow-up documentation for #1854 (see also #1853)
Part 1 — e2e test for the built browser dist (#7)
Dist vs dev-build: what was untested
The existing playwright e2e (
__tests__/e2e-test.ts) servesbundle/index.js— the raw webpack output. What consumers actually load from GitHub Pages is the release artifact shape:latest/index.jspluslatest/dynamic-import.js, wheredynamic-import.jsis derived byscripts/post-webpack.ts(a textualvar eyereasoner;→export var eyereasoner;transform). That release script only ever ran inside the release job, so a regression in it — or a webpack output change that makes the transform silently no-op, leavingdynamic-import.jswith no export — would ship without any CI signal.The new test (
__tests__/e2e-dist-test.ts)beforeAllrecreates the released shape from the webpack bundle that the test flow already builds (no second build step added —npm run test:unitrunsbundle:webpackbefore jest): it copiesbundle/index.jsinto a version dir and runs the realnpm run bundle:latest -- --name=vdist-testrelease script, producingbundle/latest/{index.js,dynamic-import.js}.bundle/latest/is served as a plain static directory (like GitHub Pages), so any chunk/asset the published bundle requests at runtime must exist in the released file set;express.staticalso sets thecharset=utf-8content-type required for WASM streaming (see "Serving Files" in the README).examples/prebuilt/index.htmlrather than a test-only copy of it (per review). The server rewrites the example's GitHub Pages<script src>to the locally builtlatest/index.jsat serve time — never touching the committed example, and failing loudly if the src pattern is not found so the test can never silently fall back to the published bundle — then the test clicks the example's Execute button like a user would and waits for the result. The example is the single source of truth for script-tag consumption and is itself under test: a packaging regression in the example page gets caught too.__test_utils__/dist-dynamic-import.html:const { eyereasoner } = await import('/latest/dynamic-import.js'). This one page remains because no example consumeslatest/dynamic-import.js(the rollup example bundles the npm package through webpack instead); it is minimal and reuses the same socrates data and derived-triple assertion as the prebuilt example.:Socrates a :Mortaltriple — which is not in the input — appears, and that no error was reported (the DOM error element for the dynamic-import page; capturedpageerrorevents for the example page, which has no error element).Adjacency with #1952
This test intentionally uses the same idioms just introduced on
test/e2e-deterministic-waits(#1952):page.waitForFunctionwith a generous 90s timeout instead of fixed sleeps, andtry/finallyaround the browser lifecycle so a failed expectation cannot leak a browser and hang the jest worker. It is a new file based onmain, so the two PRs merge cleanly in either order.Part 2 — README: RDF 1.2 support level (#1854 follow-up)
Adds a short "RDF 1.2 support" section recording the outcome of #1854: EYE's RDF 1.1/1.2 parsing is experimental (official support targets the N3 spec;
n3genin eyeling is the recommended conversion path, per @josd); annotation syntax desugars to blank-node reifiers with triple terms only asrdf:reifiesobjects (the pre-1.2 RDF-star CG form is gone); N3.js v2 (#1853) and EYE agree on this model; thedataStartest cases are the guard.Validation
Playwright cannot run on this (production-shared, browserless) box, so the CI matrix on this PR is the behavioural validation. Locally validated:
tsc --noEmittype-check of__tests__/e2e-dist-test.ts(the repo tsconfig only includeslib/): exit 0bundle:webpackoutput contains thevar eyereasoner;transform target exactly once;bundle:latest -- --name=vdist-testexits 0 and producesbundle/latest/{index.js,dynamic-import.js}withexport var eyereasoner;present indynamic-import.jsonly; the test server responds 200 on all routes withtext/javascript; charset=utf-8for the bundles/route returns the prebuilt example verbatim except<script src="/latest/index.js">in place of the GitHub Pages URL (and noeyereasoner.github.ioreference remains)🤖 Generated with Claude Code