fix(detail): Ofsted sentinel codes, sixth form, carried-forward labels (Batch A) #64

Merged
tudor merged 1 commits from fix/detail-ofsted-correctness into main 2026-07-20 06:21:07 +00:00
Owner

Batch A of applying the compare-screen learnings to the detail page (points 2-3 of the list).

Point 2 — Ofsted sentinel codes & sixth form

The legacy OEIF sub-judgement grid rendered any non-null value via OFSTED_LABELS[value], so:

  • Ofsted's sentinel code 9 ("not applicable / no judgement") leaked as an undefined label.
  • The sixth-form judgement was never in the list, so it was dropped entirely.

New shared ofstedLegacyAreas() helper returns only real grades (1-4) and includes Sixth Form provision. Both detail views and the "all sub-grades match the overall" shortcut now use it, so a school with a sixth form shows it, and no sentinel ever renders as a rating.

Point 3 — carried-forward grade labelling

The OEIF disclaimer always said "From September 2024, Ofsted no longer makes an overall effectiveness judgement" even while showing a carried-forward grade — contradictory. It's now grade_source-aware and labels carried-forward grades as such, matching the compare screen's regime handling. (Report-card detection was already fixed in #62.)

Tests: new ofstedLegacyAreas unit tests (sentinel filtering, sixth-form inclusion, early-years). 105 frontend tests green.

Next batches queued: anchoring & provenance (5,6), inclusion/admissions framing (7-10), chart truthfulness (4,12), all-through (11), mobile + expert review (13-15).

🤖 Generated with Claude Code

https://claude.ai/code/session_0146VHeLAWjDVE2B5uU67jCB

Batch A of applying the compare-screen learnings to the detail page (points 2-3 of the list). ## Point 2 — Ofsted sentinel codes & sixth form The legacy OEIF sub-judgement grid rendered any non-null value via `OFSTED_LABELS[value]`, so: - Ofsted's sentinel code **9** ("not applicable / no judgement") leaked as an undefined label. - The **sixth-form judgement** was never in the list, so it was dropped entirely. New shared `ofstedLegacyAreas()` helper returns only real grades (1-4) and includes Sixth Form provision. Both detail views and the "all sub-grades match the overall" shortcut now use it, so a school with a sixth form shows it, and no sentinel ever renders as a rating. ## Point 3 — carried-forward grade labelling The OEIF disclaimer always said "From September 2024, Ofsted no longer makes an overall effectiveness judgement" even while showing a **carried-forward** grade — contradictory. It's now `grade_source`-aware and labels carried-forward grades as such, matching the compare screen's regime handling. (Report-card detection was already fixed in #62.) Tests: new `ofstedLegacyAreas` unit tests (sentinel filtering, sixth-form inclusion, early-years). 105 frontend tests green. Next batches queued: anchoring & provenance (5,6), inclusion/admissions framing (7-10), chart truthfulness (4,12), all-through (11), mobile + expert review (13-15). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_0146VHeLAWjDVE2B5uU67jCB
tudor added 1 commit 2026-07-20 06:15:52 +00:00
fix(detail): filter Ofsted sentinel codes, show sixth-form judgement, label carried-forward grades
PR Checks / Frontend Typecheck + Tests (pull_request) Successful in 1m2s
PR Checks / Backend Smoke (pull_request) Successful in 7s
PR Checks / Build Backend (no push) (pull_request) Successful in 11s
PR Checks / Build Frontend (no push) (pull_request) Successful in 46s
PR Checks / Build Pipeline (no push) (pull_request) Successful in 10s
PR Checks / AI Code Review (Claude) (pull_request) Successful in 1m23s
fdda52ff0a
Batch A of applying compare-screen learnings to the detail page (points 2-3):

- Point 2: the legacy OEIF sub-judgement grid rendered any non-null value
  via OFSTED_LABELS[value], so Ofsted's sentinel code 9 ('not applicable')
  leaked as an undefined label, and the sixth-form judgement was dropped
  entirely. New shared ofstedLegacyAreas() helper returns only real grades
  (1-4) and includes Sixth Form provision. Both detail views + the
  all-same-grade check use it.
- Point 3: the OEIF disclaimer always claimed 'Ofsted no longer makes an
  overall judgement' even when showing a carried-forward grade. It's now
  grade_source-aware and labels carried-forward grades as such, matching
  the compare screen.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0146VHeLAWjDVE2B5uU67jCB

🤖 AI Code Review (Claude Code)

This PR extracts the Ofsted OEIF sub-judgement filtering logic (previously duplicated in SchoolDetailView and SecondarySchoolDetailView) into a single tested ofstedLegacyAreas utility, which correctly drops sentinel/non-applicable codes (values outside 1-4) instead of rendering them, adds the previously-omitted Sixth Form judgement, and adds a disclaimer for grades carried forward from an earlier inspection. All new field accesses (grade_source, sixth_form_provision) match existing type definitions, and the ofsted.grade_source access is safely guarded behind an outer {ofsted && (...)} block in both components. The change is clean, DRY, and covered by new unit tests.

No issues found.

## 🤖 AI Code Review (Claude Code) This PR extracts the Ofsted OEIF sub-judgement filtering logic (previously duplicated in SchoolDetailView and SecondarySchoolDetailView) into a single tested `ofstedLegacyAreas` utility, which correctly drops sentinel/non-applicable codes (values outside 1-4) instead of rendering them, adds the previously-omitted Sixth Form judgement, and adds a disclaimer for grades carried forward from an earlier inspection. All new field accesses (`grade_source`, `sixth_form_provision`) match existing type definitions, and the `ofsted.grade_source` access is safely guarded behind an outer `{ofsted && (...)}` block in both components. The change is clean, DRY, and covered by new unit tests. ✅ No issues found.
tudor merged commit aa87fa917d into main 2026-07-20 06:21:07 +00:00
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: tudor/school_compare#64