Repository navigation
feat(ui): show business context on related-node chips (v0.75.0) #92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 6 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
bf9daa9
feat: show Our side / Counterparty on related-node person chips (v0.7…
seonghobae 86969db
feat: show Company / Group on related-node org chips (v0.73.0) (#93)
seonghobae f669509
feat: show related-node post chips as the title only (v0.74.0) (#97)
seonghobae 2fb74bc
feat: show affiliation on related-node person chips (v0.75.0)
seonghobae ab7cda7
test(ui): reject invented primary affiliation captions
seonghobae c72317c
fix(ui): omit ambiguous person affiliations
seonghobae 15de5d4
fix(ui): use unique catalog identity for person affiliations
seonghobae 9bb5829
test(integration): exercise related affiliation SQL on Postgres
seonghobae 6db8b72
feat(ui): inventory related-node chips in one module (v0.76.0) (#230)
seonghobae 5648966
merge: bring related-node chip slice onto current main
cursoragent 915b3cf
fix(ui): drop Storybook claim and lock raw-code captions
cursoragent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| """Regression tests for related-node affiliation display authority.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import asyncio | ||
| from typing import Any | ||
|
|
||
| from backend.app.knowledge_graph import hydrate_related_nodes | ||
| from lineageweave.knowledge_graph import NODE_PERSON, node_key | ||
|
|
||
|
|
||
| _PERSON_ID = "11111111-1111-4111-8111-111111111111" | ||
|
|
||
|
|
||
| class _FakeConnection: | ||
| """Return the minimum query results needed by ``hydrate_related_nodes``.""" | ||
|
|
||
| def __init__(self, affiliations: list[str]) -> None: | ||
| self._affiliations = affiliations | ||
|
|
||
| async def fetch(self, query: str, *args: Any) -> list[dict[str, Any]]: | ||
| if "from cataloged_person" in query: | ||
| return [ | ||
| { | ||
| "person_id": _PERSON_ID, | ||
| "person_name": "Priya Nair", | ||
| "person_side_code": "counterparty", | ||
| } | ||
| ] | ||
| if "from person_affiliation" in query: | ||
| return [ | ||
| { | ||
| "person_id": _PERSON_ID, | ||
| "affiliated_organization_name": organization_name, | ||
| "affiliated_corporate_entity_id": None, | ||
| } | ||
| for organization_name in self._affiliations | ||
| ] | ||
| if "from common_lookup_value" in query: | ||
| return [{"lookup_code": "counterparty", "lookup_label": "Counterparty"}] | ||
| raise AssertionError(f"unexpected query: {query}") | ||
|
|
||
|
|
||
| def _hydrate(affiliations: list[str]) -> dict[str, Any]: | ||
| payload = asyncio.run( | ||
| hydrate_related_nodes( | ||
| _FakeConnection(affiliations), # type: ignore[arg-type] | ||
| [(node_key(NODE_PERSON, _PERSON_ID), 0.8)], | ||
| ) | ||
| ) | ||
| assert len(payload) == 1 | ||
| return payload[0] | ||
|
|
||
|
|
||
| def test_related_person_exposes_one_unambiguous_affiliation() -> None: | ||
| """A single known affiliation is safe to use as compact display context.""" | ||
| node = _hydrate(["Northridge Grid"]) | ||
| assert node["affiliation_organization_name"] == "Northridge Grid" | ||
|
|
||
|
|
||
| def test_related_person_omits_affiliation_when_multiple_are_known() -> None: | ||
| """Multiple affiliations must not be collapsed into an invented primary one.""" | ||
| node = _hydrate(["Northridge Grid", "Northridge Holdings"]) | ||
| assert "affiliation_organization_name" not in node |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.