Skip to content

[Core] Plan for adding RelationshipCollection with opportunity, award, and organization relationships #1223

Closed

Description

@laurabelinfante

Summary

Mary Moilanen (Fluxx) raised record relationships, and Billy proposed a reusable collection pattern following IdentifierCollection:

/** A collection of relationships with a record. */
model RelationshipCollection<TRef> {
  /** A record that replaces the current record */
  supersededBy?: TRef;
  /** Additional relationships defined by the implementation */
  otherRelationships?: Record<TRef>;
}

This ticket owns the generic collection plus the opportunity, award, and organization surfaces that use it. Settle the pattern first: one person leads the design decision on the collection's shape, records it in this ticket, then implements it, rather than running a full ADR cycle.

For opportunities and awards, add OppRelationships, AwdRelationships, and relationships? on OpportunityBase and AwardBase. supersededBy means the referenced record replaces the current duplicate; a temporal successor is different. This ticket does not define HTTP redirects, status codes, fetch behavior, or list exclusion. Award.parent continues to mean amendment or tranche, and pass-through funding remains separate.

For organizations, extend the collection with the typed members Fluxx needs and add OrganizationBase.relationships?: OrgRelationships:

/** A collection of relationships for an organization. */
model OrgRelationships extends RelationshipCollection<OrgRef> {
  parent?: OrgRef;
  fiscalSponsor?: OrgRef;
  dba?: OrgRef;          // or a root-level string / string[]?
  subsidiary?: OrgRef;   // or subsidiaries: OrgRef[]?
}

Fluxx plans six concepts: parent, subsidiary, chapter, fiscal sponsor, doing-business-as, and successor. Each needs a recorded cardinality and representation, and a temporal successor must not be conflated with supersededBy.

Acceptance criteria

  • The collection pattern is recorded in this ticket before implementation, including how organization relationships extend it
  • Follow on ACs are created for an implementation ticket

Activity

  1. added
    coreIssues related to @common-grants/core library
    sdkIssue or PR related to our SDKs
    featureNew capability. Belongs on a hold branch.
    on Sep 23, 2026
  2. laurabelinfante commented on Sep 28, 2026

    @laurabelinfante
    CollaboratorAuthor
  3. SnowboardTechie commented on Sep 29, 2026

    @SnowboardTechie
    Collaborator

    Recording where the relationship design landed, so it's on the ticket before I start the implementation.

    The pattern. Every model gets a parents list instead of a relationships collection. Each entry is a reference to another record of the same model plus a required kind, an extensible enum specific to that model:

    • OpportunityBase.parents?: OppParentRef[]: entries are { kind, id, title, identifiers? }, kind supersededBy
    • AwardBase.parents?: AwdParentRef[]: entries are { kind, id, title, identifiers? }, kinds amendment, tranche, and supersededBy
    • OrganizationBase.parents?: OrgParentRef[]: entries are { kind, id, name, identifiers? }, kinds subsidiary, chapter, department, dba, fiscalSponsor, and supersededBy

    Every kind enum also takes custom. parents is the right name because every link in scope points up, to the record this one exists under or derives from. Links to other models, such as competitions, funders, or an award's opportunity and recipientOrganizations, stay where they are.

    There's no RelationshipCollection<TRef> and no otherRelationships. A generic base in TypeSpec emits an auto-named schema per reference type. And the per-model kind already is the extension point: a new kind is an additive change.

    Organization concepts. Each concept is a parents entry owned by the dependent record, pointing at the other organization. The list holds zero or more entries, and an organization can carry several at once (a department that's also fiscally sponsored, for example):

    Concept Kind Meaning
    Subsidiary subsidiary The referenced organization owns or controls this one
    Chapter chapter This organization is a chapter of the referenced organization or network
    Department department This organization is a department of the referenced organization
    Fiscal sponsor fiscalSponsor The referenced organization fiscally sponsors this one
    DBA dba This record is a name the referenced legal entity does business under
    Successor supersededBy The referenced organization replaces this one, as a merged duplicate or as a new legal entity
    Parent in general any kind above, or custom There's no unqualified parent; every entry says what kind it is

    A DBA link runs one way: the DBA's own record points at its legal entity, and the legal entity doesn't list its DBAs. Core has no reverse lookup, so a parent's record doesn't list the organizations under it.

    What this changes in the criteria above. If this lands with everyone, I'll update the description to match. Until then, this comment supersedes it where they differ:

    • The pattern criterion is this comment.
    • The RelationshipCollection<TRef> criterion becomes a parents list of kinded references on all three models, with no exported collection, no relationships property, and no otherRelationships. supersededBy stays, as a kind. Everything is still versioned for v0.5.
    • The six-concept criterion now covers seven, with department added, as in the table. The body's OrgRelationships sketch is replaced by it. On organizations, supersededBy also covers a new legal entity replacing a dissolved one, so the successor concept lives there rather than in a separate field.
    • The OrgPatchData criterion applies to parents. A patch sets or clears the whole list.
    • v0.5 has no hold branch, so the Zod and Pydantic check runs before this PR merges.

    The examples/docs/changelog criterion stands as written, for parents on all three models.

    A few knock-on changes in the same PR:

    • The award's root parent stays in v0.5 but is marked deprecated, alongside the new amendment and tranche kinds that carry the same meaning. The next version removes it, so the migration note from [Core] Promote the award routes from experimental status #1222 should call out the deprecation.
    • ADR 0023 gets a dated amendment in place: its parent example moves into the parents list and gains kind, and the stale sentence about awards having no parent concept is fixed. No new ADR.
    • OrgRef.name is reworded to "the name this organization is known by; for a legal entity, its legal name," since a DBA record's name is its trading name.
  4. changed the title [-][Core] Add `RelationshipCollection` with opportunity, award, and organization relationships[/-] [+][Core] Plan for adding `RelationshipCollection` with opportunity, award, and organization relationships[/+] on Sep 29, 2026
  5. SnowboardTechie commented on Oct 5, 2026

    @SnowboardTechie
    Collaborator

    After a first review pass and refinement I have shared the ADR draft plan with Mary at Fluxx.

  6. laurabelinfante commented on Oct 6, 2026

    @laurabelinfante
    CollaboratorAuthor

    @SnowboardTechie since the plan is "done" according to these ACs and we have the ADR ticket + the implementation ticket, I think we can close this one out! up to you!

  7. SnowboardTechie commented on Oct 6, 2026

    @SnowboardTechie
    Collaborator

    @laurabelinfante that sounds good to me 👍🏻

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

Metadata

Metadata

Labels

coreIssues related to @common-grants/core libraryfeatureNew capability. Belongs on a hold branch.sdkIssue or PR related to our SDKs

Type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions