Skip to content

Commit 9cbc0dd

Browse files
Updates from Dell 2026-07-24
1 parent e7dde59 commit 9cbc0dd

25 files changed

Lines changed: 1014 additions & 988 deletions

.protocol/metadata/internal_graph.json

Lines changed: 132 additions & 862 deletions
Large diffs are not rendered by default.

app.py

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
"""RED-Python application main module."""
2+
23
import os
34
import csv
4-
import copy
55
import tkinter as tk
66
from tkinter import ttk, filedialog, messagebox
77
from datetime import datetime
88

99
from config import (
1010
Settings,
1111
DEFAULT_FILTER_RULES,
12-
DEFAULT_PROTECTED_DIRS,
13-
DEFAULT_SETTINGS,
1412
)
1513
from core import Scanner, Cleaner, ScanResult
1614
from filters import METHODS, TYPES, METHOD_LABELS, TYPE_LABELS
@@ -100,7 +98,6 @@ def _ok(self):
10098

10199

102100
class SettingsDialog(tk.Toplevel):
103-
104101
def __init__(self, parent, settings: Settings):
105102
super().__init__(parent)
106103
self.title("Settings - RED-Python")
@@ -169,9 +166,7 @@ def _build(self):
169166
# Buttons row
170167
bf = ttk.Frame(t1)
171168
bf.pack(fill=tk.X, padx=6, pady=4)
172-
ttk.Button(bf, text="+ Add", command=self._rule_add).pack(
173-
side=tk.LEFT, padx=2
174-
)
169+
ttk.Button(bf, text="+ Add", command=self._rule_add).pack(side=tk.LEFT, padx=2)
175170
ttk.Button(bf, text="✎ Edit", command=self._rule_edit).pack(
176171
side=tk.LEFT, padx=2
177172
)
@@ -194,9 +189,9 @@ def _build(self):
194189
# ── Tab 2: Protection ─────────────────────────────────────────
195190
t2 = ttk.Frame(nb)
196191
nb.add(t2, text="Protection")
197-
ttk.Label(
198-
t2, text="Protected folders (one per line - never deleted):"
199-
).pack(anchor=tk.W, padx=6, pady=(6, 0))
192+
ttk.Label(t2, text="Protected folders (one per line - never deleted):").pack(
193+
anchor=tk.W, padx=6, pady=(6, 0)
194+
)
200195
self._protected = tk.Text(t2, font=("Consolas", 9))
201196
sb2 = ttk.Scrollbar(t2, command=self._protected.yview)
202197
self._protected.config(yscrollcommand=sb2.set)
@@ -312,9 +307,7 @@ def _unreg_shell(self):
312307
# ── Bottom buttons ────────────────────────────────────────────
313308
bb = ttk.Frame(self)
314309
bb.pack(fill=tk.X, padx=6, pady=6)
315-
ttk.Button(bb, text="Cancel", command=self.destroy).pack(
316-
side=tk.RIGHT, padx=4
317-
)
310+
ttk.Button(bb, text="Cancel", command=self.destroy).pack(side=tk.RIGHT, padx=4)
318311
ttk.Button(bb, text="Save", command=self._save).pack(side=tk.RIGHT)
319312

320313
# ------------------------------------------------------------------
@@ -473,7 +466,10 @@ def _apply_style(self):
473466
s.theme_use(theme)
474467
break
475468
except Exception as _e:
476-
import sys; print(f'[DEBUG] Ignored Exception: {_e}', file=sys.stderr); continue
469+
import sys
470+
471+
print(f"[DEBUG] Ignored Exception: {_e}", file=sys.stderr)
472+
continue
477473

478474
# ------------------------------------------------------------------
479475
def _build(self):
@@ -487,9 +483,7 @@ def _build(self):
487483
self._path_entry.bind("<Return>", lambda e: self._add_path())
488484

489485
ttk.Button(tb, text="Browse", command=self._browse).pack(side=tk.LEFT, padx=2)
490-
ttk.Button(tb, text="+ Add", command=self._add_path).pack(
491-
side=tk.LEFT, padx=2
492-
)
486+
ttk.Button(tb, text="+ Add", command=self._add_path).pack(side=tk.LEFT, padx=2)
493487
ttk.Button(tb, text="− Remove", command=self._remove_path).pack(
494488
side=tk.LEFT, padx=2
495489
)
@@ -599,17 +593,17 @@ def _build(self):
599593
side=tk.LEFT, fill=tk.X, expand=True, padx=(0, 6)
600594
)
601595

602-
self._btn_stop = ttk.Button(bf, text="Stop", command=self._stop, state=tk.DISABLED)
596+
self._btn_stop = ttk.Button(
597+
bf, text="Stop", command=self._stop, state=tk.DISABLED
598+
)
603599
self._btn_stop.pack(side=tk.RIGHT, padx=2)
604600
self._btn_delete = ttk.Button(
605601
bf, text="Delete selected", command=self._delete, state=tk.DISABLED
606602
)
607603
self._btn_delete.pack(side=tk.RIGHT, padx=2)
608604
self._btn_scan = ttk.Button(bf, text="Scan", command=self._scan)
609605
self._btn_scan.pack(side=tk.RIGHT, padx=2)
610-
ttk.Button(bf, text="Export…", command=self._export).pack(
611-
side=tk.RIGHT, padx=2
612-
)
606+
ttk.Button(bf, text="Export…", command=self._export).pack(side=tk.RIGHT, padx=2)
613607
ttk.Button(bf, text="Deselect", command=self._desel_all).pack(
614608
side=tk.RIGHT, padx=2
615609
)
@@ -706,17 +700,21 @@ def _do():
706700
try:
707701
total_bytes += os.path.getsize(long_path(fpath))
708702
except Exception as _e:
709-
import sys; print(f'[DEBUG] Ignored Exception: {_e}', file=sys.stderr)
703+
import sys
704+
705+
print(f"[DEBUG] Ignored Exception: {_e}", file=sys.stderr)
710706

711707
if total_bytes > 0:
712708
if total_bytes < 1024:
713709
size_str = f"{total_bytes} B"
714710
elif total_bytes < 1024 * 1024:
715-
size_str = f"{total_bytes/1024:.1f} KB"
711+
size_str = f"{total_bytes / 1024:.1f} KB"
716712
else:
717-
size_str = f"{total_bytes/(1024*1024):.1f} MB"
713+
size_str = f"{total_bytes / (1024 * 1024):.1f} MB"
718714
except Exception as _e:
719-
import sys; print(f'[DEBUG] Ignored Exception: {_e}', file=sys.stderr)
715+
import sys
716+
717+
print(f"[DEBUG] Ignored Exception: {_e}", file=sys.stderr)
720718

721719
self._tree.insert(
722720
"",
@@ -766,9 +764,7 @@ def _delete(self):
766764
to_process = [r for r in self.results if r.status == "empty"]
767765

768766
if not to_process:
769-
messagebox.showinfo(
770-
"No selection", "There are no empty folders to delete."
771-
)
767+
messagebox.showinfo("No selection", "There are no empty folders to delete.")
772768
return
773769

774770
mode = self._mode.get()
@@ -811,7 +807,9 @@ def _do():
811807
values=("Deleted", vals[1] if vals else ""),
812808
)
813809
except Exception as _e:
814-
import sys; print(f'[DEBUG] Ignored Exception: {_e}', file=sys.stderr)
810+
import sys
811+
812+
print(f"[DEBUG] Ignored Exception: {_e}", file=sys.stderr)
815813

816814
self.after(0, _do)
817815

@@ -820,7 +818,9 @@ def _do():
820818
try:
821819
self._tree.item(result.path, tags=("error",))
822820
except Exception as _e:
823-
import sys; print(f'[DEBUG] Ignored Exception: {_e}', file=sys.stderr)
821+
import sys
822+
823+
print(f"[DEBUG] Ignored Exception: {_e}", file=sys.stderr)
824824

825825
self.after(0, _do)
826826

config.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Configuration module for RED-Python application."""
2+
23
import os
34
import sys
45
import json
@@ -104,7 +105,9 @@ def load(self):
104105
saved = json.load(f)
105106
self.data.update(saved)
106107
except Exception as _e:
107-
import sys; print(f'[DEBUG] Ignored Exception: {_e}', file=sys.stderr)
108+
import sys
109+
110+
print(f"[DEBUG] Ignored Exception: {_e}", file=sys.stderr)
108111
return self
109112

110113
def save(self):

core.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Core module for RED-Python handling scanning and cleaning of directories."""
2+
23
import os
34
import stat
45
import threading
@@ -24,7 +25,9 @@
2425
logger = logging.getLogger("red_python")
2526
if not logger.handlers:
2627
handler = logging.StreamHandler()
27-
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
28+
formatter = logging.Formatter(
29+
"%(asctime)s - %(name)s - %(levelname)s - %(message)s"
30+
)
2831
handler.setFormatter(formatter)
2932
logger.addHandler(handler)
3033
logger.setLevel(logging.INFO)
@@ -84,9 +87,7 @@ def _run(self, paths):
8487
if self._stop.is_set():
8588
break
8689
total += self._scan_root(root)
87-
self.on_log(
88-
f"[{_ts()}] Scan complete - {total} empty folders found."
89-
)
90+
self.on_log(f"[{_ts()}] Scan complete - {total} empty folders found.")
9091
self.on_done(total)
9192

9293
def _scan_root(self, root):
@@ -217,8 +218,7 @@ def _run(self, results):
217218
to_delete.sort(key=lambda r: r.depth, reverse=True) # deepest first
218219

219220
self.on_log(
220-
f"[{_ts()}] Starting deletion ({mode.upper()}) - "
221-
f"{len(to_delete)} folders."
221+
f"[{_ts()}] Starting deletion ({mode.upper()}) - {len(to_delete)} folders."
222222
)
223223

224224
count = errors = 0
@@ -277,7 +277,9 @@ def _delete_one(self, result, mode):
277277
try:
278278
os.chmod(lpath, stat.S_IWRITE | stat.S_IREAD | stat.S_IEXEC)
279279
except Exception as _e:
280-
import sys; print(f'[DEBUG] Ignored Exception: {_e}', file=sys.stderr)
280+
import sys
281+
282+
print(f"[DEBUG] Ignored Exception: {_e}", file=sys.stderr)
281283
os.rmdir(lpath)
282284
self.on_log(f"[{_ts()}] Deleted: {path}")
283285
return freed
@@ -297,11 +299,15 @@ def _purge_ignorable_files(self, lpath) -> int:
297299
try:
298300
freed += os.path.getsize(lfpath)
299301
except Exception as _e:
300-
import sys; print(f'[DEBUG] Ignored Exception: {_e}', file=sys.stderr)
302+
import sys
303+
304+
print(f"[DEBUG] Ignored Exception: {_e}", file=sys.stderr)
301305
try:
302306
# Force write permissions to allow deletion of read-only junk
303307
os.chmod(lfpath, stat.S_IWRITE)
304308
os.remove(lfpath)
305309
except Exception as _e:
306-
import sys; print(f'[DEBUG] Ignored Exception: {_e}', file=sys.stderr)
310+
import sys
311+
312+
print(f"[DEBUG] Ignored Exception: {_e}", file=sys.stderr)
307313
return freed

deprecated/bootstrap_v0.5/record_validation_debt_historical.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@
2121
description="Server validation was ceremonial — only checked file structure, not endpoint functionality. /expedientes endpoint had timeout/hanging behavior.",
2222
evidence=[
2323
"00 audit/results/exterior/Control_Procesal/2026-06-05/phase2_ui_screenshot.png (shows 'Conectando...' status)",
24-
"00 audit/results/exterior/Control_Procesal/2026-06-05/phase2_remediation_result.md (documents initialization race condition)"
24+
"00 audit/results/exterior/Control_Procesal/2026-06-05/phase2_remediation_result.md (documents initialization race condition)",
2525
],
2626
remediation="Implemented async bootstrap chain: verificarServidor() → cargarData() → cargarInhabiles() → cargarClientes() → cargarValoraciones(). Added tests to block reintroduction.",
27-
falsely_approved_phase="PHASE_1_CONTRACT"
27+
falsely_approved_phase="PHASE_1_CONTRACT",
2828
)
2929

3030
print(f"✅ Recorded debt: {debt_id_1}")
3131
print(" Type: Functional validation gap (ceremonial audit)")
3232
print(" Severity: CRITICAL")
33-
print(" Phase: Control_Procesal server validation only checked structure, not real endpoints")
33+
print(
34+
" Phase: Control_Procesal server validation only checked structure, not real endpoints"
35+
)

0 commit comments

Comments
 (0)