Skip to content

add key-level translation strings and jurisdiction content#6527

Open
seanmalbert wants to merge 2 commits into
mainfrom
6508/key-level-translation-data-model
Open

add key-level translation strings and jurisdiction content#6527
seanmalbert wants to merge 2 commits into
mainfrom
6508/key-level-translation-data-model

Conversation

@seanmalbert

Copy link
Copy Markdown
Collaborator

This PR addresses #6508

  • Addresses the issue in full
  • Addresses only certain aspects of the issue

Description

Adds the Phase 1 data model (content from the database): the key-level TranslationStrings table, the JurisdictionContent table, the SiteEnum and TranslationOrigin enums, and migration 66_key_level_translation_content.

  • TranslationStrings: one row per (jurisdiction, language, site, key) with value, a source_hash (for staleness detection in later work), and a machine/human origin. The unique index is created NULLS NOT DISTINCT in the migration SQL (Prisma cannot express it in the schema) so base rows (null jurisdiction and site) and global-Partners rows (null jurisdiction) cannot be duplicated.
  • JurisdictionContent: typed JSON documents (footer, faq, resources, disclaimers, contact) per (jurisdiction, language), FK to jurisdictions with ON DELETE CASCADE.
  • Back-relations added on Jurisdictions.

The change is additive: nothing reads the new tables yet, and the legacy translations table is untouched. It is retired in a later ticket once the read services are switched over.

How Can This Be Tested/Reviewed?

  1. Pull the branch and apply the migration: cd api && yarn prisma migrate deploy. It should apply 66_key_level_translation_content cleanly (requires Postgres 15+; Bloom runs 18).
  2. Confirm the translation_strings unique index is NULLS NOT DISTINCT:
    SELECT indexdef FROM pg_indexes
    WHERE indexname = 'translation_strings_jurisdiction_id_language_site_key_key';
    -- ... (jurisdiction_id, language, site, key) NULLS NOT DISTINCT
  3. Confirm duplicate null-keyed rows are rejected. Base rows (null jurisdiction and site):
    BEGIN;
    INSERT INTO translation_strings (language, key, value, updated_at) VALUES ('en','x','a',now());
    INSERT INTO translation_strings (language, key, value, updated_at) VALUES ('en','x','b',now()); -- expect unique violation
    ROLLBACK;
    And global-Partners rows (null jurisdiction, site = 'partners') the same way; the second insert should raise a unique-constraint violation.
  4. yarn prisma migrate status should report the schema is up to date, and yarn prisma validate should pass.

Author Checklist:

  • Added QA notes to the issue with applicable URLs
  • Reviewed in a desktop view (N/A: backend schema/migration only)
  • Reviewed in a mobile view (N/A: backend schema/migration only)
  • Reviewed considering accessibility (N/A: no UI)
  • Added tests covering the changes (no unit-test surface for a schema/migration change; the models are exercised by the services in Translation read/merge service and public read endpoints #6509+ and the integration/e2e in Integration and end-to-end tests #6521)
  • Ran yarn generate:client and/or created a migration when required (created 66_key_level_translation_content)

Review Process:

  • Read and understand the issue
  • Ensure the author has added QA notes
  • Review the code itself from a style point of view
  • Pull the changes down locally and test that the acceptance criteria is met
  • Either (1) explicitly ask a clarifying question, (2) request changes, or (3) approve the PR, even if there are very small remaining changes, if you don't need to re-review after the updates

@netlify

netlify Bot commented Jul 17, 2026

Copy link
Copy Markdown

Deploy Preview for bloom-angelopolis canceled.

Name Link
🔨 Latest commit 5d97638
🔍 Latest deploy log https://app.netlify.com/projects/bloom-angelopolis/deploys/6a5a95fc7bcca900075673ff

@netlify

netlify Bot commented Jul 17, 2026

Copy link
Copy Markdown

Deploy Preview for partners-bloom-dev ready!

Name Link
🔨 Latest commit 5d97638
🔍 Latest deploy log https://app.netlify.com/projects/partners-bloom-dev/deploys/6a5a95fcd8b2420008cdd7e6
😎 Deploy Preview https://deploy-preview-6527--partners-bloom-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Jul 17, 2026

Copy link
Copy Markdown

Deploy Preview for bloom-exygy-dev ready!

Name Link
🔨 Latest commit 5d97638
🔍 Latest deploy log https://app.netlify.com/projects/bloom-exygy-dev/deploys/6a5a95fc3045c8000787d8d4
😎 Deploy Preview https://deploy-preview-6527--bloom-exygy-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@seanmalbert seanmalbert changed the title feat(api): add key-level translation strings and jurisdiction content… add key-level translation strings and jurisdiction content Jul 17, 2026
@seanmalbert
seanmalbert marked this pull request as ready for review July 17, 2026 20:54
@seanmalbert
seanmalbert requested a review from ludtkemorgan July 17, 2026 20:54
@seanmalbert seanmalbert added the 1 review needed Requires 1 more review before ready to merge label Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1 review needed Requires 1 more review before ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants