Skip to content

Use CMS Certificate Title for program verifiable credentials - #3698

Merged
zamanafzal merged 3 commits into
mainfrom
zafzal/certificate-cms-title-verifiable-credential
Aug 6, 2026
Merged

Use CMS Certificate Title for program verifiable credentials#3698
zamanafzal merged 3 commits into
mainfrom
zafzal/certificate-cms-title-verifiable-credential

Conversation

@zamanafzal

@zamanafzal zamanafzal commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

What are the relevant tickets?

Follow-up to the certificate-title work (hq#11907, tracked in hq#11938).

Description

When a program certificate is issued, the verifiable credential (Open Badge) is signed with a name. Today that name is the program title. This changes it to the CMS "Certificate Title" (CertificatePage.product_name) so the issued credential matches the title printed on the certificate (and shown on the MIT Learn certificate page).

Falls back to the program title when product_name is unset.

  • Going forward only. This affects credentials signed after this lands. Already-signed verifiable credentials are not re-issued (per product direction on #11938).

Change

courses/api.pyget_verifiable_credentials_payload, program branch:

certificate_name = certificate_page.product_name or certificate.program.title

certificate_page is always present here (the caller returns early via should_provision_verifiable_credential when it is None).

How to test

Manual:

docker compose exec web python manage.py shell

from courses.models import ProgramCertificate
from courses.api import get_certificate_page, get_verifiable_credentials_payload

# pick a cert whose program has a CMS certificate page + the user has an enrollment
cert = ProgramCertificate.objects.first()
page = get_certificate_page(cert)
print("Certificate Title (product_name):", repr(page.product_name))
print("Program title               :", repr(cert.program.title))

payload = get_verifiable_credentials_payload(cert, page)
ach = payload["credentialSubject"]["achievement"]
print("VC name       :", ach["name"])         # -> should be the Certificate Title
print("VC description:", ach["description"])

Automated:

docker compose run --rm web uv run pytest courses/api_test.py -k verifiable_credential
  • test_program_certificate_verifiable_credentials_signing_payload now sets a CMS product_name ("Universal AI") distinct from the program title ("Data Science MicroMasters") and asserts the credential name/description use the product_name.
  • test_program_verifiable_credential_name_falls_back_to_program_title (new) asserts the fallback to program title when product_name is empty.

Manual (optional): issue a new program certificate for a program whose CMS certificate page "Certificate Title" differs from its program title, then inspect the resulting verifiable credential — credentialSubject.achievement.name should be the Certificate Title.

@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown

OpenAPI Changes

Show/hide changes
## Changes for v0.yaml:
No changes detected

## Changes for v1.yaml:
No changes detected

## Changes for v2.yaml:
No changes detected

Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

Comment thread courses/api.py Outdated
@zamanafzal zamanafzal changed the title Use CMS Certificate Title for program verifiable credentials WIP: Use CMS Certificate Title for program verifiable credentials Jun 24, 2026
@zamanafzal
zamanafzal force-pushed the zafzal/certificate-cms-title-verifiable-credential branch from f61e41f to a9e7788 Compare June 30, 2026 09:10
@zamanafzal zamanafzal changed the title WIP: Use CMS Certificate Title for program verifiable credentials Use CMS Certificate Title for program verifiable credentials Jun 30, 2026
Comment thread courses/api.py
certificate_name = certificate.program.title
certificate_name = (
certificate_page.product_name or ""
).strip() or certificate.program.title

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So are we giving higher precedence to product name over the program title?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

oh, I see

@annagav annagav left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

zamanafzal and others added 3 commits August 6, 2026 15:12
Program verifiable credentials now use the CMS "Certificate Title"
(product_name) for the credential name, so the issued credential matches
the title printed on the certificate. Falls back to the program title
when product_name is unset.

Applies to newly issued credentials going forward only; already-signed
verifiable credentials are not re-issued.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Match the frontend getCertificateTitle helper, which falls back to the
program title on whitespace-only Certificate Titles. Parametrize the
fallback test over empty and whitespace-only product_name.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@zamanafzal
zamanafzal force-pushed the zafzal/certificate-cms-title-verifiable-credential branch from a9e7788 to 7a86c8f Compare August 6, 2026 10:19
@zamanafzal
zamanafzal merged commit 8ba02ad into main Aug 6, 2026
14 checks passed
@zamanafzal
zamanafzal deleted the zafzal/certificate-cms-title-verifiable-credential branch August 6, 2026 12:15
@odlbot odlbot mentioned this pull request Aug 6, 2026
3 tasks
@zamanafzal

Copy link
Copy Markdown
Contributor Author

Verified the changes on RC and left a comment on the ticket https://github.com/mitodl/hq/issues/11938#issuecomment-5215132791

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants