Decide hall URI, static renderer sibling, and allowlist trust.
HOH-WP-0002 T01–T03. Public slug is frontmatter id. Rendering lives in hall-render. T04 still needs the operator corpus call. Assistant: grok Assistant-Session: 01a09dc1-b21e-77e1-919e-fcad2f82b267
This commit is contained in:
parent
2554e437ea
commit
250f9a525c
4 changed files with 84 additions and 5 deletions
|
|
@ -12,6 +12,8 @@ ENTRIES = ROOT / "entries"
|
|||
README = ROOT / "README.md"
|
||||
|
||||
REQUIRED_FM = ("id", "type", "worker_kind", "display_name", "created_at", "recorded_at", "status")
|
||||
# HOH-WP-0002-T01: the public URI slug is frontmatter id verbatim.
|
||||
ID_RE = re.compile(r"^[A-Za-z0-9]+(?:-[A-Za-z0-9]+)*$")
|
||||
REQUIRED_HEADINGS = (
|
||||
"Who I was",
|
||||
"Contribution",
|
||||
|
|
@ -120,6 +122,11 @@ def check_entry(path: Path, ids: dict[str, Path]) -> list[str]:
|
|||
entry_id = fm.get("id", "")
|
||||
if entry_id and ids.get(entry_id) not in (None, path):
|
||||
errors.append(f"{path.name}: duplicate id {entry_id}")
|
||||
if entry_id and ID_RE.match(entry_id) is None:
|
||||
errors.append(
|
||||
f"{path.name}: id {entry_id!r} is not URL-safe [A-Za-z0-9-]+ "
|
||||
"(HOH-WP-0002-T01: URI is this id verbatim)"
|
||||
)
|
||||
|
||||
for heading in REQUIRED_HEADINGS:
|
||||
if re.search(rf"^## {re.escape(heading)}\s*$", body, re.M) is None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue