Skip to content

STIT-607 consume backend compare object - #203

Open
jasonbrownrmi wants to merge 10 commits into
mainfrom
STIT-607-consume-backend-compare-object
Open

STIT-607 consume backend compare object#203
jasonbrownrmi wants to merge 10 commits into
mainfrom
STIT-607-consume-backend-compare-object

Conversation

@jasonbrownrmi

Copy link
Copy Markdown
Contributor

The merge review page now renders its source comparison grid and detail-panel heading from the compare object on the merge-candidate detail response, instead of fetching every source resource individually and re-deriving
comparison status client-side. The backend is now the single source of truth for comparison semantics.

What changed

  • New candidateCompare.js helpers read compare entries: per-resource cell values and the winning candidate name.
  • MergeSourceComparison is now a pure, props-driven component — no data fetching. Statuses come verbatim from compare[].status; loading/error state belongs to the page's existing detail query.
  • The detail panel derives its heading from compare, eliminating its per-resource detail requests. While the detail query is in flight it shows the queue's cached name (same query the queue items already issued — no extra requests) so first selection doesn't flash the id fallback.
  • Once a candidate has been merged, the heading shows the merged resource's name instead of falling back to Candidate #<id>. A shared useMergedResourceDetail hook (extracted from MergedResourceView, which
    now uses it too) fetches this once and both consumers share the cache entry — no extra requests.
  • Orphaned client-side comparison logic removed (getRowStatus, valuesMatch); isEmptyValue stays (still used by the queue-name path).

Deliberate behavior change

Row status is no longer computed in the frontend, so comparison semantics follow the backend:

  • String matching is now case-sensitive — "USA" vs "usa" shows as
    Differs (previously Match).
  • An empty string counts as a real value (previously treated as empty).

Caveat: queue item names for merged candidates

A merge repoints source data onto the new merged resource; the original resources are kept but become null shells (rows with no source data). compare is computed live from those originals, so it never carries a name
for a merged candidate. This PR fixes the detail panel heading (reads the merged resource directly, see above), but queue item names still use the pre-existing per-resource-fetch path (useMergeCandidateName), which hits
the same null-shell originals for merged candidates and falls back to Candidate #<id> there. This is unchanged, existing behavior — not a regression from this PR — and is intentionally out of scope here.

A follow-up ticket will add a backend display_name to the list endpoint so queue items can show the merged resource's name too, and drop their per-resource fetches and duplicated source-priority logic (SOURCE_PRIORITY, which has already drifted from the backend's priority table — it's missing ccr).

Copilot AI 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.

Pull request overview

This PR updates the merge review UI to consume the backend-provided compare object from the merge-candidate detail endpoint, making the backend the single source of truth for comparison semantics and reducing client-side fetching/derivation.

Changes:

  • Added candidateCompare helpers to read compare entries (per-field entry lookup, per-resource value lookup, and “winning” name selection).
  • Refactored MergeSourceComparison to be props-driven (no internal fetching), rendering backend statuses verbatim and moving loading/error state to the parent detail query.
  • Updated the merge review page and tests to derive the detail-panel heading from compare (with queue-cached name during detail load) and to show merged resource names post-merge via a shared useMergedResourceDetail hook.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
deployments/stitch-frontend/src/utils/mergeComparison.js Removes client-side row-status derivation; retains isEmptyValue helper.
deployments/stitch-frontend/src/utils/mergeComparison.test.js Updates tests to cover isEmptyValue now that row-status logic is removed.
deployments/stitch-frontend/src/utils/candidateCompare.js Introduces helpers for consuming backend compare entries and selecting a display name.
deployments/stitch-frontend/src/utils/candidateCompare.test.js Adds unit tests for the new candidateCompare helpers.
deployments/stitch-frontend/src/components/MergeSourceComparison.jsx Refactors comparison UI to render from compare prop with parent-driven loading/error.
deployments/stitch-frontend/src/components/MergeSourceComparison.test.jsx Reworks tests to match new props-driven comparison behavior and backend semantics.
deployments/stitch-frontend/src/pages/MergeCandidateReviewPage.jsx Derives heading from compare/merged resource detail; passes compare/loading/error props to comparison component.
deployments/stitch-frontend/src/pages/MergeCandidateReviewPage.test.jsx Updates page tests to validate compare-derived headings and loading/merged-name behaviors.
deployments/stitch-frontend/src/hooks/useMergedResourceDetail.js Extracts a shared hook for merged resource detail fetching/caching.
deployments/stitch-frontend/src/components/MergedResourceView.jsx Switches to useMergedResourceDetail to share cache with the review page.
.gitignore Adds docs/ ignore entry (appears unrelated to PR goal).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

<p className="sr-only">Loading comparison…</p>
<ComparisonSkeleton resourceIds={ids} />
</div>
) : isError ? (

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.

This seems like a nudge to solve STIT-420 / STIT-437

cc @jdhoffa

@github-actions

Copy link
Copy Markdown

CD summary 3864d6d

Frontend: https://witty-mushroom-017a3dc1e-203.westus2.1.azurestaticapps.net

Deployments (4)
service url fqdn
api open pr-203-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io
entity-linkage open pr-203-entity-linkage.purplegrass-c07d0a94.westus2.azurecontainerapps.io
frontend https://witty-mushroom-017a3dc1e-203.westus2.1.azurestaticapps.net
stitch-llm open pr-203-stitch-llm.purplegrass-c07d0a94.westus2.azurecontainerapps.io
Database (1)
db_name postgres_host postgres_port postgres_db
pr_203 stitch-dev.postgres.database.azure.com 5432 pr_203
Jobs (2)
job image postgres_db api_url auth_mode
db-migrations ghcr.io/rmi/stitch-api:pr-203@sha256:f293bc8a9a614d93765d2f3f843f2c6d07809e0655d75f6b139686de53047f40 pr_203
seed ghcr.io/rmi/stitch-seed:pr-203@sha256:2e25b124014a66398d7a1bf25e7315dcc1961d724b97145316932abec0a15c09 https://pr-203-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io/api/v1 stitch-client-bearer-token
Images (4)
build_time commit_time git_sha image image_digest
2026-07-29T20:33:11Z 2026-07-29T20:32:57Z 22e3a51 ghcr.io/rmi/stitch-api:pr-203 ghcr.io/rmi/stitch-api:pr-203@sha256:f293bc8a9a614d93765d2f3f843f2c6d07809e0655d75f6b139686de53047f40
2026-07-29T20:33:15Z 2026-07-29T20:32:57Z 22e3a51 ghcr.io/rmi/stitch-entity-linkage:pr-203 ghcr.io/rmi/stitch-entity-linkage:pr-203@sha256:ed439c35585a46aa2c331514bc2f1094874eeb59555adf88d00b2ce3750a7c8f
2026-07-29T20:33:14Z 2026-07-29T20:32:57Z 22e3a51 ghcr.io/rmi/stitch-seed:pr-203 ghcr.io/rmi/stitch-seed:pr-203@sha256:2e25b124014a66398d7a1bf25e7315dcc1961d724b97145316932abec0a15c09
2026-07-29T20:33:11Z 2026-07-29T20:32:57Z 22e3a51 ghcr.io/rmi/stitch-stitch-llm:pr-203 ghcr.io/rmi/stitch-stitch-llm:pr-203@sha256:8aa426d68ea2b9370d0ee05853aa5bee3c0aa014394700728e2f494fef8e7cea

Comment thread .gitignore

# Sphinx documentation
docs/_build/
docs/

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.

didn't we already ignore this?

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

CD summary b69738a

Frontend: https://witty-mushroom-017a3dc1e-203.westus2.1.azurestaticapps.net

Deployments (4)
service url fqdn
api open pr-0203-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io
entity-linkage open pr-0203-el.purplegrass-c07d0a94.westus2.azurecontainerapps.io
frontend https://witty-mushroom-017a3dc1e-203.westus2.1.azurestaticapps.net
stitch-llm open pr-0203-llm.purplegrass-c07d0a94.westus2.azurecontainerapps.io
Database (1)
db_name postgres_host postgres_port postgres_db
pr_0203 stitch-dev.postgres.database.azure.com 5432 pr_0203
Jobs (2)
job image postgres_db api_url auth_mode
db-migrations ghcr.io/rmi/stitch-api:pr-0203@sha256:c5bbabc0a1ee363960d330b15e27c0dfc84b2df25784b031fa3bbfacc473d747 pr_0203
seed ghcr.io/rmi/stitch-seed:pr-0203@sha256:d7e1a94de83c2e62af4f0c6ec11fc487c645c4b9bc9b62b7bf5f04d651b81b8e https://pr-0203-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io/api/v1 stitch-client-bearer-token
Images (4)
build_time commit_time git_sha image image_digest
2026-08-05T17:19:05Z 2026-08-05T17:18:50Z ecf8f67 ghcr.io/rmi/stitch-api:pr-0203 ghcr.io/rmi/stitch-api:pr-0203@sha256:c5bbabc0a1ee363960d330b15e27c0dfc84b2df25784b031fa3bbfacc473d747
2026-08-05T17:19:07Z 2026-08-05T17:18:50Z ecf8f67 ghcr.io/rmi/stitch-entity-linkage:pr-0203 ghcr.io/rmi/stitch-entity-linkage:pr-0203@sha256:41320cd50f0680679cd556acf2a0f964ae3ddf8415162870ea749fb1f9a5be5a
2026-08-05T17:19:08Z 2026-08-05T17:18:50Z ecf8f67 ghcr.io/rmi/stitch-seed:pr-0203 ghcr.io/rmi/stitch-seed:pr-0203@sha256:d7e1a94de83c2e62af4f0c6ec11fc487c645c4b9bc9b62b7bf5f04d651b81b8e
2026-08-05T17:19:09Z 2026-08-05T17:18:50Z ecf8f67 ghcr.io/rmi/stitch-stitch-llm:pr-0203 ghcr.io/rmi/stitch-stitch-llm:pr-0203@sha256:c4936617a2bee60b348b2a0e1b393b8453fb5c29f2c7c81c1cd1a651a6ff5dc6

@AlexAxthelm

Copy link
Copy Markdown
Collaborator

@jasonbrownrmi I made some commits to fix a merge conflict I resolved wrong.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

CD summary 1f19138

Frontend: https://witty-mushroom-017a3dc1e-203.westus2.1.azurestaticapps.net

Deployments (4)
service url fqdn
api open pr-0203-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io
entity-linkage open pr-0203-el.purplegrass-c07d0a94.westus2.azurecontainerapps.io
frontend https://witty-mushroom-017a3dc1e-203.westus2.1.azurestaticapps.net
stitch-llm open pr-0203-llm.purplegrass-c07d0a94.westus2.azurecontainerapps.io
Database (1)
db_name postgres_host postgres_port postgres_db
pr_0203 stitch-dev.postgres.database.azure.com 5432 pr_0203
Jobs (1)
job image postgres_db
db-migrations ghcr.io/rmi/stitch-api:pr-0203@sha256:ce537214133ccc2aaa9dfb7ee99ecf744a08778a9958cf62ba252ecd4091cc83 pr_0203
Images (4)
build_time commit_time git_sha image image_digest
2026-08-05T17:47:59Z 2026-08-05T17:47:39Z 464d125 ghcr.io/rmi/stitch-api:pr-0203 ghcr.io/rmi/stitch-api:pr-0203@sha256:ce537214133ccc2aaa9dfb7ee99ecf744a08778a9958cf62ba252ecd4091cc83
2026-08-05T17:47:55Z 2026-08-05T17:47:39Z 464d125 ghcr.io/rmi/stitch-entity-linkage:pr-0203 ghcr.io/rmi/stitch-entity-linkage:pr-0203@sha256:5d034b56d00abff6ac97583992a9c19cfbe7fbddc44e1ad2ed66ae7296695be8
2026-08-05T17:47:56Z 2026-08-05T17:47:39Z 464d125 ghcr.io/rmi/stitch-seed:pr-0203 ghcr.io/rmi/stitch-seed:pr-0203@sha256:4975228bf936ab08203994b8bfe4848609629e2237ccffc77ff2bf1ac6b2b60f
2026-08-05T17:47:58Z 2026-08-05T17:47:39Z 464d125 ghcr.io/rmi/stitch-stitch-llm:pr-0203 ghcr.io/rmi/stitch-stitch-llm:pr-0203@sha256:4c033d33bfbcca156421c8ef61a609136cd61fe181fabd1a76a662ea0aa921f5

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.

3 participants