Skip to content

Feat(UI): Disclaimers for "Variant" and related changes - Large Change - #534

Open
Aditya-Dawadikar wants to merge 8 commits into
bluelearn-org:mainfrom
Aditya-Dawadikar:fix/520-disclaimers
Open

Aditya-Dawadikar wants to merge 8 commits into
bluelearn-org:mainfrom
Aditya-Dawadikar:fix/520-disclaimers

Conversation

@Aditya-Dawadikar

@Aditya-Dawadikar Aditya-Dawadikar commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #520.

Disclaimers could not be set when creating a variant. Disclaimer edits in a guide revision were never applied when the revision was published. Reviewers couldn't see disclaimers, the Changes view didn't show them, and a revision that only changed disclaimers was rejected as "no changes".

The root cause was that disclaimers were written straight onto the guide base rather than proposed on the revision. On a published guide that write was blocked, so there was nothing to review or publish.

Revision-scoped disclaimers

  • New guide_revision_disclaimers table, with RLS: anyone can read; only the author of a draft can change it. Each revision now proposes its own disclaimer set, like subject tags.
  • A trigger starts every new revision from its base's current disclaimers, whichever path created it. Existing revisions are backfilled with their base's current set.
  • close_review_panel replaces the base's disclaimers with the approved revision's set. Rejected revisions leave the base untouched.
  • revise_guide_revision carries the rejected revision's disclaimers into the new draft.
  • createGuide, addGuideVariant and updateRevision now save disclaimers on the revision. This removes the 422 that blocked disclaimer edits on published guides.

Variant creation

  • The variant form gets the shared DisclaimersField, filled in from the selected base guide. If lookups resolve out of order, the latest pick wins.
  • createVariantSchema accepts an optional disclaimers list; leaving it out keeps the base guide's set.

Review and Changes view

  • GET /reviews/cases/:id returns the revision's disclaimers, and the review page shows their banners.
  • Both revision diff endpoints return a disclaimers set diff (added / removed / unchanged). RevisionDiff shows it as a Disclaimers row.
  • On the revision history page, a guide's first version lists all its disclaimers as added.

Disclaimer-only edits

  • isRevisionDraftUnchanged now compares disclaimers, ignoring order, so a guide or variant revision that only changes disclaimers can be submitted.

Refactor

  • The disclaimer picker is now a shared DisclaimersField. Labels and banner copy live in lib/disclaimers, keyed by DisclaimerSlug. The duplicated slug lists were replaced with the ones from @bluelearn/schemas.

Note: revisions approved before this migration were backfilled with the base's current disclaimers. Diffs between those older revisions will show disclaimers as unchanged.

Edit 1

  • Variants now store their disclaimers separately from the original guide
  • Disclaimers are now available during review for the verifier accounts

Type of change

  • Bug fix
  • Feature
  • Refactor (no behavior change)
  • Documentation
  • Build / tooling / CI
  • Other: _________

Verification

  • pnpm -r typecheck passes
  • pnpm -r build passes
  • Manually verified in a browser (for UI / behavior changes)
  • Followed the app layout conventions
  • No new dependencies, or new dependencies are justified and AGPL-compatible
  • Change does not violate any non-negotiable principle
  • Documentation only, no changes to the codebase, so no tests required

Move the disclaimer picker into a reusable DisclaimersField and gather the labels and banner copy in lib/disclaimers, keyed by the shared DisclaimerSlug so a new slug can't ship without a label. Drop the duplicated slug lists in contributions.ts and guideRevisions.ts in favour of @bluelearn/schemas.

Prep for adding disclaimers to the variant creation form (bluelearn-org#520).
…pproval

Disclaimers are now proposed per revision, like subject tags, instead of being written straight onto the guide base. A new
guide_revision_disclaimers table holds each revision's set. A trigger starts every new revision from its base's current disclaimers, and
close_review_panel copies the approved revision's set onto the base. Forks of a rejected revision keep the disclaimers it proposed. This drops the 422 that blocked disclaimer edits on published guides, so edits made in a guide revision now show up once it is approved.

The variant creation form gets the shared DisclaimersField, filled in from the selected base guide. createVariantSchema accepts an optional disclaimers list, leaving it out keeps the base guide's set.
…edits

The review case now returns its revision's disclaimers, so reviewers see the banners the guide will carry. Revision diffs compare the two revisions' disclaimer sets as added / removed / unchanged, and the Changes view shows
them, the first version of a guide lists all of its disclaimers as added.

The edit form's no-change check now counts disclaimer edits, so a guide or variant revision that only changes disclaimers can be submitted.
@Aditya-Dawadikar Aditya-Dawadikar changed the title Fix/520 disclaimers Feat: Disclaimers for "Variant" and related changes Oct 25, 2026
@Aditya-Dawadikar Aditya-Dawadikar changed the title Feat: Disclaimers for "Variant" and related changes Feat(UI): Disclaimers for "Variant" and related changes - Large Change Oct 25, 2026
@Aditya-Dawadikar
Aditya-Dawadikar marked this pull request as ready for review October 31, 2026 06:15
@TheGIftedExplorer

Copy link
Copy Markdown
Contributor

@Aditya-Dawadikar Well done but there's one bug- Your code changes disclaimers of the base guide whenever a variant is created with additional disclaimers, The base guide should not be affected by a variant creation.
Also can you display disclaimer details in the review cases(side panel or content) that a verifier reviews

@Aditya-Dawadikar

Copy link
Copy Markdown
Contributor Author

@Aditya-Dawadikar Well done but there's one bug- Your code changes disclaimers of the base guide whenever a variant is created with additional disclaimers, The base guide should not be affected by a variant creation. Also can you display disclaimer details in the review cases(side panel or content) that a verifier reviews

let me take a look. thank you for taking your time out to review this huge PR

the reviewer can now see the disclaimers.
@Aditya-Dawadikar

Copy link
Copy Markdown
Contributor Author

Verifier can now see the disclaimers during review

image

GuideReader now renders the disclaimer banner, but the guide and variant
pages still drew their own above it, so each disclaimer showed twice.
Drop the page-level banners and let GuideReader render it everywhere.
…inal guide.

now each variant stores its own set of disclaimers and schema is modifed accordingly.

added regression tests to add/remove a disclaimer without touching the original guide.

This branch has not been deployed

No deployments
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.

[Bug] Disclaimers field missing in variant creation form

3 participants