feat(frontend): burgerapp in de browser die via FSC voor Burgers met elk RegelHet praat en lokaal voorspelt #42
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/burgerapp"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds the citizen's own app in the browser: a static build of
frontend-regelhet(--mode burgerapp) that talks to every RegelHet on its list over FSC voor Burgers, keeps its key in the browser, and predicts the decision on the device before the citizen applies. There is no backend: a backend would hold the keys of every citizen.Builds on #39 (
gegevens,/fsc4b/regelwerken,bundel_hash, CORS), now on main.What it does
src/burgeromgeving/vervoer/fsc4b.ts, beside Tauri and the cookie. The citizen's screens (dossier, record, application form) are reused unchanged; the core insrc/burgeromgeving/fsc4b/kern.tsanswers the same commands as the Rust core of the desktop app (kernSessieis shared).fsc4b/client.ts,fsc4b/jose.ts), mirroringpackages/fsc4b/src/client.rs: demo Stelsel, test Activatiedienst, CreateSession, encrypted calls with the idempotency key inside, one new session on a 401. WebCrypto plus thejoselibrary;jose.test.tsreads the panva/jose vectors thatjose.rschecks the server against.fsc4b/opslag.ts): a P-256CryptoKeywithextractable: false, in IndexedDB, per RegelHet. Activation is once per RegelHet from the list inregelhets.json. The screens say the key is software.KeuzeView.vue): the list of RegelHets with their activation state; pick one, activate with a test citizen, and the existing screens open on it. "Andere regeling kiezen" goes back to the list.VoorspellingPaneel.vue,fsc4b/voorspelling.ts,fsc4b/rekenen.ts), in a new slot on the application form (src/burger/voorspelling.ts) that only this transport fills:gegevensis read from its signature (organization key from the Stelseldocument,iss,sub, the copy beside it must match);/fsc4b/regelwerkenmust hash to the signedbundel_hash, then load into the chronolexografie kern as WASM, with the case ofgegevens.casuschosen;herstellen(decisions included, chronicle checks applied);brongegevens(the same function the executor signs) and every answer is put beside the signed one; a difference, or other regelwerk versions, shows as a critical error. A silent cell (null) reads "Niet bekend bij de regeling", not "nee";voorBeslissen. For each fact inbij_aanvraag(the GGD's advice) the app tries every combination of its yes/no fields (at most 4, 16 trial decisions) and shows the least that grants plus one line for the rest: "Als GGD Wilgendaal vaststelt: langdurige loopbeperking: Toegekend … In alle andere gevallen: Afgewezen". A passenger's card, which needs two findings together, is found that way. A procedure that hands out nothing (uitgevenempty) says so ("geeft nog geen gegevens uit"); the prediction then rests on the form and the facts after the application.The form's values reach only the kern until the citizen presses "Dien aanvraag in", which goes through the existing
indieningenrequest.Example
frontend-regelhet/burgerapp/regelhets.json(the chart writes the same from its values):A first application for testburger 999990032 on the real kern (
rekenen.wasm.test.ts):Kern (Rust)
bundel::met_bronnen: an empty bundle now holds no built-in cases, sonew Poc("{}", [bron])plays only the source. Before, it failed on the missingpackages/poc-chronolexografie/corpus/casussen. The chronolexografie poc always passes its own bundle, so its behavior does not change; testan_empty_bundle_plays_only_the_cases_of_its_sources.Spel::brongegevensandPoc.brongegevensexpose PR A'sbrongegevensto the browser, so the app compares the same function on both sides.Build and deployment
just burgerapp-wasmbuilds the kern intofrontend-regelhet/burgerapp/wasm/pkg/(gitignored);npm run build:burgerappcopies it beside the bundle and refuses to build without it.just burgerappruns the dev server on http://localhost:7150.frontend-regelhet/burgerapp/Dockerfile: WASM stage (as poc-portal), node build, unprivileged nginx. The CSP'sconnect-srccomes fromBURGERAPP_CONNECT_SRC;script/security-headers.test.mjsnow also checksnginx.conf.template..forgejo/workflows/burgerapp-image.yml: builds and pushesregelrecht/burgerapp:mainand:<commit>from main.charts/burgerapp: Deployment, Service, ConfigMap withregelhets.json, ListenerSet and HTTPRoute on the shared Gateway;connect-srcfrom the list's origins; refuses anhttpaddress. Linted in CI. Not deployed: the namespacetnt-rr-voorbeeld--burgerapp(functl) and the release come after merge, since the image builds from main, and on a hostname whose certificate can be issued. Each RegelHet on the list needs the app's origin inREGELHET_FSC4B_ORIGINS.Also in this PR
packages/poc-wetsgeschiedenis/tests/api.rs: the race-prone testeen_mislukt_dossier_wordt_onthouden_en_een_bezoeker_mag_het_opnieuwis removed (the task reports "fout" before the failed dossier is in the store, so it failed now and then in CI). The real fix is tracked in tdjager/regelrecht-agents#75..forgejo/workflows/ci.yml: new job "Burgerapp on the real kern" (pinned wasm-bindgen release with checksum,just burgerapp-wasm, the real-kern tests withBURGERAPP_WASM_VEREIST=1so a missing build fails instead of skipping), and a Helm check forcharts/burgerapp.Custom CSS
None. Only NLDD components (
nldd-list,nldd-tag,nldd-inline-dialog,nldd-banner,nldd-button, ...).Tests
fsc4b/jose.test.ts: interop vectors, non-extractable key, ES256,dir/A256GCM and ECDH-ES round trips with test keys, refused algorithms.fsc4b/kern.test.ts: activation against a RegelHet in memory that checks what the server checks; encrypted calls, session renewal, no demo, withdrawal, one key per RegelHet; the config list.fsc4b/rekenen.test.ts: replay grouping, answer and version comparison (nullis notfalse), conditional and certain predictions, the kern restored afterwards.fsc4b/rekenen.wasm.test.ts: the parking card on the real WASM kern: conditional first application, an earlier card replayed and recomputed (all answers equal, prediction certain: afgewezen), the passenger's card needing two findings, the kern unchanged after a prediction. Runs in the new CI job "Burgerapp on the real kern"; skipped elsewhere without the build.fsc4b/gegevens.test.ts:bundel_hashcomputation, signature/issuer/subject/copy checks, and that a source with another hash stops the prediction before the kern loads.fsc4b/VoorspellingPaneel.test.ts: mismatch display, conditional outcome, one outcome, errors.scheiding.test.ts: the new bundle reaches no back office, login or other transport; the Tauri bundle reaches nothing offsc4b/.packages/poc-chronolexografie/tests/spel.rs: a dossier with an earlier card, restored on chronicles of its own while the executor's also hold a second citizen, gives the samebrongegevens(answers and regelwerk versions).regelrecht-regelhetbuilt from main (FSC4B demo,REGELHET_FSC4B_ORIGINS=http://localhost:7150), cross-origin: list, activation as 999990032, dossier, signedgegevensverified and both answers "Klopt", conditional prediction (loopbeperking: Toegekend; geen: Afgewezen) with no network request during the prediction, then "Dien aanvraag in" over FSC4B: "Aanvraag ingediend".connect-src,application/wasm, 404 for a missing kern file.Docs:
docs/src/content/docs/components/regelhet-burgerapp.md.🤖 Generated with Claude Code
https://claude.ai/code/session_01XDZRnqjJJ2izeL3kP33bnv
Een statische build van frontend-regelhet (`--mode burgerapp`) met een derde transport, vervoer/fsc4b.ts. De app activeert zich per RegelHet bij diens test-Activatiedienst, houdt een niet-exporteerbare sleutel in IndexedDB en praat met de bestaande burgerschermen via dezelfde commando's als de bureaubladapp. Op het aanvraagformulier voorspelt een paneel het besluit op het apparaat, met de kern als WASM: de ondertekende gegevens naspelen, vergelijken met wat de kern zelf uitrekent, en voorwaardelijk op wat na de aanvraag nog komt (het advies van de GGD). bundel::met_bronnen: een lege bundel heeft geen eigen casussen, zodat `new Poc("{}", [bron])` alleen de bron speelt. Image (frontend-regelhet/burgerapp/Dockerfile), workflow en chart (charts/burgerapp) voor een Deployment met route. Claude-Session: https://claude.ai/code/session_01XDZRnqjJJ2izeL3kP33bnvUit de review: de voorspelling probeert elke combinatie van ja/nee-velden van een feit na de aanvraag (tot vier, zestien proefbesluiten) en toont het minste dat toekent plus één regel voor de rest, zodat een passagierskaart die twee bevindingen samen vraagt gevonden wordt. De app rekent niet als de regelwerken een andere hash hebben dan `bundel_hash` in de ondertekende gegevens, kiest de casus van de gegevens uit de bron, vergelijkt ook als de procedure niets uitgeeft ("geeft nog geen gegevens uit"), vergeet een credential dat de regeling weigert, wist een oude voorspelling als het formulier verandert en laadt het paneel alleen met open formulier. CI bouwt de kern als WASM en speelt de parkeerkaart daarop. Claude-Session: https://claude.ai/code/session_01XDZRnqjJJ2izeL3kP33bnvc833ef65afe482c5ca44