feat(org-lens): seed demo accounts when persona detection returns none#692
Conversation
The CD-3507 stakeholder demo on the feat/CD-3507-org-lens-shell preview URL needs the org selector populated for any logged-in user, but the persona-service contract for user-scoped organizations is still blocked upstream. Today the only path that populates `organizations` is `extractOrganizations`, which scrapes `board_member` detection extras, so most engineering accounts on the dev cluster see an empty selector. Overlay a small demo seed (8 orgs: Toyota + the IBM family) only when extraction yields zero. Real board members remain unaffected: the seed never displaces detected orgs, it just fills the void. The seed deliberately carries only `accountId` + `accountName` so tier, slug, and logo continue to resolve live from `platinum_lfx_one_org_lens_account_context` via `getOrgLensAccountContext`, exercising the real enrichment path end-to-end (Toyota -> Platinum, IBM Watson Health -> Contributor). Remove `ORG_LENS_DEMO_SEED_ACCOUNTS` and `withDemoSeedFallback` once the upstream persona service starts returning user-scoped organizations. - add ORG_LENS_DEMO_SEED_ACCOUNTS in packages/shared accounts constants (identifier + name only) - add private withDemoSeedFallback(req, accounts) helper in PersonaDetectionService - apply the fallback to all three return paths of computePersonaDetections (error / no-detections / success) Generated with [Cursor Composer](https://cursor.com/composer) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Signed-off-by: ahmedomosanya <aopeyemi@contractor.linuxfoundation.org>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
This PR adds a demo-only fallback to ensure the Org Lens org selector is populated when persona detection returns no organizations (e.g., users without board_member detections), by seeding a fixed set of demo accounts.
Changes:
- Introduces
ORG_LENS_DEMO_SEED_ACCOUNTS(Toyota + IBM family) in shared constants. - Adds
withDemoSeedFallback(...)inPersonaDetectionServiceand applies it to multiplecomputePersonaDetectionsreturn paths (including error / empty detections / success).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/shared/src/constants/accounts.constants.ts | Adds exported demo seed accounts list used as an organizations fallback. |
| apps/lfx-one/src/server/services/persona-detection.service.ts | Applies the demo seed fallback when persona detection yields no orgs (and currently also on detection error). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| logger.debug(req, 'extract_organizations', 'No detected orgs — returning Org Lens demo seed', { | ||
| seed_count: ORG_LENS_DEMO_SEED_ACCOUNTS.length, | ||
| }); | ||
| return ORG_LENS_DEMO_SEED_ACCOUNTS.map((account) => ({ ...account })); | ||
| } |
| export const ORG_LENS_DEMO_SEED_ACCOUNTS: Account[] = [ | ||
| { accountId: '0012M00002ND5yOQAT', accountName: 'Toyota Motor Corporation' }, | ||
| { accountId: '0014100000kgVoqAAE', accountName: 'International Business Machines Corporation' }, | ||
| { accountId: '0014100000Te2QjAAJ', accountName: 'Red Hat, Inc.' }, | ||
| { accountId: '0014100000TdzYmAAJ', accountName: 'Apptio' }, | ||
| { accountId: '0012M00002ZLGHsQAP', accountName: 'IBM Watson Health' }, | ||
| { accountId: '0012M000027Enn8QAC', accountName: 'Nordcloud, an IBM Company' }, | ||
| { accountId: '0012M00002F2mObQAJ', accountName: 'Stackwatch Inc' }, | ||
| { accountId: '0014100000Te2qeAAB', accountName: 'Turbonomic, an IBM Company' }, | ||
| ]; |
| personas: ['contributor'], | ||
| projects: [], | ||
| organizations: [], | ||
| organizations: this.withDemoSeedFallback(req, []), |
Ticket: CD-3507
Summary
ORG_LENS_DEMO_SEED_ACCOUNTS(8 orgs: Toyota + IBM family) inpackages/shared/src/constants/accounts.constants.ts. Each entry carries onlyaccountId+accountNameso tier, slug, and logo continue to resolve live fromplatinum_lfx_one_org_lens_account_contextviagetOrgLensAccountContext.withDemoSeedFallback(req, accounts)helper inPersonaDetectionServicethat returns the seed only when the input list is empty, so realboard_memberdetections are never displaced.computePersonaDetections: persona-service error, no detections, and the success path'sextractOrganizationsoutput.Why
The persona-service contract for user-scoped
organizationsis still blocked upstream (Prabodh's work). Today the only path that populatesorganizationsisextractOrganizations, which scrapesboard_memberdetection extras — so engineering accounts on the dev cluster see an empty selector. The seed unblocks the stakeholder demo without faking enrichment data: tier badges, logos, and slugs all come from the real Snowflake context.Out of scope (intentionally)
organizationsintegration. Will replace this fallback once the upstream contract is in.getOrgLensAccountContextso the demo exercises the live path.Test plan
make nats-forward+make start, log in, visithttp://localhost:4200/org/overviewyarn check-typespassesFollow-ups
ORG_LENS_DEMO_SEED_ACCOUNTSandwithDemoSeedFallbackonce the upstream persona service returns user-scoped organizations.Generated with Cursor Composer