semantics: complete DEF-to-region migration, fix regressions

- Convert legacy [DEF🆔Type] anchors to #region/#endregion across 329 files
- Reinstate _normalize_timestamp_value in sql_generator.py
- Fix MarkerLogger→logger migration in events.py (molecular CoT markers)
- Fix dataset_review orchestrator dependencies (_build_execution_snapshot)
- Fix config_manager stale-record deletion (moved to save path only)
- Add 77 missing [/DEF:] closers in 5 unbalanced test files
- Update assistant_chat.integration.test.js for #region format
- Apply molecular-cot-logging markers (REASON/REFLECT/EXPLORE) via logger.* methods
This commit is contained in:
2026-05-12 23:54:55 +03:00
parent fe8978f716
commit 306c5ae742
331 changed files with 9630 additions and 10312 deletions

View File

@@ -1,12 +1,17 @@
# #region DictionaryUtils [C:1] [TYPE Module]
# #endregion DictionaryUtils
# #region DictionaryUtils [C:1] [TYPE Module] [SEMANTICS dictionary, utils, normalize, delimiter]
# @BRIEF Utility helpers for dictionary management (term normalization and delimiter detection).
# @LAYER: Domain
import re
import unicodedata
# #region _normalize_term [C:2] [TYPE Function] [SEMANTICS dictionary,normalize]
# @BRIEF Normalize a term for case-insensitive unique constraint lookup using NFC normalization.
# #region _normalize_term [TYPE Function]
# @BRIEF Normalize a term for case-insensitive unique constraint lookup.
# @RATIONALE: NFC normalization is applied before lowercasing to ensure consistent
# comparison of Unicode characters (e.g. precomposed vs decomposed forms).
# @REJECTED: Lowercasing without NFC normalization — would cause duplicate entries
# for semantically identical Unicode strings in different normalization forms.
def _normalize_term(term: str) -> str:
"""Normalize a term by NFC, lowercasing, and removing extra whitespace."""
if not term:
@@ -16,7 +21,8 @@ def _normalize_term(term: str) -> str:
# #endregion _normalize_term
# #region _detect_delimiter [C:1] [TYPE Function] [SEMANTICS dictionary,delimiter]
# #region _detect_delimiter [TYPE Function]
# @BRIEF Detect the delimiter used in a CSV/TSV header line.
def _detect_delimiter(header_line: str) -> str:
"""Detect delimiter by counting tabs vs commas in the first line."""
if not header_line:
@@ -25,3 +31,4 @@ def _detect_delimiter(header_line: str) -> str:
comma_count = header_line.count(",")
return "\t" if tab_count > comma_count else ","
# #endregion _detect_delimiter
# #endregion DictionaryUtils