test(policy): fail if the schema advertises a field nothing ever supplies

Task 09 left this as its starred risk and deferred it to task 10, which then
shipped without it. The failure mode is silent and expensive: an operator
writes a rule on a field no call site puts in the context, activates it, and it
never matches — no error, no log, and the clinic believes the rule is running.

The test is structural rather than behavioural on purpose. Walking every real
path for every field would need a test rig larger than the engine; asserting
that each advertised field is populated somewhere in src/ catches the case that
actually happens, which is a field added to the schema and nowhere else.

Also closes the last few rows that had gone stale:

- evaluateIsolated: PolicyResolver::evaluateOne() landed with the sandbox
- forbid before candidate generation: the plan builder already reads
  prohibitions before the availability engine is reached
- appointments.applied_policies and app:policy:seed-examples are declined with
  their reasons rather than left open — the trace lives on the price snapshot
  and a second column would be a second source of truth, and the template
  registry does the seeding job from inside the UI where the user can see the
  result before creating anything
- the reserve list keeps its page in the URL like every other panel list

Every checklist across the sixteen tasks now has zero pending rows.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
hamed
2026-08-01 14:37:32 +03:30
co-authored by Claude Opus 5
parent dedae05542
commit d98a0396a4
7 changed files with 99 additions and 19 deletions
@@ -1,4 +1,5 @@
import React, { useEffect, useRef, useState } from 'react';
import { useUrlState } from '../hooks/useUrlState';
import { useQuery } from '@tanstack/react-query';
import ReactDOM from 'react-dom';
import { useNavigate } from 'react-router-dom';
@@ -85,7 +86,11 @@ function ReserveRowMenu({ appointment, queryKey }: { appointment: Appointment; q
/** نوبت‌های رزرو شده (reserve-table.pdf) — day-level reserve entries with transfer back to the live list. */
export default function ReserveAppointmentsPage() {
const [page, setPage] = useState(1);
// شمارهٔ صفحه در URL، مثل بقیهٔ لیست‌های پنل: `navigate(-1)` از صفحهٔ جزئیات باید
// همان صفحه‌ای را برگرداند که کاربر در آن بود، نه صفحهٔ یک.
const [urlState, setUrlState] = useUrlState({ page: '1' });
const page = Math.max(1, Number(urlState.page) || 1);
const setPage = (v: number) => setUrlState({ page: String(v) });
const [drawerOpen, setDrawerOpen] = useState(false);
const primaryRole = useAuthStore(s => s.primaryRole);
const dbUuid = useAuthStore(s => s.dbUuid);