For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: Clickable mockups of v7's public and embedded tariff page for Burundi and Rwanda, identical to the live pages except for five marked differences.
Architecture: v7's own pages, captured from the live sites with every asset copied locally, are served as static files under /docs/step3/mockups/. A stand-in hooked into jQuery answers v7's five /api/Tariffs/* requests from recorded answers chosen by a scenario. A shell page outside the frame switches country, page, language and scenario. The five differences are marked edits on a copy of v7's tariffs.js, with a generated diff a reader can follow.
Tech Stack: Node ≥ 22 (node:test, fetch, no new dependency), the docs site's server.mjs and build-docs.mjs; in the page, v7's jQuery 3.5, Backbone 1.4, Semantic UI dropdowns, Bootstrap 3.4.
Spec: design.md, agreed in principle 26-10-2026.
https://burundi.tradeportal.org/Tariffs and https://rwandatrade.rw/Tariffs; code eRegulations-4.0-Public origin/main at 68f3a0f06. Where the live site and the code disagree, the live site wins, and the difference is noted in the manifest./docs/step3/mockups/; CDN files are copied locally; Google Translate's script is not loaded (its placeholder stays)./docs/step3/mockups/ keeps today's policy. Test in Task 1.Files:
server.mjs (the HEADERS constant and handle)docs/build-docs.mjs (after the copy of docs.css, line ~395)package.json ("test": "node --test tests/")tests/server.test.mjs, docs/step3/mockups/.keepInterfaces:
Produces: headersFor(pathname: string) -> object exported from server.mjs; the server starts only when run directly (import.meta.url === pathToFileURL(process.argv[1]).href). The build copies docs/step3/mockups/** verbatim to site/docs/step3/mockups/ and site/docs/fr/step3/mockups/ is not created.
Under /docs/step3/mockups/: Content-Security-Policy: default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; frame-ancestors 'self'. Elsewhere: unchanged.
TYPES gains .json, .woff, .woff2, .ttf, .eot, .gif, .jpg, .ico, .csv.
Step 1: Write the failing tests — tests/server.test.mjs: mockups policy allows inline and same-origin frames (headersFor('/docs/step3/mockups/index.html')['Content-Security-Policy'] contains 'unsafe-inline' and frame-ancestors 'self'); other pages keep the strict policy (headersFor('/docs/index.html') equals default-src 'self'; style-src 'self'; img-src 'self' data:; frame-ancestors 'none'); a look-alike path stays strict (/docs/step3/mockups-x/a.html and /docs/step3/mockups/../index.html normalised are strict).
Step 2: Run npm test — Expected: FAIL, headersFor not exported.
Step 3: Implement headersFor and use it for every response; guard the listen call.
Step 4: Add the build copy with fs.cpSync(src, dest, { recursive: true }).
Step 5: Run npm test && npm run build && ls site/docs/step3/mockups/.keep — Expected: tests pass, file present.
Step 6: Commit Mockups served from /docs/step3/mockups/ under their own security policy.
Files:
tools/mockups/capture.mjs, tests/capture.test.mjsdocs/step3/mockups/v7/<country>/<page>.<lang>.html, docs/step3/mockups/v7/<country>/assets/**, docs/step3/mockups/v7/manifest.jsonInterfaces:
Produces: country ∈ bi, rw; page ∈ public, embed; lang = each language the site's menu offers. manifest.json: { captured: "dd-mm-yyyy", code: "68f3a0f06", pages: [{ country, page, lang, url, file }], assets: [{ url, file, sha256 }], notes: [string] }. Captured HTML has every asset reference rewritten to a relative path under assets/, and a single line <script src="../../standin/standin.js"></script> inserted before v7's first script.
How a language is selected on each site is read from its language menu; capture.mjs follows the link the menu gives.
Step 1: Write the failing test — tests/capture.test.mjs: every captured page exists for both countries (manifest lists public and embed for bi and rw in at least one language each); no remote reference is left (no src=/href=/url( to http:, https: or // in captured HTML and CSS, except anchors <a href> to the site's own other pages, which stay as they are); every local asset exists; the stand-in is loaded before v7's scripts.
Step 2: Run npm test — Expected: FAIL, no manifest.
Step 3: Implement capture.mjs (node tools/mockups/capture.mjs): fetch each page with fetch, collect link, script, img and CSS url() references recursively, download each once, rewrite references, drop the Google Translate <script>; record in notes each asset whose bytes differ from origin/main at 68f3a0f06.
Step 4: Run node tools/mockups/capture.mjs && npm test — Expected: PASS.
Step 5: Check by eye in the browser pane: /docs/step3/mockups/v7/bi/public.fr.html beside the live page at 1 280 px; same layout and styles (the tariff form stays empty, the stand-in has no answers yet).
Step 6: Commit v7's tariff page captured for Burundi and Rwanda, assets local.
Files:
tools/mockups/record.mjs, tests/recordings.test.mjsdocs/sources/2026-10-26-v7-recordings/<country>/<case>.json, .../README.mdInterfaces:
Produces: each file { country, case, recorded: "dd-mm-yyyy", request: { method, path, body }, status, answer }, answer as v7's server returned it, parsed when JSON. Cases per country: rates (GET /api/Tariffs/GetExchangeRates), preferences (GET /api/Tariffs/GetCountryPreferences), search-code-1006, search-words-rice, search-none, details-<code> for each product used, and estimates estimate-import-rice, estimate-import-<second product>, estimate-export-<product>, with amounts in the declaration currency (no conversion). Burundi's second product is a vehicle of 8703 with a cylinder capacity, Rwanda's a product with a percentage and a specific rate; the builder picks the codes from the search answers.
Consumes: the request shape v7's tariffs.js sends (read from the captured script; Estimate is a POST of taxEstimationPayload).
estimate-import-rice and one export per country are made by hand in the browser pane on the live page, the answer read from its network log, and the result screenshotted at 1 280 and 375 px into docs/step3/mockups/check/live-<country>-<case>-<width>.png; they count toward the six. The other estimates are sent by record.mjs with the same request.
Step 1: Write the failing test — tests/recordings.test.mjs: each country has the five lookups and two to six estimates; every estimate answered 200 with at least one charge line; no credential, cookie or token is kept (no key matching /key|token|cookie|authorization/i in any request).
Step 2: Run npm test — Expected: FAIL, no recordings.
Step 3: Implement and run record.mjs once (node tools/mockups/record.mjs), one second between calls; README states the date, the hosts and that the estimates were real requests to OBR and RRA through v7, agreed by melux on 26-10-2026.
Step 4: Run npm test — Expected: PASS.
Step 5: Commit v7's live answers recorded, five lookups and up to six estimates per country.
Files:
docs/step3/mockups/standin/route.mjs, docs/step3/mockups/standin/standin.js, docs/step3/mockups/scenarios.json, docs/step3/mockups/answers/<country>/*.json (copied from Task 3, plus hand-written failures), tests/standin.test.mjsInterfaces:
Produces: route(request: { method, url, body }, scenario: Scenario, answers: Map<string, Answer>) -> { status: number, body: any, delayMs: number } in route.mjs (pure, no DOM). Scenario = { id, country, group, label, label_fr, reach: [string], answers: { "<METHOD> <path pattern>": "<answer file>" } }; Answer = the recording shape of Task 3. standin.js reads ?scenario= from the frame's address, loads scenarios.json and the answers, and registers $.ajaxTransport('+*', ...) for URLs starting /api/Tariffs/, case-insensitive, answering through route.
Hand-written answers, in the shape v7 receives: estimate-field-refused (400 with v7's error list), estimate-external-freight-zero (bare SERVER-ERROR), estimate-customs-refused (4xx from customs), estimate-timeout (no answer within v7's 30 s; delayMs 31000), estimate-credentials (401), rates-empty (200 []), rates-missing-currency (no rate for one listed currency).
scenarios.json covers every state of the design's table, each with reach, the clicks that get there from an empty page.
Step 1: Write the failing tests — tests/standin.test.mjs: a recorded request gets its recording verbatim (body deep-equals the file's answer); paths match case-insensitively (/api/tariffs/search?query=1006 and /api/Tariffs/Search?query=1006); an unknown code is an empty 200 (GET /api/Tariffs/GetCommodityDetails/9999999999 → { status: 200, body: null } and Search?query=zzz → { status: 200, body: [] }, as v7's server answers); a failure scenario overrides the estimate (estimate-credentials → 401); every scenario names answers that exist; every state of the design has a scenario (a list of the table's states in the test, each matched by one label).
Step 2: Run npm test — Expected: FAIL.
Step 3: Implement route.mjs and standin.js.
Step 4: Run npm test — Expected: PASS.
Step 5: Check by eye: /docs/step3/mockups/v7/bi/public.fr.html?scenario=estimate-import-rice, follow its reach, the result matches the recording line by line.
Step 6: Commit A stand-in answers v7's tariff requests from the recordings.
Files:
docs/step3/mockups/index.html, docs/step3/mockups/shell.js, docs/step3/mockups/shell.css, tests/shell.test.mjsInterfaces:
Consumes: manifest.json (Task 2), scenarios.json (Task 4).
Produces: framesFor(manifest, scenarios, choice: { country, page, lang, scenario }) -> { src: string, langs: string[], scenarios: Scenario[] } exported from shell.js as an ES module; index.html shows four selects and an <iframe> at the page's width, plus a width toggle 1 280 / 375. The shell's look is the docs site's (../../docs.css variables), never v7's.
Step 1: Write the failing tests — tests/shell.test.mjs: only captured languages are offered (framesFor for rw/embed returns exactly the manifest's languages); the frame address carries the scenario (src ends ?scenario=<id>); scenarios are those of the country.
Step 2: Run npm test — Expected: FAIL.
Step 3: Implement shell.js, index.html, shell.css.
Step 4: Run npm test — Expected: PASS; then in the browser pane switch country, page, language, scenario and width, and see the frame follow.
Step 5: Commit The mockups' shell: country, page, language, scenario, width.
Files:
docs/step3/mockups/mockup/tariffs.js (v7's tariffs.js from the capture, with marked edits), docs/step3/mockups/mockup/differences.mjs, docs/step3/mockups/mockup/texts.js, tools/mockups/diff.mjs, docs/step3/mockups/v7-to-mockup.diff, tests/differences.test.mjstools/mockups/capture.mjs so each captured page loads mockup/tariffs.js instead of v7's, and re-run it.Interfaces:
Produces, in differences.mjs (pure, imported by the tests and by mockup/tariffs.js through a classic-script global window.mockupDifferences): roundOnce(value: number) -> number (two decimals, half away from zero); rateLabel(rate: number, date: string, source: string, lang: 'en'|'fr') -> string (rate to six decimals); localBeside(total, chosenCode, localTotal, localCode, lang) -> string. Texts in texts.js: notice, outOfDate, rateFrom, localOriginal, each { en, fr }; any other language takes en.
Every edit in mockup/tariffs.js sits between // [mockup Dn …] and // [/mockup]. diff.mjs writes v7-to-mockup.diff (unified, v7's captured file against the mockup's).
The edits: 1 · D4 the notice under #total-amount-due after every result; 2 · D23, D52 declarationAmount returns roundOnce(value) instead of Math.round(value); 3 · D53 the currency menus use what the rates answer quotes, less the installation's exclusions (XDR, DTS, ZWD, VEF, MRO, FRF, SKK, KPW, BAM, ZIG), the local currency always — v7 since 7.6.48 already does this, so the edit only applies where the capture shows otherwise, and the manifest notes which; 4 · D33, D54 any change of a form field after a result adds the class mockup-out-of-date to the result (dimmed, the outOfDate text above it) until the next estimate, while a new product or a tab switch still calls resetEstimateResult(); 5 · D46, D47 under the total, the local-currency total and rateLabel(...) from the rates answer's date and the customs service's name.
Step 1: Write the failing tests — tests/differences.test.mjs: roundOnce keeps cents (roundOnce(0.769231) → 0.77; roundOnce(100 / 1300) → 0.08, where v7 sent 0); rateLabel shows six decimals (rateLabel(2971.5, '24-10-2026', 'OBR', 'fr') contains 2 971,500000 and 24-10-2026 and OBR); every hunk is marked (each hunk of v7-to-mockup.diff contains [mockup D); five differences, no more (the markers name exactly D4, D23, D53, D54 and D46).
Step 2: Run npm test — Expected: FAIL.
Step 3: Implement differences.mjs, texts.js, the five marked edits, diff.mjs; re-run capture.mjs's rewrite; run node tools/mockups/diff.mjs.
Step 4: Run npm test — Expected: PASS.
Step 5: Check by eye in the browser pane, each difference in its scenario and absent where it does not apply (difference 4: change the quantity after a result, then change the product).
Step 6: Commit The five differences from v7, each marked.
Files:
docs/step3/index.md, docs/step3/index.fr.md, docs/step3/differences.md, docs/step3/differences.fr.mddocs/data/progress.json, docs/data/progress.fr.json (step 3: href step3/index.html; gate 1 now, label first pass), docs/data/documents.json, docs/data/documents.fr.json (the three pages), docs/index.md, docs/index.fr.md ("Next" card)Interfaces:
index.md: what the mockups are, the link to mockups/index.html, the table of states with each scenario's reach (generated by hand from scenarios.json, one row per scenario), the design and the plan. differences.md: the five differences, each with its decision, its scenario and the hunk's line in v7-to-mockup.diff; the languages that fall back to English; the manifest's notes.
Step 1: Write the four pages and the data changes.
Step 2: Run npm run fr:stamp -- docs/step3/index.fr.md docs/step3/differences.fr.md && npm run build && npm test — Expected: build without a late or missing French page; tests pass.
Step 3: Commit Step 3's pages: the mockups' index and what differs from v7.
Files:
docs/step3/check.md, docs/step3/check.fr.md, docs/step3/mockups/check/<country>-<state>-<width>.pngInterfaces:
Consumes: everything above. One row per check of the design's "How it is checked": state, country, width, live screenshot, mockup screenshot, verdict (same, differs as decided with the difference's number, differs with what).
Step 1: For each country at 1 280 and 375 px, screenshot the live page and the mockup in each state the live site reaches without an estimate; for one import and one export per country, the result (the mockup from Task 3's recording; the live side from Task 3's live-*.png, no new estimate).
Step 2: Reach every scenario by its reach clicks; open print and CSV on both sides.
Step 3: Write check.md and its French twin; each differs row is fixed in the task that owns it and checked again, or listed as a known difference with its reason.
Step 4: Run npm run fr:stamp -- docs/step3/check.fr.md && npm run build && npm test — Expected: clean.
Step 5: Commit The mockups checked against the live sites.