docs: bring README up to date; fix test type errors
- README: deployed behind Caddy and a shared password, party size (1-20), multi-date signup (up to 24), coordinator notices, migration rule now that production has applied migrations, D1/D2/D5 status, and a current "still unverified" list. - tests: type the shiftRows helper and the speculation-rules JSON so `tsc -p tsconfig.json` passes with no errors.
This commit is contained in:
1 parent
16ef47d8bf
commit
085f2dc668
3 files changed
+42
-19
No files matched your search
@@ -10,7 +10,7 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
|
||||
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
**This is not ready for a public launch, and it is not ready for real volunteer records.** Phase 1A has public browsing, individual signup, cancellation, queued email, and coordinator sign-in for events, one-off shifts, rosters, and cancellation. A coordinator can add a walk-in and move a signup from a shift roster. A volunteer can switch shifts from their private link. An active weekly template fills shifts for the next three months. A coordinator can add, change, or end a weekly template, and can remove a cancelled person, a finished empty shift, an ended template, or an event that is off the public list and already empty. A confirmed signup can receive a reminder 48 hours before the shift and again 2 hours before, and can turn reminders off without cancelling. A coordinator can download a roster for one shift, one event, or a local date range. A coordinator can import a contact list, download it, open a person to see current and past shifts, use a saved contact when adding a walk-in, and add a saved contact to an open shift. A coordinator can set when reminder emails go out, where replies go, and how long signup details stay in the app. A signed-in administrator can add another administrator. Removing someone takes away their sign-in access. The last administrator cannot be removed. After 1:00 AM Central Time, signups older than that many months lose their name and contact details in this app. After 2:30 AM Central Time, the app saves a database backup on this computer. A container can run that same app on this computer, on port 3020, without opening it to the network. This is not a public launch. Around 1:00 AM in each event's time zone, the app adds any missing weekly shifts for the next eight weeks, once that local day. Development prints mail in the server log. It does not send real email.
|
||||
**This is deployed but not publicly launched.** It runs at `https://volunteer.hopefoodpantrysc.org` behind Caddy, and the whole site is behind a shared password until launch. Phase 1A has public browsing, signup for one or more people on one or more dates, cancellation, queued email, and coordinator sign-in for events, one-off shifts, rosters, and cancellation. A coordinator can add a walk-in and move a signup from a shift roster. A volunteer can switch shifts from their private link. An active weekly template fills shifts for the next three months. A coordinator can add, change, or end a weekly template, and can remove a cancelled person, a finished empty shift, an ended template, or an event that is off the public list and already empty. A confirmed signup can receive a reminder 48 hours before the shift and again 2 hours before, and can turn reminders off without cancelling. A coordinator can download a roster for one shift, one event, or a local date range. A coordinator can import a contact list, download it, open a person to see current and past shifts, use a saved contact when adding a walk-in, and add a saved contact to an open shift. A coordinator can set when reminder emails go out, where replies go, and how long signup details stay in the app. A signed-in administrator can add another administrator. Removing someone takes away their sign-in access. The last administrator cannot be removed. After 1:00 AM Central Time, signups older than that many months lose their name and contact details in this app. After 2:30 AM Central Time, the app saves a database backup on this computer. The container listens on `127.0.0.1:3020` only, and Caddy serves it over HTTPS. Around 1:00 AM in each event's time zone, the app adds any missing weekly shifts for the next eight weeks, once that local day. Development prints mail in the server log and does not send real email. Production sends through SMTP2GO.
|
||||
|
||||
## Current step
|
||||
|
||||
@@ -18,7 +18,10 @@ You should have received a copy of the GNU General Public License along with thi
|
||||
| --- | --- |
|
||||
| Configuration, database, time zones, fallback brand, fake seed | Done |
|
||||
| Public event and shift pages | Done |
|
||||
| Individual signup with capacity and duplicate checks | Done |
|
||||
| Signup with capacity and duplicate checks | Done |
|
||||
| Bring more than one person on a signup (up to 20) | Done |
|
||||
| Sign up for several dates in one form (up to 24) | Done |
|
||||
| Email coordinators when a volunteer signs up, cancels, switches, or changes party size | Done |
|
||||
| Cancel your own signup from its private link | Done |
|
||||
| Confirmation and cancellation email | Done |
|
||||
| Coordinator sign-in, events, one-off shifts, roster, and cancellation | Done |
|
||||
@@ -36,19 +39,21 @@ You should have received a copy of the GNU General Public License along with thi
|
||||
| Refill weekly shifts around 1:00 AM in each event time zone | Done |
|
||||
| Remove personal details after the saved retention period | Done |
|
||||
| Save a database backup after 2:30 AM Central Time | Done |
|
||||
| Run the app in Docker and check that a restart keeps the database | Ready for review |
|
||||
| Run the app in Docker and check that a restart keeps the database | Done |
|
||||
| Deploy behind Caddy with a shared password before launch | Done |
|
||||
| Public launch (remove the shared password) | Not started |
|
||||
|
||||
The core tables for later steps are already in `migrations/001_init.sql`. Behavior for those tables is not built yet. While this database only holds fake seed data, the schema can still change by replacing that first migration. After a database you care about has applied it, the app refuses to start if the file is edited. Add a new numbered file instead.
|
||||
The schema starts in `migrations/001_init.sql` and each later change is its own numbered file. The production database has applied every migration in this folder. The app refuses to start if an applied file is edited, so never change one. Add a new numbered file instead.
|
||||
|
||||
## Decisions still open
|
||||
|
||||
Do not treat this repository as an approved operating setup.
|
||||
|
||||
- [ ] **D1.** SMTP2GO is the email provider. The pantry verifies the sender and the reply-to.
|
||||
- [ ] **D2.** Whether a group signup is essential. A shared email can already sign up more than one person on the same shift. Each person takes one spot and gets their own confirmation and private link. The same person, matched by name and email, cannot take a second spot on that shift. `group_size` stays 1. Group signup still needs its own decision: who the reservation is for, what happens when the count changes, and who receives mail.
|
||||
- [ ] **D1.** SMTP2GO is the email provider. The pantry verifies the sender and the reply-to. Production already sends through SMTP2GO; the pantry's sign-off on the sender and reply-to is still open.
|
||||
- [x] **D2.** Group signup is built as a party size. One signup can hold 1 to 20 people. Only the person who signs up is named, and only they receive mail. The extra people take spots but are not stored by name. The count can be changed from the private link while spots are open. A shared email can also sign up other people separately, and each of them gets their own confirmation and private link. The same person, matched by name and email, cannot take a second signup on that shift.
|
||||
- [ ] **D3.** The pantry approves how long signup details are kept, including copies and exports.
|
||||
- [ ] **D4.** The pantry confirms the coordinator list, who owns the administrator account, and the recovery contact.
|
||||
- [ ] **D5.** Configure production Turnstile keys and the allowed hostname.
|
||||
- [ ] **D5.** Configure production Turnstile keys and the allowed hostname. Production keys are set; the hostname and action checks have not been tested on the live site.
|
||||
- [ ] **D6.** The host owner confirms the offsite backup destination, who owns it, the recovery target, and a restore test.
|
||||
|
||||
## TODO(Phase 2)
|
||||
@@ -72,7 +77,7 @@ npm run seed
|
||||
|
||||
Open `/` for the weekly pantry sign-up page. **View** starts on **List**: a card for each day with a shift in the next three months, split into that day's shifts. Each shift lists the names of the people who are signed up. A shift that has already ended stays on that day's card, grayed out, until midnight in the event's time zone. At midnight the day leaves the list. Emails, phone numbers, and notes stay off the page. **Calendar** is the other choice in that menu, at `/?view=calendar`, and it stops at that same three-month date. A shift later than that date is left off both views, and the signup form does not take a reservation for it. `/e/weekly-pantry` is the same seeded event. `/healthz` returns `{"ok":true,"database":"ok"}` and nothing else. A shift shows how many spots are filled, such as 3/5 spots filled. A shift with space left uses a soft green label. A full shift uses a soft red label.
|
||||
|
||||
An open shift has a signup form. It asks for one person. Another person can use the same email and takes another spot. The same person cannot take a second spot. The form needs JavaScript because of the Turnstile check. Wait a few seconds after the page loads before submitting. The confirmation page shows a private link and says a confirmation email is on the way. That page works without JavaScript. Cancel this signup there to open the spot again. A cancellation email is queued, and a confirmation that has not been sent yet is dropped. That person can sign up again once the cancellation is saved. Someone else can use the email while the first signup is still confirmed. A cancelled signup stays on that private page until the link expires. A private link controls only that signup. Use the separate link for each signup.
|
||||
An open shift has a signup form. It asks for a first name, last name, email, and phone, with optional notes. **How many people** offers 1 to 20, and never more than the spots left. A signup for 3 people fills 3 spots, and only the person signing up is named. The form also lists every other open shift on the public list, from any published event, and up to 24 can be ticked in one submit. Full, ended, cancelled, and not-yet-open shifts are left out. Each date is its own signup, with its own confirmation email and private link. If any date cannot be saved, none are, and the form says which date to leave unchecked. Another person can use the same email and takes their own signup. The same person cannot sign up twice for one shift. The form needs JavaScript because of the Turnstile check. Wait a few seconds after the page loads before submitting. The confirmation page shows a private link and says a confirmation email is on the way. That page works without JavaScript. Cancel this signup there to open the spot again. A cancellation email is queued, and a confirmation that has not been sent yet is dropped. That person can sign up again once the cancellation is saved. Someone else can use the email while the first signup is still confirmed. A cancelled signup stays on that private page until the link expires. A private link controls only that signup. Use the separate link for each signup. On that page, **How many people** changes the party size. A larger number needs that many spots open. A smaller number gives spots back. Coordinators get an email when the count changes.
|
||||
|
||||
With `MAIL_DRIVER=console`, the development server tries to send queued mail every 30 seconds and prints each accepted message in its terminal. That is not delivery to a real inbox. `sent` means the driver accepted the message. A lost result is marked uncertain and is not sent again. SMTP2GO is the mail provider. Set `MAIL_DRIVER=smtp2go` and `SMTP2GO_API_KEY` to send through it. Postmark and SES remain available.
|
||||
|
||||
@@ -82,9 +87,9 @@ Coordinator sign-in is at `/login`. The first time the app starts with an empty
|
||||
|
||||
After sign-in, `/admin` lists events, including events that are off the public list. A coordinator can add and edit an event, show or hide it, add and edit a one-off shift, read that shift's roster, cancel one signup, or cancel the shift. Cancelling a shift marks each confirmed signup cancelled, queues a cancellation email, and takes that shift off the upcoming list. The shift stays stored, so a template does not add that date again. **Cancel selected**, on the event page, does this for each open shift that is checked. A shift that has already ended is left out of that batch. A time or role change emails the people who are signed up and replaces their private links. The old link stops working when that email is queued. A location change emails each person once, covering every shift of theirs that has not ended, and leaves those signup links in place. Saving shows how many people that email will reach before it is sent.
|
||||
|
||||
On an open shift, **Add a walk-in** records one person who is here. It takes one spot, uses the same person rule as the public form, and queues a confirmation email. The name is listed on the public sign-up page when that shift is posted there. Email and notes stay off that page. A full, cancelled, or ended shift does not take a walk-in.
|
||||
On an open shift, **Add a walk-in** records a person who is here, and can include how many people came with them. It takes that many spots, uses the same person rule as the public form, and queues a confirmation email. The name is listed on the public sign-up page when that shift is posted there. Email and notes stay off that page. A full, cancelled, or ended shift does not take a walk-in.
|
||||
|
||||
**Move to** puts that person on another open shift in the same event. The first shift gets its spot back and keeps the signup as cancelled. The other shift takes one spot. A change email is queued, and a reminder that is still waiting is dropped. The old private link stops working. The new link is in the change email. A full, cancelled, or ended shift cannot receive the person. A shift that already has that person cannot receive them again. Someone else at the same email can. A failed move leaves them on the original shift.
|
||||
**Move to** puts that person on another open shift in the same event. The first shift gets its spots back and keeps the signup as cancelled. The other shift takes as many spots as the signup holds, so a party needs that much room. A change email is queued, and a reminder that is still waiting is dropped. The old private link stops working. The new link is in the change email. A full, cancelled, or ended shift cannot receive the person. A shift that already has that person cannot receive them again. Someone else at the same email can. A failed move leaves them on the original shift.
|
||||
|
||||
On the private signup page, **Switch to** does the same thing for the volunteer. The next page has the new link. A full, cancelled, ended, or unpublished shift is not offered. A switch is rejected if that name and email already occupy the destination shift. The destination list does not reveal which other shifts match those details. If the switch cannot be saved, the original signup stays.
|
||||
|
||||
@@ -157,7 +162,7 @@ SQLite runs in WAL mode with foreign keys on. Migrations in `migrations/` are ap
|
||||
|
||||
There is no cascade delete. **Remove this shift** still refuses a shift that has anyone on the roster. A coordinator cancels a signup, or cancels or ends the shift, before that removal. Ending a template deletes each shift from it that has already ended, including the signups on it. A shift from that template that has not ended is cancelled instead, so the cancellation email can still be sent. Removing an ended template detaches any shifts that are still stored. An event can be removed when it is taken off the public list; that removal deletes the shifts, templates, and signups on it.
|
||||
|
||||
Confirmed signups have a partial unique index on shift, normalized email, and name, without regard to case. Normalization of the email is trim, Unicode normalize, and lowercase. Dots and plus-tags stay. A different person can use that email and takes their own spot. Anonymized rows clear the name and email, so they do not collide with that index. New signups always store `is_minor` as 0 with null guardian fields; legacy columns remain for older rows. `group_size` cannot be anything but 1.
|
||||
Confirmed signups have a partial unique index on shift, normalized email, and name, without regard to case. Normalization of the email is trim, Unicode normalize, and lowercase. Dots and plus-tags stay. A different person can use that email and takes their own spot. Anonymized rows clear the name and email, so they do not collide with that index. New signups always store `is_minor` as 0 with null guardian fields; legacy columns remain for older rows. `group_size` is the party size, from 1 to 20, and capacity counts the sum of `group_size` on confirmed signups.
|
||||
|
||||
`reminders_sent.queued_at` means the reminder was queued. `sent_at` means a provider accepted it. Queueing mail is not delivery. A closer reminder that replaces an older overdue one is stored as not sent.
|
||||
|
||||
@@ -279,4 +284,12 @@ The command prints the coordinator id, not the address. It does not deactivate a
|
||||
|
||||
## What is still unverified
|
||||
|
||||
Real inbox delivery, a production host, and a public launch. The container was checked on this computer with a temporary database, separate from the development database: it starts, the weekly page loads, `/healthz` answers, a path prefix is included in that health address, and a restart keeps the database. The development settings were refused. This computer does not have the Docker daemon running, so that check used Podman. It has not been deployed. Decision D6 is still open. The console driver only prints mail. SMTP2GO is the selected provider and is not connected on this computer yet. Gmail is not connected. A real Turnstile hostname check still needs the production keys from decision D5. Development uses Cloudflare's always-pass test keys. Those keys succeed with hostname `example.com` and no action, so the hostname and action checks apply to real keys. Coordinator sign-in is covered here with the console driver, not with a real inbox.
|
||||
The app is deployed with Docker behind Caddy, and the whole site is behind a shared password until the public launch. Production uses SMTP2GO, real Turnstile keys, and the Compose `TRUST_PROXY` subnet. The nightly backup runs there.
|
||||
|
||||
Still not checked:
|
||||
|
||||
- Inbox delivery beyond the provider accepting the message. `sent` means SMTP2GO accepted it, not that it reached an inbox or stayed out of spam.
|
||||
- The Turnstile hostname and action checks on the live hostname (D5).
|
||||
- The two-client rate-limit check through Caddy described under Docker.
|
||||
- An offsite copy of the backups and a restore test (D6). Today the backups stay on the same server as the database.
|
||||
- A public launch. Removing the shared password is a separate step.
|
||||
@@ -292,11 +292,13 @@ describe('public pages', () => {
|
||||
const rules = await app.request('/speculation-rules.json');
|
||||
expect(rules.status).toBe(200);
|
||||
expect(rules.headers.get('content-type')).toContain('application/speculationrules+json');
|
||||
const body = await rules.json();
|
||||
expect(body.prefetch[0].eagerness).toBe('moderate');
|
||||
expect(body.prefetch[0].where.and[1].not.selector_matches).toContain('[data-confirm]');
|
||||
expect(body.prefetch[0].where.and[1].not.selector_matches).toContain('[data-open-event]');
|
||||
expect(body.prefetch[0].where.and[1].not.selector_matches).toContain('[data-signup]');
|
||||
const body = (await rules.json()) as {
|
||||
prefetch: { eagerness: string; where: { and: { not: { selector_matches: string } }[] } }[];
|
||||
};
|
||||
expect(body.prefetch[0]!.eagerness).toBe('moderate');
|
||||
expect(body.prefetch[0]!.where.and[1]!.not.selector_matches).toContain('[data-confirm]');
|
||||
expect(body.prefetch[0]!.where.and[1]!.not.selector_matches).toContain('[data-open-event]');
|
||||
expect(body.prefetch[0]!.where.and[1]!.not.selector_matches).toContain('[data-signup]');
|
||||
});
|
||||
|
||||
it('prefixes routes and assets when the app is mounted at /volunteer', async () => {
|
||||
|
||||
+10
-2
@@ -243,13 +243,21 @@ function templateInput(overrides: Partial<{ weekday: number; role: string; capac
|
||||
};
|
||||
}
|
||||
|
||||
function shiftRows(db: Awaited<ReturnType<typeof openDb>>) {
|
||||
type ShiftRow = {
|
||||
occurrence_date: string | null;
|
||||
role: string;
|
||||
capacity: number;
|
||||
template_revision: number | null;
|
||||
cancelled: number;
|
||||
};
|
||||
|
||||
function shiftRows(db: Awaited<ReturnType<typeof openDb>>): ShiftRow[] {
|
||||
return db
|
||||
.prepare(
|
||||
`SELECT occurrence_date, role, capacity, template_revision, cancelled
|
||||
FROM shifts ORDER BY occurrence_date`,
|
||||
)
|
||||
.all();
|
||||
.all() as ShiftRow[];
|
||||
}
|
||||
|
||||
async function openDb() {
|
||||
|
||||
Reference in new issue
Block a user