@windyroad/voice-tone 0.5.10 → 0.5.11-preview.721
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -54,8 +54,21 @@ surface = os.environ.get('EXTCOMMS_SURFACE', '')
|
|
|
54
54
|
# changeset-author: strip the leading YAML frontmatter block + blank line.
|
|
55
55
|
if surface == 'changeset-author':
|
|
56
56
|
draft = re.sub(r'^---\n.*?\n---\n\n?', '', draft, count=1, flags=re.DOTALL)
|
|
57
|
-
#
|
|
58
|
-
|
|
57
|
+
# Substance-aware whitespace normalization (P276 / ADR-009 + ADR-028 amended
|
|
58
|
+
# 2026-06-06). Tolerate trivial PASS-class reformatting so a marker survives
|
|
59
|
+
# interior CRLF/CR line endings and per-line trailing whitespace — the same
|
|
60
|
+
# normalization _substance_normalize_then_hash (gate-helpers.sh) applies to
|
|
61
|
+
# the policy-file-drift gates. Conservative boundary preserved: single-numeral
|
|
62
|
+
# edits and frontmatter-key changes stay substantive (key changes → review
|
|
63
|
+
# re-fires), so the leak-detection guarantee is never weakened.
|
|
64
|
+
# 1. CRLF / CR -> LF
|
|
65
|
+
# 2. strip trailing whitespace per line
|
|
66
|
+
# 3. strip trailing whitespace of the whole draft (subsumes the prior
|
|
67
|
+
# single-canonical rstrip; NO trailing '\n' is appended here so the key
|
|
68
|
+
# shape sha256(normalize(draft) + '\n' + surface) is byte-stable for
|
|
69
|
+
# already-clean drafts — existing markers and keys do not shift).
|
|
70
|
+
draft = draft.replace('\r\n', '\n').replace('\r', '\n')
|
|
71
|
+
draft = '\n'.join(line.rstrip() for line in draft.split('\n')).rstrip()
|
|
59
72
|
print(hashlib.sha256((draft + '\n' + surface).encode('utf-8')).hexdigest())
|
|
60
73
|
" 2>/dev/null
|
|
61
74
|
}
|