From 0dcd186820433652f7459818ef458bcd54f2d322 Mon Sep 17 00:00:00 2001 From: cproudlock Date: Sun, 12 Jul 2026 20:46:09 -0400 Subject: [PATCH] Fix defects found in session review of GE-Enforce plugin Consolidated fixes from a three-dimension adversarial review. Data-loss (HIGH): the manifest entry editor stripped fields the form did not expose, because PUT /entries is a full reset-then-apply. The form now captures everything - InUseCheck processes as structured name/ExePath/timeout rows (not just names), LogFile, and the three preinstall flags as checkboxes; the dead payload-source control (never wired) is removed. New regression test proves an edit preserves ExePath/timeout/LogFile/PreEnrollment/PCTypesStrict. Update-entry crash (found by that regression test): replacing an entry's one-to-one InUseCheck (unique entryid) collided with the old row mid-flush -> IntegrityError -> 400. update_entry now frees the old InUseCheck (delete+flush) before populate re-inserts it. Export truncation (MEDIUM): export_scope_to_share used a plain truncating open, so a failed/partial write left the live on-share manifest (every PC reads it) empty. Now writes a temp file in the same dir and os.replace() atomically. Report dedup case bug (MEDIUM, confirmed by scratch test): the iscurrent demote matched hostname case-sensitively while the read path uses ilike, so a PC reporting different casing left two iscurrent rows and double-counted. Demote is now case-insensitive; regression test added. Simulator fidelity (MEDIUM): PCTypesStrict was captured but ignored by the filter mirror, so the simulator wrongly matched a collections-only strict entry to a nocollections PC via the shared Standard alias group. matches_pctype now honors PCTypesStrict (disables alias expansion); test added. Hardening: removed the dead/unscoped GEENFORCE_API_KEY env fallback (never wired into config; tokens are the only path); create/update entry return 400 on a duplicate Name instead of 500; parity now asserts scope-level Version/Site; a new test guards real-manifest field lengths against column limits (the DB-free parity harness can't see truncation); error handling added to the previously unguarded editor + reports API calls. Full suite green; naming + frontend build green. Co-Authored-By: Claude Opus 4.8 --- .../src/views/settings/EnforcementReports.vue | 13 +- .../src/views/settings/ImagingPCTypes.vue | 136 +++++++++++++----- plugins/geenforce/api/routes.py | 35 ++++- plugins/geenforce/filters.py | 24 +++- plugins/geenforce/parity.py | 16 ++- plugins/geenforce/service.py | 29 +++- tests/test_plugins/test_geenforce_crud.py | 56 ++++++++ tests/test_plugins/test_geenforce_parity.py | 49 +++++++ .../test_plugins/test_geenforce_reporting.py | 18 +++ 9 files changed, 314 insertions(+), 62 deletions(-) diff --git a/frontend/src/views/settings/EnforcementReports.vue b/frontend/src/views/settings/EnforcementReports.vue index 6e29e26..8258993 100644 --- a/frontend/src/views/settings/EnforcementReports.vue +++ b/frontend/src/views/settings/EnforcementReports.vue @@ -1,6 +1,7 @@