Skip to content

feat!(core): add identifier models to core library and website#1000

Merged
widal001 merged 11 commits into
HOLD-core-v0.4.0from
957-org-identifiers
Jul 14, 2026
Merged

feat!(core): add identifier models to core library and website#1000
widal001 merged 11 commits into
HOLD-core-v0.4.0from
957-org-identifiers

Conversation

@widal001

@widal001 widal001 commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds Identifier and IdentifierCollection models; replaces ein, duns, and uei on OrganizationBase with new identifier entries; and updates the website docs for these models.

Changes proposed

What was added, updated, or removed in this PR.

  • Adds Identifier, IdentifierCollection, and SystemId models to @common-grants/core library following the pattern defined in ADR-0023
  • Adds identifiers prop to OrganizationBase and moves ID-related props into that collection, matching the org-related IDs added in feat(website): add ID registry catalog #979
    • OrganizationBase.ein -> OrganizationBase.identifiers[org:us:ein]
    • OrganizationBase.uei -> OrganizationBase.identifiers[org:us:uei]
    • OrganizationBase.duns -> OrganizationBase.identifiers[org:xi:duns]
  • Adds a /protocol/fields/identifiers/ page for the new identifier fields and updates /protocol/models/organization to include the new org ID entries
  • Fixes the question bank and Form library mappings to use the new identifiers models.
  • Updates version-generator.ts to remove props marked with @Versioning.removed() in the JSON schemas that are auto-generated from TypeSpec since @typespec/versioning doesn't support this natively, and commits these auto-generated schemas.
  • Simplified the Identifier schema proposed in ADR-0023 by removing:
    • kind, scope, and schema from Identifer.registry
    • Removing uri, verifiedAt, and verifiedBy from the root

Context for reviewers

Testing instructions, background context, more in-depth details of the implementation, and anything else you'd like to call out or ask reviewers. Explain how the changes were verified.

Instructions to review

  1. Go to the PR preview page: https://cg-pr-1000.billy-daly.workers.dev/
  2. Review the website protocol docs:
  3. Review the updated question bank and form mapping:
    • Check that the Organization EIN form data is mapped to the correct location
    • Check that the Organization DUNS form data is mapped to the correct location
    • Check that the Organization UEI form data is mapped to the right location.
    • Check the other versions of the same ID fields (e.g. Fiscal Sponsor EIN, UEI, and DUNS)

Notes

  • I descoped adding an identifiers prop to OpportunityBase because it would break the property-based testing that we have set up in the TypeScript SDK unless we also implement in in the SDK.
  • The fixes I added to support @Versioning.removed() in the JSON schema output should probably be moved either into lib/changelog-emitter or in a new custom TypeSpec emitter in our lib/ directory because multiple sections of this codebase use @typespec/json-schema and the resulting JSON schemas will include ein, duns, and uei properties unless they adopt a similar fix to the one this PR adds to version-generator.ts to remove them.
  • I simplified the Identifier model a bit by removing some extra fields that we may want to add in the future. But given the complexity of removing properties (as surfaced in this PR) I'd rather be more conservative with the fields we add in the initial release. The fields I removed are:
    • kind, scope, and schema since these can be looked up in the ID registry entry using registry.url
    • uri, verifiedAt, and verifiedBy because it's a lot to add a verification layer or external lookups to identifiers at this step.

Additional information

Screenshots, GIF demos, code examples or output to help show the changes working as expected.

Fields page

Screenshot 2026-07-09 at 7 49 06 PM

New identifiers field page

Screenshot 2026-07-09 at 8 11 35 PM

Updated organization model page

Screenshot 2026-07-09 at 8 12 35 PM

Update question bank and form mapping

Screenshot 2026-07-09 at 8 13 23 PM

widal001 added 7 commits July 9, 2026 14:17
Add the Identifier and SystemId field models, the IdentifierT
template they instantiate, and the Identifiers collection.
Tighten the employerTaxId, samUEI, and duns scalars to their
registry-specific formats.
Remove the ein, uei, and duns fields from OrganizationBase and
add an identifiers collection (OrgIds) built from the OrgIdEin,
OrgIdUei, and OrgIdDuns registry-specific models.

BREAKING CHANGE: OrganizationBase.ein, uei, and duns are removed
in favor of the identifiers collection.
The per-version schema reconstruction now strips fields whose
@removed version is at or before the target version, not just
fields added after it. Without this, v0.4 OrganizationBase kept
the removed ein/uei/duns fields.
Rename IdentifierCollection to Identifiers and
OrgIdentifierCollection to OrgIds in ADR-0023 to match the
implemented models.
Add the Identifiers field page (Identifier, SystemId, Identifiers)
and per-identifier sections (OrgIds, OrgIdEin, OrgIdUei, OrgIdDuns)
on the Organization model page.
Repoint the question-bank and SF-424 form mappings from the
removed org ein/uei/duns fields to the identifiers collection
(organizations.primary.identifiers.org:us:ein.id, etc.).
Regenerate the published JSON schemas for the identifier models
and the updated OrganizationBase.
@github-actions github-actions Bot added website Issues related to the website core Issues related to @common-grants/core library typescript Issue or PR related to TypeScript tooling labels Jul 9, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🚀 Website Preview Deployed!

Preview your changes at: https://cg-pr-1000.billy-daly.workers.dev

This preview will be automatically deleted when the PR is closed.

@widal001 widal001 requested a review from SnowboardTechie July 10, 2026 00:14
Removes a few fields like `verifiedAt`, `uri`, `registry.schema` etc. to
prevent us from prematurely adding props that we wind up removing later.
Also makes all of the props in this model optional.
@widal001 widal001 linked an issue Jul 10, 2026 that may be closed by this pull request
2 tasks

@SnowboardTechie SnowboardTechie left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looked through this, really nice work on the IdentifierT template shape, the registry-pinned org IDs and the version-generator fix all read clean, and the removal tests pin the semantics down well.

On the ADR-0023 deviations: I'd land them the same way. Dropping kind/scope/schema/uri/verifiedAt/verifiedBy is the right conservative call, this PR itself shows how much cheaper adding later is than removing.

One tiny wording note inline, otherwise good to go.

Comment thread website/src/content/docs/governance/adr/0023-org-ids.mdx Outdated
widal001 added 3 commits July 14, 2026 12:22
Refers to `IdentifierCollection` as a "field" instead of a "collection"
to avoid repetition.
…ions

A model or property defined via `is`/`extends` on a versioned base inherits
the base's `@added`/`@removed` decorators in addition to its own, so
`getAddedOnVersions`/`getRemovedOnVersions` can report the same version more
than once. This produced duplicate "Added X model" changelog entries for the
identifier template instantiations (Identifier, SystemId, OrgIdEin, OrgIdUei,
OrgIdDuns).

Collapse duplicate versions before logging model/property additions and
removals, since an entity can only be added or removed once per version.
The `refactor(core): simplify Identifier model` change and the org-identifier
additions shifted line numbers in identifier.tsp, organization.tsp, types.tsp,
and filters/numeric.tsp, but the doc frontmatter ranges were not updated, so
several TypeSpec tabs rendered the wrong model or truncated code.

Realign every affected range to its declaration (doc comment through closing
line): identifier/SystemId/IdentifierCollection, OrgSocialLinks, the string,
date, and numeric scalars, and the number range/array filters.
@widal001

widal001 commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator Author

@SnowboardTechie FYI - I incorporated your suggested fix in ADR-0023 and then fixed a few incorrect ranges on the website docs in this commit: docs(website): fix stale TypeSpec line ranges

@widal001 widal001 merged commit 1dab640 into HOLD-core-v0.4.0 Jul 14, 2026
7 checks passed
@widal001 widal001 deleted the 957-org-identifiers branch July 14, 2026 17:39
@github-actions

Copy link
Copy Markdown
Contributor

🗑️ Preview Cleaned Up

The preview for this PR has been automatically deleted.

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

Labels

core Issues related to @common-grants/core library typescript Issue or PR related to TypeScript tooling website Issues related to the website

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Org IDs] Add identifiers models to organization and opportunity

2 participants