Test the v2 Affinity export scripts end to end, then retire the old library entries #205

Open
opened 2026-10-10 18:13:03 +00:00 by peterswimm · 5 comments
Owner

The Affinity export scripts now end with a hand-off panel instead of trying to submit anything themselves (#201). Affinity's scripting can't send data to Forgejo, so the panel lists the browser steps: upload the file, open a PR, add the assets.yml entry, add the build-dist label. No tokens are involved.

The updated scripts are in the Affinity script library as export-icon v2 and export-plate v2. The library can't overwrite or delete entries from a script, so the old export-icon and export-plate are still there next to them. export-doc-master was new, so it has no "v2".

What to do

  1. Panel test, in a scratch document. Run each of export-icon v2, export-plate v2 and export-doc-master:

    • the hand-off panel opens, is readable at 720 px wide, and its text box can be selected and copied;
    • the upload link points at the right folder (Brand/source/icons/…, …/plates/…, …/documents/…);
    • the assets.yml step shows the entry to paste, or says it's already listed.
  2. One real browser hand-off, end to end. Use an existing asset or a throwaway shape. No new brand art, and no test icons or plates committed to main. Follow the panel's steps exactly:

    • upload, on a new branch asset/<id> with commit message Add <id>;
    • open the PR (its title comes from that commit message);
    • add the entry;
    • add build-dist.

    Check that the bot builds dist/. Then close the PR without merging and delete the branch.

  3. Clean up the library. Once 1 and 2 pass, delete the old export-icon and export-plate by hand in Affinity.

  4. Report back anything the panel got wrong. Fixes go in the repo files under Brand/source/_editor/affinity-scripts/; the repo is the source of truth and the library is only a local copy.

Done when

  • All three scripts' panels check out.
  • One hand-off ran end to end, and its PR was closed unmerged.
  • The old library entries are deleted.
The Affinity export scripts now end with a **hand-off panel** instead of trying to submit anything themselves (#201). Affinity's scripting can't send data to Forgejo, so the panel lists the browser steps: upload the file, open a PR, add the `assets.yml` entry, add the `build-dist` label. No tokens are involved. The updated scripts are in the Affinity script library as **`export-icon v2`** and **`export-plate v2`**. The library can't overwrite or delete entries from a script, so the old `export-icon` and `export-plate` are still there next to them. `export-doc-master` was new, so it has no "v2". ## What to do 1. **Panel test, in a scratch document.** Run each of `export-icon v2`, `export-plate v2` and `export-doc-master`: - the hand-off panel opens, is readable at 720 px wide, and its text box can be selected and copied; - the upload link points at the right folder (`Brand/source/icons/…`, `…/plates/…`, `…/documents/…`); - the `assets.yml` step shows the entry to paste, or says it's already listed. 2. **One real browser hand-off, end to end.** Use an existing asset or a throwaway shape. **No new brand art, and no test icons or plates committed to `main`.** Follow the panel's steps exactly: - upload, on a new branch `asset/<id>` with commit message `Add <id>`; - open the PR (its title comes from that commit message); - add the entry; - add `build-dist`. Check that the bot builds `dist/`. Then **close the PR without merging** and delete the branch. 3. **Clean up the library.** Once 1 and 2 pass, delete the old `export-icon` and `export-plate` by hand in Affinity. 4. Report back anything the panel got wrong. Fixes go in the repo files under `Brand/source/_editor/affinity-scripts/`; the repo is the source of truth and the library is only a local copy. ## Done when - [ ] All three scripts' panels check out. - [ ] One hand-off ran end to end, and its PR was closed unmerged. - [ ] The old library entries are deleted.
Author
Owner

Wish: 76894aa6. Related: #201 (the hand-off scripts).

Wish: `76894aa6`. Related: #201 (the hand-off scripts).
Member

Test report for #205.
Results

  • I ran export-icon, export-plate and export-doc-master in Affinity 3.3.0. Each one exported its file.
  • All three hand-off panels were readable, and their text could be selected and copied.
  • The icon export hand-off works.
  • The plate and the document master (the whitepaper cover) exported and passed their tests.
  • The browser hand-off worked end to end. This includes the build-dist label and the build.
  • The test PR, #216, was closed unmerged.
  • The test branch asset/icon.test was deleted.
  • My Affinity library had no old export-icon or export-plate entries, so there was nothing to delete. The entries now in the library are the newly installed scripts.
    Finding: export-icon exports the whole document, not the artwork bounds
  • export-icon.js exports the entire Affinity document (the whole canvas) rather than the artwork bounds. It uses the default SVG preset, sets no export area, and does not check bounds.
  • My test icon came out at 2481 × 3508 (A4). In Forgejo the icon appeared very small inside a large transparent area.
  • The committed icons have tight, variable viewBoxes that fit the artwork, for example 562 × 467 and 442 × 571.
  • assets.py preserves the source viewBox, so an oversized one carries into the themed output.
  • No document tells the designer to size the document to the artwork, and the script does not check it.
  • This is a #205 finding. It is not expected behaviour. How to fix it is open.
    Setup
  • The v2 scripts were not already in my Affinity library, so I installed them from the repo files. I changed repoRoot in my local Affinity copies to point to my clone.
    @peterswimm
Test report for #205. Results - I ran export-icon, export-plate and export-doc-master in Affinity 3.3.0. Each one exported its file. - All three hand-off panels were readable, and their text could be selected and copied. - The icon export hand-off works. - The plate and the document master (the whitepaper cover) exported and passed their tests. - The browser hand-off worked end to end. This includes the build-dist label and the build. - The test PR, #216, was closed unmerged. - The test branch asset/icon.test was deleted. - My Affinity library had no old export-icon or export-plate entries, so there was nothing to delete. The entries now in the library are the newly installed scripts. Finding: export-icon exports the whole document, not the artwork bounds - export-icon.js exports the entire Affinity document (the whole canvas) rather than the artwork bounds. It uses the default SVG preset, sets no export area, and does not check bounds. - My test icon came out at 2481 × 3508 (A4). In Forgejo the icon appeared very small inside a large transparent area. - The committed icons have tight, variable viewBoxes that fit the artwork, for example 562 × 467 and 442 × 571. - assets.py preserves the source viewBox, so an oversized one carries into the themed output. - No document tells the designer to size the document to the artwork, and the script does not check it. - This is a #205 finding. It is not expected behaviour. How to fix it is open. Setup - The v2 scripts were not already in my Affinity library, so I installed them from the repo files. I changed repoRoot in my local Affinity copies to point to my clone. @peterswimm
Author
Owner

Status (2026-10-20): the panels and the end-to-end hand-off passed in ville's test report. Test PR #216 was closed unmerged, and its branch was deleted.

Two items left before this closes:

  1. export-icon exports the whole A4 document (the test icon was 2481×3508), not the artwork bounds. The committed icons use tight viewBoxes, e.g. 562×467.
    • Fix it in Brand/source/_editor/affinity-scripts/ to export the artwork bounds or selection.
    • Add a check that fails on an oversized viewBox.
  2. The old export-icon / export-plate library entries. ville's library had none, so I'll check mine and delete them there.
**Status (2026-10-20):** the panels and the end-to-end hand-off passed in ville's test report. Test PR #216 was closed unmerged, and its branch was deleted. Two items left before this closes: 1. **`export-icon` exports the whole A4 document** (the test icon was 2481×3508), not the artwork bounds. The committed icons use tight viewBoxes, e.g. 562×467. - Fix it in `Brand/source/_editor/affinity-scripts/` to export the artwork bounds or selection. - Add a check that fails on an oversized viewBox. 2. **The old `export-icon` / `export-plate` library entries.** ville's library had none, so I'll check mine and delete them there.
Author
Owner

Item 1 is up: #221.

  • export-icon now exports the artwork's bounds, via FileExportArea.createForSelection over every layer.
  • The build refuses an icon whose artwork spans under 75% of its viewBox. Every committed icon spans 85% or more; your A4 test icon would have spanned about a fifth.

@ville, could you run export-icon once on a small shape in an A4 document and confirm the SVG's viewBox fits the shape? The script can't run outside Affinity, so that's the one step the tests can't cover.

Item 2 (the old library entries) is still mine to check.

Item 1 is up: #221. - `export-icon` now exports the artwork's bounds, via `FileExportArea.createForSelection` over every layer. - The build refuses an icon whose artwork spans under 75% of its viewBox. Every committed icon spans 85% or more; your A4 test icon would have spanned about a fifth. @ville, could you run `export-icon` once on a small shape in an A4 document and confirm the SVG's viewBox fits the shape? The script can't run outside Affinity, so that's the one step the tests can't cover. Item 2 (the old library entries) is still mine to check.
Author
Owner

Static pre-check of the three scripts against step 1, from the repo copies (Brand/source/_editor/affinity-scripts/, which step 4 names as the source of truth). This does not replace the panel test — it is the part that can be checked without Affinity, so the manual pass can skip what is already known good and look hard at the one thing that is not.

Checks that pass

Step 1 criterion Result
Panel readable at 720 px All three set dlg.initialWidth = 720 (export-icon.js:161, export-plate.js:161, export-doc-master.js:166).
The assets.yml step appears Present in all three; each builds an _edit/<branch>/udg/config/assets.yml link.
export-icon target folders DIRS = { icon: 'icons', infographic: 'infographics', wireframe: 'wireframes' } (:179). All three exist under Brand/source/.

1. This issue's step 1 names a folder that does not exist

Step 1 says the upload link should point at "Brand/source/icons/…, …/plates/…, …/documents/…".

There is no Brand/source/plates/. export-plate targets Brand/source/components/<folder>/ — export-plate.js:201, and its own header comment at :4 says so deliberately. Brand/source/components/ exists and holds twelve entries.

So the script is right and the acceptance criterion is stale. Worth correcting before the manual pass, because someone following step 1 literally will either record a false failure or, worse, "fix" export-plate to write into a directory that has never existed.

2. export-doc-master is the one to watch in step 2

export-doc-master writes to Brand/source/documents/<role>/ (:226), and Brand/source/documents/ does not exist in the repo. The script creates it locally — FileSystemApi.createDirectories(...) at :229 — so the local export will succeed and look fine.

The hand-off is the untested half. The panel builds …/_upload/main/<dir> from the file's own path (:149), so for this script it links at a directory with nothing in it. Forgejo's _upload normally creates intermediate directories on commit, so this probably works — but it has never been run, and it is the only one of the three pointing somewhere that does not yet exist.

Worth noting this is not drift: the doc templates from #198/#199 landed as dist/<brand>/invoice.odt, so nothing has ever populated a Brand/source/documents/ tree. export-doc-master would be the first thing to create it.

Suggestion: run step 2's single end-to-end hand-off with export-doc-master rather than with an icon. It is the only one whose upload path is unproven, and the other two point at directories that already hold assets.

**Static pre-check of the three scripts against step 1, from the repo copies** (`Brand/source/_editor/affinity-scripts/`, which step 4 names as the source of truth). This does not replace the panel test — it is the part that can be checked without Affinity, so the manual pass can skip what is already known good and look hard at the one thing that is not. ## Checks that pass | Step 1 criterion | Result | |---|---| | Panel readable at 720 px | All three set `dlg.initialWidth = 720` (`export-icon.js:161`, `export-plate.js:161`, `export-doc-master.js:166`). | | The `assets.yml` step appears | Present in all three; each builds an `_edit/<branch>/udg/config/assets.yml` link. | | `export-icon` target folders | `DIRS = { icon: 'icons', infographic: 'infographics', wireframe: 'wireframes' }` (`:179`). All three exist under `Brand/source/`. | ## 1. This issue's step 1 names a folder that does not exist Step 1 says the upload link should point at "`Brand/source/icons/…`, `…/plates/…`, `…/documents/…`". There is no `Brand/source/plates/`. `export-plate` targets **`Brand/source/components/<folder>/`** — `export-plate.js:201`, and its own header comment at `:4` says so deliberately. `Brand/source/components/` exists and holds twelve entries. So the script is right and **the acceptance criterion is stale**. Worth correcting before the manual pass, because someone following step 1 literally will either record a false failure or, worse, "fix" `export-plate` to write into a directory that has never existed. ## 2. `export-doc-master` is the one to watch in step 2 `export-doc-master` writes to **`Brand/source/documents/<role>/`** (`:226`), and **`Brand/source/documents/` does not exist in the repo.** The script creates it locally — `FileSystemApi.createDirectories(...)` at `:229` — so the local export will succeed and look fine. The hand-off is the untested half. The panel builds `…/_upload/main/<dir>` from the file's own path (`:149`), so for this script it links at a directory with nothing in it. Forgejo's `_upload` normally creates intermediate directories on commit, so this probably works — but it has never been run, and it is the only one of the three pointing somewhere that does not yet exist. Worth noting this is not drift: the doc templates from #198/#199 landed as `dist/<brand>/invoice.odt`, so nothing has ever populated a `Brand/source/documents/` tree. `export-doc-master` would be the first thing to create it. **Suggestion:** run step 2's single end-to-end hand-off with **`export-doc-master`** rather than with an icon. It is the only one whose upload path is unproven, and the other two point at directories that already hold assets.
Sign in to join this conversation.
No description provided.