Skip to content

Lab 05: QA, critic review and security

Objectives

Test the actual app rather than its generated description. Exercise failures and races, independently inspect PDF output, and collect manual accessibility evidence. Distinguish pass, fail, and unexecuted checks.

Prerequisites

Complete the relevant build slices with approved dependencies and a runnable app. A blocked package or missing app keeps its checks unexecuted. Read the PRD TEST identifiers, API precedence, UX states, and source record. The current Python app has 18 passing backend HTTP/restart/PDF/ recovery/source/unit tests and 10 passing proxy tests, reported separately. Neither set is browser/manual evidence or human source acceptance. No mock browser journey substitutes for the real API.

Bounded prompt

Work only in C:\src\GitHub\devopsabcs-engineering\ontario-form-practice.
Read the PRD, source ledger, API/data/UX contracts and actual implementation.
Limit edits to tests/, web/test_dev_server.py and sanitized evidence/qa/.
Add and execute real unit, HTTP, disk-restart, browser, source-gate and
independent PDF-parser tests against distinct ignored disk paths. Use no mocks
for the end-to-end persistence journey and no real personal information.
Report exact revisions, commands, tools, exits, pass/fail/unexecuted counts,
and high-confidence defects. Do not fix broad design issues silently.
Do not acquire excluded content, claim manual screen-reader/visual checks
you cannot perform, create screenshots from imagined UI, waive findings,
sign off or deploy. Stop at missing runtime/package prerequisites.
Prepare named human checks for accessibility, source and PDF visual review.

Steps

  1. Record exact app and curriculum revisions, versions, test DB path, source snapshot, and dependency/license gate status. Tests must reject path escape and live/test equality. Keep all fixtures deliberately synthetic.
  2. Execute domain tests: empty defaults, trimming/uppercase, raw limits, non-ASCII/control rejection, strict boolean/integer types, unknown keys, unsupported constants, and plate-only/VIN-only/both/no-identifier review. Do not certify real plates, VINs, or names.
  3. Test all six endpoints and transport errors. Cover invalid/duplicate JSON, UTF-8/media/encoding, streamed body beyond 16 KiB, query duplication, GET body, unexpected Host/Origin, no-store/nosniff, malformed UUID, unknown route/method, missing row, and sanitized field/error envelopes. Assert 400/403/404/405/409/413/414/415/422/431/500/503 where specified, allowing documented low-level header close behavior.
  4. Prove the actual application migration/write, process exit, restart/read, and deletion using isolated disk SQLite. Verify WAL/SHM and required pragmas, failed migration/incompatible schema startup, busy/storage/commit failures, rollback, and no false success. Do not substitute the prior native probe.
  5. Race update/review/delete at one expected revision: exactly one mutation commits. Test unchanged save clearing review, stale review, revision ceiling, and review completeness leaving the row unchanged on failure.
  6. Exercise export at the requested reviewed revision, current-unreviewed, stale, missing, and source-pending cases. Independently parse successful output for PDF signature, 1-4 Letter pages, at most 1 MiB, persisted values, draft/source revisions/hash, and exact disclaimer. Force generation/limit failures and edit/delete/source drift before the final output check. Test the documented in-flight boundary rather than promising recall.
  7. In a live browser, run start/save/reload/resume/review/edit/re-review/download/ delete against the real API. With the current pending live source, record review/download as blocked by SOURCE_REVIEW_REQUIRED; do not enable test acceptance for a browser demonstration. Continue the accepted-source journey only after actual human approval. Use two tabs for conflict and a stopped backend for interrupted/failure states. Inspect storage: no draft-bearing localStorage/sessionStorage/IndexedDB/service-worker cache or console logs.
  8. Perform human keyboard and screen-reader checks. Record OS/browser/reader, version, steps, and actual announcements. Verify skip/main structure, labels/hints, linked summary/control focus, Error: title, inline errors, polite save status, route headings, and delete Cancel return focus.
  9. Check 320/375/768px and desktop, portrait/landscape, 200% zoom and equivalent 320px reflow, visible focus, at least 44-by-44 lab touch targets, virtual keyboard, and mobile PDF preview/save. A scanner pass is complementary, not an AODA/ODS/accessibility certification.
  10. Human-review the PDF at longest permitted name/identifiers for wrapping, page bounds, print and mobile behavior. Review source revision/anchors and French extraction/visual limits separately. Capture only original sanitized screenshots from actual runs and attach revision/scenario provenance.
  11. Inspect code for high-confidence boundary failures: string-concatenated SQL, unsafe rendering, arbitrary DB paths/proxy targets, false saved states, browser data storage, government template/logo reuse, or leaked errors. Record defects and repeat affected checks after an explicit fix.

Validation

Use the existing approved Python environment and actual test modules:

Set-Location C:\src\GitHub\devopsabcs-engineering\ontario-form-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 syntax check 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' }
git --no-pager diff --check
if ($LASTEXITCODE -ne 0) { throw 'Whitespace check failed' }

The named tests use dedicated ignored SQLite files, real backend child processes and independent pypdf parsing of ReportLab output. They clean up only owned temporary paths/PIDs; isolated synthetic source acceptance never approves live source. No React lint/typecheck/build or npm install is required. Optional node --check web\app.js with existing Node proves syntax only. Browser/keyboard/reader/mobile and PDF visual outcomes must be recorded separately.

For the live app with source acceptance still pending, this PowerShell 7 probe asserts the source gate and deletion. Start the API and proxy using .\.venv\Scripts\python.exe -m api.server and .\.venv\Scripts\python.exe -m web.dev_server in separate LearnerRoot terminals. -SkipHttpErrorCheck allows inspecting expected non-2xx responses:

Set-Location C:\src\GitHub\devopsabcs-engineering\ontario-form-practice
$base = 'http://127.0.0.1:3001'
$created = Invoke-WebRequest -Method Post -Uri "$base/api/drafts" -ContentType 'application/json' -Body '{"data":{}}'
if ($created.StatusCode -ne 201) { throw 'Create failed' }
$draft = ($created.Content | ConvertFrom-Json).draft
$uri = "$base/api/drafts/$($draft.id)"
$body = @{ expectedRevision = $draft.revision } | ConvertTo-Json -Compress
$review = Invoke-WebRequest -Method Post -Uri "$uri/review" -ContentType 'application/json' -Body $body -SkipHttpErrorCheck
if ($review.StatusCode -ne 409 -or
    ($review.Content | ConvertFrom-Json).error.code -ne 'SOURCE_REVIEW_REQUIRED') {
    throw 'Expected pending live source gate'
}
$removed = Invoke-WebRequest -Method Delete -Uri $uri -ContentType 'application/json' -Body $body
if ($removed.StatusCode -ne 204) { throw 'Delete did not commit' }
$missing = Invoke-WebRequest -Uri $uri -SkipHttpErrorCheck
if ($missing.StatusCode -ne 404) { throw 'Deleted draft remains available' }

The unittest fixtures cover accepted-source completeness 422 separately. Live pending source returns 409 first; do not fake source approval to make a browser journey pass. Record manual outcomes separately in evidence\accessibility\ and evidence\qa\, including unexecuted checks.

Expected observable results

Actual test reports distinguish passes, failures, and blocked checks with exact reproductions. Human observations cover screen-reader/320px/zoom/source/PDF behavior. Clean scans alone cannot turn missing runtime evidence into acceptance. Backend and proxy evidence is reported in LearnerRoot, not published as raw curriculum assets. Limited browser evidence and a historical application excerpt are available in Lab 04; full human keyboard/screen-reader, mobile, zoom and PDF visual acceptance remain pending.

Troubleshooting

If browser tooling is unavailable, record the blocker and use approved setup; do not fetch excluded tooling elsewhere. A source-pending 409 is expected, not a missing-identifier bug. If Windows and another host disagree, compare versions and lock/config rather than waiving the failure. Do not run forced dependency upgrades or retries to conceal policy exclusions.

Costs

QA/AI usage, scanner execution, and hosted capacity charges are unmeasured. Record actual usage and elapsed time. Do not invent credit totals.

Knowledge checks

  • Which tests prove rollback rather than a misleading "Saved" status?
  • Why can a valid incomplete review return 409 before 422?
  • Which accessibility observations require a human rather than a scanner?

Previous: Build slices. Next: Human sign-off.