Public: anyone can read this; the crew can change it.

One acceptance test opens a board JSON, an STL, a PDF, a CSV and an mp4 on the blob page and each renders with its view switch #16825

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

This adds test/files-render-acceptance.test.ts. All 9 tests pass, and no renderer was broken, so nothing under src/web/render/ changed. I did not touch server.ts, repo.ts or store.ts.

Notes

opened this

This adds test/files-render-acceptance.test.ts. All 9 tests pass, and no renderer was broken, so nothing under src/web/render/ changed. I did not touch server.ts, repo.ts or store.ts. The gate's 32 rules pass and tsc shows nothing for the new file. I ran only this test file and not the rest of the suite; the forge's check runs that on push.

What it does

  • It commits one fixture of each kind to a public test repository:
    • a board JSON in boards/, with .forge/schemas.json mapping boards/*.json to board.schema.json;
    • an ASCII STL;
    • a one-page PDF;
    • a CSV;
    • a 32-byte ftyp mp4 built in the test, so nothing large is committed.
  • Each blob page answers 200 with its own renderer, not "Binary file". The renderers are the config form, model3d, the PDF frame, the CSV table and <video>.
  • Each page keeps the switch: Rendered, Source, Raw and Download links.
  • Each file's bytes come from the media route with the expected policy header, nosniff and content type.
  • The PDF is the one kind that leaves without sandbox, because Chrome's PDF viewer will not run in a sandboxed document (see PDF_POLICY in media.ts). The issue says every kind is sandboxed, so I assert MEDIA_POLICY for four and PDF_POLICY for the PDF, plus a test that only the PDF lacks sandbox.
  • For the board round trip, a board is written to forge/boards and edited through the real file form, posted as admin with an Origin header: reorder two panels, add a panel, change a chart from bar to heat, review, then save.
    • The committed file passes parseBoard, with the expected order, the heat chart and the new panel.
    • /boards/<slug> shows the new panel and the reordering.
    • I confirmed the test fails when the heat field is left out.
  • The round trip uses the forge/boards repository, because that is where /boards/<slug> reads boards from. The fixture board in the test repository only proves the blob page and its schema mapping.

I reused writeBoard, boardSchema, STARTING_BOARDS and the createSession/setCrawlClock setup from render-media.test.ts; I wrote no new functions beyond test helpers.

Left out

  • The review block walking all five files at 390 px and desktop width in both themes is not in this pull. I could not take screenshots from the sandbox, so that part of the issue is still open and a person would need to do it.
  • The commit carries No look and No door lines, since it is a test only.

How to try it: bun test test/files-render-acceptance.test.ts

Closes #16744

2 earlier comments
commented

This adds test/files-render-acceptance.test.ts. All 9 tests pass, and no renderer was broken, so nothing under src/web/render/ changed. I did not touch server.ts, repo.ts or store.ts. The gate's 32 rules pass and tsc shows nothing for the new file. I ran only this test file and not the rest of the suite; the forge's check runs that on push.

What it does

  • It commits one fixture of each kind to a public test repository:
    • a board JSON in boards/, with .forge/schemas.json mapping boards/*.json to board.schema.json;
    • an ASCII STL;
    • a one-page PDF;
    • a CSV;
    • a 32-byte ftyp mp4 built in the test, so nothing large is committed.
  • Each blob page answers 200 with its own renderer, not "Binary file". The renderers are the config form, model3d, the PDF frame, the CSV table and <video>.
  • Each page keeps the switch: Rendered, Source, Raw and Download links.
  • Each file's bytes come from the media route with the expected policy header, nosniff and content type.
  • The PDF is the one kind that leaves without sandbox, because Chrome's PDF viewer will not run in a sandboxed document (see PDF_POLICY in media.ts). The issue says every kind is sandboxed, so I assert MEDIA_POLICY for four and PDF_POLICY for the PDF, plus a test that only the PDF lacks sandbox.
  • For the board round trip, a board is written to forge/boards and edited through the real file form, posted as admin with an Origin header: reorder two panels, add a panel, change a chart from bar to heat, review, then save.
    • The committed file passes parseBoard, with the expected order, the heat chart and the new panel.
    • /boards/<slug> shows the new panel and the reordering.
    • I confirmed the test fails when the heat field is left out.
  • The round trip uses the forge/boards repository, because that is where /boards/<slug> reads boards from. The fixture board in the test repository only proves the blob page and its schema mapping.

I reused writeBoard, boardSchema, STARTING_BOARDS and the createSession/setCrawlClock setup from render-media.test.ts; I wrote no new functions beyond test helpers.

Left out

  • The review block walking all five files at 390 px and desktop width in both themes is not in this pull. I could not take screenshots from the sandbox, so that part of the issue is still open and a person would need to do it.
  • The commit carries No look and No door lines, since it is a test only.

How to try it: bun test test/files-render-acceptance.test.ts

commented

One acceptance test, test/files-render-acceptance.test.ts, opens a board JSON, an STL, a PDF, a CSV and an mp4 on the blob page. It checks that each renders with the Rendered | Source | Raw | Download switch. This push only adds the comment @juniper asked for. The file passes (9 tests), and scripts/gate.ts --fix changed nothing. I did not run tsc or scripts/design-lint.ts, since only a comment changed.

  • Round trip: the board round trip posts to forge/boards, not to the boards/throughput.json committed in the test's repository. That is deliberate, because /boards/<slug> reads only from forge/boards. A comment above the round-trip describe now says so.
  • PDF: the PDF asserts PDF_POLICY rather than a sandbox, because Chrome's viewer will not run inside one. A test covers this.
  • Untouched: server.ts and repo.ts are unchanged.

Preview: the test builds its own temporary repository, which does not exist on the preview. To try it by hand, create a repository alice/files with boards/throughput.json, part.stl, doc.pdf, table.csv and clip.mp4. You can copy the fixture contents from the top of test/files-render-acceptance.test.ts.

I did not produce the review block @juniper asked for. I have not walked the blob pages at 390 px and at desktop width, in light and dark, so I have not written steps for them. Nothing in this push changes a page, so I have not added one to this description.

commented

Left #16744 open: 1 unticked item remain (The pull's review block walks all five files at 390 px and at desktop width, in both themes, so a person can confirm the pass from the looks.).

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs