fix(ia): IA גל-1 — סנכרון-cache + נתונים-שגויים + מחיקת-מתים (#130, X17)
All checks were successful
G12 Leak-Guard / leak-guard (pull_request) Successful in 13s
All checks were successful
G12 Leak-Guard / leak-guard (pull_request) Successful in 13s
גל-1 מבקלוג #127 (docs/ia-audit-redesign.md §4) — תיקון מקומי, ללא הגירת-IA. מקיים G2 בשכבת-ה-UI דרך INV-IA1/IA2/IA5/IA6 (docs/spec/X17). א) פערי-סנכרון (INV-IA2 — mutation מבטל כל קורא): - CAS-1/2: העלאת-DOCX/export מבטלים ['decision-blocks'] (מחוון source_of_truth) - APR-1/4: פתרון/יצירת-הערה מבטלים ['chair','pending'] (תיבה+תג-סרגל) - APR-5/ADM-2: אישור/batch הלכות מבטלים ['chair','pending']+['operations'] - APR-6/ADM-3: create/update/delete/upload פסיקה-חסרה מבטלים שניהם - LRN-6: ComparePanel גוזר בחירה מהקורפוס המרוענן (אין POST ל-id מחוק → 404) - LRN-8: מחיקת-קורפוס מבטלת רשימת-צ'אטים (chat שהתייתם לא נשאר עם קישור-קורפוס תקוע) - LRN-10/MET-1/MET-8: promote מבטל גם lessons וגם methodology (LessonsTab+/methodology) ב) נתונים-שגויים (INV-IA5 — סטטוס מגובה-צרכן): - LRN-4: KPI "דפוסי סגנון" — הוסר היחס-השקרי "מתוך total_patterns" (שאילתות עצמאיות) - LRN-5: findings_applied (דגל אינפורמטיבי-בלבד) → findings_approved (שער INV-LRN1 האמיתי) - ADM-1: halacha_backlog שהוחזר ונזרק → מרונדר ב-/diagnostics, מצביע ל-/approvals (INV-IA1) - ADM-6: מוני-סוכנים מסמנים "חלקי+" כשחברת-Paperclip לא נטענה - APR-3: מכוסה ע"י APR-1 (count+sample מאותה שאילתה; הבעיה היתה staleness-cache) - MET-6: עורך-צ'קליסטים מציג איזה case בוחר כל צ'קליסט (explainer-תחולה) - ADM-5: ערך-Container מסומן "ממתין ל-redeploy" כש-Coolify≠Container ג) מתים/jargon: - PRE-2: הוסר GET /api/precedent-library/queue/pending (אפס צרכני-frontend) - PRE-3/5: AuthorityBadge (binding/persuasive) מרונדר גם בחיפוש, לא רק בתור-הביקורת - MET-5: הוסר ז'רגון T7/T15 מטקסט-העזר ב-/methodology (INV-IA6) Invariants: מקיים INV-IA1/IA2/IA5/IA6 (X17), G2 (מקור-אמת יחיד בשכבת-UI), G10 (לא הוסר שום שער-אנושי — רק סנכרון/נתון/קוד-מת). שומר INV-LRN1. בדיקות: py_compile web/app.py ✓ · tsc --noEmit ✓ · eslint ✓ (לבד מ-learning-panel:109 unescaped-quote — קיים-מראש ב-main, מחוץ לסט-הממצאים). next build נכשל רק בגלל symlink node_modules ב-worktree (Turbopack) — ה-build ב-Docker/CI תקין. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { apiRequest } from "./client";
|
||||
import { casesKeys } from "./cases";
|
||||
import { decisionBlocksKeys } from "./decision-blocks";
|
||||
|
||||
export type ExportFile = {
|
||||
filename: string;
|
||||
@@ -80,6 +81,9 @@ export function useExportDocx(caseNumber: string) {
|
||||
onSuccess: () => {
|
||||
qc.invalidateQueries({ queryKey: exportsKeys.list(caseNumber) });
|
||||
qc.invalidateQueries({ queryKey: casesKeys.detail(caseNumber) });
|
||||
// CAS-2 (INV-IA2): export flips active_draft → source_of_truth='docx';
|
||||
// the block viewer must re-fetch or its sync warning stays hidden.
|
||||
qc.invalidateQueries({ queryKey: decisionBlocksKeys.case(caseNumber) });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -104,6 +108,9 @@ export function useUploadDraft(caseNumber: string) {
|
||||
qc.invalidateQueries({ queryKey: exportsKeys.list(caseNumber) });
|
||||
qc.invalidateQueries({ queryKey: exportsKeys.activeDraft(caseNumber) });
|
||||
qc.invalidateQueries({ queryKey: exportsKeys.bookmarks(caseNumber) });
|
||||
// CAS-1 (INV-IA2): uploading a DOCX draft makes it the source-of-truth;
|
||||
// refresh the block viewer so the divergence banner appears immediately.
|
||||
qc.invalidateQueries({ queryKey: decisionBlocksKeys.case(caseNumber) });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -79,6 +79,9 @@ export function useCreateFeedback() {
|
||||
}),
|
||||
onSuccess: () => {
|
||||
qc.invalidateQueries({ queryKey: feedbackKeys.all });
|
||||
// APR-4 (INV-IA2): a new unresolved comment raises the chair-pending
|
||||
// aggregate — keep /approvals + the nav badge in sync.
|
||||
qc.invalidateQueries({ queryKey: ["chair", "pending"] });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -103,6 +106,9 @@ export function useResolveFeedback() {
|
||||
),
|
||||
onSuccess: () => {
|
||||
qc.invalidateQueries({ queryKey: feedbackKeys.all });
|
||||
// APR-1/APR-4 (INV-IA2): resolving a comment lowers the chair-pending
|
||||
// aggregate; refresh /approvals' counter + the nav badge (one source).
|
||||
qc.invalidateQueries({ queryKey: ["chair", "pending"] });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { apiRequest } from "./client";
|
||||
import { trainingKeys } from "./training";
|
||||
import { methodologyKeys } from "./methodology";
|
||||
|
||||
export type DraftFinalPair = {
|
||||
id: string;
|
||||
@@ -111,6 +113,13 @@ export function usePromoteLearning(pairId: string) {
|
||||
),
|
||||
onSuccess: () => {
|
||||
qc.invalidateQueries({ queryKey: learningKeys.all });
|
||||
// LRN-10 (INV-IA2): promote flips folded lessons' review_status, so the
|
||||
// per-corpus LessonsTab must refetch (lessons key is corpus-scoped —
|
||||
// invalidate the whole "lessons" prefix since promote is pair-scoped).
|
||||
qc.invalidateQueries({ queryKey: [...trainingKeys.all, "lessons"] });
|
||||
// MET-1 (INV-IA2): promote also writes discussion_rules + transition_
|
||||
// phrases['universal'] — /methodology (staleTime 30s) would stay stale.
|
||||
qc.invalidateQueries({ queryKey: methodologyKeys.all });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -158,6 +158,10 @@ export function useCreateMissingPrecedent() {
|
||||
}),
|
||||
onSuccess: () => {
|
||||
qc.invalidateQueries({ queryKey: missingPrecedentKeys.all });
|
||||
// APR-6 / ADM-3 (INV-IA2): a new open gap raises the chair-pending
|
||||
// aggregate and the /operations missing_precedents counter.
|
||||
qc.invalidateQueries({ queryKey: ["chair", "pending"] });
|
||||
qc.invalidateQueries({ queryKey: ["operations"] });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -173,6 +177,10 @@ export function useUpdateMissingPrecedent() {
|
||||
onSuccess: (_, { id }) => {
|
||||
qc.invalidateQueries({ queryKey: missingPrecedentKeys.detail(id) });
|
||||
qc.invalidateQueries({ queryKey: missingPrecedentKeys.all });
|
||||
// APR-6 / ADM-3 (INV-IA2): a status edit (e.g. open→irrelevant) shifts
|
||||
// the chair-pending aggregate and the /operations counter.
|
||||
qc.invalidateQueries({ queryKey: ["chair", "pending"] });
|
||||
qc.invalidateQueries({ queryKey: ["operations"] });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -187,6 +195,10 @@ export function useDeleteMissingPrecedent() {
|
||||
),
|
||||
onSuccess: () => {
|
||||
qc.invalidateQueries({ queryKey: missingPrecedentKeys.all });
|
||||
// APR-6 / ADM-3 (INV-IA2): removing a gap lowers the chair-pending
|
||||
// aggregate and the /operations counter.
|
||||
qc.invalidateQueries({ queryKey: ["chair", "pending"] });
|
||||
qc.invalidateQueries({ queryKey: ["operations"] });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -256,6 +268,10 @@ export function useUploadMissingPrecedent() {
|
||||
qc.invalidateQueries({ queryKey: missingPrecedentKeys.detail(id) });
|
||||
qc.invalidateQueries({ queryKey: missingPrecedentKeys.all });
|
||||
qc.invalidateQueries({ queryKey: ["precedent-library"] });
|
||||
// APR-6 / ADM-3 (INV-IA2): uploading closes the gap → chair-pending
|
||||
// aggregate and the /operations missing_precedents counter both drop.
|
||||
qc.invalidateQueries({ queryKey: ["chair", "pending"] });
|
||||
qc.invalidateQueries({ queryKey: ["operations"] });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -646,6 +646,10 @@ export function useUpdateHalacha() {
|
||||
),
|
||||
onSuccess: () => {
|
||||
qc.invalidateQueries({ queryKey: libraryKeys.all });
|
||||
// APR-5 / ADM-2 (INV-IA2): approving/rejecting a halacha changes the
|
||||
// chair-pending aggregate and the /operations halacha_review counter.
|
||||
qc.invalidateQueries({ queryKey: ["chair", "pending"] });
|
||||
qc.invalidateQueries({ queryKey: ["operations"] });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -666,6 +670,10 @@ export function useBatchReviewHalachot() {
|
||||
),
|
||||
onSuccess: () => {
|
||||
qc.invalidateQueries({ queryKey: libraryKeys.all });
|
||||
// APR-5 / ADM-2 (INV-IA2): a batch review shifts the chair-pending
|
||||
// aggregate and the /operations halacha_review counter.
|
||||
qc.invalidateQueries({ queryKey: ["chair", "pending"] });
|
||||
qc.invalidateQueries({ queryKey: ["operations"] });
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -18,9 +18,28 @@ export type DiagDoc = {
|
||||
created_at: string | null;
|
||||
};
|
||||
|
||||
/** Halacha review backlog (GAP-14 / INV-QA1 / G10) — human-gate visibility. */
|
||||
export type HalachaBacklog = {
|
||||
pending_review: number;
|
||||
pending_clean: number;
|
||||
pending_flagged: number;
|
||||
approved: number;
|
||||
rejected: number;
|
||||
deferred: number;
|
||||
published: number;
|
||||
total: number;
|
||||
reviewed_total: number;
|
||||
oldest_pending_at: string | null;
|
||||
throughput_24h: number;
|
||||
throughput_7d: number;
|
||||
};
|
||||
|
||||
export type Diagnostics = {
|
||||
db_ok: boolean;
|
||||
tables: Record<string, number | null>;
|
||||
// ADM-1 (INV-IA5): the backend returns this human-gate counter; render it
|
||||
// rather than silently dropping it. /approvals owns the action (INV-IA1).
|
||||
halacha_backlog: HalachaBacklog;
|
||||
failed_documents: DiagDoc[];
|
||||
stuck_documents: DiagDoc[];
|
||||
active_tasks: Array<{
|
||||
|
||||
@@ -172,6 +172,10 @@ export function useDeleteCorpusEntry() {
|
||||
onSuccess: () => {
|
||||
qc.invalidateQueries({ queryKey: trainingKeys.corpus() });
|
||||
qc.invalidateQueries({ queryKey: trainingKeys.report() });
|
||||
// LRN-8 (INV-IA2): deleting a corpus row nulls style_corpus_id on any
|
||||
// chat that referenced it — refresh the conversation list so those
|
||||
// chats no longer show a stale corpus link.
|
||||
qc.invalidateQueries({ queryKey: chatKeys.conversations() });
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -301,7 +305,10 @@ export type CuratorStats = {
|
||||
total_findings: number;
|
||||
decisions_with_findings: number;
|
||||
decisions_total: number;
|
||||
findings_applied: number;
|
||||
// LRN-5 (INV-IA5): the count of curator lessons with review_status='approved'
|
||||
// (the real INV-LRN1 writer gate) — replaces the old findings_applied, which
|
||||
// counted the informative-only applied_to_skill flag.
|
||||
findings_approved: number;
|
||||
recent_findings: CuratorFinding[];
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user