-
-
Notifications
You must be signed in to change notification settings - Fork 153
fix/resolve all consent rebased #7488
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
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
3191ed6
feat(engine): add resolve-all consent protocol
matthewevans b295b96
fix(engine): expose resolve-all consent actions
matthewevans 7a68bee
fix(engine): materialize ready consent revocations
matthewevans c8ca2a2
feat(resolve-all): collapse authorized safe prefixes
matthewevans 25f0d07
fix(resolve-all): consume ready consent locally
matthewevans 28397a9
fix(resolve-all): resume after AI consent grant
matthewevans 1e2761f
test(resolve-all): type consent proposals
matthewevans ffa3ea9
test(engine): order resolve-all consent module
matthewevans 7ab15a3
fix(resolve-all): cover consent waiting states
matthewevans 80e6785
fix(resolve-all): wire consent across decision surfaces
matthewevans accaba9
fix(resolve-all): reconcile downstream consumers
matthewevans 4a9f5c0
fix(resolve-all): deduplicate consent candidates
matthewevans fecafc5
test(engine): exclude resolve-all from preflight census
matthewevans a707079
fix(resolve-all): preserve priority through consent
matthewevans 77f7fd0
test(engine): count resolve-all waiting states
matthewevans e7f5e33
test(resolve-all): register protocol surface
matthewevans 79f5eab
test(resolve-all): cover consent-ready transport
matthewevans f88e0cb
fix(resolve-all): preserve consent priority order
matthewevans 5fe9e8c
fix(resolve-all): harden consent handoff
matthewevans 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
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,68 @@ | ||
| import { useCallback } from "react"; | ||
| import { useTranslation } from "react-i18next"; | ||
|
|
||
| import { dispatchResolveAll } from "../../game/dispatch.ts"; | ||
| import { useGameDispatch } from "../../hooks/useGameDispatch.ts"; | ||
| import { useGameStore } from "../../stores/gameStore.ts"; | ||
| import { DialogShell } from "./DialogShell.tsx"; | ||
|
|
||
| /** | ||
| * Engine-authored Resolve All consent prompt. The browser only presents the | ||
| * representative and echoes a finite Grant/Decline action; authorization and | ||
| * the subsequent safe prefix stay entirely in the engine. | ||
| */ | ||
| export function ResolveAllConsentModal({ playerId }: { playerId: number }) { | ||
| const { t } = useTranslation("game"); | ||
| const waitingFor = useGameStore((s) => s.waitingFor); | ||
| const dispatch = useGameDispatch(); | ||
|
|
||
| const visible = | ||
| waitingFor?.type === "ResolveAllConsent" && | ||
| waitingFor.data.representative === playerId; | ||
|
|
||
| const respond = useCallback( | ||
| async (decision: "Grant" | "Decline") => { | ||
| if (waitingFor?.type !== "ResolveAllConsent") return; | ||
| const grantedEpoch = waitingFor.data.epoch; | ||
| await dispatch({ | ||
| type: "RespondResolveAllConsent", | ||
| data: { epoch: grantedEpoch, decision: { type: decision } }, | ||
| }); | ||
| const waitingForAfterSubmission = useGameStore.getState().gameState?.waiting_for; | ||
| if ( | ||
| decision === "Grant" && | ||
| waitingForAfterSubmission?.type === "ResolveAllReady" && | ||
| waitingForAfterSubmission.data.epoch === grantedEpoch | ||
| ) { | ||
| await dispatchResolveAll(playerId, []); | ||
| } | ||
| }, | ||
| [dispatch, playerId, waitingFor], | ||
| ); | ||
|
|
||
| if (!visible) return null; | ||
|
|
||
| return ( | ||
| <DialogShell | ||
| eyebrow={t("resolveAllConsent.eyebrow")} | ||
| title={t("resolveAllConsent.title")} | ||
| subtitle={t("resolveAllConsent.subtitle")} | ||
| size="sm" | ||
| > | ||
| <div className="flex gap-3 px-5 py-5"> | ||
| <button | ||
| className="flex-1 rounded-xl bg-emerald-500 px-4 py-3 font-semibold text-emerald-950 transition hover:bg-emerald-400" | ||
| onClick={() => void respond("Grant")} | ||
| > | ||
| {t("resolveAllConsent.grant")} | ||
| </button> | ||
| <button | ||
| className="flex-1 rounded-xl bg-gray-700 px-4 py-3 font-semibold text-white transition hover:bg-gray-600" | ||
| onClick={() => void respond("Decline")} | ||
| > | ||
| {t("resolveAllConsent.decline")} | ||
| </button> | ||
| </div> | ||
| </DialogShell> | ||
| ); | ||
| } | ||
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.
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.