mirror of
https://github.com/razzant/ouroboros.git
synced 2026-08-26 11:31:48 +00:00
Merge pull request #261 from razzant/codex/fix-account-remove-confirmation
Some checks failed
CI / integration-test (push) Waiting to run
CI / quick-test (push) Waiting to run
CI / full-test (macos-latest) (push) Waiting to run
CI / full-test (ubuntu-latest) (push) Waiting to run
CI / full-test (windows-latest) (push) Waiting to run
CI / skill-smoke (macos-latest) (push) Waiting to run
CI / skill-smoke (ubuntu-latest) (push) Waiting to run
CI / skill-smoke (windows-latest) (push) Waiting to run
CI / marker-guards (push) Waiting to run
CI / build (dmg, macos-latest, macos-arm64, syft_1.50.0_darwin_arm64.tar.gz, syft, e32fdb9d47823fa633748a1efca2528fd77c37469ea93c9e40ab835da44e4cce) (push) Blocked by required conditions
CI / build (tar.gz, ubuntu-latest, linux-x86_64, syft_1.50.0_linux_amd64.tar.gz, syft, bf7b29ff57f06da30918266a0e1c2885a8f99784798d1bdb1628886aa015d788) (push) Blocked by required conditions
CI / build (zip, windows-latest, windows-x64, syft_1.50.0_windows_amd64.zip, syft.exe, 815ee6973ec5dff6a671d7f41b0e78835a8c45b91d5a39f4743ea1cee833d3be) (push) Blocked by required conditions
CI / vendor-package-smoke (push) Blocked by required conditions
CI / release (push) Blocked by required conditions
Claudexor platform gate (API keys — subscription auth NOT covered) / fixture · macos-latest · exact managed runtime, fake harness, no model (push) Waiting to run
Claudexor platform gate (API keys — subscription auth NOT covered) / fixture · ubuntu-latest · exact managed runtime, fake harness, no model (push) Waiting to run
CI / ui-smoke (push) Waiting to run
CI / docker-ui-smoke (push) Waiting to run
CI / docker-portable-test (push) Waiting to run
CI / release-preflight (push) Blocked by required conditions
Claudexor platform gate (API keys — subscription auth NOT covered) / fixture · windows-latest · exact managed runtime, fake harness, no model (push) Waiting to run
Claudexor platform gate (API keys — subscription auth NOT covered) / live · macos-latest · claude · API key only, subscription NOT covered (push) Waiting to run
Claudexor platform gate (API keys — subscription auth NOT covered) / live · ubuntu-latest · claude · API key only, subscription NOT covered (push) Waiting to run
Claudexor platform gate (API keys — subscription auth NOT covered) / live · windows-latest · claude · API key only, subscription NOT covered (push) Waiting to run
Claudexor platform gate (API keys — subscription auth NOT covered) / live · macos-latest · codex · API key only, subscription NOT covered (push) Waiting to run
Submit Claudexor dependency / Submit managed runtime snapshot (push) Has been cancelled
Some checks failed
CI / integration-test (push) Waiting to run
CI / quick-test (push) Waiting to run
CI / full-test (macos-latest) (push) Waiting to run
CI / full-test (ubuntu-latest) (push) Waiting to run
CI / full-test (windows-latest) (push) Waiting to run
CI / skill-smoke (macos-latest) (push) Waiting to run
CI / skill-smoke (ubuntu-latest) (push) Waiting to run
CI / skill-smoke (windows-latest) (push) Waiting to run
CI / marker-guards (push) Waiting to run
CI / build (dmg, macos-latest, macos-arm64, syft_1.50.0_darwin_arm64.tar.gz, syft, e32fdb9d47823fa633748a1efca2528fd77c37469ea93c9e40ab835da44e4cce) (push) Blocked by required conditions
CI / build (tar.gz, ubuntu-latest, linux-x86_64, syft_1.50.0_linux_amd64.tar.gz, syft, bf7b29ff57f06da30918266a0e1c2885a8f99784798d1bdb1628886aa015d788) (push) Blocked by required conditions
CI / build (zip, windows-latest, windows-x64, syft_1.50.0_windows_amd64.zip, syft.exe, 815ee6973ec5dff6a671d7f41b0e78835a8c45b91d5a39f4743ea1cee833d3be) (push) Blocked by required conditions
CI / vendor-package-smoke (push) Blocked by required conditions
CI / release (push) Blocked by required conditions
Claudexor platform gate (API keys — subscription auth NOT covered) / fixture · macos-latest · exact managed runtime, fake harness, no model (push) Waiting to run
Claudexor platform gate (API keys — subscription auth NOT covered) / fixture · ubuntu-latest · exact managed runtime, fake harness, no model (push) Waiting to run
CI / ui-smoke (push) Waiting to run
CI / docker-ui-smoke (push) Waiting to run
CI / docker-portable-test (push) Waiting to run
CI / release-preflight (push) Blocked by required conditions
Claudexor platform gate (API keys — subscription auth NOT covered) / fixture · windows-latest · exact managed runtime, fake harness, no model (push) Waiting to run
Claudexor platform gate (API keys — subscription auth NOT covered) / live · macos-latest · claude · API key only, subscription NOT covered (push) Waiting to run
Claudexor platform gate (API keys — subscription auth NOT covered) / live · ubuntu-latest · claude · API key only, subscription NOT covered (push) Waiting to run
Claudexor platform gate (API keys — subscription auth NOT covered) / live · windows-latest · claude · API key only, subscription NOT covered (push) Waiting to run
Claudexor platform gate (API keys — subscription auth NOT covered) / live · macos-latest · codex · API key only, subscription NOT covered (push) Waiting to run
Submit Claudexor dependency / Submit managed runtime snapshot (push) Has been cancelled
Fix account removal confirmation handling
This commit is contained in:
commit
e7c84240fc
2 changed files with 58 additions and 7 deletions
|
|
@ -1026,25 +1026,35 @@ async function toggleAccountEnabled(harness, profileId, enabled) {
|
|||
renderRows();
|
||||
}
|
||||
|
||||
async function confirmRemoveAccount(harness, profileId) {
|
||||
/**
|
||||
* Complete destructive flow behind a row's Remove button. Injectable deps let
|
||||
* the node suite drive the production handler; confirm mode authorizes only on
|
||||
* its documented strict boolean `true`, never the input mode's object shape.
|
||||
*/
|
||||
export async function confirmRemoveAccount(harness, profileId, {
|
||||
dialogImpl = openConfirmDialog,
|
||||
removeImpl = removeAccount,
|
||||
store = state.store,
|
||||
renderImpl = renderRows,
|
||||
} = {}) {
|
||||
if (!harness || !profileId) return;
|
||||
const family = familyLabel(harness, state.store.snapshot || {});
|
||||
const answer = await openConfirmDialog({
|
||||
const family = familyLabel(harness, store.snapshot || {});
|
||||
const answer = await dialogImpl({
|
||||
title: 'Remove account',
|
||||
body: removeAccountConfirmBody(profileId, family),
|
||||
confirmLabel: 'Remove',
|
||||
danger: true,
|
||||
});
|
||||
if (!answer?.confirmed) return;
|
||||
if (answer !== true) return;
|
||||
state.removeError = '';
|
||||
try {
|
||||
await removeAccount(harness, profileId);
|
||||
await removeImpl(harness, profileId);
|
||||
} catch (error) {
|
||||
state.removeError = `Could not remove "${profileId}": ${error.message || error}. `
|
||||
+ 'The account is unchanged.';
|
||||
}
|
||||
await state.store.refresh();
|
||||
renderRows();
|
||||
await store.refresh();
|
||||
renderImpl();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import {
|
|||
accountGroups,
|
||||
accountMetaLine,
|
||||
accountName,
|
||||
confirmRemoveAccount,
|
||||
familyActionLabel,
|
||||
familyLabel,
|
||||
familyStatus,
|
||||
|
|
@ -627,6 +628,46 @@ test('a partial gap obeys the SAME fault precedence as a total one', () => {
|
|||
// Removal.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
test('Remove consumes the non-input confirm boolean and performs the mutation once', async () => {
|
||||
const calls = [];
|
||||
const store = {
|
||||
snapshot: { harnesses: [{ id: 'claude', display_name: 'Claude Code' }] },
|
||||
refresh: async () => calls.push(['refresh']),
|
||||
};
|
||||
|
||||
await confirmRemoveAccount('claude', 'work', {
|
||||
dialogImpl: async (options) => {
|
||||
assert.notEqual(options.input, true);
|
||||
assert.equal(options.danger, true);
|
||||
assert.equal(options.confirmLabel, 'Remove');
|
||||
calls.push(['dialog']);
|
||||
return true;
|
||||
},
|
||||
removeImpl: async (harness, profileId) => calls.push(['remove', harness, profileId]),
|
||||
store,
|
||||
renderImpl: () => calls.push(['render']),
|
||||
});
|
||||
|
||||
assert.deepEqual(calls, [
|
||||
['dialog'],
|
||||
['remove', 'claude', 'work'],
|
||||
['refresh'],
|
||||
['render'],
|
||||
]);
|
||||
|
||||
for (const resolution of [false, undefined, null, { confirmed: true }]) {
|
||||
const skipped = [];
|
||||
await confirmRemoveAccount('claude', 'work', {
|
||||
dialogImpl: async () => { skipped.push(['dialog']); return resolution; },
|
||||
removeImpl: async () => skipped.push(['remove']),
|
||||
store: { snapshot: store.snapshot, refresh: async () => skipped.push(['refresh']) },
|
||||
renderImpl: () => skipped.push(['render']),
|
||||
});
|
||||
assert.deepEqual(skipped, [['dialog']],
|
||||
`resolution ${JSON.stringify(resolution)} must stop after the dialog`);
|
||||
}
|
||||
});
|
||||
|
||||
test('removing a named account goes through the engine contract, and says so', () => {
|
||||
const calls = [];
|
||||
const fetchImpl = async (url, init) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue