Repository navigation
v0.140.0
Fixed
-
localization/orchestrator.pyFluentLocalization.format_pattern: strict mode not enforced on
two early-return paths (DEFECT-ORCHESTRATOR-STRICT-ENFORCEMENT-001):format_patternvalidated two conditions before entering the main resolution path — (1) that
argsis aMappingorNonevia_check_mapping_arg, and (2) thatattributeisstror
None— and returned(FALLBACK_INVALID, tuple(errors))on failure for both; neither path
checkedself._strict, so aFluentLocalization(strict=True)instance silently returned a
fallback value instead of raisingFormattingIntegrityError; this violated the architecture
invariant: "Whenstrict=True, NO formatting operation returns a fallback value"FluentBundle._format_pattern_implhandles the equivalent validation paths correctly — all
early returns checkself._strictbefore returning; theFluentLocalizationpaths were
inconsistent with this contract- Added
if self._strict: self._raise_strict_error(...)before both early returns, using
errors[-1](the error appended by_check_mapping_arg) for the invalid-args path and a
locally constructedFrozenFluentErrorfor the invalid-attribute path; the fix is structurally
identical to the existing strict-mode enforcement in_format_pattern_impl - Location:
localization/orchestrator.pyFluentLocalization.format_pattern(lines guarding
_check_mapping_argfailure and non-strattribute)
-
runtime/cache.pyIntegrityCache: four defects corrected inIntegrityCache
(DEFECT-CACHE-OBSERVABILITY-001 through DEFECT-CACHE-OBSERVABILITY-004):-
DEFECT-CACHE-OBSERVABILITY-001 —
write_once_conflictscounter missing: True write-once
violations (different content attempted for an existing key underwrite_once=True) were
silently rejected in non-strict mode with only an audit log entry and no counter; production
deployments without audit logging had no observable signal for data races; added
_write_once_conflictscounter, incremented unconditionally for true conflicts before the
strictbranch — strict mode raisesWriteConflictErrorAND increments, non-strict mode
silently rejects AND increments; exposed asget_stats()["write_once_conflicts"]and
cache.write_once_conflictsproperty; theFluentLocalization.get_cache_stats()aggregates
this counter across all bundles -
DEFECT-CACHE-OBSERVABILITY-002 —
HashableValuecomment was incorrect: line-164 comment
stated "Note: Decimal, datetime, date, FluentNumber are hashable and preserved unchanged" —
factually wrong;_make_hashable()never returns these types directly; all are converted to
type-tagged tuples (e.g.,Decimal("1.5")→("__decimal__", "1.5")); the primitives appear
in theHashableValueunion because tagged tuples contain them as inner elements (the union is
recursive); corrected to accurately describe type-tagging semantics and explain why primitives
appear in the union -
DEFECT-CACHE-OBSERVABILITY-003 — class docstring memory formula was stale:
IntegrityCache
class docstring stated"Weight is calculated as: len(formatted_str) + (len(errors) * 200)"—
the static200coefficient was removed in a prior version when dynamic weight calculation via
_estimate_error_weight()was introduced; corrected to"len(formatted_str) + sum(_estimate_error_weight(e) for e in errors)"with a description of the function's scope -
DEFECT-CACHE-OBSERVABILITY-004 —
_error_bloat_skipsconflated two distinct skip causes:
put()has three independent weight guards; check 2 (len(errors) > max_errors_per_entry) and
check 3 (total_weight > max_entry_weight) both incremented_error_bloat_skips; high
_error_bloat_skipswas ambiguous — it could indicate too many errors (pointing at error
diagnostic tuning) or a long formatted string combined with moderate errors (pointing at message
length); split into two counters:_error_bloat_skipsfor check 2 (error count exceeded) and
_combined_weight_skipsfor check 3 (combined formatted+error weight exceeded); both exposed
viaget_stats()and dedicated properties;FluentLocalization.get_cache_stats()aggregates
both; four pre-existing tests that assertederror_bloat_skips == 1for scenarios where check 3
fired (combined weight) corrected to assertcombined_weight_skips == 1 -
Missing properties added:
error_bloat_skips,combined_weight_skips, and
write_once_conflictswere counter slots with no public property accessor, inconsistent with all
other counter fields (hits,misses,oversize_skips,corruption_detected,
idempotent_writes); all three properties added
-