Skip to content

feat(legal): show a legal document's version and effective date - #2665

Merged
michaelassraf merged 7 commits into
mainfrom
feat/legal-docs-pipeline
Oct 14, 2026
Merged

michaelassraf merged 7 commits into
mainfrom
feat/legal-docs-pipeline

Conversation

@michaelassraf

@michaelassraf michaelassraf commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

What

  • LegalDocumentPage shows the version and effective date the served document states ("Version 2.0 · Effective October 14, 2026") in place of the time it was last synced. A document that states neither keeps the old line.
  • Its copy props are optional: the title falls back to the one the document carries, so a host that shows whatever the hub lists states no per-document copy.
  • useLegalDocuments reads the hub's list of legal documents (GET /api/legal): type, title, page, FAQ topic, version, effective date, published.
  • LEGAL_DOCUMENT_TYPES (utils, server-safe): the types of legal document a hub can publish, for a statically exported host that prerenders one page per type.
  • The embedding example shows one card per published document on its home page, each opening that document's own page, and its legal page no longer holds a copy map that fell back to the privacy policy for an unknown type.

Checked

Type-check, eslint and biome pass; 4 new vitest cases pass.

Change-Set: feat-legal-docs-pipeline
ClickUp task: CU-17tkuw5x9wh Legal documents: split license from Terms of Service, add payment terms, review privacy policy, one pipeline for all legal files

🤖 Generated with Claude Code

Change set flamingo-stack/openframe-oss-lib#2665: these pull requests are one change, reviewed together.

Linked work

  • …and 1 linked item not shown here

Linked by the Depends-On / Change-Set lines in these descriptions; this block is maintained by the hub.

…tive date, and list the hub's documents [preview:none]

LegalDocumentPage shows the version and effective date the served document states, in place of the time it was last synced, and takes its title from the document when the host passes none, so a host states no per-document copy. useLegalDocuments reads the hub's list of legal documents.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@michaelassraf

Copy link
Copy Markdown
Member Author

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

🦩 Flamingo Code Review

1 finding: 🔴 0 action required · 🟠 0 recommended · 🔵 1 informational

Advisory: findings do not block the merge.

1 defect outside any rule

Inline comments: 1 new

2 possible problems checked and ruled out
  • openframe-frontend-core/src/components/shared/legal-document/index.ts:10 16 new or changed definitions have no test referencing them: New hook/util logic (useLegalDocuments, legal-documents.ts) genuinely lacks tests, though the finding bundles in trivial type re-exports and unrelated files, diluting its value.
  • openframe-frontend-core/src/components/shared/legal-document/legal-document-page.tsx:35 LegalDocumentPage's public prop contract changed from required strings to optional with silent defaults: Required props becoming optional with sensible defaults widens the contract rather than breaking it; existing callers passing these props still compile and behave identically.

Change set

  • Land together with flamingo-stack/openframe-oss-frontend#619: its branch uses what this pull request removes or changes.
🤖 Prompt for AI agents: fix every finding
Address these code-review findings on pull request #2665 of flamingo-stack/openframe-oss-lib, most important first.
For each one, make the minimal change that resolves it and do not refactor unrelated code.
If you can show a finding is wrong, skip it and say why.

1. [Informational] openframe-frontend-core/src/components/shared/legal-document/legal-document-page.tsx:123 Error/empty-state title falls back to a generic 'Legal document' when the fetch fails before any data arrives
   `title` is now computed as `titleProp ?? data?.title ?? 'Legal document'`. The sibling consumer (react-embedding-example/src/pages/legal.tsx) no longer passes a `title` prop at all, relying entirely on the fetched document's own title. But the document's title is only known once the fetch SUCCEEDS (`data` is populated). If the fetch fails (network error, 404, hub down) — exactly the case `errorTitle`/`emptyStateMessage` exist to describe — `data` is still null, so `title` falls back to the generic literal `'Legal document'`, and `errorTitle` becomes `'Unable to load Legal document'` / `emptyStateMessage` becomes `'Legal document is not available at this time.'` regardless of which document (privacy, terms, payment, …) actually failed. Previously the host supplied a per-document `errorTitle` (e.g. 'Unable to load terms of service'), so this is a real loss of specificity in exactly the failure path these props exist for. Consider deriving a per-docType fallback title (e.g. title-casing `docType`) instead of the single literal, or keeping `errorTitle`/`emptyStateMessage` keyed off `docType` rather than off `title`.

Next: commit a suggestion, or hand a comment's prompt to your coding agent. React 👍 on a finding that helped and 👎 on one that is wrong: the reviewer learns from both.

Review again. New commits are not reviewed until you ask:

  • Review the new commits: only what was pushed since this review
  • Review the whole diff again: everything, including what was already reviewed

Or comment @flamingo-review (new commits) or @flamingo-review full (everything). Add the flamingo-review-always label to review every push.

Updated 2026-10-14 02:46 UTC · reviewed from Michael Assraf's machine

…documents on the legal page [preview:none]

LegalDocumentPage takes a documents prop: a switcher over the hub's list, so a host with one legal route shows every published document and names none. The embedding example uses it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ocument is its own page [preview:none]

LegalDocumentPage shows one document and nothing else. The list carries a one-line summary per document for a host's cards, and utils exports LEGAL_DOCUMENT_TYPES for a statically exported host that prerenders one page per type. The embedding example lists one card per published document.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
michaelassraf and others added 2 commits October 13, 2026 22:48
…in the example, so a failed load still says which one [preview:none]

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…inks only the documents it has pages for [preview:none]

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread react-embedding-example/src/components/app-shell.tsx
michaelassraf and others added 2 commits October 13, 2026 23:11
…f; the example links every legal document [preview:none]

LegalDocumentPage takes documentsEndpoint and gets the document's title and FAQ topic from the hub's list, so a host passes only the type and its endpoints. The embedding example's navigation and home page list every document on the hub's list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… is not available, not an error [preview:none]

A 404 from the hub means the document has no published text yet. The page shows its not-available state and logs nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant