# Northline Workshops — repair handoff

## Deliverables and run instructions

- `output/site/index.html` — preserved workshop copy and title; accessible form markup.
- `output/site/style.css` — responsive dark-blue/orange layout.
- `output/site/app.js` — corrected calculator, validation and signup submission.
- `output/site/server.py` — byte-for-byte copy of the supplied server.
- `output/evidence/browser-submissions.jsonl` — three actual fake records created during browser checks, in observed order.
- `output/evidence/server-checks.json` — results of 20 in-process server-handler tests.
- `output/checks.py` — standard-library verification script used for those tests and record archival.
- `output/handoff.md` — this report, including browser evidence below.

Run:

```sh
cd output/site
python3 server.py
# Open http://127.0.0.1:8765
```

`PORT` can override the port. Successful requests create `submissions.jsonl` beside `server.py`. Browser test records were archived outside the runnable site and removed from its active record file; the delivery starts without test signups. Use fake `example.test` email addresses for further checks. These run/storage requirements come from `inputs/brief.md`, **Workshop site acceptance brief**, and `site/server.py`, **Handler.do_POST / __main__**.

## Fixes and decisions

1. **Storage:** changed the incorrect `/api/lead` URL to `/api/leads`, posting JSON `name`, `email`, and numeric `seats`. Success is shown only after an OK response with `ok: true`; errors are visible. The button is disabled while a request is pending to prevent concurrent clicks. Sources: `site/app.js`, **submit listener**; `site/server.py`, **Handler.do_POST**.
2. **Calculator:** changed multiplication by the discount rate into multiplication by `(1 - discount)`, then applied 12% tax. Valid totals display `CAD` with two decimals. Invalid seats show `CAD —` and an error instead of a misleading price. Source: `inputs/brief.md`, **Workshop site acceptance brief**; original defect in `site/app.js`, **calculateTotal**.
3. **Validation:** rejects empty/whitespace-only names, implausible emails, and blank/noninteger/out-of-range seats before posting. Inline field errors, `aria-invalid`, error descriptions, a live status message, and focus on the first invalid field were added. Native HTML constraints remain; JavaScript uses explicit inline validation so whitespace names and dotless email domains are handled consistently. The server is still the final validation authority. Sources: `inputs/brief.md`, **Workshop site acceptance brief**; `site/server.py`, **Handler.do_POST**.
4. **Mobile:** replaced the fixed-width shell with a fluid shell capped at the original 1120 px; grid columns collapse below 760 px. Inputs and buttons retain 18 px text and have a 48 px minimum height. Focus outlines and wrapping are explicit. Original workshop text, page title, and dark blue `#152a45` / orange `#e78136` are retained. Sources: `site/style.css`, **.shell / .layout / body / button rules**; `site/index.html`, **title / header / main content**; `inputs/brief.md`, **Workshop site acceptance brief**.
5. **Assumptions:** surrounding whitespace in name/email is incidental and is trimmed before storage. Email plausibility uses the supplied server's basic pattern plus the browser's email validity check; it is not deliverability verification. Eight seats is the per-request limit, not a global inventory system: the supplied server only validates each record. No inventory, email, dependencies, tracking, or external services were added.

## Browser checks actually performed

Tool: supplied local browser, loading `output/site`. Each call used a fresh browser; all actions needed for a submission were in that call. Its trusted server implements the original `/api/leads` behavior. Observations are **text, controls, error lists and overflow reports, not screenshots**.

**All 18 calls below returned `overflow: false` and `errors: []`.** Name, Email, Seats, and Request a place controls were present. Both required widths were exercised in initial, calculator, and form states. Successful clicks demonstrate usable controls in this browser; visual readability and physical touch behavior were not independently inspected.

| ID | Width | Actions / inputs | Observed result |
|---|---:|---|---|
| B01 | 1280 | Initial page | Workshop copy and form visible; `CAD 268.80` |
| B02 | 390 | Initial page | Workshop copy and form visible; `CAD 268.80` |
| B03 | 1280 | Submit Desktop Tester / desktop@example.test / 2 | `CAD 537.60`; “Thanks! Your workshop request is saved.” |
| B04 | 390 | Submit Mobile Tester / mobile@example.test / 3 | `CAD 725.76`; same success message |
| B05 | 1280 | Set seats to 8 | `CAD 1935.36` |
| B06 | 390 | Submit valid name/email with blank seats | Seat error; `CAD —`; not-saved message |
| B07 | 390 | Submit valid name/email with 0 seats | Seat error; `CAD —`; not-saved message |
| B08 | 390 | Submit valid name/email with -1 seats | Seat error; `CAD —`; not-saved message |
| B09 | 390 | Submit valid name/email with 1.5 seats | Seat error; `CAD —`; not-saved message |
| B10 | 390 | Submit valid name/email with 9 seats | Seat error; `CAD —`; not-saved message |
| B11 | 1280 | Submit untouched form (empty name/email, seats 1) | Name and email errors; not-saved message |
| B12 | 390 | Submit three spaces as name / tester@example.test / 1 | Name error; not-saved message |
| B13 | 1280 | Submit Email Tester / tester@example / 1 | Email error; not-saved message |
| B14 | 390 | Name `  Recovery Tester  `, recovery@example.test; submit seats 9, change to 8 and resubmit | Final state `CAD 1935.36`; success; stored name trimmed |
| B15 | 390 | Set seats to 2 | `CAD 537.60` |
| B16 | 1280 | Set seats to 3 | `CAD 725.76` |
| B17 | 1280 | Reload page | Initial form restored; `CAD 268.80` |
| B18 | 390 | Submit Email Tester / not-an-email / 1 | Email error; not-saved message |

B06–B10 used `Invalid Seat Tester` and `invalid-seats@example.test`, isolating seat validation. Exact observed messages:

- Seat error: “Enter a whole number of seats from 1 to 8.”
- Name error: “Enter your name.”
- Email error: “Enter a valid email address, such as name@example.test.”
- Not-saved status: “Please correct the highlighted fields. Your signup has not been saved.”

The browser's native `valid` flag remained true for whitespace-only names and `tester@example`; the custom inline errors correctly rejected them. No reliance was placed on native validity alone.

### Persistence evidence

Read `output/site/submissions.jsonl` after B03/B04: exactly two records existed (Desktop Tester, 2 seats; Mobile Tester, 3 seats). Read it again after B06–B13: it was unchanged, demonstrating those invalid submissions added no records.

After B14–B18, the verification script read and asserted the exact three records before archiving them to `output/evidence/browser-submissions.jsonl`:

| Evidence line | Name | Email | Integer seats |
|---:|---|---|---:|
| 1 | Desktop Tester | desktop@example.test | 2 |
| 2 | Mobile Tester | mobile@example.test | 3 |
| 3 | Recovery Tester | recovery@example.test | 8 |

Only the corrected B14 submission added a record; the malformed-email check added none. This is file-content evidence, not just a success message. B17 did not erase stored records.

### Calculator evidence

Required values: `inputs/brief.md`, **Workshop site acceptance brief**. Calculation: `seats × 240 × (seats >= 3 ? 0.90 : 1.00) × 1.12`.

| Seats | Subtotal | Discount | After discount | Tax | Expected/displayed CAD | Browser evidence |
|---:|---:|---:|---:|---:|---:|---|
| 1 | 240.00 | 0.00 | 240.00 | 28.80 | 268.80 | B01, B02 |
| 2 | 480.00 | 0.00 | 480.00 | 57.60 | 537.60 | B03, B15 |
| 3 | 720.00 | 72.00 | 648.00 | 77.76 | 725.76 | B04, B16 |
| 8 | 1920.00 | 192.00 | 1728.00 | 207.36 | 1935.36 | B05, B14 |

All four examples were observed in the browser at **both 390 and 1280 px**. Blank, 0, negative, fractional and 9 seats were checked in B06–B10.

## Additional local checks actually performed

Executed `output/checks.py` with the local Python runner; exit code 0, no stderr. It:

- Verified `output/site/server.py` is byte-identical to original `site/server.py` and compiled/executed its definitions.
- Invoked `Handler.do_POST` with in-memory request/response streams and a temporary storage directory (**not live HTTP transport**).
- Passed 4 valid cases (seats 1, 2, 3, 8): each returned 201, `{"ok":true}`, and added exactly one record.
- Passed 16 invalid cases: seats `""`, 0, -1, 1.5, 9, null, true, `"3"`; names empty, whitespace, null; emails empty, malformed, dotless-domain, null; and a non-object JSON payload. Each returned 400 and added zero records.
- Asserted and archived the three actual browser records, then removed the active test data from the runnable site.

Full case results: `output/evidence/server-checks.json`. Original input files were not edited. No package installation, external network access, or third-party libraries were used.

## Limitations and remaining work

- The browser tool supplies the original server endpoint; I did not launch a separate `python3 server.py` process and browse that process. The copied server was verified identical and its handler was tested separately as described above.
- No screenshots, real-device checks, cross-browser matrix, screen-reader pass, or keyboard-only navigation pass were performed. CSS sizes/focus styling were reviewed in code, not measured via browser geometry.
- Network failures, server write failures, rapid repeated requests, and error-response UI branches were not fault-injected. There is no server-side deduplication; a deliberate second successful submission can create a second record, as in the supplied server. A lost response after a write can therefore leave confirmation uncertain.
- No known acceptance failure remains in the tested cases. A human should allow **about 10 minutes (estimate, not measured)** to run the delivered server directly and perform a visual/keyboard smoke check at both widths. Broader browser/accessibility or reliability testing would be additional scope.
