feat(affinity): export scripts end in a Forgejo web hand-off (no token) #201

Merged
peterswimm merged 1 commit from feat/affinity-submit into main 2026-10-08 17:21:18 +00:00
Owner

Scope

Step 6 of the designer-tooling roadmap, as a browser hand-off. A script in Affinity 3.3 can't send an HTTP request body, so it can't open a pull request through the Forgejo API. Instead, each export script (export-icon, export-plate, export-doc-master) now ends in a Send it for review dialog. Its multi-line box can be copied, and it holds:

  • a link to Forgejo's upload page for the right folder;
  • the branch name (asset/<id>) and commit message to use;
  • a link to edit udg/config/assets.yml on that branch;
  • the entry to paste;
  • a reminder to add the build-dist label.

The browser does the writes with the designer's normal login, and no script holds a token. The quickstart and the scripts README are updated to match.

Testing

  • Added generator/tests/unit/test_affinity_scripts.py, which checks that:
    • the three hand-off copies are identical;
    • the hand-off names the label the bot listens for;
    • no script uses network.js, an API path or a token.
  • Control: editing one copy and planting Authorization in a script made 2 tests fail. Reverting made all 4 pass.
  • The full suite passes (338). just check passes.
  • Affinity request probe: POSTs from Affinity to a local listener arrived with headers but no body, whether sent as a string or a Buffer. A curl control arrived with its body.
  • In Affinity through MCP, I built the dialog without opening it. The width, static text and 18-row multi-line text box were all accepted, and the text kept its newlines.
  • The step text was rendered in node. A folder name with a space is URL-encoded.
  • Forgejo 16.0.3 routes:
    • _upload/… and _edit/… send a signed-out visitor to the login page (303). An unknown route returns 404.
    • In the v16.0 source, the upload page accepts a folder that doesn't exist yet.
    • main refuses pushes.
    • ville has write access, so asset/* branches are same-repo and the bot runs on them.
  • Not yet run:
    • one export clicked through from the Scripting panel;
    • the four browser steps on a throwaway asset, closed afterwards.

Impact Statement

  • Existing features: export scripts end in a dialog instead of an alert. Lint and export behaviour are unchanged.
  • Public APIs / contracts: no expected impact.
  • Schemas: no expected impact.
  • Data / artifacts: no dist/ changes.
  • Integrations: the links point at git.toilville.dev/Toilville/toilville-design (FORGEJO_REPO in each script).
  • Mappings: no expected impact.
  • Backward compatibility: library copies must be re-saved to pick up the change.

Docs

docs/DESIGNER_QUICKSTART.md (steps 2–4) and Brand/source/_editor/affinity-scripts/README.md (the hand-off, why it goes through the browser, and Testing notes).

## Scope Step 6 of the designer-tooling roadmap, as a browser hand-off. A script in Affinity 3.3 can't send an HTTP request body, so it can't open a pull request through the Forgejo API. Instead, each export script (`export-icon`, `export-plate`, `export-doc-master`) now ends in a **Send it for review** dialog. Its multi-line box can be copied, and it holds: - a link to Forgejo's upload page for the right folder; - the branch name (`asset/<id>`) and commit message to use; - a link to edit `udg/config/assets.yml` on that branch; - the entry to paste; - a reminder to add the `build-dist` label. The browser does the writes with the designer's normal login, and no script holds a token. The quickstart and the scripts README are updated to match. ## Testing - Added `generator/tests/unit/test_affinity_scripts.py`, which checks that: - the three hand-off copies are identical; - the hand-off names the label the bot listens for; - no script uses `network.js`, an API path or a token. - Control: editing one copy and planting `Authorization` in a script made 2 tests fail. Reverting made all 4 pass. - The full suite passes (338). `just check` passes. - Affinity request probe: POSTs from Affinity to a local listener arrived with headers but no body, whether sent as a string or a `Buffer`. A `curl` control arrived with its body. - In Affinity through MCP, I built the dialog without opening it. The width, static text and 18-row multi-line text box were all accepted, and the text kept its newlines. - The step text was rendered in node. A folder name with a space is URL-encoded. - Forgejo 16.0.3 routes: - `_upload/…` and `_edit/…` send a signed-out visitor to the login page (303). An unknown route returns 404. - In the v16.0 source, the upload page accepts a folder that doesn't exist yet. - `main` refuses pushes. - `ville` has write access, so `asset/*` branches are same-repo and the bot runs on them. - **Not yet run:** - one export clicked through from the Scripting panel; - the four browser steps on a throwaway asset, closed afterwards. ## Impact Statement - Existing features: export scripts end in a dialog instead of an alert. Lint and export behaviour are unchanged. - Public APIs / contracts: no expected impact. - Schemas: no expected impact. - Data / artifacts: no `dist/` changes. - Integrations: the links point at git.toilville.dev/Toilville/toilville-design (`FORGEJO_REPO` in each script). - Mappings: no expected impact. - Backward compatibility: library copies must be re-saved to pick up the change. ## Docs `docs/DESIGNER_QUICKSTART.md` (steps 2–4) and `Brand/source/_editor/affinity-scripts/README.md` (the hand-off, why it goes through the browser, and Testing notes).
feat(affinity): export scripts end in a Forgejo web hand-off (no token)
Some checks failed
PR policy check / policy-gate (pull_request) Successful in 0s
Security Scans / Trivy filesystem scan (pull_request) Failing after 30s
Block Validation / validate (pull_request) Successful in 58s
Security Scans / Gitleaks secret scan (pull_request) Successful in 30s
Test Generator / lint-workflows (pull_request) Successful in 15s
UDG dist drift gate / dist/ matches dtcg + udg sources (pull_request) Successful in 17s
Test Generator / lint-prose (pull_request) Successful in 19s
Copy coverage / Design copy reaching rendered HTML (pull_request) Successful in 28s
Test Generator / test (pull_request) Failing after 56s
7961d42256
Affinity 3.3 scripts cannot send an HTTP request body, so a script cannot
open the PR itself. Each export now ends in a 'Send it for review' dialog
with copyable steps: Forgejo upload link for the folder, branch asset/<id>,
commit message, an edit link for assets.yml on that branch, the entry, and
the build-dist label. No credential lives in any script.

Adds test_affinity_scripts.py: the three hand-off copies stay identical,
name the bot's label, and no script makes a request or holds a token.
peterswimm deleted branch feat/affinity-submit 2026-10-08 17:21:18 +00:00
Sign in to join this conversation.
No description provided.