Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
b315a33
Read the API origin and sign-in settings from the environment
anth-volk Oct 12, 2026
886645c
Add Auth0 sign-in and save associations to the account when signed in
anth-volk Oct 12, 2026
c08e16a
Back v3 reforms and reports with the account API; remove the Next dat…
anth-volk Oct 12, 2026
459dedf
Add sign-in menu, account page, and first-sign-in import of local work
anth-volk Oct 12, 2026
1955b26
List only v3 reforms in the account reform store
anth-volk Oct 12, 2026
e7bb14b
Pin Auth0 browser SDK dependencies to releases over two weeks old
anth-volk Oct 12, 2026
5c1f062
Ignore import skips that come back without a client_ref
anth-volk Oct 12, 2026
e26e8d9
Show saved work as loading while the sign-in session is restored
anth-volk Oct 13, 2026
0658446
Stop saving to this browser when the signed-in account cannot be loaded
anth-volk Oct 13, 2026
910bd3d
Record import items the server did not accept, and stop re-offering
anth-volk Oct 13, 2026
803754d
Treat local-only IDs the same way in every account store
anth-volk Oct 13, 2026
6ca48b5
Keep one person's account data out of the next session on a shared br…
anth-volk Oct 13, 2026
d3c8304
Make the fallback messages for 409 and 422 accurate
anth-volk Oct 13, 2026
58c425c
Name the local-store lookup callbacks
anth-volk Oct 13, 2026
78fcd13
Make saved-work writes wait for the sign-in session to be restored
anth-volk Oct 13, 2026
d0b9b81
Tell the user when a created item could not be added to saved work
anth-volk Oct 13, 2026
e2e867c
Share one helper for saved-work stores and their wait for the session
anth-volk Oct 13, 2026
a601cdf
Load each saved reform's changes separately and cache v1 policies
anth-volk Oct 13, 2026
0772378
Write saved work in the item's country, and list report labels per se…
anth-volk Oct 13, 2026
1486153
Keep v3 reforms out of the legacy Policies list when signed in
anth-volk Oct 13, 2026
56c64d3
Offer each account this browser's signed-out work it has not imported
anth-volk Oct 13, 2026
1a02a63
Fail session waits when the auth provider goes away, and name conflic…
anth-volk Oct 13, 2026
f9093aa
Show the save-failure notice only for account saves
anth-volk Oct 13, 2026
a8e9cbe
Return the legacy calculator to browser-only storage
anth-volk Oct 13, 2026
7b69c0d
Sign in only in the v3 workspace, as one of two states
anth-volk Oct 13, 2026
d729649
Keep v3 off legacy storage and open only account IDs when signed in
anth-volk Oct 13, 2026
51286ba
Copy this browser's v3 work into an account when sign-in creates it
anth-volk Oct 13, 2026
98e4077
Describe v3-only sign-in, and hide it outside the US and UK
anth-volk Oct 13, 2026
689663c
Merge origin/main into feat/v3-user-login
anth-volk Oct 13, 2026
f5dd276
Move browser-saved v3 work into the account at every sign-in
anth-volk Oct 13, 2026
333b680
Create a reform's v1 policy when it is saved while signed out
anth-volk Oct 13, 2026
9b78de2
Say what a browser reform keeps beside its v1 policy ID
anth-volk Oct 13, 2026
cb66d9b
Save a reform before running its report, and link every reform run
anth-volk Oct 13, 2026
ba65531
Keep Build's draft working across sign-in, session end and deletion
anth-volk Oct 13, 2026
6b98447
Run only reports that change the law, and offer sign-in only in the U…
anth-volk Oct 13, 2026
21dbbfb
Save signed-out work to the Public API as the browser's unauthenticat…
anth-volk Oct 14, 2026
b475562
Send no label with the base policies v3 creates
anth-volk Oct 14, 2026
abddbbb
Style the sign-in upgrade notice as a v3 panel
anth-volk Oct 14, 2026
1332e60
Group the More menu with Build and Reforms in the v3 top bar
anth-volk Oct 14, 2026
cd0938a
Merge origin/main: keep v3 storage on the Public API, bring over the …
anth-volk Oct 14, 2026
6e18e87
Keep a report's budget window on its saved record
anth-volk Oct 14, 2026
8fcc858
Merge origin/main: keep v3 storage on the Public API, bring over the …
anth-volk Oct 14, 2026
06f65a3
Link v3 reports by their saved report, which anyone can open
anth-volk Oct 15, 2026
957783f
Merge origin/main: keep v3 storage on the Public API, bring over the …
anth-volk Oct 15, 2026
37d123d
Re-run and reopen account reports with their year, window and comparison
anth-volk Oct 15, 2026
a87463b
Leave no signed-in work in this browser from main's per-country draft…
anth-volk Oct 15, 2026
9984565
Merge origin/main a fourth time: keep the v3 save-then-run flow, take…
anth-volk Oct 15, 2026
2e43948
Keep a report's comparison when its record no longer names the reform
anth-volk Oct 15, 2026
f53a752
Run the draft as it was saved, whatever is edited during the save
anth-volk Oct 15, 2026
b8a2fc1
Make a browser user only where it is sent: signed out in the US and UK
anth-volk Oct 15, 2026
e4a6de6
Hold an account's drafts when a load cannot restore its session
anth-volk Oct 15, 2026
ca70700
Clamp saved names by character, never splitting an emoji
anth-volk Oct 15, 2026
5c52d47
Merge origin/main a fifth time: keep v1 policies label-free, take #13…
anth-volk Oct 15, 2026
1795637
Treat current law as unknown until the model's metadata loads
anth-volk Oct 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,43 @@ Format code:
make format
```

## Sign-in and saved work (v3 workspace)

The v3 workspace (the flagship shell: Ask, Build, Reforms, reports and the
account page) can sign users in with social sign-on (Auth0) and save their
reforms and reports to their PolicyEngine account through the PolicyEngine
API (`/v2/me` and `/v2/user-*`). It is off unless all of these are set at
build time (see `calculator-app/.env.example`), alongside
`NEXT_PUBLIC_FLAGSHIP_SHELL=true`:

| Variable | Purpose |
| --- | --- |
| `NEXT_PUBLIC_AUTH_ENABLED` | `true` turns sign-in on |
| `NEXT_PUBLIC_AUTH0_DOMAIN` | Auth0 (custom) domain |
| `NEXT_PUBLIC_AUTH0_CLIENT_ID` | SPA application for the environment |
| `NEXT_PUBLIC_AUTH0_AUDIENCE` | PolicyEngine API resource server identifier |
| `NEXT_PUBLIC_API_URL` | PolicyEngine API origin (default `https://api.policyengine.org`); set to the staging API on staging |

- On the US and UK workspace, saved reforms and reports always go to the
PolicyEngine API. Signed in, they belong to the account. Signed out, they
belong to this browser's unauthenticated user: a random UUID made on the
first visit, kept in localStorage (`pe-browser-user-id`) with no expiry,
and sent as the `PolicyEngine-Unauthenticated-User` header. It is the
credential for that work, so it never goes in a URL or a log.
- A saved reform is a pointer to its PolicyEngine API policy (with its
name, baseline and origin); its changes are read back from the policy.
Running a report creates its policy, simulations and report in the API.
- Signing in upgrades the browser's unauthenticated user
(`POST /v2/me/upgrade`): on a first sign-in it becomes the account, so
everything saved stays; for an existing account its work moves into that
account. The browser then starts over with a new UUID. A failed upgrade
keeps the UUID, so the next sign-in tries again.
- With sign-in off, and outside the US and UK, saved work stays in this
browser, in v3's own keys.
- The legacy calculator (policies, households, simulations and reports
built outside the workspace) has no sign-in and keeps its saved work in
localStorage, as before. v3 never reads or writes that storage.

## Project structure

```
Expand Down
3 changes: 2 additions & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"chromatic": "VITE_APP_MODE=website chromatic --only-changed --build-script-name='storybook:build'"
},
"dependencies": {
"policyengine-household-wizard": "^0.1.0",
"@auth0/auth0-react": "2.27.0",
"@policyengine/ui-kit": "^0.4.0",
"@reduxjs/toolkit": "^2.8.2",
"@tabler/icons-react": "^3.34.0",
Expand All @@ -53,6 +53,7 @@
"html-to-image": "^1.11.13",
"jsonp": "^0.2.1",
"lucide-react": "^0.575.0",
"policyengine-household-wizard": "^0.1.0",
"radix-ui": "^1.4.3",
"react": "^19.1.0",
"react-dom": "^19.1.0",
Expand Down
109 changes: 0 additions & 109 deletions app/src/adapters/ReformAdapter.ts

This file was deleted.

Loading
Loading