test(confirm): behaviour tests of the four sites the guard alone held (#467) #492
No reviewers
Labels
No labels
autopilot:pending-human
source:analyste
source:defenseur
source:human
source:medic
source:revue
status:approved
status:blocked
status:in-progress
status:needs-clarification
status:needs-fix
status:ready
status:review
status:to-test
status:triage
type:bug
type:feature
type:infra
type:refactor
type:schema
type:security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
maximus/Simpl-Resultat!492
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-467-confirm-behaviour-tests"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Resolves #467
Generated autonomously by /autopilot run of 2026-10-23
Link 3 of 4 of the milestone
planned-2026-10-23-gardes-tests-front(#480 → #478 → #467 → #451). Base:issue-478-journal-folder-stops(PR #491, head66d9aad). Link #451 is stacked on this branch and usessrc/test/elementTree.ts.What it does
Tests only, no production code. After #421,
src/__integration__/native-dialog-guard.test.tswas all that held four confirmation sites: it checks that eachconfirmAction(is awaited, not what the handler does with the answer (without theawait,!promiseis false andif (promise)is true: the deletion runs on « Annuler »). Each site now has a behaviour test on the hook harness (src/test/hookHarness.ts, #409), withconfirmActionmocked: a refusal leaves the data alone, an acceptance deletes the right id, and each test asserts the marked message passed toconfirmAction(faketofsrc/test/i18nMock.ts, through thei18nMockfactory).CategoryDetailPanel(t(categories.deleteConfirm)): the delete button lives in the childCategoryForm, which the harness never calls; the test finds theCategoryFormelement of the edit view and calls itsonDeleteprop. Refusal →onDeletenot called; acceptance →onDelete(10)once and no message;onDeleteresolving{ blocked: true, count: 3 }→t(categories.deleteBlocked[count=3])rendered at the next render (absent before); a later deletion that goes through clears it.AdjustmentDetailPanel(t(adjustments.deleteConfirm)): same layout withAdjustmentForm. Refusal → nothing; acceptance →onDelete(7)once.TemplateActions(t(budget.deleteTemplateConfirm)): the test opens the template list by clicking « Appliquer un modèle » (the button that holdsBookTemplate), renders again, then calls theonClickof the second template's delete button with{ stopPropagation: vi.fn() }.stopPropagationis asserted right after the call, before the answer, in both cases (the click would otherwise reach the row, which selects the template). Refusal → nothing; acceptance →onDelete(9)once. Neverharness.commit(): the component's effect callsdocument.addEventListener.AccountsPage(t(balance.category.actions.deleteConfirm)):useBalanceAccountsmocked as a whole; the test opens the categories tab by its button, renders again, and takes each category's delete button in its row (trkeyed by the category id). User category without account: refusal →removeCategorynot called; acceptance →removeCategory(21)once. Category with two linked accounts: buttondisabled, a click through the props calls neitherconfirmActionnorremoveCategory, and the next render showst(balance.category.error.has_accounts[count=2,names=Voilier, Toile]). Seeded category: buttondisabled, a click does nothing, no message.Shared helper
src/test/elementTree.ts(the plan's name), withsrc/test/elementTree.test.tsnext to it, on the model ofhookHarness.ts+hookHarness.test.ts:find(node, pred): every element the predicate keeps, depth first (an element before what it holds), through arrays at any depth and fragments: the semantics of the copy inBudgetPage.wiring.test.ts;holding(node, type): every element one of whose direct children is an element oftype, once each (the button that holds aTrash2, neither the icon nor the row): the semantics of the copy inProfileFormModal.delete.test.ts, including its one-level read ofprops.children(in<td>{label}{rows}</td>the items ofrowsare not direct children);props.childrenonly and never call a component of the tree. The docblock says both semantics; 15 tests pin each point (predicate, depth, arrays, fragments, texts and holes, other props, child components never called; by type, several occurrences, once per holder, identity of tags and components, the one-level read, a fragment holding its own children, child components never called).ProfileFormModal.delete.test.tsandBudgetPage.wiring.test.tsdrop their local copy and import the helper (same tests, same counts: 2 + 6).Files
src/test/elementTree.ts,src/test/elementTree.test.ts,src/components/categories/CategoryDetailPanel.delete.test.ts,src/components/adjustments/AdjustmentDetailPanel.delete.test.ts,src/components/budget/TemplateActions.delete.test.ts,src/pages/AccountsPage.delete.test.ts.src/components/profile/ProfileFormModal.delete.test.ts,src/pages/BudgetPage.wiring.test.ts(import of the helper, local copy removed);docs/architecture.md, section « Harnais de hooks »: harness users recounted with thegrepcited on that line (21 on 2026-10-20 → 25 on 2026-10-23), the four delete tests named; one paragraph forelementTree.ts(whatfindandholdingdo, who uses them, the 16 files that keep a copy).CategoryForm.tsx,AdjustmentForm.tsx,hookHarness.ts,i18nMock.ts.STATE.mduntouched (no manual check).The
grepcriterion of the plan: not met as writtenThe plan's criterion «
grep -rn "function holding\|function find" src --include='*.test.*'ne rend plus rien » assumed two local copies. Measured on the base66d9aad: 18 test files define a localfunction find(orfunction holding(, and the pattern also matches two distinct helpers (findCheckboxesinFilterPanel.test.tsx,holdingRowinuseSnapshotEditor.test.ts); three of thefindcopies take a type, not a predicate. The plan's decision and file list name two files, so this PR migrates those two (orchestrator decision, MEDIUM, logged). After it, the plan's grep still prints 18 lines: 16 files keep a copy (grep -rlE "function (find|holding)\(" src --include='*.test.*'):AdjustmentForm.wiring.test.ts,LinkTransfersModal.wiring.test.ts,HierarchyCheckModal.wiring.test.ts,OnboardingChecklist.test.tsx,ImportEmptyState.test.tsx,AppShell.slot.test.tsx,OnboardingBanner.render.test.tsx,StepCard.render.test.tsx,ChangelogContent.test.tsx,CategoryCombobox.placement.test.ts,EmptyState.test.tsx,UpsellCtas.render.test.tsx,UpsellDialog.render.test.tsx,TransactionTable.wiring.test.ts,SystemsSettingsPage.test.tsx,UsersSettingsPage.test.tsx.What this PR proves instead (narrower check): the seven test files it adds or changes (
elementTree.test.ts, the two migrated, the four new) define nofindorholding(grep -nE "function (find|holding)\(" <the 7 files>→ exit 1, no line), and all seven importtest/elementTree: one implementation of each helper for them, insrc/test/elementTree.ts. The plan also placed afindatProfileFormModal.delete.test.ts:48: that file only hadholding(l. 44; l. 48 was inside it).Decisions (details in the run's decisions log)
find).TemplateActionsby « Appliquer un modèle »,AccountsPageby the categories tab. Neither test depends on the order of the component's hooks, so the list « Préréglages actuels » ofdocs/architecture.md« Limites connues (#437) » is left unchanged (said in each test's header). Rejected:harness.slots[0] = true/= "categories", which the body allowed (a hook-order dependency and two more entries in that list, for no extra coverage).P(defaultTreeProps), soProfileFormModal.delete.test.tskeepsonClick?: () => Promise<void>without a cast at the call. The value import ofisValidElementfromreactinelementTree.tsis safe: test modules import it after thevi.mock("react")factory, never from inside it (the reasonhookHarness.tsimports React as a type only).244184c, before the mutation pass): the first draft gave categories asort_orderequal to their id, so a handler passingsort_orderwould have passed the id assertion; mutation P3 now shows it red.stopPropagationbefore the answer; no message on an unblocked deletion, and the message cleared after a later one; the seed guard;disabledon linked accounts.texts()(one line overfind) stays local in the two files that read a rendered message: the plan fixes the helper's API atfind+holding.719588f): no manual check, no post-merge action.Proofs
Tests committed (
92082c3,e7c3def,244184c) before the first mutation, and the self-review fix (719588f) before E7. One mutation at a time, restored bygit checkout -- <file>,git status --shortempty after each. For each «awaitremoved » mutation, the site's test andnative-dialog-guard.test.ts(34 tests) ran together.CategoryDetailPanel.tsxawaitremoved:if (!(confirmAction(…))) return;CategoryDetailPanel.tsxif (await confirmAction(…)) return;CategoryDetailPanel.tsxonDelete(selectedCategory.parent_id ?? selectedCategory.id)CategoryDetailPanel.tsxsetDeleteError(t("categories.deleteBlocked", …))removed)CategoryDetailPanel.tsx{false && deleteError && (…)}CategoryDetailPanel.tsxsetDeleteError(null)removedAdjustmentDetailPanel.tsxawaitremovedAdjustmentDetailPanel.tsxAdjustmentDetailPanel.tsxonDelete(selectedAdjustment.id + 1)TemplateActions.tsxawaitremoved:if (confirmAction(…)) {TemplateActions.tsxif (!(await confirmAction(…))) {TemplateActions.tsxhandleDelete(e, templates[0].id)TemplateActions.tsxe.stopPropagation()moved after theawaitAccountsPage.tsxawaitremovedAccountsPage.tsxAccountsPage.tsxremoveCategory(cat.sort_order)AccountsPage.tsxconfirmActioncalled)AccountsPage.tsxif (cat.is_seed) return;removedAccountsPage.tsxconst blocked = cat.is_seed;(linked accounts dropped fromdisabled)elementTree.tsfindpost-order (children before the element)elementTree.tsfinddrops arrayselementTree.tsholdingreturns the elements of the type, not their holderelementTree, 2ProfileFormModal.delete, 2TemplateActions.delete, 4AccountsPage.delete)elementTree.tsholdingflattens nested arrays (.flat(Infinity))elementTree.tsholdingreturns a holder once per child of the typeelementTree.tsfindcalls function componentselementTree.tsholdingcalls function components719588f; green (0 of 14, exit 0) on6e80525: the self-review finding fixed by719588fUnder C1, A1, T1 and P1 the site's acceptance test stays green (
!promiseis false, so the deletion runs): the refusal test is the one that catches a missingawait, as the body expected, together with the guard.Tests
66d9aad, 161 files / 2610 tests on the head719588f(+5 files, +27 tests: 15elementTree, 4CategoryDetailPanel, 2AdjustmentDetailPanel, 2TemplateActions, 4AccountsPage), green,i18n-mock-guardandnative-dialog-guardincluded.npm run build(tsc + vite) green on the head.src/zz_tmp_probe.test.tswithexpect(1).toBe(2)→npx vitest run src/zz_tmp_probe.test.tsexit 1 (sonde rc=1), file deleted.Hors périmètre
find/holding(list above): follow-up proposed to Max by the orchestrator (tests only, mechanical; three of them take a type, not a predicate).UpsellDialog.render.test.tsxis one of the 16.holding(node, type)returns the holder of an element of the type; theUpsellDialogelement itself isfind(tree, (el) => el.type === UpsellDialog).For the reviewer
onDeleteprop the panel hands its form; the form's ownonClick={onDelete}is not exercised here.AccountsPagecannot be reached from the UI (buttondisabled): the tests assertdisabledfirst, then call the handler through the props to prove the guard behind it.🤖 Generated with Claude Code
Niveau : normal
Verdict : APPROVE
Auto-revue de l'auteur (worker
/autopilot, maillon 3 de 4), pas une revue indépendante : le label restestatus:reviewet la PR porteautopilot:pending-human.Niveau, fichier par fichier (
REVIEW.mddemain)src/test/elementTree.ts,src/test/elementTree.test.ts, les quatre*.delete.test.ts,ProfileFormModal.delete.test.ts,BudgetPage.wiring.test.ts: désignés par la ligne Haut « code livré :src/**», dont la condition n'est pas remplie (aucun appel réseau ajouté ni modifié, aucune URL, aucun consentement touché : du code de test, que l'app n'importe pas) → normal.docs/architecture.md: aucune ligne Haut ne le désigne ; la liste « Restent au moins normaux » l'exclut du niveau bas → normal.src-tauri/, aucun manifeste, lock, workflow ni configuration.La PR est de niveau normal.
Ce que j'ai vérifié
66d9aad: refus → aucune suppression ; acceptation → suppression avec le bon identifiant (onDelete(10),onDelete(7),onDelete(9),removeCategory(21)) ; message marqué passé àconfirmActionaffirmé dans chaque test qui l'appelle. Le cas bloqué deCategoryDetailPanel(t(categories.deleteBlocked[count=3])) n'est rendu qu'au second rendu, et il est absent avant. PourAccountsPage, les comptes liés et la catégorie du seed : boutondisabled, aucun appel àconfirmActionni àremoveCategory, et le texte d'erreur au second rendu pour les comptes liés.awaitretiré » font rougir le test de refus du site etnative-dialog-guard.test.tsensemble.harness.commit()dansTemplateActions.delete.test.ts; aucun emplacement préréglé, les deux états s'ouvrent par un clic dans l'arbre rendu, donc la liste « Préréglages actuels » dedocs/architecture.mdreste juste telle quelle.react-i18nextpari18nMock()et n'écrivent aucun fauxt;native-dialog-guardne lit pas les tests, etelementTree.tsne mentionne aucune confirmation.grepcité : 25 au 2026-10-23. Copies locales restantes rejouées : 16 fichiers ; les sept fichiers de la PR n'en définissent aucune (grepexit 1).npm run buildvert etnpm testvert sur719588f(161 fichiers, 2610 tests). Lignes ajoutées sans.onlyni.skip, sans donnée personnelle ni jeton.pull_refaveccloses, venue de cette PR ; aucun autre verbe de fermeture dans le corps ni dans les commits.Constats (tous corrigés)
src/test/elementTree.ts:22-26sur6e80525(23-27 sur719588f) : le docblock affirmait qu'aucun des deux helpers n'appelle un composant de l'arbre, mais seulfindavait un test. La mutation E7 (holdingqui appelle les composants fonctions) restait verte sur6e80525(14 sur 14, exit 0). Corrigé par719588f: test « never calls a component of the tree: a holder its child renders is not there » danssrc/test/elementTree.test.ts; E7 rouge sur719588f(1 sur 15, exit 1).src/test/elementTree.ts:5-6sur6e80525: « before #467, test files kept their own copy » laissait croire qu'aucun ne la garde encore, alors que 16 la gardent. Reformulé dans719588f.244184c) : les catégories des fixtures avaient unsort_orderégal à leur identifiant, donc un gestionnaire qui aurait passésort_orderaurait passé l'assertion. Elles ont désormais des nombres distincts, et P3 le prouve.Suggestions (non bloquantes)
find/holdingsursrc/test/elementTree.ts(liste dans le corps de la PR) : des tests seulement, un travail mécanique. Trois d'entre elles prennent un type, qui s'écritfind(tree, (el) => el.type === X). Cette issue de suivi est à décider par Max.texts()(une ligne au-dessus defind) est écrit deux fois, dansCategoryDetailPanel.delete.test.ts:95etAccountsPage.delete.test.ts:114. Si un troisième fichier en a besoin, l'exporter depuiselementTree.tsdemandera une décision, puisque le plan fixe l'API àfindetholding.holding(node, type)rend le parent qui contient un élément du type. L'élémentUpsellDialoglui-même s'obtient parfind(tree, (el) => el.type === UpsellDialog).onClick={onDelete},CategoryForm.tsx:159etAdjustmentForm.tsx:179) n'a aucun test : les tests de cette PR appellent la proponDeleteque le panneau donne au formulaire. Ce trou existait avant la PR et sort de son périmètre.CI lue par l'orchestrateur
/autopilotdu 2026-10-23 (pas une revue).719588f, run 621PR Check — Frontend, statut combinésuccess.npm ci(176 paquets),✓ built in 11.16s, puis les fichiers de la PR :elementTree.test.ts(15 tests),CategoryDetailPanel.delete.test.ts(4),AccountsPage.delete.test.ts(4),TemplateActions.delete.test.ts(2),AdjustmentDetailPanel.delete.test.ts(2),ProfileFormModal.delete.test.ts(2),BudgetPage.wiring.test.ts(6) ; gardesnative-dialog-guard.test.ts(34) eti18n-mock-guard.test.ts(5) vertes.Test Files 161 passed (161),Tests 2610 passed (2610),Job succeeded: les comptes du corps de la PR (161 / 2610, contre 156 / 2583 sur la base66d9aad).Niveau : normal
Verdict : APPROVE
Résumé
Tests et doc seuls. Les quatre tests de suppression épinglent ce que chaque gestionnaire fait de la réponse de
confirmAction, ce que confirment les mutations du relecteur (23 rouges sur 26, les trois survivantes expliquées plus bas), etsrc/test/elementTree.tsreprend à l'identique les deux copies qu'il remplace. Le critère «grepvide » de #467 n'est pas rempli ; la PR le dit, chiffres à l'appui : la suite est une décision de Max (D1), pas un défaut du code.Niveau (Step 0bis,
REVIEW.mddemain)src/test/elementTree.ts,src/test/elementTree.test.ts, les quatre*.delete.test.ts,ProfileFormModal.delete.test.ts,BudgetPage.wiring.test.ts: désignés par la ligne Haut « code livré :src/**», dont la condition n'est pas remplie (aucun appel réseau, aucune URL, aucun consentement, et l'app n'importe aucun de ces fichiers) → normal.docs/architecture.md: « Restent au moins normaux » → normal.src-tauri/, aucun manifeste, lock, workflow ni configuration.Rejoué (clone hors dépôt, tête
719588f, base66d9aad)npm ci, sonde rc=1 (expect(1).toBe(2), fichier retiré ensuite),npm run buildrc=0 (tsclit toutsrc/, tests compris, avecnoUnusedLocals),npx vitest run: 161 fichiers et 2610 tests verts.HEAD is now at 719588f,Test Files 161 passed (161),Tests 2610 passed (2610).check-rustne tourne pas : aucun fichier Rust touché.findetholdingsont ceux des copies retirées, au typage près (génériqueP).docs/architecture.md, rejoués avec les commandes qu'il cite : 25 fichiers utilisent le harnais (21 sur la base et surmain), 16 gardent une copie locale (18 sur la base). Toutes ces copies sont desfind:elementTree.tsporte désormais le seulholdingdu dépôt. Sur la tête, legrepdu plan rend 18 lignes (les 16 copies, plusfindCheckboxesetholdingRow), comme l'annonce le corps. Les sept fichiers ajoutés ou modifiés n'en définissent aucune (grepexit 1) et importent touselementTree.docs/architecture.md, cohérents avec sa tête.Mutations du relecteur
Une à la fois sur le clone, restaurée par
git checkout --, arbre propre après chacune. Elles diffèrent de celles du corps, sauf R20, rejouée pour contrôle. R1 à R19 lancent le test du site ; R20 y ajoutenative-dialog-guard.test.ts; R21 à R26 lancentelementTree.test.tset les six fichiers qui l'importent (35 tests).CategoryDetailPanel.tsxcategories.editCategory)CategoryDetailPanel.tsxonDeleteappelé avant la réponseCategoryDetailPanel.tsxcountlu danskeyword_countau lieu du résultatCategoryDetailPanel.tsxCategoryDetailPanel.tsxAdjustmentDetailPanel.tsxAdjustmentDetailPanel.tsxonDeleteappelé deux foisAdjustmentDetailPanel.tsxTemplateActions.tsxe.stopPropagation()retiréTemplateActions.tsxTemplateActions.tsxTemplateActions.tsx|| true)AccountsPage.tsxAccountsPage.tsxis_seedretiré dudisabledAccountsPage.tsxAccountsPage.tsx> 3à> 2AccountsPage.tsxremoveCategoryavant la réponseAccountsPage.tsxsort_orderdans le gestionnaireAccountsPage.tsxnulldu message, en tête du gestionnaire, retiréeAccountsPage.tsxawaitretiré (P1 du corps)native-dialog-guardelementTree.tsfindne descend plus sous un élément gardéelementTree.tsholdingne descend plus sous un porteurelementTree.tsholding:some→everyelementTree.tsfindtraverse les fragments sans les présenter au prédicatelementTree.tsholdingignore unprops.childrenen tableauelementTree.tsfindne lit que le premier élément d'un tableauSurvivantes :
disabled(même calcul que le gestionnaire), donc le messagehas_accountsn'est jamais posé dans l'app et sa remise ànullne change rien ; le seuil du « … » ne se distingue qu'à partir de trois comptes liés. Rien à demander.Constats bloquants
Aucun.
Suggestions (non bloquantes)
src/components/budget/TemplateActions.delete.test.ts:33-34et:67-75: avec trois modèles et le bouton du milieu, R11 rougit, et T3 (templates[0].id) reste rouge.src/test/elementTree.ts:15-21: la lecture sur un niveau deholdingest documentée et épinglée, mais une absence prouvée parholdingpeut être vide : dans<td>{label}{rows}</td>, unTrash2derowsn'est pas vu. Aucun appel actuel n'affirme une absence avecholding(tous entoHaveLength(1)outoHaveLength(2), et les absences du dépôt passent parfind). Une phrase du docblock suffit : une absence se prouve avecfind.Décision pour Max
D1. Critère de #467 non rempli : «
grep -rn "function holding\|function find" src --include='*.test.*'ne rend plus rien ». Le plan comptait deux copies ; la base en a 18, dont troisfindqui prennent un type. La PR migre les deux que nomme le plan et le dit dans son corps et dansdocs/architecture.md(commande et compte).Resolves #467ferme l'issue au merge. Trois voies :findpar type deviennent des prédicats) : c'est ce que propose le corps ;docs/architecture.mdreste la seule trace des 16 copies ;Fermeture
La timeline de #467 porte une seule entrée
pull_refencloses, venue de cette PR ; #490, #491 et #493 ne font que citer #467.Resolves #467figure aussi dans les messages de6e80525et719588f: un merge en avance rapide (/merge-stack) ferme l'issue lui aussi. Commits au format conventionnel.Pile
La base, #491, est en
REQUEST_CHANGES(commentaire 27073), pour du texte seulement. Si la correction se fait sur sa branche, cette PR sera à rebaser. Le seul fichier commun,docs/architecture.md, change aux lignes 664-666 ici, et la correction B2 de #491 vise sa ligne 693 : aucun conflit attendu. Un rebase qui laisse identique le diff de cette PR contre sa base ne demande pas de second tour.Actions faites
/tmp/pr492-reviewet fichiers/tmp/pr492-*supprimés en fin de revue ; aucun fichier du dépôt touché.status:review→status:approved.719588ffe2483f886ac0Rebasée le 2026-10-24 par la session principale, sans changement de son diff.
REQUEST_CHANGES, texte seulement) :90a9a52(B1, ligne « Migration repair failed: » passée parwithoutFolders, décision de Max) etf02169c(B2, limite décrite telle qu'elle reste). Cette PR a été rebasée dessus : ancienne tête719588f, nouvelle tête483f886.git range-diff 66d9aad..719588f f02169c..483f886: les cinq commits sont identiques (=). Le diff de la PR contre sa base est identique à celui que la revue 27088 a relu, aux lignesindexprès.483f886: 161 fichiers, 2611 tests (2610 avant, plus le test de B1 venu de la base).