Sam Rolfe 5d263987dd Phase 4a: fetch and parse the authoritative Compass learning tasks
The Learning Tasks grid is capped at 20 rows and, on the parent page, mixes
both children, so it cannot answer "what is overdue". The parent home page
reported 6 overdue tasks for Harry while the stored grid held 1.

Fetch the per-child task list (read-only) from
POST /Services/LearningTasks.svc/GetAllLearningTasksByUserId, parse it into
task rows, and refuse to store it when the overdue count disagrees with the
home page summary (FR-12).

- fetcher: store learning-tasks-all.json + meta (userId, status, task count)
- parse: new learning-tasks-all page, JSON parser, home-page reconciliation
- store: drop superseded grid-derived task rows before the upsert
- docs: docs/phase-4a-overdue-tasks.md; close the Phase 3 known gap

Verified with live runs: Harry 70 tasks / 6 overdue, Finn 42 tasks / 2 overdue,
both equal to the home page; a tampered home page stops the parse.

Note: the fetcher and store.go files also carry the per-child session work
that was already uncommitted in this shared workspace (AUD-108).

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-10-15 17:39:11 +11:00

Compass / NHS

A school service for Harry and Finn: Compass for the daily schedule and notices, Teams for homework and assignments. It stores what is due per child, puts overdue work first, and tells the family before work is late.

Build spec: AGENTS.md. This repository is at Phase 3 (parsing the stored Compass pages). See §11 of the spec for the phase order.

Status — Phase 3

Phase 3 parses the raw pages stored by Phase 2 into the SQLite items table (tasks, messages, events). See docs/phase-3-parse-notes.md.

scripts/parse-compass.sh --child Harry --run latest --classify auto

Status — Phase 1

Built and deployed on .13:

  • Go service, SQLite schema for children, items, scans, notifications, session (internal/store/migrations/001_init.sql).
  • The service's own session login — a signed cookie, not SSO.
  • Server-rendered HTMX shell using the Family Home Lab design tokens (internal/web/static/tokens.css), phone-friendly with dark mode.
  • GET /health.
  • Its own container and port 8792, behind Caddy at school.lab.audasmedia.com.au.

Not built yet (later phases): both children's data, the dashboard data, the calendar write, notifications, and the Hub API. The service itself does not scan the school; the daily scan and the Teams source come later.

Fail loudly (FR-12)

A missing or failed scan is shown as an explicit warning or error, never as an empty day. The dashboard reads the scans table and shows one of:

  • NO SCAN HAS RUN YET — amber banner.
  • SCAN FAILED — red banner with the failure on record.
  • Last scan completed — green banner.

Layout

cmd/school/                 service entry point (run, parse, hash-password, gen-secret)
internal/config/            environment configuration
internal/store/             SQLite: schema, migrations, queries
internal/parse/             HTML -> structured items (tasks, messages, events)
internal/llm/               OmniRoute client (importance classification only)
internal/auth/              session login (signed cookies, CSRF)
internal/web/               HTTP handlers, templates, static assets
deploy/                     Caddy snippet, deployment notes, verify script
scripts/                    Compass fetchers and the parse wrapper
environment.d/              env example (the real file is gitignored)

Run

cp environment.d/school-service.env.example environment.d/school-service.env
chmod 600 environment.d/school-service.env   # then fill in the secrets
docker compose up -d --build

Generate secrets with the built image:

docker run --rm --entrypoint /app/school compass-teams-nhs/school:0.2.0-phase3 gen-secret
docker run --rm --entrypoint /app/school compass-teams-nhs/school:0.2.0-phase3 hash-password 'the-password'

Note: Docker Compose interpolates $VAR inside env_file. A bcrypt hash contains $, so escape each one as $$ in the env file.

Verify

make verify-phase1

It checks the container is healthy, GET /health returns 200, the login page renders and a session login succeeds, and Caddy serves the public URL.

Rules

  • Read-only against the school. Never post, message, or submit anything.
  • A failed scan must be loud — never report an empty day as "nothing due".
  • School credentials and harness session state are secrets; never commit them.
  • This project has its own folder, container, and port.
Description
Scan Compass and Teams for the boys school schedule and homework.
Readme 1.3 MiB
Languages
Go 80.3%
JavaScript 6.2%
Shell 5.6%
HTML 3.6%
CSS 3.3%
Other 0.9%