MASON-WP-0004-T02: 27/29 descriptions applied; clip to OpenBao's byte limit
Founder run 4 merged 27 accepted descriptions. Two failed with HTTP 400: used_by was 514 bytes because clipping counted characters and appended a 3-byte ellipsis. Clip and check now count bytes; manifest re-clipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Assistant: claude-code Assistant-Model: opus Assistant-Process: 327203@bnt-lap001 Assistant-Session: 55028ae3-4914-4bd1-8f5c-815f3527aef0
This commit is contained in:
parent
6bab3bbfdf
commit
84beefc406
4 changed files with 20 additions and 6 deletions
|
|
@ -36,8 +36,12 @@ PROPOSALS = os.path.join(os.path.dirname(__file__), "..", "docs", "credential-ow
|
|||
|
||||
|
||||
def _clip(text: str | None) -> str:
|
||||
"""Fit OpenBao's custom_metadata limit, which counts bytes, not characters."""
|
||||
text = " ".join(str(text or "").split())
|
||||
return text if len(text) <= MAX_VALUE else text[: MAX_VALUE - 1] + "…"
|
||||
if len(text.encode()) <= MAX_VALUE:
|
||||
return text
|
||||
cut = text.encode()[: MAX_VALUE - 3].decode(errors="ignore")
|
||||
return cut + "..."
|
||||
|
||||
|
||||
def _first_sentence(text: str | None) -> str:
|
||||
|
|
@ -111,7 +115,7 @@ def check(doc: dict) -> int:
|
|||
bad = 0
|
||||
for path, e in doc.items():
|
||||
missing = [k for k in REQUIRED if not e.get(k)]
|
||||
long = [k for k in REQUIRED if len(str(e.get(k, ""))) > MAX_VALUE]
|
||||
long = [k for k in REQUIRED if len(str(e.get(k, "")).encode()) > MAX_VALUE]
|
||||
state = e.get("review")
|
||||
if missing or long or state != "accepted":
|
||||
bad += 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue