Skip to content

PM-6579: Resolve extension Work projects from challenge billing - #56

Merged
jmgasper merged 1 commit into
devfrom
PM-6579-1
Oct 19, 2026
Merged

jmgasper merged 1 commit into
devfrom
PM-6579-1

Conversation

@jmgasper

Copy link
Copy Markdown
Contributor

What was broken

Extension deal details could still omit the shared Work project and its billing history after PM-6579's previous fix in #54.

Jira was moved to QA Failed on October 18. Its latest comment describes the previous implementation; there is no additional QA diagnosis beyond the original report that extensions must show the same Work project as the first opportunity.

Root cause

The previous fix correctly added the Salesforce TC_Connect_Project_Id__c fallback. It remained incomplete when that reference was absent, invalid, or pointed to a missing/deleted project: the endpoint ignored challenge billing records linking the extension's account to the shared project. Completed challenges retain earlier accounts after the project's current billing account changes.

What was changed

Preserve the existing current-account and Salesforce-reference lookups. When neither resolves, query challenges billed to any of the opportunity's accounts and select a non-deleted project using the existing most-recently-updated/highest-ID ordering.

Retain the opportunity's own billing account and load the resolved project's full challenge billing history. Include all challenge statuses, ignore nonpositive/missing project IDs, and return the existing sanitized 502 on lookup failures. No relationship is inferred from names or customers.

Files modified:

  • src/api/salesforce/salesforce-opportunity.service.ts
  • src/api/salesforce/salesforce-opportunity.service.spec.ts
  • src/api/salesforce/dto/salesforce-opportunity-response.dto.ts
  • README.md

No schema, dependency, or UI changes. If there is no current-account match, usable Salesforce reference, or challenge billing relationship, the project remains null.

Any added/updated tests

Added eight regression cases for absent/invalid/unresolved Salesforce references, multiple accounts/project candidates, missing/deleted projects, and challenge/project lookup failures. Updated existing no-match and precedence assertions. All four core extension regressions fail against the merged previous fix and pass with this change.

Commands run after nvm use in each project:

  • pnpm install --frozen-lockfile — passed.
  • pnpm lint — passed.
  • pnpm build — passed.
  • pnpm test --runInBand src/api/salesforce src/shared/services/billingAccount.service.spec.ts — 64 passed.
  • Platform UI: yarn test:no-watch --runInBand --runTestsByPath src/apps/sales/src/OpportunityModal.spec.tsx — 6 passed, including the Work challenges link and billing details.
  • pnpm test --runInBand — 502 passed, 3 skipped, 15 failed.
  • pnpm test:e2e --runInBand — 73 passed, 29 skipped, 8 failed.
  • git fetch origin and git diff --check — passed.

The full suites do not pass on unchanged origin/dev at 47a0577 either: 494 unit tests pass with the same 15 failures; e2e has the same 73 passes and 8 failures. Compared Jest JSON results and confirmed identical failing test names. Those existing metadata-event, JWT, event-fixture, and permission-check failures require separate fixes; this change adds no failures.

Live reproduction of the screenshot remains unavailable: billing account 80004530 returns 404 from api.topcoder-dev.com using the provided M2M token helper. The API regressions and existing modal rendering tests validate the expected link behavior.

What was broken

Extension deal details could still omit the shared Work project and its billing
history after the earlier PM-6579 fix.

Root cause

The earlier fix added the Salesforce TC_Connect_Project_Id__c fallback, but an
extension without a usable reference still needed a current project account
match. Challenges already associate earlier billing accounts with the shared
project, including after the project's current account changes.

What was changed

Preserve current-account and explicit-reference precedence. When neither
resolves, use challenges billed to the opportunity's accounts to find a
non-deleted project, with the existing updatedAt/id ordering. Retain the
opportunity account and load the shared project's full challenge billing history.
Update service documentation, the response DTO description, and README.

Any added/updated tests

Add eight cases covering absent, invalid and unresolved Salesforce references,
multiple account/project candidates, deleted/missing projects, and lookup errors.
Update existing precedence and no-match assertions. All four core extension
regressions fail against the merged previous fix and pass with this change.

pnpm lint and pnpm build pass. All 64 focused API tests and all 6 existing
Sales modal rendering tests pass. The full unit suite has 502 passed, 3 skipped,
and 15 failed; e2e has 73 passed, 29 skipped, and 8 failed. All failing test names
match unchanged origin/dev at 47a0577; this change introduces no new failures.
The existing failures concern metadata events, JWT handling, event fixtures,
and permission checks. The screenshot account is unavailable in dev (404).
@jmgasper
jmgasper merged commit 932a048 into dev Oct 19, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant