Skip to content

feat(certifications): shared certificationLabelKey so producer and importer resolve one key path per certification (CEL-1702) - #20

Merged
mong-x merged 3 commits into
mainfrom
marcus/cel-1702-certification-labels
Sep 8, 2026
Merged

feat(certifications): shared certificationLabelKey so producer and importer resolve one key path per certification (CEL-1702)#20
mong-x merged 3 commits into
mainfrom
marcus/cel-1702-certification-labels

Conversation

@mong-x

@mong-x mong-x commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

What

New src/certifications.ts exporting CERTIFICATION_TYPES (organic, fairtrade, sustainable), isCertificationType, and certificationLabelKey(type) returning a stable key certification. plus the English fallback (raw id for unknown types; Object.hasOwn keeps prototype names out). Re-exported from the package index.

Why

Producer renders the certification chips via offers:form.certification.* and importer via opportunities:certifications.*, identical English on two key paths, so the seven machine-translated locales can drift between surfaces (found in the CEL-1699 review). Both consumers will resolve the key through this helper and carry certification. in their own locale file.

Release and consumers

No version bump on the branch; after merge, make release-minor on main (0.12.1 to 0.13.0) and the OIDC workflow publishes. Then producer (replace the local helper in src/lib/offer-form-i18n-labels.ts) and importer (opportunity-detail.tsx inline keys) bump to ^0.13.0 in separate PRs.

Tests

tests/certifications.test.ts: canonical keys and fallbacks, unknown id keeps a stable key, prototype names rejected, canonical id list. Full suite green.

Gates

npm run typecheck 0, vitest run green, make build 0 (dist orphan check OK).

Implemented by the orchestrator because agent spawns were denied.


Summary by cubic

Adds a shared certificationLabelKey helper to @cellarnode/beverage-utils so the producer and importer dashboards resolve one stable i18n key path per certification. Previously each dashboard kept its own key path (offers:form.certification.* vs certifications.*), which could drift in the machine-translated locales.

  • Exports CERTIFICATION_TYPES, certificationLabelKey, isCertification, and normalizeAndCheckCertification from the package index.
  • Canonical ids match case- and whitespace-insensitively; unknown ids keep a stable certification.<type> key with i18next separators neutralized and the raw id as fallback, and prototype names like constructor are rejected.
  • Records the certification i18n key contract as a proposed ADR (.reposkein/decisions/2026-09-08-one-certification-i18n-key-contract-for-every-dashboard.json).

Migration

  • Release-minor on main (0.12.1 → 0.13.0) after merge, then bump producer and importer to ^0.13.0 replacing their local helpers/inline keys.

Written for commit 9600a63. Summary will update on new commits.

Review in cubic

…porter resolve one key path per certification (CEL-1702)
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Warning

Review limit reached

Next included review available in 42 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: ebfbb372-7df4-447a-a3fc-8d4dd9fa4a5b

📥 Commits

Reviewing files that changed from the base of the PR and between baf9863 and 9600a63.

📒 Files selected for processing (4)
  • .reposkein/decisions/2026-09-08-one-certification-i18n-key-contract-for-every-dashboard.json
  • __tests__/certifications.test.ts
  • src/certifications.ts
  • src/index.ts

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 774a4c9e-2d76-4ce9-925b-4be709e5814b

📥 Commits

Reviewing files that changed from the base of the PR and between e3b1d36 and baf9863.

📒 Files selected for processing (3)
  • __tests__/certifications.test.ts
  • src/certifications.ts
  • src/index.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Summary

Summary by CodeRabbit

  • New Features
    • Added standardized certification labels for Organic, Fairtrade, and Sustainable certifications.
    • Certification labels now provide consistent translation keys and English fallback text.
    • Unknown certification types remain supported with their original identifier as fallback text.
    • Certification options and label helpers are available through the public package interface.

Walkthrough

Changes

Certification utilities

Layer / File(s) Summary
Certification vocabulary and label behavior
src/certifications.ts, __tests__/certifications.test.ts
Adds canonical certification types, type validation, stable label keys, English fallbacks, and tests for known and unknown identifiers.
Public certification exports
src/index.ts
Re-exports the certification types, registry, label formatter, and type guard.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Feature

Merge Risk: ⚪ Minimal · up to baf98

This adds shared certification translation-key utilities with stable fallbacks and public package exports. Canonical, unknown, and prototype-name inputs are covered, with no current merge-readiness risk identified.

Suggested labels: feature

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the shared certificationLabelKey helper and its purpose of providing one key path for producer and importer consumers. It is specific to the main change, although longer t…
Description check ✅ Passed The description directly explains the new exports, fallback behavior, tests, release plan, and consumer migration. It is fully related to the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch marcus/cel-1702-certification-labels

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks each label key,
Three tidy names hop merrily.
Unknown tags keep their little name,
Safe type guards join the game.
The public index opens wide,
Certification tools reside.

Comment @coderabbitai help to get the list of available commands.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Adds a shared certificationLabelKey helper and constants with tests, consolidating i18n key resolution to prevent drift between dashboards. Bounded additive change with no behavior impact on existing consumers.

Re-trigger cubic

@coderabbitai coderabbitai Bot added the feature label Sep 8, 2026
@mong-x
mong-x merged commit 7104f3c into main Sep 8, 2026
2 checks passed
@mong-x
mong-x deleted the marcus/cel-1702-certification-labels branch September 8, 2026 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant