assessment-model/docs/adr
Daniel Roth f8cc3924b3 feat(ara-projects): contractor-scoped work orders and per-project view (#421)
A contractor-org user (resolved via team_members → team → org, #408) now sees
only their own slice of a project: work orders issued to their organisation,
scoped KPI tiles, the workstreams they are assigned to, and a permission-driven
"What you can do" panel.

The scoping is enforced server-side, in one place. `workOrderOrganisationScope`
(@/lib/projects/authz) is the single definition of whose orders a caller may
see — null for internal/client (the whole programme), a contractor's own orgs
otherwise, never another org's. The work-orders route handler resolves that
scope and passes it to `loadWorkOrderPage`, which pushes it into SQL as an
`AND pwc.organisation_id IN (…)`. Because it is a separate predicate, it composes
with — and can never be widened by — the caller's own contractor filter: a
contractor asking for another org's orders gets an empty page, not a leak.

- Reuses the #419 admin table component and derivations verbatim; only the
  server-seeded page and (cosmetically) the filter options are scoped.
- The contractor per-project view replaces the programme dashboard for that
  role, deriving KPIs from the same `summariseDashboard` fold over
  organisation-scoped groups so tiles and table reconcile.
- Row action links to the work-order detail route (#422, built in parallel).
- Internal/client callers are unaffected: their scope is null, so the query is
  unchanged from #419.

Tests: route-handler-level and query-construction tests prove a contractor can
never retrieve another org's orders (including when they filter by one); pure
authz tests for scope resolution and capability summary; a Cypress
contractor-login-sees-scoped-list spec. Typecheck, lint and the full unit suite
(1180) are green. See ADR-0023.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-24 08:43:11 +00:00
..
0001-data-backfills-outside-drizzle.md docs: reporting glossary terms + ADR-0010 compliance-window filter 2026-07-07 22:08:35 +00:00
0002-effective-performance-is-canonical-current.md docs: reporting glossary terms + ADR-0010 compliance-window filter 2026-07-07 22:08:35 +00:00
0003-app-authored-scenarios.md feat(scenarios): portfolio Scenarios tab — gallery, detail, creation journey 2026-07-06 08:34:47 +00:00
0007-postcode-search-creates-properties.md fix(postcode-search): classify RH (HMO) family as addable residential 2026-07-09 10:33:07 +00:00
0008-modelling-runs-filters-to-distributor.md feat(modelling-runs): run config on tasks.inputs; backend contract updates 2026-07-07 10:46:29 +00:00
0009-portfolio-organisation-is-per-user.md docs(adr): 0009 — portfolio organisation is per-user, not shared 2026-07-07 21:11:21 +00:00
0010-compliance-window-is-a-report-view-parameter.md docs: reporting glossary terms + ADR-0010 compliance-window filter 2026-07-07 22:08:35 +00:00
0011-app-owned-task-marker-in-task-source.md feat(live-reporting): bulk document download from the Documents tab 2026-07-08 14:11:42 +00:00
0012-portfolio-list-resolves-descriptors-via-override-precedence.md docs(portfolio): ADR-0012 — list resolves descriptors via override precedence 2026-07-10 23:21:21 +00:00
0013-tags-are-app-owned-property-groupings.md docs: ADR-0013 tagging system + CONTEXT (Bulk tag assignment, Run filter tags) 2026-07-13 15:45:14 +00:00
0014-epc-cards-count-certificates-not-predictions.md fix(reporting): EPC cards count certificates, not predictions (ADR-0014) 2026-07-14 12:19:02 +00:00
0015-scenario-overlay-is-one-read-model.md docs(reporting): Scenario overlay term + ADRs 0015–0017 2026-07-20 14:22:31 +01:00
0016-sap-epc-threshold-ladder-single-owner.md docs(reporting): Scenario overlay term + ADRs 0015–0017 2026-07-20 14:22:31 +01:00
0017-likely-downgrade-is-band-movement-only.md docs(reporting): Scenario overlay term + ADRs 0015–0017 2026-07-20 14:22:31 +01:00
0018-ara-projects-supersedes-hubspot-live-projects.md docs(ara-projects): ADR-0018 + CONTEXT.md Ara Projects domain language 2026-07-21 08:30:32 +00:00
0019-uk-date-format-in-form-inputs.md feat(dates): restore a calendar picker behind DateInput 2026-07-22 15:39:11 +00:00
0019-work-order-import-is-setup-gated-and-carries-contractor-per-row.md feat(ara-projects): import — contractor/stage columns + setup gate 2026-07-22 16:36:16 +00:00
0020-import-session-and-mapping-are-client-held.md feat(ara-projects): import mapping screen — column + value mapping UI (#415) 2026-07-23 10:22:18 +00:00
0021-contractor-permissions-are-per-assignment-shown-per-contractor.md feat(ara-projects): edit and show permissions per workstream (#413) 2026-07-23 15:34:06 +00:00
0021-stage-ladder-seeding-and-the-status-column.md feat(ara-projects): step through workstreams, and drop the per-stage dates 2026-07-23 15:00:14 +00:00
0022-contractor-permissions-are-edited-and-shown-per-workstream.md feat(ara-projects): edit and show permissions per workstream (#413) 2026-07-23 15:34:06 +00:00
0023-work-orders-endpoint-is-one-org-scoped-read.md feat(ara-projects): contractor-scoped work orders and per-project view (#421) 2026-07-24 08:43:11 +00:00