Skip to content

Feat/re prioritize - #164

Closed
AlexAxthelm wants to merge 13 commits into
mainfrom
feat/re-prioritize
Closed

Feat/re prioritize#164
AlexAxthelm wants to merge 13 commits into
mainfrom
feat/re-prioritize

Conversation

@AlexAxthelm

Copy link
Copy Markdown
Collaborator

No description provided.

functional, but with a lot to revise
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

CD summary cf7841f

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

Deployments (4)
service url fqdn
api open pr-164-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io
entity-linkage open pr-164-entity-linkage.purplegrass-c07d0a94.westus2.azurecontainerapps.io
frontend https://witty-mushroom-017a3dc1e-164.westus2.1.azurestaticapps.net
stitch-llm open pr-164-stitch-llm.purplegrass-c07d0a94.westus2.azurecontainerapps.io
Database (1)
db_name postgres_host postgres_port postgres_db
pr_164 stitch-dev.postgres.database.azure.com 5432 pr_164
Jobs (2)
job image postgres_db api_url auth_mode
db-migrations ghcr.io/rmi/stitch-api:pr-164@sha256:66e9863cdf2983b734e9263e8206c186a2c0fd53f477a2823978a6f0d561ef56 pr_164
seed ghcr.io/rmi/stitch-seed:pr-164@sha256:1aa1937deddc7cbc369a10a93f550568bfc7816fdc73b43cf892125f4f9a528e https://pr-164-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-08T09:10:59Z 2026-07-08T09:10:43Z 88f4c21 ghcr.io/rmi/stitch-api:pr-164 ghcr.io/rmi/stitch-api:pr-164@sha256:66e9863cdf2983b734e9263e8206c186a2c0fd53f477a2823978a6f0d561ef56
2026-07-08T09:11:03Z 2026-07-08T09:10:43Z 88f4c21 ghcr.io/rmi/stitch-entity-linkage:pr-164 ghcr.io/rmi/stitch-entity-linkage:pr-164@sha256:fde7bca5417fd2abdede3d80c7e6ea91d4a6f8ce7200eb835ef3322be78bcdd7
2026-07-08T09:10:59Z 2026-07-08T09:10:43Z 88f4c21 ghcr.io/rmi/stitch-seed:pr-164 ghcr.io/rmi/stitch-seed:pr-164@sha256:1aa1937deddc7cbc369a10a93f550568bfc7816fdc73b43cf892125f4f9a528e
2026-07-08T09:10:58Z 2026-07-08T09:10:43Z 88f4c21 ghcr.io/rmi/stitch-stitch-llm:pr-164 ghcr.io/rmi/stitch-stitch-llm:pr-164@sha256:ed706eb20aac7995901ded493f05d73b5f6ea8be1ba49ecfc9acd4f562d0a3a5

Base automatically changed from feat/see-source-values to main July 9, 2026 11:04
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

CD summary 20c8970

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

Deployments (4)
service url fqdn
api open pr-164-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io
entity-linkage open pr-164-entity-linkage.purplegrass-c07d0a94.westus2.azurecontainerapps.io
frontend https://witty-mushroom-017a3dc1e-164.westus2.1.azurestaticapps.net
stitch-llm open pr-164-stitch-llm.purplegrass-c07d0a94.westus2.azurecontainerapps.io
Database (1)
db_name postgres_host postgres_port postgres_db
pr_164 stitch-dev.postgres.database.azure.com 5432 pr_164
Jobs (1)
job image postgres_db
db-migrations ghcr.io/rmi/stitch-api:pr-164@sha256:180c055933131b13f90e9117a0c6f9b9cc9eeb9e7551c9021562d02ab6b42936 pr_164
Images (4)
build_time commit_time git_sha image image_digest
2026-07-09T11:46:41Z 2026-07-09T11:46:11Z bba2f5e ghcr.io/rmi/stitch-api:pr-164 ghcr.io/rmi/stitch-api:pr-164@sha256:180c055933131b13f90e9117a0c6f9b9cc9eeb9e7551c9021562d02ab6b42936
2026-07-09T11:46:41Z 2026-07-09T11:46:11Z bba2f5e ghcr.io/rmi/stitch-entity-linkage:pr-164 ghcr.io/rmi/stitch-entity-linkage:pr-164@sha256:52d1e07568aaa476b3c2c16a27305f17a2bc5744639087a34db861ed1e7c2921
2026-07-09T11:46:44Z 2026-07-09T11:46:11Z bba2f5e ghcr.io/rmi/stitch-seed:pr-164 ghcr.io/rmi/stitch-seed:pr-164@sha256:2f5058b6c4351761d78eb593bad183e11e957f1e18b478f9127b95c1d736a1c7
2026-07-09T11:46:45Z 2026-07-09T11:46:11Z bba2f5e ghcr.io/rmi/stitch-stitch-llm:pr-164 ghcr.io/rmi/stitch-stitch-llm:pr-164@sha256:90f460766e518ae979e6013770f00724f889240501b368b0c989386aa2d0189a

@github-actions

Copy link
Copy Markdown

CD summary 7ef21ed

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

Deployments (4)
service url fqdn
api open pr-164-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io
entity-linkage open pr-164-entity-linkage.purplegrass-c07d0a94.westus2.azurecontainerapps.io
frontend https://witty-mushroom-017a3dc1e-164.westus2.1.azurestaticapps.net
stitch-llm open pr-164-stitch-llm.purplegrass-c07d0a94.westus2.azurecontainerapps.io
Database (1)
db_name postgres_host postgres_port postgres_db
pr_164 stitch-dev.postgres.database.azure.com 5432 pr_164
Jobs (1)
job image postgres_db
db-migrations ghcr.io/rmi/stitch-api:pr-164@sha256:eba94117467b1a87d102cd580293f646bc7df0681bfef26621e89c262ae222e5 pr_164
Images (4)
build_time commit_time git_sha image image_digest
2026-07-23T17:17:59Z 2026-07-23T17:17:43Z 57c430b ghcr.io/rmi/stitch-api:pr-164 ghcr.io/rmi/stitch-api:pr-164@sha256:eba94117467b1a87d102cd580293f646bc7df0681bfef26621e89c262ae222e5
2026-07-23T17:17:59Z 2026-07-23T17:17:43Z 57c430b ghcr.io/rmi/stitch-entity-linkage:pr-164 ghcr.io/rmi/stitch-entity-linkage:pr-164@sha256:a2c4d0ec3084c83b3035b472b9f1fedd3fe540351ff77e75d6dcbb250f974593
2026-07-23T17:18:02Z 2026-07-23T17:17:43Z 57c430b ghcr.io/rmi/stitch-seed:pr-164 ghcr.io/rmi/stitch-seed:pr-164@sha256:6f0b5505823b4da1686964bed6d24f59fd81480048960a61c9ca959d5660be2a
2026-07-23T17:18:02Z 2026-07-23T17:17:43Z 57c430b ghcr.io/rmi/stitch-stitch-llm:pr-164 ghcr.io/rmi/stitch-stitch-llm:pr-164@sha256:76cdaea68cd4b6671d8454e69396d34d6bf1dc7d41d3803f0c4577ff034ade21

@github-actions

Copy link
Copy Markdown

CD summary 124cc6c

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

Deployments (4)
service url fqdn
api open pr-164-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io
entity-linkage open pr-164-entity-linkage.purplegrass-c07d0a94.westus2.azurecontainerapps.io
frontend https://witty-mushroom-017a3dc1e-164.westus2.1.azurestaticapps.net
stitch-llm open pr-164-stitch-llm.purplegrass-c07d0a94.westus2.azurecontainerapps.io
Database (1)
db_name postgres_host postgres_port postgres_db
pr_164 stitch-dev.postgres.database.azure.com 5432 pr_164
Jobs (1)
job image postgres_db
db-migrations ghcr.io/rmi/stitch-api:pr-164@sha256:ca6d41602de4654c7ef6df055d7547a7d4ab587249658c85417a3dbc772b8f5e pr_164
Images (4)
build_time commit_time git_sha image image_digest
2026-07-24T10:49:04Z 2026-07-24T10:48:51Z 98e3235 ghcr.io/rmi/stitch-api:pr-164 ghcr.io/rmi/stitch-api:pr-164@sha256:ca6d41602de4654c7ef6df055d7547a7d4ab587249658c85417a3dbc772b8f5e
2026-07-24T10:49:10Z 2026-07-24T10:48:51Z 98e3235 ghcr.io/rmi/stitch-entity-linkage:pr-164 ghcr.io/rmi/stitch-entity-linkage:pr-164@sha256:7685346606ca7984c520811ba5258d767e0f8ee9d2ca62673eb0875ff717c446
2026-07-24T10:49:05Z 2026-07-24T10:48:51Z 98e3235 ghcr.io/rmi/stitch-seed:pr-164 ghcr.io/rmi/stitch-seed:pr-164@sha256:e79f511289bd95d80d3cd437e74c62b02e143a421686bf2cef6e0e83fcc9e189
2026-07-24T10:49:05Z 2026-07-24T10:48:51Z 98e3235 ghcr.io/rmi/stitch-stitch-llm:pr-164 ghcr.io/rmi/stitch-stitch-llm:pr-164@sha256:0f8b3c94ba2aca09be8daecc3e05152944d606005bc5e0414e3716498d8931db

@github-actions

Copy link
Copy Markdown

CD summary 127a87b

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

Deployments (4)
service url fqdn
api open pr-164-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io
entity-linkage open pr-164-entity-linkage.purplegrass-c07d0a94.westus2.azurecontainerapps.io
frontend https://witty-mushroom-017a3dc1e-164.westus2.1.azurestaticapps.net
stitch-llm open pr-164-stitch-llm.purplegrass-c07d0a94.westus2.azurecontainerapps.io
Database (1)
db_name postgres_host postgres_port postgres_db
pr_164 stitch-dev.postgres.database.azure.com 5432 pr_164
Jobs (1)
job image postgres_db
db-migrations ghcr.io/rmi/stitch-api:pr-164@sha256:ff94af4565b3653f051b5ea0a332632ca79a3d5dd8abf09db84aad189a490217 pr_164
Images (4)
build_time commit_time git_sha image image_digest
2026-07-24T11:08:06Z 2026-07-24T11:07:37Z 0db5e2e ghcr.io/rmi/stitch-api:pr-164 ghcr.io/rmi/stitch-api:pr-164@sha256:ff94af4565b3653f051b5ea0a332632ca79a3d5dd8abf09db84aad189a490217
2026-07-24T11:08:07Z 2026-07-24T11:07:37Z 0db5e2e ghcr.io/rmi/stitch-entity-linkage:pr-164 ghcr.io/rmi/stitch-entity-linkage:pr-164@sha256:974a825c983baf238322488ff17667721a63b07f61a236de636495d8d5f5bd89
2026-07-24T11:08:08Z 2026-07-24T11:07:37Z 0db5e2e ghcr.io/rmi/stitch-seed:pr-164 ghcr.io/rmi/stitch-seed:pr-164@sha256:870627601cb33ec4a456f903c2d2829bf9aed4fba8d1a74f49e3f227330e2bc1
2026-07-24T11:08:09Z 2026-07-24T11:07:37Z 0db5e2e ghcr.io/rmi/stitch-stitch-llm:pr-164 ghcr.io/rmi/stitch-stitch-llm:pr-164@sha256:f24734afa97388f827655d8fa1dc492595749247d1c4b207e8b07a8b9df825f3

@github-actions

Copy link
Copy Markdown

CD summary f5e87e5

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

Deployments (4)
service url fqdn
api open pr-164-api.purplegrass-c07d0a94.westus2.azurecontainerapps.io
entity-linkage open pr-164-entity-linkage.purplegrass-c07d0a94.westus2.azurecontainerapps.io
frontend https://witty-mushroom-017a3dc1e-164.westus2.1.azurestaticapps.net
stitch-llm open pr-164-stitch-llm.purplegrass-c07d0a94.westus2.azurecontainerapps.io
Database (1)
db_name postgres_host postgres_port postgres_db
pr_164 stitch-dev.postgres.database.azure.com 5432 pr_164
Jobs (1)
job image postgres_db
db-migrations ghcr.io/rmi/stitch-api:pr-164@sha256:d9381d97b282268d737ffa626150770f9baaf05bb8cc4e005dd91e2c049c2b6c pr_164
Images (4)
build_time commit_time git_sha image image_digest
2026-07-24T11:41:16Z 2026-07-24T11:40:58Z 5e49314 ghcr.io/rmi/stitch-api:pr-164 ghcr.io/rmi/stitch-api:pr-164@sha256:d9381d97b282268d737ffa626150770f9baaf05bb8cc4e005dd91e2c049c2b6c
2026-07-24T11:41:17Z 2026-07-24T11:40:58Z 5e49314 ghcr.io/rmi/stitch-entity-linkage:pr-164 ghcr.io/rmi/stitch-entity-linkage:pr-164@sha256:3cf5aeb8e6bb05d41ba529db7ad76add88884340f94aadfddaf6882c0c5e4dc9
2026-07-24T11:41:16Z 2026-07-24T11:40:58Z 5e49314 ghcr.io/rmi/stitch-seed:pr-164 ghcr.io/rmi/stitch-seed:pr-164@sha256:7ada29d5d415f4a612c8353b0ca75c83c4d8f91d12e6cbe1bf9fe3a8825eecf4
2026-07-24T11:41:14Z 2026-07-24T11:40:58Z 5e49314 ghcr.io/rmi/stitch-stitch-llm:pr-164 ghcr.io/rmi/stitch-stitch-llm:pr-164@sha256:6ff103482620f8f864c59ebb0e9caaea5a8dbe4ece8f889e20c4ae8a2431ccfd

@github-actions

Copy link
Copy Markdown

CD summary dfee1f2

Database (1)
db_name postgres_host postgres_port postgres_db
pr_164 stitch-dev.postgres.database.azure.com 5432 pr_164
Images (4)
build_time commit_time git_sha image image_digest
2026-07-30T13:15:34Z 2026-07-30T13:15:06Z a77f1fb ghcr.io/rmi/stitch-api:pr-164 ghcr.io/rmi/stitch-api:pr-164@sha256:2f2d652b8c6acbf18f1e3964d765fad9d321b53cb9b0203a2ec4c8f1ffd9ee48
2026-07-30T13:15:33Z 2026-07-30T13:15:06Z a77f1fb ghcr.io/rmi/stitch-entity-linkage:pr-164 ghcr.io/rmi/stitch-entity-linkage:pr-164@sha256:7aec64e413dbf37a85a014bac55f2dd1010b5a52dfcc591a09682b7867ca78b9
2026-07-30T13:15:28Z 2026-07-30T13:15:06Z a77f1fb ghcr.io/rmi/stitch-seed:pr-164 ghcr.io/rmi/stitch-seed:pr-164@sha256:b030e5bb462cc6e1fd07722e396f75c85b998af15429b820810ae4b3e3d0964f
2026-07-30T13:15:28Z 2026-07-30T13:15:06Z a77f1fb ghcr.io/rmi/stitch-stitch-llm:pr-164 ghcr.io/rmi/stitch-stitch-llm:pr-164@sha256:e7574c40eea17cfc3b9e26ac50cfc02ab4a2d378dae4bdd33bb30227cfb165eb

@github-actions

Copy link
Copy Markdown

CD summary dfee1f2

Database (1)
db_name postgres_host postgres_port postgres_db
pr_164 stitch-dev.postgres.database.azure.com 5432 pr_164
Images (4)
build_time commit_time git_sha image image_digest
2026-07-30T15:01:13Z 2026-07-30T15:00:43Z 030109d ghcr.io/rmi/stitch-api:pr-164 ghcr.io/rmi/stitch-api:pr-164@sha256:8a85fc4a522e48e805bf1504ed4de92cc29dacdb8a5f16053e609b0b50d72921
2026-07-30T15:01:17Z 2026-07-30T15:00:43Z 030109d ghcr.io/rmi/stitch-entity-linkage:pr-164 ghcr.io/rmi/stitch-entity-linkage:pr-164@sha256:2806e7eb90a4f7f6255462b9d87203ad4559cd9d27d2933a2caaceae38188e7c
2026-07-30T15:01:16Z 2026-07-30T15:00:43Z 030109d ghcr.io/rmi/stitch-seed:pr-164 ghcr.io/rmi/stitch-seed:pr-164@sha256:a61461bdab6fa2794b39ffe6186865b1e165168a775ffa79c258886ea4fd3d16
2026-07-30T15:01:21Z 2026-07-30T15:00:43Z 030109d ghcr.io/rmi/stitch-stitch-llm:pr-164 ghcr.io/rmi/stitch-stitch-llm:pr-164@sha256:f9ba8dddf035984404fd8afa23e78a2d6d129693277976e822c79ff3c31b3417

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 adds per-field, per-source-record priority overrides so curators can re-rank which source record “wins” for an individual field (instead of relying solely on global per-source defaults). It updates the API, DB schema, coalescing behavior, and the frontend UI to support editing and persisting that ordering, with tests covering the new behavior.

Changes:

  • Add a new API endpoint to persist a best-first ordering of source रिकॉर्डs for a single field and return the updated winner-first listing.
  • Update coalescing + DB query ranking to apply a two-tier ordering (overridden records outrank non-overridden records for that field).
  • Add frontend UI + hooks to gate editing by permission and allow reordering + saving source priority, with unit/integration tests.

Reviewed changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/stitch-ogsi/src/stitch/ogsi/model/init.py Extends the field-source-values view model with is_override and updates contract docs.
deployments/stitch-frontend/src/queries/api.js Adds updateFieldSourcePriority() API client helper.
deployments/stitch-frontend/src/hooks/usePermissions.js Introduces a cached permission hook backed by /auth/me (with mock mode support).
deployments/stitch-frontend/src/components/ResourceFieldCard.jsx Adds reorder/edit UI, save flow, and curated-row badge for overridden records.
deployments/stitch-frontend/src/components/ResourceFieldCard.test.jsx Adds frontend tests for permission gating, reordering + save call, and curated badge.
deployments/api/src/stitch/api/entities.py Adds request schema for the reorder endpoint (SetFieldPriorityRequest).
deployments/api/src/stitch/api/routers/oil_gas_fields.py Adds PUT /{id}/fields/{field}/sources/priority endpoint with permission enforcement.
deployments/api/src/stitch/api/db/og_field_resource_actions.py Implements read ordering with override tiering and adds set_field_source_priority() write action.
deployments/api/src/stitch/api/db/model/og_field_resource_source_priority.py Re-keys override table to (resource_id, source_pk, colname) and adds audit columns + checks.
deployments/api/src/stitch/api/db/model/resource.py Adds bulk loader for per-field override maps by resource id.
deployments/api/src/stitch/api/db/utils.py Passes loaded per-field overrides into the coalescer during resource coalescing.
deployments/api/src/stitch/api/db/queries.py Updates SQL ranking to incorporate override tiering and per-(record,field) joins.
deployments/api/src/stitch/api/coalesce.py Updates pure coalescer to apply per-field override tiering consistently with SQL.
deployments/api/src/stitch/api/db/model/oil_gas_field_source.py Drops empty-string values on write (treats "" as “unset”).
deployments/api/src/stitch/api/db/model/oil_gas_field_source_value.py Adds DB-level CHECK constraint to reject persisted empty-string text values.
deployments/api/src/stitch/api/db/merge_candidate_actions.py Aligns merge comparison logic with the new “empty strings never persist” invariant.
deployments/api/alembic/versions/b7e1c2f4a9d0_per_field_source_record_priority.py Migration to recreate override table at per-(resource,record,field) grain with audit columns.
deployments/api/alembic/versions/790b2078d706_drop_empty_string_source_values.py Migration to delete existing empty strings and enforce the non-empty text constraint.
deployments/api/tests/test_coalesce.py Adds unit tests for override tiering, per-field scoping, and backward-compatible defaults.
deployments/api/tests/utils.py Updates source-model test helper to avoid emitting empty-string value rows.
deployments/api/tests/routers/test_route_permissions.py Adds route permission coverage for the new priority update endpoint.
deployments/api/tests/routers/test_resources_integration.py Adds integration test proving reorder persists and flips the coalesced winner.
deployments/api/tests/routers/test_merge_candidates_integration.py Updates merge-candidate test to use per-record, per-field overrides.
deployments/api/tests/db/test_resource_actions.py Adds/updates DB integration tests for empty-string rejection and priority snapshot semantics.

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

Comment on lines +236 to +242
<MoveButtons
label={SOURCE_LABELS[row.source] ?? UNKNOWN_SOURCE_LABEL}
canMoveUp={idx > 0}
canMoveDown={idx < displayRows.length - 1}
onMoveUp={() => move(idx, -1)}
onMoveDown={() => move(idx, 1)}
/>
]);
setIsEditing(false);
} catch (err) {
setSaveError(err.message || "Failed to save source order.");
@AlexAxthelm

Copy link
Copy Markdown
Collaborator Author

Closing again in favor of #174, following merge of #170

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.

2 participants