Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
193 commits
Select commit Hold shift + click to select a range
aba5967
Allow spaces in registration first and last names
claude Oct 17, 2026
b370960
Keep schema.sql in sync with committed migrations only
claude Oct 17, 2026
085f136
perf: maintain registration positions per event instead of refreshing…
rvirtaha Oct 17, 2026
d552198
fix: bound Postgres pools to the connection budget and fail fast on e…
rvirtaha Oct 17, 2026
1c778b5
perf: coalesce eventRegistrations notifications to one per event per …
rvirtaha Oct 17, 2026
74c5414
test: add registration stampede stress harness
rvirtaha Oct 17, 2026
09e35bc
Merge branch 'feat/registration-stampede-fixes' into feat/registratio…
rvirtaha Oct 17, 2026
6914bf7
fix: promote from the queue under the per-event positions lock
rvirtaha Oct 17, 2026
31ec6f6
Only prefill registration names when the split is unambiguous
claude Oct 17, 2026
496ea02
payments: add paymentsEnabled flag and fee maths to @app/lib
claude Oct 17, 2026
c7e9f04
payments: expose Query.paymentsEnabled and lazy Stripe client
claude Oct 17, 2026
26d6f6f
Store first and last names from Keycloak and prefill registrations wi…
claude Oct 17, 2026
0805b62
docs: document the stress test harness
rvirtaha Oct 17, 2026
7c72034
style: lint and format the stress harness
rvirtaha Oct 17, 2026
e87c201
chore: commit pending migrations as 000005
rvirtaha Oct 17, 2026
56b17fc
Apply uncommitted migrations before running e2e tests
claude Oct 17, 2026
818849c
fix: keep question options with their question when reordering or rem…
ainokotiranta Oct 17, 2026
2763aa2
test: make stress runs fail loudly instead of looking clean
rvirtaha Oct 17, 2026
03f5006
fix: email the earliest queued registration of the quota on promotion
rvirtaha Oct 17, 2026
8439719
test: cover the queue promotion lock and positions against the refere…
rvirtaha Oct 17, 2026
8af4585
feat: add an MCP server for browsing events and registering
Henrisal Oct 17, 2026
13a1bcd
feat: rate limit signed-in registrations per user instead of per IP
Henrisal Oct 17, 2026
acc486b
fix: keep the throttle relay running when a publish fails
rvirtaha Oct 17, 2026
3e95369
fix: log unexpected GraphQL errors on the server
rvirtaha Oct 17, 2026
5f01808
docs: note that WORKER_POOL_MAX is read from the process environment
rvirtaha Oct 17, 2026
b8e9687
Merge branch 'feat/registration-stampede-fixes' into feat/registratio…
rvirtaha Oct 17, 2026
805eec3
payments: database schema and functions (phase 2)
claude Oct 17, 2026
33cfc82
fix: reset editor state when switching description language
ainokotiranta Oct 17, 2026
2ee22ab
fix: give dev realm users the default roles so MCP clients get offlin…
Henrisal Oct 17, 2026
a57cd17
fix: email everyone who leaves the queue when positions are recomputed
rvirtaha Oct 17, 2026
9a04a05
fix: keep unsaved event edits on locale switch and guard editor docum…
ainokotiranta Oct 17, 2026
4a46849
fix: release root pool clients in Cypress server commands
rvirtaha Oct 17, 2026
3fc6d95
payments: fix phase 2 review findings
claude Oct 17, 2026
becf40c
payments: Stripe checkout and webhook (phase 3)
claude Oct 17, 2026
55a5ff2
test: always release redis, pools and worker utils in server test tea…
claude Oct 17, 2026
0d197fa
fix: block registration updates after signup has closed
rvirtaha Oct 17, 2026
c321eb1
fix: answer GET and DELETE on /mcp with 405
Henrisal Oct 17, 2026
0750d7b
payments: worker tasks and emails (phase 4)
claude Oct 17, 2026
55c7cfc
Merge branch 'payments-p4' (phase 4: worker tasks and emails)
claude Oct 17, 2026
83273c6
test: cover MCP access token verification and the /mcp routes
Henrisal Oct 17, 2026
c5707c1
docs: document the MCP server, its Keycloak client and local testing
Henrisal Oct 17, 2026
677a3e4
config: honour an explicit TEST_REDIS_URL
ccruzkauppila Oct 17, 2026
2ec4146
feat: type event and registration times into boxes instead of scrolling
ainokotiranta Oct 17, 2026
8d8cedc
payments: admin UI (phase 6)
ccruzkauppila Oct 17, 2026
1a79762
payments: participant UI (phase 5)
ccruzkauppila Oct 17, 2026
f4b423e
payments: fix phase 6 review findings
ccruzkauppila Oct 17, 2026
de92f66
Merge branch 'payments-p6' (phase 6: admin UI)
ccruzkauppila Oct 17, 2026
0fc3f1b
payments: fix phase 5 review findings
ccruzkauppila Oct 17, 2026
6b87b58
feat: hide email preview tab in event form outside development
ainokotiranta Oct 17, 2026
1e132d7
Merge branch 'payments-p5' (phase 5: participant UI)
ccruzkauppila Oct 17, 2026
f88ffe2
payments: e2e tests and docs (phase 7)
ccruzkauppila Oct 17, 2026
e562be0
payments: fix phase 7 review findings
ccruzkauppila Oct 17, 2026
d447016
Merge branch 'payments-p7' (phase 7: e2e tests and docs)
ccruzkauppila Oct 17, 2026
0c2b1fe
payments: webhook, checkout and refund robustness fixes
ccruzkauppila Oct 17, 2026
4cb05da
payments: admin and UI follow-ups
ccruzkauppila Oct 17, 2026
947a888
payments: fix tableUtils test typing
ccruzkauppila Oct 17, 2026
de4ecae
Merge phase 7 into the fix pass
ccruzkauppila Oct 17, 2026
1a42482
payments: fix fix-pass review findings
ccruzkauppila Oct 17, 2026
0376bf2
Merge branch 'payments-fix' (review follow-ups fix pass)
ccruzkauppila Oct 17, 2026
daa4ec6
feat: prefill Telegram and dietary restriction answers in registrations
Henrisal Oct 17, 2026
76537c5
feat: custom ribbon text for highlighted events
Henrisal Oct 17, 2026
66eb861
feat: pick prefill questions from the question type select
Henrisal Oct 17, 2026
067cd1a
feat: let admins create draft events over MCP
Henrisal Oct 17, 2026
713b705
chore: commit current migrations as 000005
Henrisal Oct 17, 2026
71525ae
feat: sticky event form footer with tab navigation and save controls
ainokotiranta Oct 17, 2026
55ccb8d
Merge main into feature/stripe-payments-7apjoq
claude Oct 19, 2026
f0c1546
worker: declare pg as a dev dependency for test helpers
claude Oct 19, 2026
80e4948
Lint staged files on commit and skip e2e on docs-only PRs
claude Oct 19, 2026
c8c833b
Don't fail installs where husky isn't present
claude Oct 19, 2026
85c264a
tests: prune redundant payment tests
claude Oct 19, 2026
20be578
fix: make local development work on Windows
kallishuone Oct 17, 2026
b8e84ad
feat: mark required tabs in the event form
kallishuone Oct 17, 2026
deebedd
feat: add event and quota templates to the event form
kallishuone Oct 17, 2026
613d295
feat: add a registration form preview to the event form
kallishuone Oct 17, 2026
c724de7
feat: let question option fields grow to show their whole text
kallishuone Oct 17, 2026
6478937
fix: keep the page width stable when the scrollbar appears
kallishuone Oct 17, 2026
8afe77e
feat: fill in event and registration times from a single day click
kallishuone Oct 17, 2026
4860560
feat: celebrate new events and registrations with confetti
kallishuone Oct 17, 2026
38296e6
fix: widen the admin side menu so labels don't run into the arrow
kallishuone Oct 17, 2026
ca52dc1
fix: require a regular quota even when the event has an open quota
kallishuone Oct 17, 2026
a7b1bf0
feat: call the open quota an overflow quota and explain how it works
kallishuone Oct 17, 2026
eb91c9d
fix: show the add and remove icons as plain outlines
kallishuone Oct 17, 2026
b517561
feat: add a demo data script with realistic events
kallishuone Oct 17, 2026
43f3328
Add calendar options and registration email invitations
sleeeski Oct 17, 2026
5731469
Add registration reminders with saved preferences
sleeeski Nov 9, 2026
126f5f1
chore: integrate staged-file linting and docs-only e2e skip (#82)
ccruzkauppila Nov 20, 2026
f0f5060
chore(db): commit pending migrations as 000005
ccruzkauppila Nov 20, 2026
88c043a
feat(client): merge event form fixes and sticky footer (#80)
ccruzkauppila Nov 20, 2026
25a047c
ci: check migration file naming and committed migrations
ccruzkauppila Nov 20, 2026
f526e0b
docs: describe the current/ migration workflow in CONTRIBUTING.md
ccruzkauppila Nov 20, 2026
404fddc
refactor(client): move the typed time picker out of the event form ma…
ccruzkauppila Nov 20, 2026
f5b5ed1
refactor(client): extract event form value mapping into EventForm/val…
ccruzkauppila Nov 20, 2026
b2b26d4
feat(worker): pass optional attachments through send_email
ccruzkauppila Nov 20, 2026
b85f82e
refactor(worker): build registration emails in one module with contri…
ccruzkauppila Nov 20, 2026
1cc8852
test(worker): add worker jest project and registration email builder …
ccruzkauppila Nov 20, 2026
5f0105f
test(db): round-trip every event input attribute through create_event…
ccruzkauppila Nov 20, 2026
25c43ff
test(server): cover CSRF protection behaviour
ccruzkauppila Nov 20, 2026
d34d9cd
feat(client): merge event templates, form preview and registration co…
ccruzkauppila Nov 20, 2026
53e743d
feat(db): add feature flags and developer permission
ccruzkauppila Nov 20, 2026
467a574
test(db): cover feature flag gates, switching and the developer role
ccruzkauppila Nov 20, 2026
6a07823
refactor(client): fold the day click into the typed time picker
ccruzkauppila Nov 20, 2026
bf595da
refactor(server): declare external routes in one registry
ccruzkauppila Nov 20, 2026
c5bb3a1
refactor(client): put event templates behind one switch
ccruzkauppila Nov 20, 2026
94109b3
refactor(client): put registration confetti behind one switch
ccruzkauppila Nov 20, 2026
c4b6018
refactor(client): put the registration form preview behind one switch
ccruzkauppila Nov 20, 2026
d1c74e7
test(e2e): cover event templates, the form preview and the day click
ccruzkauppila Nov 20, 2026
732f87c
test(db): merge the event input round-trip test
ccruzkauppila Nov 20, 2026
da96572
feat(client): merge the event form base and event templates
ccruzkauppila Nov 20, 2026
7da64d3
feat(lib): add the feature flag registry
ccruzkauppila Nov 20, 2026
734b24b
test(db): check the flag registry against the table and SQL gates
ccruzkauppila Nov 20, 2026
d26f968
test: add feature flag and developer user helpers
ccruzkauppila Nov 20, 2026
0e40e70
feat(auth): stamp users.is_developer from the ilmo-developer role
ccruzkauppila Nov 20, 2026
5cbf5d6
feat(server): read feature flags and record their availability
ccruzkauppila Nov 20, 2026
08e2421
feat(worker): add withFeature for tasks gated by a feature flag
ccruzkauppila Nov 20, 2026
c92a2e1
test(e2e): add Cypress server commands for flags and developers
ccruzkauppila Nov 20, 2026
da1d5e5
refactor(worker): merge the registration email builder
ccruzkauppila Nov 20, 2026
d84e9d3
refactor(server): merge the external route registry
ccruzkauppila Nov 20, 2026
1e74b3b
feat: merge event ribbon text (#78)
ccruzkauppila Nov 20, 2026
59b8152
refactor(client): move the ribbon text inputs into a field component
ccruzkauppila Nov 20, 2026
b3cfe34
feat(db): list the features an admin sees only as a preview
ccruzkauppila Nov 20, 2026
6ba8ab2
feat: put the event ribbon text behind one switch
ccruzkauppila Nov 20, 2026
8c6298d
docs(db): state the update_event attribute rule in its comment
ccruzkauppila Nov 20, 2026
c842480
test(e2e): set a ribbon text when updating an event
ccruzkauppila Nov 20, 2026
2b00032
feat(client): fetch enabled features with the shared layout query
ccruzkauppila Nov 20, 2026
f33bc11
feat(components): add useFeature, <Feature> and the preview tag
ccruzkauppila Nov 20, 2026
6f3294e
feat(admin): restrict pages to developers and show them a Features entry
ccruzkauppila Nov 20, 2026
70020de
refactor(server): merge external route registry
ccruzkauppila Nov 20, 2026
120b0be
feat: merge rate limiting of registrations per user (#75)
ccruzkauppila Nov 20, 2026
019ebd0
feat(server): answer 404 on external routes while their feature flag …
ccruzkauppila Nov 20, 2026
eb1388d
feat: merge calendar invites and registration reminders (#83)
ccruzkauppila Nov 20, 2026
66d07c7
fix(worker): send waitlist confirmations and skip unfinished registra…
ccruzkauppila Nov 20, 2026
ce1afd7
feat: merge MCP server (#75)
ccruzkauppila Nov 20, 2026
7fcbd35
feat(admin): add the Features page for switching feature flags
ccruzkauppila Nov 20, 2026
ef9b2ff
test(e2e): cover the Features page and who can reach it
ccruzkauppila Nov 20, 2026
72ac90c
feat: gate calendar invites, reminders and Telegram behind feature flags
ccruzkauppila Nov 20, 2026
b3465d8
test(components): compile component tests without type checking
ccruzkauppila Nov 20, 2026
0ef9e52
ci: run the unit tests a second time with every feature flag on
ccruzkauppila Nov 20, 2026
7264bcb
feat: merge MCP server and registration rate limiting
ccruzkauppila Nov 20, 2026
dbae575
feat: merge event ribbon text, event form base and event templates
ccruzkauppila Nov 20, 2026
01f4a37
refactor(lib): build registration form initial values in one function
ccruzkauppila Nov 20, 2026
8aa945f
fix: integrate blocking registration updates after signup closes (#76)
ccruzkauppila Nov 20, 2026
4d5f813
fix: integrate names with spaces and Keycloak first and last names (#73)
ccruzkauppila Nov 20, 2026
6f40d20
test(server): close signup through the database in updateRegistration…
ccruzkauppila Nov 20, 2026
6395702
feat(registration): prefill Keycloak first and last names behind keyc…
ccruzkauppila Nov 20, 2026
51c9824
feat(db): commit migration 000008
ccruzkauppila Nov 20, 2026
4585f7a
feat: merge Stripe payments (#81)
ccruzkauppila Nov 20, 2026
5d0cd76
feat(server): rate limit Checkout Session creation
ccruzkauppila Nov 20, 2026
f24e3cb
feat: integrate per-event registration positions and bounded pools (#74)
ccruzkauppila Nov 20, 2026
870e827
fix(db): toggle registration position triggers in fake data scripts
ccruzkauppila Nov 20, 2026
6466ce8
fix: turn live queries off and load the event page with a query
ccruzkauppila Nov 20, 2026
bf13bc6
feat(db): commit migration 000009
ccruzkauppila Nov 20, 2026
7303c11
feat: merge prefilled registration answers (#77)
ccruzkauppila Nov 20, 2026
fbe33b2
feat(registration): gate prefill answers and save them only on opt-in
ccruzkauppila Nov 20, 2026
de8d69f
ci: drop the all-flags-on unit test job
ccruzkauppila Nov 20, 2026
dd7f57f
fix(test): bound jest memory by recycling one test worker
ccruzkauppila Nov 20, 2026
99a2e31
feat: merge event form, templates, ribbon text, reminders, MCP and pa…
ccruzkauppila Nov 20, 2026
ef35f10
feat: merge prefilled registration answers
ccruzkauppila Nov 20, 2026
3dd7db7
feat(client): read every client gate from the feature flags
ccruzkauppila Nov 20, 2026
4d9824d
feat(db): commit the ribbon text migration as 000010
ccruzkauppila Nov 20, 2026
f412483
fix(db): leave the empty placeholder out of migration 000010
ccruzkauppila Nov 20, 2026
aa3f74d
feat(db): commit the client-only feature flag migration as 000011
ccruzkauppila Nov 20, 2026
9a2d649
feat(db): commit the calendar invites migration as 000012
ccruzkauppila Nov 20, 2026
29b76a4
feat(db): commit the registration reminders migration as 000013
ccruzkauppila Nov 20, 2026
5ceecfc
feat(db): commit the Telegram reminders migration as 000014
ccruzkauppila Nov 20, 2026
441e77c
feat(db): commit the MCP sessions migration as 000015
ccruzkauppila Nov 20, 2026
ffe3203
feat(db): commit the payments migration as 000016
ccruzkauppila Nov 20, 2026
eb6bd4f
feat(db): commit the prefilled registration answers migration as 000017
ccruzkauppila Nov 20, 2026
f20b6f0
test(e2e): switch on the flags the event form specs need
ccruzkauppila Nov 20, 2026
737480c
test(server): add the quota price to the admin update snapshot
ccruzkauppila Nov 20, 2026
e205311
test(e2e): wait for the flags in the templates spec and unfold the ca…
ccruzkauppila Nov 20, 2026
f6daa84
docs: drop design board numbers from payment comments
ccruzkauppila Nov 20, 2026
77e1724
fix(db): clear blank registration names before the new name check
ccruzkauppila Nov 20, 2026
f3b0675
docs: point stale references at the committed migrations
ccruzkauppila Nov 20, 2026
eb9a76a
fix(db): keep a question's prefill when updateEvent omits it
ccruzkauppila Nov 20, 2026
0d0e5e8
docs: describe the payment rules instead of citing a missing document
ccruzkauppila Nov 20, 2026
63e4bfb
test(components): cover the client-only flags in the event form and card
ccruzkauppila Nov 20, 2026
f6bceab
fix(components): render the event form only after the flags load
ccruzkauppila Nov 20, 2026
367c167
fix(client): keep the reminder settings reachable for removal
ccruzkauppila Nov 20, 2026
dc21b77
feat(components): do not offer Admins only for flags admins cannot pr…
ccruzkauppila Nov 20, 2026
1107244
fix(client): wait for the shared query before rendering the event page
ccruzkauppila Nov 20, 2026
4ffdae5
fix(components): keep event form edits when the cached event is rewri…
ccruzkauppila Nov 20, 2026
d2e4f8b
test(e2e): expect the CSRF error when the event page loads
ccruzkauppila Nov 20, 2026
0bd0a6e
refactor(db): simplify payments to pay-after-close without refunds
ccruzkauppila Nov 21, 2026
3377146
refactor(server): open Pay only after registration closes and drop re…
ccruzkauppila Nov 21, 2026
9f90898
refactor(worker): drop refunds and the Stripe client
ccruzkauppila Nov 21, 2026
bea9db1
refactor(graphql): drop payment mode, refund and price snapshot fields
ccruzkauppila Nov 21, 2026
1ac870c
refactor(lib): drop refund and payment mode states
ccruzkauppila Nov 21, 2026
4dd874c
feat(client): show payment notice and no-refund warnings
ccruzkauppila Nov 21, 2026
7430931
test(e2e): pay after registration closes, warn on paid deletes
ccruzkauppila Nov 21, 2026
3a1718b
docs(payments): describe pay-after-close and manual refunds
ccruzkauppila Nov 21, 2026
33adcf8
fix(client): describe the payments flag without payment settings
ccruzkauppila Nov 21, 2026
fd662a1
test(server): update admin delete registration error snapshots
ccruzkauppila Nov 21, 2026
3c09027
test(db): keep moved registration close before the event start
ccruzkauppila Nov 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 8 additions & 0 deletions .env.ci
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,11 @@ PORT=5678
ROOT_URL=http://localhost:5678
ENABLE_CYPRESS_COMMANDS=1
REDIS_URL=redis://127.0.0.1:6379

# Stripe is not configured with this file, so the `payments` feature flag is
# unavailable: jest runs with payments off and the server tests set the
# Stripe variables themselves. The sharded Cypress job in
# .github/workflows/e2e.yml appends dummy keys. Never put real Stripe keys
# here.
# STRIPE_SECRET_KEY=sk_test_...
# STRIPE_WEBHOOK_SECRET=whsec_...
34 changes: 32 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,35 @@ jobs:
docker run --rm -v "$PWD:/repo" -w /repo \
rhysd/actionlint:1.7.7 -color

migrations:
name: Migration files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0

- name: Check current/ prefixes are unique
run: node scripts/check-migrations.mjs current

# Maintainers commit migrations. Their own migration-commit PRs carry the
# `migration-commit` label; the label is read from the API, not the event
# payload, so re-running the job after labelling picks it up.
- name: Check the PR leaves committed/ unchanged
if: github.event_name == 'pull_request'
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: |
set -euo pipefail
labels=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER" --jq '.labels[].name')
if grep -qxF migration-commit <<< "$labels"; then
echo "::notice::Label migration-commit is set; committed/ changes are allowed."
exit 0
fi
node scripts/check-migrations.mjs committed "$BASE_SHA"

lint:
name: Lint & depcheck
runs-on: ubuntu-latest
Expand Down Expand Up @@ -114,8 +143,9 @@ jobs:
run: pnpm build

- name: Test
# --runInBand: debezium/postgres has a single replication slot,
# so parallel jest workers race on it.
# One test file at a time: debezium/postgres has a single replication
# slot, so parallel jest workers race on it. scripts/test.mjs runs the
# files in one worker that jest restarts to bound its memory.
run: pnpm test --ci --runInBand

docker:
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,18 @@ jobs:
uses: ./.github/actions/install-pg-dump

- name: Setup environment and database
# Stripe is configured here so that the payments_* specs can switch
# the `payments` flag on; the keys are dummies because the specs
# never reach Stripe (Checkout is stubbed and the webhook gets signed
# fake events from the completeStripeCheckout server command).
# `setup` resets the DB to committed migrations only; `watch --once`
# applies migrations/current/ on top, as `pnpm dev` does locally.
run: |
cp .env.ci .env
{
echo "STRIPE_SECRET_KEY=sk_test_dummy"
echo "STRIPE_WEBHOOK_SECRET=whsec_dummy"
} >> .env
CONFIRM_DROP=1 pnpm run setup
pnpm --filter @app/db run watch --once

Expand Down
36 changes: 33 additions & 3 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,55 @@ permissions:
actions: read

jobs:
# Lets docs-only PRs skip e2e. Pushes to main and manual runs always run it.
changes:
name: Detect changes
runs-on: ubuntu-latest
outputs:
code: ${{ steps.filter.outputs.code }}
steps:
- name: Check for changes outside docs
id: filter
if: github.event_name == 'pull_request'
uses: dorny/paths-filter@v4
with:
predicate-quantifier: every
filters: |
code:
- "**"
- "!**/*.md"
- "!docs/**"

ci:
uses: ./.github/workflows/ci.yml
secrets: inherit

e2e:
needs: [changes]
if: github.event_name != 'pull_request' || needs.changes.outputs.code == 'true'
uses: ./.github/workflows/e2e.yml
secrets: inherit

all-checks:
name: All checks passed
runs-on: ubuntu-latest
needs: [ci, e2e]
needs: [changes, ci, e2e]
if: always()
steps:
- name: Verify all required jobs succeeded
env:
CHANGES_RESULT: ${{ needs.changes.result }}
CI_RESULT: ${{ needs.ci.result }}
E2E_RESULT: ${{ needs.e2e.result }}
E2E_SKIPPABLE: ${{ github.event_name == 'pull_request' && needs.changes.outputs.code != 'true' }}
run: |
set -euo pipefail
if [ "${{ needs.ci.result }}" != "success" ] || [ "${{ needs.e2e.result }}" != "success" ]; then
echo "ci=${{ needs.ci.result }} e2e=${{ needs.e2e.result }}"
echo "changes=$CHANGES_RESULT ci=$CI_RESULT e2e=$E2E_RESULT e2e_skippable=$E2E_SKIPPABLE"
if [ "$CHANGES_RESULT" != "success" ] || [ "$CI_RESULT" != "success" ]; then
exit 1
fi
# e2e may only be skipped when the PR touches docs alone
if [ "$E2E_RESULT" != "success" ] && ! { [ "$E2E_RESULT" = "skipped" ] && [ "$E2E_SKIPPABLE" = "true" ]; }; then
exit 1
fi

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ cache
.agignore
*.tsbuildinfo
.ethereal
/@app/worker/email.local.json
.DS_Store
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm exec lint-staged
14 changes: 13 additions & 1 deletion @app/__tests__/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ export const createUsers = async (
client: PoolClient,
count: number = 1,
verified: boolean = true,
isAdmin: boolean = false
isAdmin: boolean = false,
isDeveloper: boolean = false
): Promise<SnakeCasedProperties<User>[]> => {
const users = []
if (userCreationCounter > 25) {
Expand Down Expand Up @@ -73,6 +74,17 @@ export const createUsers = async (
]
)
).rows[0]
if (isDeveloper) {
// Not settable through really_create_user: developer rights come from
// Keycloak or a direct update only.
const {
rows: [developer],
} = await client.query(
"update app_public.users set is_developer = true where id = $1 returning *",
[user.id]
)
Object.assign(user, developer)
}
user._email = email
user._password = password
users.push(user)
Expand Down
57 changes: 49 additions & 8 deletions @app/__tests__/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { readdirSync } from "node:fs"
import { resolve } from "node:path"
import { Pool, PoolClient } from "pg"

import type { FeatureFlagState, FeatureKey } from "@app/lib"

export {
constructAnswersFromQuestions,
createEventCategories,
Expand Down Expand Up @@ -63,6 +65,8 @@ export const deleteTestEventData = (pool: Pool) => {
// We're not using withRootDb because we don't want the transaction rolled back
return pool.query(
`BEGIN;
delete from app_public.payments;
delete from app_private.stripe_events;
delete from app_private.registration_secrets;
delete from app_public.registrations;
delete from app_public.quotas;
Expand All @@ -79,10 +83,26 @@ export const deleteTestEventData = (pool: Pool) => {
)
}

/**
* The flag state every test starts from: off, or on when the suite runs with
* TEST_FEATURE_FLAGS=on, see scripts/test.mjs.
*/
export const featureFlagBaseline = (): FeatureFlagState =>
process.env.TEST_FEATURE_FLAGS === "on" ? "on" : "off"

// Also marks every flag available again: a server booted by a test records
// the availability of integration-backed flags from its own environment.
export const resetFeatureFlags = (pool: Pool) =>
pool.query(
"update app_public.feature_flags set state = $1, available = true where state <> $1 or not available",
[featureFlagBaseline()]
)

export const deleteTestData = async () => {
const pool = poolFromUrl(TEST_DATABASE_URL)
await deleteTestUsers(pool)
await deleteTestEventData(pool)
await resetFeatureFlags(pool)
}

/* Quickly becomes root, does the thing, and then reverts back to previous role */
Expand All @@ -105,6 +125,35 @@ export const asRoot = async <T>(
}
}

/******************************************************************************/
// Feature flags

/**
* Sets the state of a feature flag directly, bypassing the developer check
* and the audit log. With a pool the change is committed; with a client it
* belongs to the client's transaction. deleteTestData switches every flag
* back off. Fails for a key without a row, which means the migration that
* adds the feature has not run.
*/
export const setFeatureFlag = async (
client: Pool | PoolClient,
key: FeatureKey,
state: FeatureFlagState
) => {
const update = (c: Pool | PoolClient) =>
c.query(
"update app_public.feature_flags set state = $2 where key = $1 returning key",
[key, state]
)
const { rowCount } =
client instanceof Pool ? await update(client) : await asRoot(client, update)
if (!rowCount) {
throw new Error(
`Feature flag "${key}" has no row in app_public.feature_flags`
)
}
}

/******************************************************************************/
// Job helpers

Expand Down Expand Up @@ -195,14 +244,6 @@ export async function claimRegistrationToken(eventId: string, quotaId: string) {
}
}

export const refreshMaterializedView = async (client: PoolClient) => {
// Become root
await client.query("reset role")
client.query(
"refresh materialized view app_hidden.registrations_status_and_position"
)
}

export const getEmails = () => global["TEST_EMAILS"]

export const clearEmails = () => {
Expand Down
6 changes: 4 additions & 2 deletions @app/client/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ module.exports = {
"/settings/delete": ["settings"],
"/settings/emails": ["settings"],
"/settings/security": ["settings"],
"/settings/reminders": ["settings", "reminders"],
"/invitations/accept": ["invitations"],
"/create-event-category": ["events"],
"/update-registration/[updateToken]": ["register_event"],
"/update-registration/[updateToken]": ["register_event", "payments"],
"/pay/[updateToken]": ["payments"],
"rgx:^/admin": ["admin", "events", "home", "register_event"],
"rgx:^/event": ["events", "register_event"],
"rgx:^/event": ["events", "register_event", "reminders"],
},
loadLocaleFrom: (lang, ns) =>
import(`./src/translations/${lang}/${ns}.json`).then((m) => m.default),
Expand Down
Loading
Loading