NumPy fixed-width replace: input width must not redefine the search and replacement
Preserve the original search and replacement arguments so input storage width cannot redefine cleaning policy.
Do not use truncated arguments as the reference
Preserve the original search and replacement arguments so input storage width cannot redefine cleaning policy. Give Truthound a reference derived from complete old and new strings. An expectation built from the same truncated arguments would approve a different operation as correct. [1, 2, 3]
Two width-dependent changes
NumPy #32518 reports fixed-width replace truncating old and new to the input width. Its examples show finding absent ab in a and truncating replacement XY. This is a reported width-specific path rather than a safety judgment for every string API or a confirmed released repair. [1]
Retain complete arguments separately
Preserve source text, old, new and output separately, deriving the reference from the full arguments. Do not store results changed by shortened arguments. Record input dtype width and separately test a longer replacement; an ordinary output length does not establish identical content. [1, 3]
The independent expectation for absent ab
The illustrative source is a, the search is ab and replacement is X. Since ab is absent, expected output remains a. Observed a meets the search condition; X fails because truncating the search to a executes another operation. This defines an independent string-semantic fixture. [1, 3]
Check prepared string semantics
Truthound Core Python SDK 3.3.2 can compare prepared independently_replaced_text and actual_replaced_text through ColumnPairValidator with relationship="==". The operator supplies complete-argument semantics and distinct empty and missing states. The SDK does not repair NumPy argument conversion or output allocation, or infer content equality from length. [1, 2, 3]
A variable-width alternative preserving policy
Use a verified variable-width or Python replace path and confirm the full replacement survives. A control changing storage width should not change policy semantics. Reuse evidence for the same reconciled final path while reviewing new old and new argument boundaries separately. [1, 3]
Application conditions
Record original old and new strings and input dtype width, testing longer replacements separately.
Alternatives
Use verified variable-width strings or Python replace and recheck complete replacement preservation.
Limitations
Core compares prepared reference strings, does not repair argument conversion or output allocation and cannot establish identity from length.
Evidence
- Event checked
- Subject checked
- Modified
