diff --git a/.claude/audits/2026-11-03-v1-2-6-label-proposals.md b/.claude/audits/2026-11-03-v1-2-6-label-proposals.md
index 1431094f..001976e8 100644
--- a/.claude/audits/2026-11-03-v1-2-6-label-proposals.md
+++ b/.claude/audits/2026-11-03-v1-2-6-label-proposals.md
@@ -528,3 +528,12 @@ Shown when a drawing attached to a view that was unmeasured would put the geomet
|---|---|---|---|
| `editor.views.repair.more_outside` | D'autres éléments sortiraient aussi du nouveau cadre : {names}. Rien n'a été appliqué. Annulez, corrigez-les, puis choisissez de nouveau l'illustration. | Other elements would also fall outside the new frame: {names}. Nothing was applied. Cancel, fix them, then choose the drawing again. | New: `newly_invalid` inside the dialog (the old wording sent to a locked tab) |
| `editor.views.repair.not_measurable` | Avec cette illustration, une vue qui porte des annotations ne serait pas mesurable. Rien n'a été appliqué. | With this drawing, a view holding annotations would not be measurable. Nothing was applied. | New: `view_unmeasured` / `changed_unmeasured` inside the dialog |
+
+## Lot O1 (owner decisions 2026-11-04: free paths never reshaped, C45; explicit category zone, C46)
+
+| Key | FR | EN | Old wording and why |
+|---|---|---|---|
+| `editor.views.repair.path_blocked` | Ce tracé libre est conservé tel quel. L'illustration ne peut pas être attachée tant qu'il sort du nouveau cadre : l'éditeur ne sait pas encore corriger les points d'un tracé libre. | This free path is kept as it is. The drawing cannot be attached while it falls outside the new frame: the editor cannot yet correct the points of a free path. | Old « Ce tracé n'a pas de coordonnées à corriger ici. Remplacez-le par un polygone pour pouvoir attacher l'illustration. »: the conversion to a triangle is refused by the owner. The reason is plain, nothing offered. The repair dialog no longer uses `editor.annotations.replace_polygon` (kept for the properties panel) |
+| `editor.findings.zone` | Zone | Zone | New: label of the required zone choice in the « Ajouter une catégorie » form |
+| `editor.findings.add_category_no_zone` | Créez d'abord une zone pour ajouter une catégorie. | Create a zone first to add a category. | New: hint shown while « Ajouter une catégorie » is disabled because no zone exists |
+| `editor.findings.required` | Renseignez le nom en français et en anglais (et la zone et le type d'une catégorie). | Fill in the name in French and in English (and the zone and the type of a category). | Old « … (et le type d'une catégorie). »: the zone is now a required choice of a category |
diff --git a/apps/app/e2e/shell/editor-geometry.spec.ts b/apps/app/e2e/shell/editor-geometry.spec.ts
index 6b6f8fa6..08ac3410 100644
--- a/apps/app/e2e/shell/editor-geometry.spec.ts
+++ b/apps/app/e2e/shell/editor-geometry.spec.ts
@@ -314,6 +314,77 @@ test.describe('editor geometry (adversarial)', () => {
})
})
+ test('a free path outside the new frame blocks the attach, is never reshaped and survives a save', async ({
+ page,
+ requests,
+ }) => {
+ const seededPath =
+ 'M 300 300 l 40 0 C 350 320 380 360 400 400 q 20 -30 -40 -50 ' +
+ 'A 30 20 0 0 1 320 330 H 310 V 305 Z'
+ const path = {
+ ...pointOf('out-path', 'main', { cx: 0, cy: 0, r: 1 }, 'Tracé libre'),
+ kind: 'zone',
+ geometry: { type: 'path', d: seededPath },
+ }
+ const point = pointOf(
+ 'out-point',
+ 'main',
+ { cx: 500, cy: 400, r: 20 },
+ 'Point hors cadre',
+ )
+ const actor = await editorActor('fr')
+ requests.forbid(actor.account.email, actor.account.password)
+ const seed = await seedDraft(actor, {
+ drawing: null,
+ shape: (document) => {
+ standardShape(document)
+ const views = document.views as { id: string }[]
+ document.views = views.filter((view) => view.id === 'main')
+ document.annotations = [point, path]
+ },
+ })
+ await openEditor(page, dict, actor, seed.sheetId)
+ await selectTab(page, dict, 'views')
+ await page.getByTestId('view-main-file').setInputFiles({
+ name: 'petit.svg',
+ mimeType: 'image/svg+xml',
+ buffer: Buffer.from(
+ '',
+ ),
+ })
+ const dialog = page.getByRole('dialog', {
+ name: dict['editor.views.repair.title'],
+ })
+ await expect(dialog).toBeVisible()
+ const row = dialog.getByTestId('repair-out-path')
+ await expect(
+ row.getByText(dict['editor.views.repair.path_blocked']),
+ ).toBeVisible()
+ await expect(row.getByRole('button')).toHaveCount(0)
+ await expect(
+ dialog.getByRole('button', { name: dict['editor.views.repair.apply'] }),
+ ).toBeDisabled()
+ await dialog
+ .getByRole('button', { name: dict['editor.views.repair.cancel'] })
+ .click()
+ await expect(dialog).toBeHidden()
+
+ // An unrelated change is saved: the path is still the seeded one, byte for byte.
+ await selectTab(page, dict, 'general')
+ const nameFr = page.getByLabel(dict['editor.general.name_fr'], {
+ exact: true,
+ })
+ await nameFr.fill('Fiche sans toucher au tracé')
+ await nameFr.press('Tab')
+ await saveDraft(page, dict, seed.revision + 1)
+ const saved = await serverDocument<{
+ annotations: { id: string; geometry: Record }[]
+ }>(seed.draftId)
+ const kept = saved.annotations.find((a) => a.id === 'out-path')
+ expect(kept?.geometry).toEqual({ type: 'path', d: seededPath })
+ })
+
test('an unmeasured view: drawing tools and add buttons disabled, the hint shown', async ({
page,
requests,
diff --git a/apps/app/e2e/shell/editor-journey.spec.ts b/apps/app/e2e/shell/editor-journey.spec.ts
index 3ca099e3..29ebcd70 100644
--- a/apps/app/e2e/shell/editor-journey.spec.ts
+++ b/apps/app/e2e/shell/editor-journey.spec.ts
@@ -119,6 +119,7 @@ async function createFindings(page: Page) {
await names('Zone essai', 'Trial zone')
await create()
await clickButton(page, dict['editor.findings.add_category'])
+ await page.locator('#finding-new-zone').selectOption({ label: 'Zone essai' })
await page.locator('#finding-new-kind').selectOption('dysfunction')
await names('Dysfonction essai', 'Trial dysfunction')
await create()
diff --git a/apps/app/e2e/shell/editor-structures.spec.ts b/apps/app/e2e/shell/editor-structures.spec.ts
index d463927f..e03217bb 100644
--- a/apps/app/e2e/shell/editor-structures.spec.ts
+++ b/apps/app/e2e/shell/editor-structures.spec.ts
@@ -153,6 +153,7 @@ test.describe('editor structures (A4)', () => {
await page
.getByRole('button', { name: dict['editor.findings.add_category'] })
.click()
+ await page.locator('#finding-new-zone').selectOption({ label: 'Zone B' })
await page.locator('#finding-new-kind').selectOption('anamnesis')
await page.locator('#finding-new-name-fr').fill('Anamnèse B')
await page.locator('#finding-new-name-en').fill('History B')
diff --git a/apps/app/src/components/editor/findings/AddBar.tsx b/apps/app/src/components/editor/findings/AddBar.tsx
index 000817b0..ad81b971 100644
--- a/apps/app/src/components/editor/findings/AddBar.tsx
+++ b/apps/app/src/components/editor/findings/AddBar.tsx
@@ -3,13 +3,18 @@ import type { PendingFinding } from '@/components/editor/findings/FindingCreateF
import { canAddNode, type FindingItem } from '@/editor/findings/tree'
import { useT } from '@/i18n/useT'
-/** « Ajouter une zone / une catégorie / un constat »: each starts a creation form. */
+/**
+ * « Ajouter une zone / une catégorie / un constat »: each starts a creation form. Only
+ * the node depends on the selection; a category names its zone in its own form (C46).
+ */
export default function AddBar({
selected,
+ hasZone,
readOnly,
onStart,
}: {
selected: FindingItem | undefined
+ hasZone: boolean
readOnly: boolean
onStart: (pending: PendingFinding) => void
}) {
@@ -28,8 +33,8 @@ export default function AddBar({
readOnly={readOnly}
variant="secondary"
size="sm"
- disabled={!selected}
- onClick={() => onStart({ kind: 'category', parent: selected ?? null })}
+ disabled={!hasZone}
+ onClick={() => onStart({ kind: 'category', parent: null })}
>
{t('editor.findings.add_category')}
@@ -42,6 +47,11 @@ export default function AddBar({
>
{t('editor.findings.add_node')}
+ {!hasZone && !readOnly && (
+
+ {t('editor.findings.add_category_no_zone')}
+
+ )}
)
}
diff --git a/apps/app/src/components/editor/findings/FindingCreateForm.tsx b/apps/app/src/components/editor/findings/FindingCreateForm.tsx
index bbc2f33b..04ce911e 100644
--- a/apps/app/src/components/editor/findings/FindingCreateForm.tsx
+++ b/apps/app/src/components/editor/findings/FindingCreateForm.tsx
@@ -7,9 +7,13 @@ import type {
import ActionButton from '@/components/editor/fields/ActionButton'
import DraftField from '@/components/editor/fields/DraftField'
import SelectField from '@/components/editor/fields/SelectField'
-import type { FindingItem, FindingKind } from '@/editor/findings/tree'
+import {
+ buildItems,
+ type FindingItem,
+ type FindingKind,
+} from '@/editor/findings/tree'
import type { IdPrefix } from '@/editor/ids'
-import { elementLabel, isBlank, useSheetDocument } from '@/editor/sheetDocument'
+import { isBlank, useSheetDocument } from '@/editor/sheetDocument'
import { useEditCommand } from '@/editor/useEditCommand'
import { useT } from '@/i18n/useT'
import { useLocaleStore } from '@/state/localeStore'
@@ -23,7 +27,7 @@ export const CATEGORY_KINDS: readonly FindingCategoryKind[] = [
export interface PendingFinding {
kind: FindingKind
- /** The zone, category or node the new element goes under; null for a zone. */
+ /** The category or node a node goes under; null for a zone and a category. */
parent: FindingItem | null
}
@@ -37,18 +41,24 @@ export default function FindingCreateForm({
onCancel,
}: {
pending: PendingFinding
- onCreated: (id: string) => void
+ onCreated: (id: string, parent: FindingItem | null) => void
onCancel: () => void
}) {
const t = useT()
- const title = useFormTitle(pending)
const edit = useEditCommand()
+ const zones = useZoneChoice()
+ const title = useFormTitle(pending, zones.chosen)
const [fr, setFr] = useState('')
const [en, setEn] = useState('')
const [kind, setKind] = useState('')
const create = () => {
+ const parent = pending.kind === 'category' ? zones.chosen : pending.parent
+ const missingParent = pending.kind === 'category' && !parent
const incomplete =
- isBlank(fr) || isBlank(en) || (pending.kind === 'category' && !kind)
+ isBlank(fr) ||
+ isBlank(en) ||
+ missingParent ||
+ (pending.kind === 'category' && !kind)
if (incomplete) {
edit.reject('form', 'editor.findings.required')
return
@@ -56,14 +66,16 @@ export default function FindingCreateForm({
let createdId = ''
const added = edit.runNew('form', PREFIX[pending.kind], (id) => {
createdId = id
- return insertCommand(pending, id, { fr: fr.trim(), en: en.trim() }, kind)
+ const name = { fr: fr.trim(), en: en.trim() }
+ return insertCommand({ ...pending, parent }, id, name, kind)
})
- if (added) onCreated(createdId)
+ if (added) onCreated(createdId, parent)
}
return (