docs: record demo access task report
This commit is contained in:
@@ -1,50 +1,74 @@
|
||||
# Task 1 Report — Migración V3→V4 + tipos compartidos
|
||||
# Task 1 Report - AgendaMax demo access references
|
||||
|
||||
## Files changed
|
||||
- `H:\MegaSync\Proyectos\AgendaPro\server\db.ts`
|
||||
- Added `migrateV3ToV4()` immediately before `export function runMigrations()`.
|
||||
- Registered `migrateV3ToV4();` as the last call inside `runMigrations()` (after `migrateV2ToV3();`).
|
||||
- `H:\MegaSync\Proyectos\AgendaPro\shared\types.ts`
|
||||
- Replaced `Business` interface to add booking fields (`booking_enabled`, `cancel_window_hours`, `cancel_penalty_pct`, `require_deposit`, `deposit_pct`, `timezone`) and v4 fields (`auto_assign_specialist`, `working_hours`).
|
||||
- Added `WorkingDay` and `WorkingHoursMap` types after the `Business` interface.
|
||||
- Added `specialties`, `working_hours`, `efficiency_score` to the `Employee` interface (after `service_ids?`).
|
||||
## Status
|
||||
|
||||
## Verification
|
||||
Complete for the source and documentation layer. Local and production SQLite data were not touched.
|
||||
|
||||
### `npm run typecheck` output (last line)
|
||||
## Changed files
|
||||
|
||||
Implementation commit `6355d18a07b5bef6fd3515b80a0f768b0ae1050b` (`docs: standardize AgendaMax demo access`) changed:
|
||||
|
||||
- `README.md` - added an explicit `Contraseña` column with `demo1234` for all eight demo accounts; changed only Admin and Dueño to `@agendamax.demo`.
|
||||
- `server/index.ts` - changed the fresh default owner email.
|
||||
- `server/scripts/seed.ts` - changed fresh admin and owner emails; retained `demo1234`.
|
||||
- `src/pages/LoginPage.tsx` - changed only the development default owner email.
|
||||
- `admin-test.mjs`, `e2e-test.mjs`, `e2e-full.mjs`, `server/scripts/booking-e2e.mjs`, `visual-audit.mjs` - aligned active platform login fixtures and assertions.
|
||||
- `docs/superpowers/plans/2026-07-26-auto-assign-specialist-booking-redesign.md` - aligned its copy-pasteable booking login example.
|
||||
|
||||
The current untracked Task 1 brief, design, and migration plan were not modified or staged. The completed Task 5 report was classified as historical and was not modified. No employee email domain or password was changed.
|
||||
|
||||
## TDD evidence
|
||||
|
||||
### RED
|
||||
|
||||
The five executable login fixtures were updated before the source constants. A read-only source assertion was then run against `server/index.ts`, `server/scripts/seed.ts`, and `src/pages/LoginPage.tsx`. It failed as expected with `AssertionError` because `[email protected]` and `[email protected]` were not yet present while the old source constants remained.
|
||||
|
||||
The focused runtime visual check was also attempted before source changes:
|
||||
|
||||
```text
|
||||
npm run audit:visual
|
||||
page.goto: net::ERR_CONNECTION_REFUSED at http://localhost:5173/
|
||||
```
|
||||
> [email protected] typecheck
|
||||
> tsc -b --noEmit
|
||||
```
|
||||
Exit code 0 — **0 errors**. (Output was just the script banner + the tsc command echo; tsc prints nothing on success.)
|
||||
|
||||
### tsx column check output (verbatim)
|
||||
```
|
||||
businesses has auto_assign_specialist: true
|
||||
businesses has working_hours: true
|
||||
employees has specialties: true
|
||||
employees has working_hours: true
|
||||
employees has efficiency_score: true
|
||||
schema_version: [Object: null prototype] { value: '4' }
|
||||
business working_hours backfilled: true
|
||||
```
|
||||
The check was run twice (second run for idempotency): identical output both times, no errors, schema_version stable at `4`.
|
||||
This did not reach the application and did not touch the database.
|
||||
|
||||
## Deviations from the plan
|
||||
- None in the actual code edits. The `migrateV3ToV4` function, the `runMigrations` body, and all type additions match the plan verbatim.
|
||||
- Verification detail: the plan's one-liner `npx tsx -e "..."` command failed under Windows PowerShell 5.1 because PowerShell parsed the embedded double-quoted SQL string (`"SELECT value FROM meta WHERE key='schema_version'"`) as terminating the outer `-e` argument, producing an "Unterminated string literal" esbuild error. To get a clean result without altering any project code, the check was executed via a throwaway `.mjs` file placed in the pre-approved temp dir (`C:\Users\URIELJ~1\AppData\Local\Temp\opencode`) that imports `server/db.ts` via an absolute `file:///H:/MegaSync/Proyectos/AgendaPro/server/db.ts` URL. The file was deleted after running. No project files were created or modified beyond `server/db.ts` and `shared/types.ts`.
|
||||
### GREEN
|
||||
|
||||
After the minimal source and README edits, the corrected read-only assertion passed:
|
||||
|
||||
```text
|
||||
source and active login fixtures: PASS
|
||||
```
|
||||
|
||||
The final active-reference and README credential assertion also passed:
|
||||
|
||||
```text
|
||||
active references and README credentials: PASS
|
||||
```
|
||||
|
||||
## Tests and outputs
|
||||
|
||||
- `npm run typecheck` - passed, exit code 0; `tsc -b --noEmit` reported no errors.
|
||||
- `npm run build` - passed, exit code 0; Vite transformed 2463 modules and built in 5.63s.
|
||||
- `npm run test:unit` - passed: 39 tests, 39 pass, 0 fail.
|
||||
- `npm run audit:visual` - unavailable: no server was listening on `localhost:5173` (`ERR_CONNECTION_REFUSED`).
|
||||
- `npm run lint` - unavailable: ESLint 9.39.5 could not find `eslint.config.js`, `eslint.config.mjs`, or `eslint.config.cjs`.
|
||||
- `rg -n ...` - unavailable because `rg` is not installed/on PATH in this environment. The equivalent scoped repository search found no old domain in active application, README, fixture, or executable plan references.
|
||||
- `git diff --cached --check` - passed before the implementation commit.
|
||||
|
||||
The database-mutating API suites (`test:e2e`, `test:admin`, and `test:booking`) were not run because this task explicitly forbids touching the ignored local database. They remain for the post-migration verification task.
|
||||
|
||||
## Self-review
|
||||
|
||||
- **All `Business` fields from the plan added?** Yes — interface body matches the plan exactly, including `booking_enabled`, `cancel_window_hours`, `cancel_penalty_pct`, `require_deposit`, `deposit_pct`, `timezone`, `auto_assign_specialist`, `working_hours`. The DB already has the v3 booking columns from `migrateV2ToV3`, so the type is now honest vs. the DB.
|
||||
- **Does `migrateV3ToV4` guard with `schema_version >= "4"`?** Yes — first line of the function is `if (getMeta("schema_version") >= "4") return;`, mirroring the v2/v3 pattern. String comparison is safe here because the values are single-digit ASCII numerics ("3" < "4").
|
||||
- **Is the backfill idempotent?** Yes, in two layers:
|
||||
1. The schema-version guard short-circuits the entire function on subsequent runs.
|
||||
2. Even if that guard were bypassed, the backfill UPDATE is gated by `WHERE working_hours IS NULL`, so businesses whose `working_hours` was already filled (e.g. by the user via PATCH `/settings`) are never overwritten. Confirmed by the second run producing identical output.
|
||||
- **Column-add idempotency:** Each ALTER is guarded by `columnExists(...)` — re-running against a DB that already has the column is a no-op.
|
||||
- **Backfill content matches the plan's default** (`1..5 = 09:00-20:00`, `6,7 = null`), which replicates the previously hard-coded hours used by `booking.ts` pre-redesign.
|
||||
- **Pre-existing WIP untouched:** `src/components/AppointmentModal.tsx`, `src/pages/CalendarPage.tsx`, and the FullCalendar block of `src/index.css` were not modified. Only `server/db.ts` and `shared/types.ts` were edited.
|
||||
- **No commit was made** (per repo policy).
|
||||
- The quick-login behavior is unchanged: `LoginPage` still loads `/api/auth/demo-users`, and the existing password and account-switching logic remain intact.
|
||||
- Only platform-owned Admin and Dueño domains changed to `@agendamax.demo`; all employee domains remain on their existing business domains.
|
||||
- All documented demo rows explicitly show `demo1234`, including every employee row.
|
||||
- No migration, abstraction, production command, local database command, `.env.local.ps1`, or `data/` file was added or changed.
|
||||
- The implementation commit contains exactly the ten intended Task 1 files and excludes the supplied untracked design/plan files.
|
||||
- Remaining `@agendapro.demo` matches are intentional migration/history references in the new migration plan/spec and the completed Task 5 report.
|
||||
|
||||
## Concerns
|
||||
None. Typecheck is clean and the migration ran end-to-end against the real `data/agendapro.db`, producing exactly the expected column set and backfilled data.
|
||||
|
||||
- Live/API and visual login verification is pending a running dev server and the later SQLite migration; those prerequisites were intentionally not started in this task.
|
||||
- Lint remains unavailable until the repository ESLint 9 configuration is supplied or the project pins a compatible ESLint setup.
|
||||
- The exact `rg` inventory command cannot be reproduced until ripgrep is installed/on PATH.
|
||||
|
||||
Reference in New Issue
Block a user