GeezerVison is showing github.com — Wire legal-text version selection and the consent field onto the legal cards (ADR-021) by Storypapst · Pull Request #770 · OpenResilienceInitiative/ORISO-Admin
Conversation
Storypapst
commented
Aug 16, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Closes #768 · Closes #769 · Part of EPIC OpenResilienceInitiative/ORISO-AgencyService#250 · ADR-021 decisions 1–4, 6, 7
Why
M3RichTextEditor already implements the whole version look-back UI, but only DataProcessingAgreementCard (the AVV) ever fed it — the privacy, imprint and Fachbereich cards used the same component without version data, so no Träger could see which policy was in force when. LegalConsentTemplateEditor likewise existed as a Storybook component with no backing feature, while the consent sentence stayed static frontend i18n.
What changed
- Generic legal-text version client, isolated in
src/api/legal/getLegalTextVersions.ts + useLegalTextVersions — one path builder over the four levels and the legal-text kind, modelled on getDpaVersions.ts. A failure resolves to an empty history: version look-back is additive on these cards, so it must never block editing or publishing the live text.
- Version selection wired onto the Träger privacy/imprint card (
LegalText), the Fachbereich DPP and imprint card (DepartmentDataProtectionCard), and the agency-level legal card (LegalTextSettings). No new version UI — toEditorVersions maps the history onto the existing editor prop, including the "adopt as new draft" copy and the per-language fallback.
- Consent sentence as a field of the DPP, reusing
LegalConsentTemplateEditor with the {{key}} token picker. Publication is refused client-side when an authored sentence lacks {{legal_links}}, naming the affected languages; draft saves stay allowed. The cookie/authentication notice is rendered as a fixed, non-editable addendum in the preview. The consent field renders on the privacy cards only — the imprint is never a consent gate.
- Empty states: "no version published yet" in the version menu; "empty = the level above applies" on the consent field.
- i18n de + en for every new string.
Contract status vs the backend
The AgencyService endpoints of #251/#252 are not merged yet (no branch, no PR at the time of writing). Every touch point carries a TODO(#250) naming branch feat/legal-text-versioning-250:
- version endpoints live only in
src/api/legal/getLegalTextVersions.ts — aligning paths/DTO is a one-file change,
- the consent field is capability-gated: it is only offered when the read payload actually carries the field (
consentText / content.privacyConsent !== undefined), so nothing changes against today's deployed backends and no unknown property is ever sent.
Per ADR-021 decision 9 the agency card still merges inheritance client-side (mergeTranslatedContent); a comment marks it for deletion in favour of a resolved read endpoint.
Not implementable as specified
#768 asks for version comparison on all three cards. M3RichTextEditor has no diff view — it offers selection, "online since", date ranges and restore. Building a diff would be a new component, deliberately out of scope here.
How to test
Storybook (port 6023): Organisms/Legal/DepartmentDataProtectionCard/Versions & Consent and Organisms/Legal/LegalConsentField.
Published evidence (13 screenshots, desktop 1440 / tablet 820 / mobile 390 / 320): see the verification-evidence comment on this PR.
Gates run green: npx tsc --noEmit, npx tsc --noEmit --project tsconfig.storybook.json, npx eslint . --max-warnings=0, npx prettier . --check, npx vitest run (273 files, 1794 tests).
Reviewer test plan
- Open the Fachbereich data-protection policy story with history — the clock split button lists the versions newest first with their online-since ranges
- Select an older version — its wording is shown read-only with a banner saying you are looking at a past version
- Press "Als neuen Entwurf übernehmen" — the old wording is loaded as an editable draft and nothing is published
- Switch to a language a version was never stored in — the version is still readable, but "adopt as new draft" is not offered
- Open a card with no history — the version menu says "no version published yet" instead of showing an empty list
- Open the consent field — the preview shows a real checkbox with sample values and the fixed cookie notice beneath, with no way to edit it
- Insert
{{Beratungsstelle}} and {{Thema}} via the token picker — they appear at the cursor in {{key}} form and the preview substitutes samples
- Delete
{{legal_links}} and press "Veröffentlichen" — publication is refused, the affected languages are named, nothing is saved
- Press "Entwurf bearbeiten" instead — the draft save is not blocked
- Clear the consent field entirely — the UI states that the level above applies, rather than showing an error
- Type
${responsible} into the sentence — it stays literal text, never evaluated
- Check the imprint cards — they carry a version selector but no consent field
- Check both stories at 320px — no horizontal scrolling, the token picker stays reachable and the error text is fully readable
- Check both stories at 412px — same, and the picker opens without covering the field being edited
- Check the Träger privacy card and the agency-level legal card — same version selector, and the agency card marks an inherited consent sentence as inherited
🤖 Generated with Claude Code
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…gal-text cards
Implements the ORISO-Admin half of ORISO-AgencyService#250 (ADR-021).
- generic legal-text version history client + hook, isolated per level
(Träger / Beratungsstelle / Fachbereich), degrading to "no history"
until the AgencyService endpoints land
- version look-back wired onto the Träger privacy/imprint card, the
Fachbereich DPP + imprint card and the agency-level legal card, reusing
the M3RichTextEditor version UI that only the AVV card fed so far
- consent sentence as a FIELD of the data-protection policy: token picker,
fixed non-editable cookie notice, client-side mirror of the server's
mandatory {{legal_links}} validator that blocks publication
Co-Authored-By: Claude Opus 5 <[email protected]>
- the M3 card is a fixed 800x740 deck card and clips visible belowSlot
content, so the consent field moves under the editor inside the same card
- explicit empty states: 'no version published yet' in the version menu,
'empty = the level above applies' on the consent field (#768/#769)
- the mandatory token is composed in JSX, never interpolated: i18next
treats {{...}} inside a translation as its own syntax
Co-Authored-By: Claude Opus 5 <[email protected]>
|
Bugbot is not enabled for your account, so this pull request was not reviewed.
Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Aug 16, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Warning
Review limit reached
You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.
Your recent review volume is higher than typical usage, so adaptive limits are currently applied.
Next review available in: 13 minutes
Limit details: You’ve used all 2 included reviews currently available under your plan. You completed 57 included PR reviews in the past 7 days; at that activity level, included reviews refill at 2 reviews per hour.
Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.
How can I continue?
After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.
To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.
How do review limits work?
CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.
For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.
Please refer docs for additional details.
Review details
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: cecac170-e4ec-4bce-8eeb-7f2890cd11fa
📥 Commits
Reviewing files that changed from the base of the PR and between 16ebd6c and 9a00925.
📒 Files selected for processing (44)
src/api/agency/publishDepartmentDpp.ts
src/api/legal/getLegalTextVersions.test.ts
src/api/legal/getLegalTextVersions.ts
src/components/FormPluginEditor/M3RichTextEditor.tsx
src/components/FormPluginEditor/SplitDropdown.tsx
src/components/PlaceholderTemplate/LegalConsentTemplateEditor.tsx
src/components/PlaceholderTemplate/PlaceholderTemplateEditor.tsx
src/components/PlaceholderTemplate/PlaceholderTextField.tsx
src/components/PlaceholderTemplate/TemplateSplitButton.tsx
src/components/PlaceholderTemplate/TokenPicker.tsx
src/components/Tenants/LegalSettings/components/DepartmentDataProtectionCard/DepartmentDataProtectionCard.consent.test.tsx
src/components/Tenants/LegalSettings/components/DepartmentDataProtectionCard/DepartmentDataProtectionCard.versions.stories.tsx
src/components/Tenants/LegalSettings/components/DepartmentDataProtectionCard/index.tsx
src/components/Tenants/LegalSettings/components/DepartmentDataProtectionContainer/DepartmentDataProtectionContainer.test.tsx
src/components/Tenants/LegalSettings/components/DepartmentDataProtectionContainer/index.tsx
src/components/Tenants/LegalSettings/components/DepartmentImprintContainer/index.tsx
src/components/Tenants/LegalSettings/components/LegalConsentField/LegalConsentField.stories.tsx
src/components/Tenants/LegalSettings/components/LegalConsentField/index.tsx
src/components/Tenants/LegalSettings/components/LegalConsentField/styles.module.scss
src/components/Tenants/LegalSettings/components/LegalText/LegalText.test.tsx
src/components/Tenants/LegalSettings/components/LegalText/index.tsx
src/components/Tenants/LegalSettings/hooks/useLegalDraft.test.tsx
src/components/Tenants/LegalSettings/hooks/useLegalDraft.ts
src/components/Tenants/LegalSettings/hooks/useViewedLegalVersion.ts
src/components/Tenants/LegalSettings/utils/consentTextValidation.test.ts
src/components/Tenants/LegalSettings/utils/consentTextValidation.ts
src/components/Tenants/LegalSettings/utils/legalDraftStorage.test.ts
src/components/Tenants/LegalSettings/utils/legalDraftStorage.ts
src/components/Tenants/LegalSettings/utils/legalVersionOptions.test.ts
src/components/Tenants/LegalSettings/utils/legalVersionOptions.ts
src/hooks/useLegalTextVersions.hook.ts
src/hooks/usePublishDepartmentDpp.hook.test.tsx
src/hooks/usePublishDepartmentDpp.hook.ts
src/locales/de/translation.json
src/locales/en/translation.json
src/pages/Agency/Edit/components/LegalTextSettings/LegalTextSettings.consent.test.tsx
src/pages/Agency/Edit/components/LegalTextSettings/LegalTextSettings.test.tsx
src/pages/Agency/Edit/components/LegalTextSettings/index.tsx
src/types/TenantAdminData.ts
src/types/agency.d.ts
src/types/dpp.ts
src/types/legalVersion.ts
src/utils/mapTenantDataToTenantAdminData.test.ts
src/utils/mapTenantDataToTenantAdminData.ts
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f1af5c869c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Verification evidence
| Result |
Environment |
Commit |
Source |
| PASS |
Local |
f1af5c8 |
Claude |
after__version-lookback-menu-open-3-versions__desktop-1440x900__de__PASS.png

after__dpp-card-with-consent-field-valid__desktop-1440x900__de__PASS.png

after__publication-refused-placeholder-missing__desktop-1440x900__de__PASS.png

after__consent-field-valid-with-fixed-addendum__desktop-1440x900__de__PASS.png

after__consent-field-error-placeholder-missing__desktop-1440x900__de__PASS.png

after__consent-field-inherited-from-traeger__desktop-1440x900__de__PASS.png

after__dpp-card-with-consent-field-valid__tablet-820x1180__de__PASS.png

after__publication-refused-placeholder-missing__tablet-820x1180__de__PASS.png

after__dpp-card-with-consent-field-valid__mobile-390x844__de__PASS.png

after__publication-refused-placeholder-missing__mobile-390x844__de__PASS.png

after__version-lookback-no-horizontal-overflow__mobile-320x1600__de__PASS.png

after__consent-field-picker-and-preview-wrap__mobile-320x1600__de__PASS.png

after__publication-refused-error-readable__mobile-320x1600__de__PASS.png

All evidence for this run
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…ad-only
Addresses the six review findings on #770.
- The consent sentence is mapped through mapTenantDataToTenantAdminData, so the
normal tenant-admin path offers the editor at all. Absence stays absence:
`undefined` is what tells the card the backend cannot store the field.
- Version look-back switches body AND consent together, read-only, via a new
`onViewVersionChange` on the editor and one shared `useViewedLegalVersion`
hook for the three DPP-bearing surfaces.
- Saving a draft stores the consent map with the body; discarding clears both.
- A failed history request no longer resolves to "nothing was ever published".
Only a 404 (endpoint not deployed yet) means empty; anything else surfaces an
inline "history unavailable" notice while editing stays possible.
- Read-only propagates into the consent field, its token picker and the template
chooser — disabled, not hidden, per the admin design rule.
- Publishing a department DPP invalidates its version history; a draft save does
not, because it appends no version.
Verification: npm run test (274 files, 1813 tests), eslint --max-warnings=0,
prettier --check, npm run build. Every new assertion was mutation-checked by
reverting its fix and confirming it fails.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Aug 16, 2026
This was referenced Aug 18, 2026
Uh oh!
There was an error while loading. Please reload this page.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|