-
Notifications
You must be signed in to change notification settings - Fork 8
feat(node-ui): S4 assertion detail view + S5 breadcrumb nav + M2(b) cross-subgraph follow #909
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
Open
Jurij89
wants to merge
4
commits into
main
Choose a base branch
from
feat/s4-s5-assertion-detail-breadcrumb
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
d8880b6
feat(node-ui): S4 — assertion detail view + lifecycle trail
2f6daba
feat(node-ui): S5 — breadcrumb navigation; drop in-detail back button
9f3025c
feat(node-ui): M2 option (b) — silent cross-subgraph switch on link f…
b742f6f
fix(node-ui): round-3 Codex — SWM assertionGraph guard + VM/discarded…
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| import { useEffect, useState } from 'react'; | ||
| import { fetchAssertionState, type AssertionStateInfo } from '../api.js'; | ||
|
|
||
| /** | ||
| * Per-mount fetch of a single assertion's CURRENT lifecycle state for | ||
| * the S4 assertion detail view (α verdict lock-b — lazy: the state is | ||
| * fetched on detail-view mount, NOT carried on every `listAssertions` | ||
| * row). `dkg:state` + `dkg:memoryLayer` are mutable literals on the | ||
| * lifecycle entity in `<cg>/_meta`; see `fetchAssertionState` in | ||
| * `api.ts` for the query shape and the data-model writers. | ||
| * | ||
| * Three terminal shapes the detail view distinguishes: | ||
| * - `{ loading: true }` — hydrating; the CTA stays hidden and | ||
| * the trail renders all-neutral with | ||
| * no "you are here" marker. | ||
| * - `{ data: AssertionStateInfo }` — resolved; drives the trail | ||
| * `is-current` halo, the badge state | ||
| * suffix, and the Promote CTA gate. | ||
| * - `{ error: string }` / data null — fetch failed OR no lifecycle | ||
| * record; the metadata panel shows | ||
| * "state unavailable" and the trail | ||
| * renders all-neutral with a quiet | ||
| * danger hint. | ||
| */ | ||
| export interface UseAssertionStateResult { | ||
| data: AssertionStateInfo | null; | ||
| loading: boolean; | ||
| error: string | null; | ||
| } | ||
|
|
||
| export function useAssertionState( | ||
| contextGraphId: string | undefined, | ||
| graphUri: string | undefined, | ||
| // Codex round-1 — bump this to force a re-fetch even when the URI is | ||
| // unchanged (e.g. after a promote FROM the detail view flips the state | ||
| // in `_meta`; the same `graphUri` would otherwise skip the effect and | ||
| // leave the trail/badge/CTA stale at the pre-promote state). | ||
| refreshKey?: number, | ||
| ): UseAssertionStateResult { | ||
| const [data, setData] = useState<AssertionStateInfo | null>(null); | ||
| const [loading, setLoading] = useState<boolean>(Boolean(contextGraphId && graphUri)); | ||
| const [error, setError] = useState<string | null>(null); | ||
|
|
||
| useEffect(() => { | ||
| if (!contextGraphId || !graphUri) { | ||
| setData(null); | ||
| setLoading(false); | ||
| setError(null); | ||
| return; | ||
| } | ||
| let cancelled = false; | ||
| // Codex round-1 — clear `data` when the assertion changes so a | ||
| // consumer reading `data` during the in-flight window can't see the | ||
| // PREVIOUS assertion's state (stale state/layer/assertionGraph). The | ||
| // detail view's `assertionGraph` derives from `data` and drives the | ||
| // triples fetch, so a stale value would briefly query the wrong | ||
| // graph. Mirror of the `triplesLoading` reset discipline. | ||
| setData(null); | ||
| setLoading(true); | ||
|
Jurij89 marked this conversation as resolved.
Jurij89 marked this conversation as resolved.
|
||
| setError(null); | ||
| fetchAssertionState(contextGraphId, graphUri) | ||
| .then((result) => { | ||
| if (cancelled) return; | ||
| setData(result); | ||
| setLoading(false); | ||
| }) | ||
| .catch((err) => { | ||
| if (cancelled) return; | ||
| // Leave any prior data in place is pointless here — the URI | ||
| // identity changed, so a stale state would be wrong. Clear it | ||
| // and surface the error so the detail view shows "unavailable". | ||
| setData(null); | ||
| setLoading(false); | ||
| setError(err instanceof Error ? err.message : 'Failed to load assertion state'); | ||
| }); | ||
| return () => { cancelled = true; }; | ||
| }, [contextGraphId, graphUri, refreshKey]); | ||
|
|
||
| return { data, loading, error }; | ||
| } | ||
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.