FICTIONAL SQL REPORT ACCEPTANCE FIXTURE

Purpose
This small teaching example demonstrates how a plausible grand total can hide a duplicated join and an unmatched lookup row. Every request, note, staff ID, result and example is fictional. It is not a customer case, a production query, a migration, or evidence that a customer system was tested.

Report definition
Snapshot: 3 November 2026 at 09:00 MYT.
Include one unique request created at or after 1 October 2026 00:00 MYT and before 1 November 2026 00:00 MYT that is Open at the snapshot. Group by assigned staff, keeping assignments without a staff lookup as unresolved. This is October-created work still Open at the 3 November snapshot. It is not October month-end backlog; reconstructing historical status requires suitable status history and separate review.

Files
- requests.csv: five fictional requests and their status at the stated snapshot.
- notes.csv: four fictional notes. R101 has two notes; R102 and R103 have one each.
- staff.csv: the fictional lookup contains A and B only, so S99 is unresolved.
- report_fixture.py: the runnable script inside the ZIP. The deployed folder contains the same code only as the plain-text preview report_fixture.py.txt. The script reads the three CSV files next to itself, loads them into SQLite :memory:, runs six deterministic tests and prints results. It uses only Python's standard library and has no database-file output, network access, user-supplied SQL, subprocess, credentials, telemetry or installation step.
- expected-output.txt: expected counts independent of local runtime-version text.

Run locally
With Python 3, open a terminal in this folder and run:
    python3 report_fixture.py
The script prints the exact Python and SQLite runtime versions it used. Test duration/runtime version can differ by machine; expected counts should not. Execution reads the bundled CSV files, creates a fresh in-memory database, runs six checks and prints output. It does not write result files.

Interpretation
The intended one-request query uses a left join to retain the unresolved staff ID and does not join notes into the request count. A naive notes join repeats R101 and an inner staff lookup drops R103. Those errors happen to leave the same grand total of three. Adding COUNT(DISTINCT request_id) after the bad inner join removes duplicate R101 but cannot recover the already-dropped R103, leaving a total of two. This does not make DISTINCT universally wrong; it shows that it cannot repair a row excluded by an earlier join.

Limits and safe use
These executed examples use SQLite teaching queries only. They are not tested SQL Server queries or customer-system results, and do not validate a real schema, indexes, query plan, permissions, time-zone conversion, source accuracy, production performance, report history or month-end reconstruction. Do not substitute confidential or production data. Before applying any real report, separately review the actual source/schema, time and status definitions, audience/access, exception handling and acceptance criteria with the system owner. This fixture does not certify a report or provide migration approval.
