| title | Ontario form practice learner template |
|---|---|
| description | Local Python SQLite and vanilla JavaScript baseline for Labs 00-08 |
| ms.date | 2026-11-28 |
Original, local-only fictional-data training app. Training only - not a government form - not submitted. No official PDF, Ontario assets, identity collection, payment, authentication or public hosting.
This is the LearnerRoot baseline for the English / French curriculum. It includes an implemented small app, its contracts and runnable tests so you can inspect, change and validate real slices instead of starting from missing files. The app interface is English-only. The lessons are bilingual.
After the instructor publishes this repository and enables Template
repository, choose
Use this template
to create your own repository. Clone your copy into the separate LearnerRoot
used by the lessons; replace YOUR-ACCOUNT with your GitHub account:
git clone https://github.com/YOUR-ACCOUNT/ontario-form-practice.git C:\src\GitHub\devopsabcs-engineering\ontario-form-practice
if ($LASTEXITCODE -ne 0) { throw 'Learner clone failed; do not overwrite an existing checkout' }
Set-Location C:\src\GitHub\devopsabcs-engineering\ontario-form-practiceDo not nest LearnerRoot inside the curriculum or clone over an existing folder. If the template is not yet published, obtain the prepared checkout from your instructor. GitHub template availability is not assumed by this local package.
The documents under evidence are blank learner worksheets, not inherited test results or approvals. Record your own commands, exit codes, exact revision and observations. Keep raw output and personal data out of Git. The template contains no database, downloaded PDF, acceptance record, virtual environment or historical npm probe.
Use installed Python 3.13 (tested: 3.13.14, Windows x64). From this repository:
The lock uses an approved corporate Python index; access to that index is a
prerequisite. If access is denied, stop and ask your instructor. Do not change
indexes, disable TLS or use a fallback to bypass policy. No npm install is needed.
Create the environment only if .venv is absent; reuse it otherwise.
if (-not (Test-Path .\.venv\Scripts\python.exe)) {
python3.13.exe -m venv .venv
if ($LASTEXITCODE -ne 0) { throw 'Application environment creation failed' }
}
.\.venv\Scripts\python.exe -m pip --isolated install --no-cache-dir -r requirements.txt
if ($LASTEXITCODE -ne 0) { throw 'Locked application installation failed' }
.\.venv\Scripts\python.exe -m pip check
if ($LASTEXITCODE -ne 0) { throw 'Application dependency check failed' }
.\.venv\Scripts\python.exe -m api.serverThe API binds only to 127.0.0.1:3001; stop with Ctrl+C. In another terminal:
.\.venv\Scripts\python.exe -m web.dev_serverOpen http://127.0.0.1:5173. The separately maintained original HTML/JavaScript
frontend proxies /api, preserving Origin and rewriting Host. Browser integration
and manual accessibility evidence are separate from the backend test results.
No npm install/build is required or authorized. Excluded resources remain
excluded; do not reinstall, copy or reconstruct them.
Configuration before startup:
$env:API_PORT = '3001'
$env:WEB_PORT = '5173'
$env:PRACTICE_DB_PATH = 'data/practice.sqlite'Ports must differ and be 1024-65535. DB paths resolve from the repository root,
only under data/ or .scratch/, with .sqlite suffix, no traversal,
symlinks/junctions, network paths, memory DBs or static assets. The API stops on
configuration/migration failure; it never silently substitutes storage.
Do not put real personal information into this lab.
Load/save/delete work immediately. Review and PDF export return
SOURCE_REVIEW_REQUIRED until a human approves the exact pinned provenance.
The pinned historical source manifest is not your verification or approval.
Follow the acceptance procedure;
do not set test mode or use synthetic acceptance for normal practice.
.\.venv\Scripts\python.exe -m pip check
if ($LASTEXITCODE -ne 0) { throw 'Application dependency check failed' }
.\.venv\Scripts\python.exe -m compileall -q api web tests
if ($LASTEXITCODE -ne 0) { throw 'Python compilation failed' }
.\.venv\Scripts\python.exe -m unittest tests.test_validation tests.test_api tests.test_persistence tests.test_source tests.test_pdf web.test_dev_server -v
if ($LASTEXITCODE -ne 0) { throw 'Application tests failed' }Tests launch real HTTP backend child processes, use dedicated ignored temporary
SQLite files under .scratch/backend-tests/, and independently parse new
ReportLab PDFs with pypdf. Synthetic accepted source fixtures cannot approve
the live source. Each test stops its exact child PIDs and removes only its owned
temporary directory. No official PDF is downloaded or copied.
The combined suite contains 28 tests: 18 backend and 10 proxy.
If Node is already installed, optionally run node --check web/app.js.
Record the actual result; do not install npm packages for this check.
The app-only Windows CI workflow uses
Windows 2025 and Python 3.13.14 x64 with the corporate-index hash lock.
Observe its actual result after publishing your repository; this template
does not supply a hosted result. An inaccessible corporate index must fail CI;
no public-index fallback is allowed.
Fill in your backend worksheet, browser worksheet, recovery worksheet and accessibility worksheet. Review the dependency boundary. Human source/rights, visual PDF, accessibility, Canadian French and release decisions remain pending in the checklist and sign-off. Automated parser checks are not tagged-PDF certification. Publishing the template does not approve a learner application.
Use only the existing installed app environment and VS Code integrated browser tools. This is TOOL-hosted automation, not a standalone Node Playwright CLI, npm test, Python unittest or hosted CI browser suite. Install nothing.
From the app root, start a fresh dedicated SYNTHETIC fixture:
.\.venv\Scripts\python.exe -m tests.e2e.serve_fixtureThe stdlib helper reuses tests.support.BackendCase with a real isolated SQLite
DB and synthetic accepted source under its own .scratch/backend-tests/case-*.
This is explicitly not live source approval. It prints JSON with actual
web/api loopback ports, owned child PIDs, syntheticFixture: true, and its
generated stopMarker. It checks HTTP 200 readiness before its control loop
and stops after a ten-minute deadline. For a bounded startup/shutdown proof:
.\.venv\Scripts\python.exe -m tests.e2e.serve_fixture --seconds 2
node --check tests/e2e/practice-flow.mjs-
Open the newly printed
webURL using the existing VS CodeopenBrowserPagetool; reuse that returned page ID. Never use a live DB, normal learner session or historical fixture. Loopback alone does not certify that a page is synthetic: use this helper's reported URL. -
Copy all of practice-flow.mjs into the existing
runPlaywrightCodetool'scodeargument. Change onlyexport async function runPracticeFlow(page)toasync function runPracticeFlow(page)and append:return await runPracticeFlow(page);
Use the provided
page, the same page ID, andtimeoutMs: 60000to receive the complete JSON outcome. No imports, browser launch, new context, session-affinity bypass, API mocks or browser draft storage are involved. If a shorter wait (for example 10000ms) returnsdeferredResultId, continue with that ID and the same page ID, omittingcode; do not launch duplicate work. A lost deferred result is not a pass. Report failures/gaps honestly; retry only corrected runner expectations, at most two retries, on the owned fixture and page. -
Expect thrown errors identifying the failed step, or returned
status, actualcount, step outcomes, actual PDF headers/byte lengths and full user agent. Assertions cover r1 resume/reload, 422 linked-error focus, r2/r3 review, real external r4 PUT and stale-save 409 reconciliation, r5 review invalidation, r6 re-review/export and confirmed deletion/404. PDF GETs inspect real bytes without clicking a download dialog or claiming locally saved files. Focus assertions are not full accessibility certification. -
Stop this helper by Ctrl+C, or in another terminal create only the exact marker path printed by this run:
New-Item -ItemType File -Path '<exact printed stopMarker>' -ErrorAction Stop
Wait for
cleanup: true,proxyStopped: true,folderRemoved: trueand process exit. The helper terminates its exact owned children and removes only its own mkdtemp directory; no caller-selected path or broad deletion is accepted. Do not manually delete a DB while its API is running.
The replay contains 12 grouped steps; record your own returned result. CI runs only the 28 Python backend/proxy tests. Negative source-gate browser restart, human source/French/PDF/accessibility and publication gates remain separate.
One live SQLite row per draft; no list, undo, history or PDF retention. Revision guards protect save/review/delete, and edits invalidate review. Deletion is logical, not secure erasure of SQLite pages, backups or downloads. For synthetic backup/restore teaching, stop the API, checkpoint/close SQLite, copy the selected DB into an isolated ignored directory, and restart there. Never restore over a running or unrelated database. The recovery unittest demonstrates this using exact owned test paths, not the live DB.
Dependencies are hash-pinned for Python 3.13 Windows x64 only. Other runtimes/ platforms require separately reviewed wheel hashes and actual validation. New original code uses Apache-2.0; dependency licenses remain separate. See notices and ADR 002.
Push this prepared baseline to devopsabcs-engineering/ontario-form-practice,
then select Settings > General > Template repository on GitHub and make
the repository public. Observe the application test workflow before assigning
the template. No application deployment is required.
Check the published Use this template link and a fresh learner clone. Publish the accompanying English/French Lab 00 changes in the separate curriculum repository through its existing manual Pages release process. Do not copy prior execution evidence, accepted local source records or runtime data into either repository. All learner worksheets start pending.