@bevel-software/platform-core-frontend 0.12.0 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bevel-software/platform-core-frontend",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "Open-source core UI of the Bevel platform (raw TS/TSX source): workspace explorer/viewer, branches & change requests, Library, secrets, tools, access control.",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -45,7 +45,7 @@
45
45
  "tailwind-merge": "^3.5.0",
46
46
  "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",
47
47
  "yaml": "^2.9.0",
48
- "@bevel-software/platform-shared": "0.12.0"
48
+ "@bevel-software/platform-shared": "0.12.1"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@testing-library/jest-dom": "^6.9.1",
@@ -0,0 +1,181 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { act, render, screen } from '@testing-library/react';
3
+ import { GitSyncFailedBanner } from '../components/GitSyncFailedBanner';
4
+ import {
5
+ EventBusContext,
6
+ type EventBusContextValue,
7
+ } from '../../workflow/state/event-bus.context';
8
+ import {
9
+ WorkspaceContext,
10
+ type WorkspaceContextValue,
11
+ } from '../../workspace/state/workspace.context';
12
+ import { makeWorkspaceFixture } from '../../workspace/__tests__/testFixtures';
13
+
14
+ /**
15
+ * A minimal stand-in for the SSE bus: keeps the handlers the component
16
+ * registers and lets a test push events through them, so these assertions
17
+ * drive the banner exactly the way the real backend does — by event, not by
18
+ * poking state.
19
+ */
20
+ function makeBus() {
21
+ // Handlers are stored untyped: the test emits plain event-shaped objects and
22
+ // the component's own subscription types are what's under test, not the bus.
23
+ const handlers = new Map<string, Set<(e: unknown) => void>>();
24
+ const ctx = {
25
+ subscribe(kind: string, handler: (e: unknown) => void) {
26
+ const set = handlers.get(kind) ?? new Set<(e: unknown) => void>();
27
+ set.add(handler);
28
+ handlers.set(kind, set);
29
+ return () => set.delete(handler);
30
+ },
31
+ } as unknown as EventBusContextValue;
32
+ return {
33
+ ctx,
34
+ emit(event: { kind: string; workspaceId: string; branch: string; reason?: string }) {
35
+ act(() => {
36
+ for (const h of handlers.get(event.kind) ?? []) h(event);
37
+ });
38
+ },
39
+ };
40
+ }
41
+
42
+ function renderBanner(workspace: Partial<WorkspaceContextValue> = {}) {
43
+ const bus = makeBus();
44
+ const view = render(
45
+ <EventBusContext.Provider value={bus.ctx}>
46
+ <WorkspaceContext.Provider value={makeWorkspaceFixture(workspace)}>
47
+ <GitSyncFailedBanner />
48
+ </WorkspaceContext.Provider>
49
+ </EventBusContext.Provider>,
50
+ );
51
+ const rerender = (next: Partial<WorkspaceContextValue>) =>
52
+ view.rerender(
53
+ <EventBusContext.Provider value={bus.ctx}>
54
+ <WorkspaceContext.Provider value={makeWorkspaceFixture(next)}>
55
+ <GitSyncFailedBanner />
56
+ </WorkspaceContext.Provider>
57
+ </EventBusContext.Provider>,
58
+ );
59
+ return { ...bus, rerender };
60
+ }
61
+
62
+ const FAILED = {
63
+ kind: 'git-sync-failed',
64
+ workspaceId: 'ws-1',
65
+ branch: 'feat/x',
66
+ reason: 'git push failed: fatal: Authentication failed',
67
+ };
68
+
69
+ describe('GitSyncFailedBanner', () => {
70
+ it('renders nothing until a failure arrives — the healthy case is invisible', () => {
71
+ renderBanner();
72
+ expect(screen.queryByRole('alert')).toBeNull();
73
+ });
74
+
75
+ it('tells the author their work is safe and points an admin at the logs', () => {
76
+ const bus = renderBanner();
77
+ bus.emit(FAILED);
78
+
79
+ const alert = screen.getByRole('alert');
80
+ // The two things this banner exists to say: the save is not lost, and
81
+ // whoever can act should look at the server logs. Neither is negotiable —
82
+ // an author reading "sync failed" with no reassurance re-types their work.
83
+ expect(alert.textContent).toContain('saved here');
84
+ expect(alert.textContent).toContain('server logs');
85
+ expect(alert.textContent).toContain('feat/x');
86
+ });
87
+
88
+ it('shows the sanitised git reason as the detail line', () => {
89
+ const bus = renderBanner();
90
+ bus.emit(FAILED);
91
+ expect(screen.getByRole('alert').textContent).toContain('Authentication failed');
92
+ });
93
+
94
+ it('clears when the backend reports the push recovered', () => {
95
+ const bus = renderBanner();
96
+ bus.emit(FAILED);
97
+ expect(screen.queryByRole('alert')).not.toBeNull();
98
+
99
+ bus.emit({ kind: 'git-sync-recovered', workspaceId: 'ws-1', branch: 'feat/x' });
100
+ expect(screen.queryByRole('alert')).toBeNull();
101
+ });
102
+
103
+ it('ignores events for another workspace', () => {
104
+ // Focus changes race with in-flight events; a failure on the branch the
105
+ // user just left must not paint a banner over the one they are on.
106
+ const bus = renderBanner();
107
+ bus.emit({ ...FAILED, workspaceId: 'ws-2', branch: 'feat/other' });
108
+ expect(screen.queryByRole('alert')).toBeNull();
109
+ });
110
+
111
+ it('does not let another workspace recovering clear this one’s banner', () => {
112
+ const bus = renderBanner();
113
+ bus.emit(FAILED);
114
+ bus.emit({ kind: 'git-sync-recovered', workspaceId: 'ws-2', branch: 'feat/other' });
115
+ expect(screen.queryByRole('alert')).not.toBeNull();
116
+ });
117
+
118
+ it('matches a slashed feature branch across the encode/decode split', () => {
119
+ // Local `workspace.id` is URL-encoded; the SSE event id is URL-decoded.
120
+ // A raw `===` drops every event on a `<user>/<branch>` workspace — which
121
+ // is every feature branch — so the banner would never show, silently
122
+ // recreating the invisible-failure bug this whole feature fixes.
123
+ const bus = renderBanner({ workspaceId: 'razvan-radulescu%2Ffeat' });
124
+ bus.emit({
125
+ kind: 'git-sync-failed',
126
+ workspaceId: 'razvan-radulescu/feat', // decoded, as the backend emits it
127
+ branch: 'razvan-radulescu/feat',
128
+ reason: 'git push failed: fatal: Authentication failed',
129
+ });
130
+ expect(screen.getByRole('alert').textContent).toContain('Authentication failed');
131
+
132
+ bus.emit({
133
+ kind: 'git-sync-recovered',
134
+ workspaceId: 'razvan-radulescu/feat',
135
+ branch: 'razvan-radulescu/feat',
136
+ });
137
+ expect(screen.queryByRole('alert')).toBeNull();
138
+ });
139
+
140
+ it('keeps each branch’s failure separately — returning to a broken branch still shows it', () => {
141
+ // A single retained record let branch B's failure overwrite branch A's;
142
+ // switching back to A then showed nothing despite A being unresolved.
143
+ const bus = renderBanner({ workspaceId: 'ws-1' });
144
+ bus.emit(FAILED); // ws-1 fails
145
+
146
+ act(() => bus.rerender({ workspaceId: 'ws-2' }));
147
+ bus.emit({ ...FAILED, workspaceId: 'ws-2', branch: 'feat/y', reason: 'ws-2 broke too' });
148
+ expect(screen.getByRole('alert').textContent).toContain('ws-2 broke too');
149
+
150
+ act(() => bus.rerender({ workspaceId: 'ws-1' }));
151
+ expect(screen.getByRole('alert').textContent).toContain('feat/x');
152
+
153
+ // ws-1 recovering clears only ws-1's record.
154
+ bus.emit({ kind: 'git-sync-recovered', workspaceId: 'ws-1', branch: 'feat/x' });
155
+ expect(screen.queryByRole('alert')).toBeNull();
156
+ act(() => bus.rerender({ workspaceId: 'ws-2' }));
157
+ expect(screen.getByRole('alert').textContent).toContain('ws-2 broke too');
158
+ });
159
+
160
+ it('clears a stale banner when the focused workspace changes', () => {
161
+ // FileViewer is not keyed by workspace, so this component survives a branch
162
+ // switch. A failure from the branch just left must not paint over the new
163
+ // one — and no recovered event would ever arrive for it.
164
+ const bus = renderBanner({ workspaceId: 'ws-1' });
165
+ bus.emit(FAILED);
166
+ expect(screen.queryByRole('alert')).not.toBeNull();
167
+
168
+ act(() => bus.rerender({ workspaceId: 'ws-2' }));
169
+ expect(screen.queryByRole('alert')).toBeNull();
170
+ });
171
+
172
+ it('stays up across repeated failures, showing the latest reason', () => {
173
+ const bus = renderBanner();
174
+ bus.emit(FAILED);
175
+ bus.emit({ ...FAILED, reason: 'git push failed: could not read Username' });
176
+
177
+ const alert = screen.getByRole('alert');
178
+ expect(alert.textContent).toContain('could not read Username');
179
+ expect(screen.getAllByRole('alert')).toHaveLength(1);
180
+ });
181
+ });
@@ -0,0 +1,106 @@
1
+ import { useCallback, useState } from 'react';
2
+ import { CloudOff } from 'lucide-react';
3
+ import { useEventBusSubscription } from '../../workflow/hooks/useEventBusSubscription';
4
+ import { canonicalizeWorkspaceId } from '../../workflow/state/event-bus.context';
5
+ import { useWorkspace } from '../../workspace/state/workspace.context';
6
+
7
+ /**
8
+ * Shown when a commit landed locally but could not be pushed to the remote.
9
+ *
10
+ * The save itself is fine and is NOT rolled back — the commit is on the
11
+ * server's disk and the retry paths keep running — so this is a warning, not
12
+ * an error state, and nothing here blocks the user. It exists because the
13
+ * failure is otherwise completely invisible: pushes happen behind saves, the
14
+ * one path that does surface an error only reaches a still-mounted editor, and
15
+ * a deployment with a broken git credential therefore looks perfectly healthy
16
+ * while every commit stacks up locally. One self-hosted install ran two days
17
+ * and 136 commits that way.
18
+ *
19
+ * Deliberately not addressed to the author: every cause of a failing push —
20
+ * an expired token, a revoked repo grant, an unreachable host — is an operator
21
+ * concern, and there is nothing the person writing a page can do about it. So
22
+ * the copy tells them their work is safe and points whoever can act at the
23
+ * logs, rather than explaining git.
24
+ *
25
+ * Clears on `git-sync-recovered`, which the backend emits when a push
26
+ * succeeds after failing. No dismiss control, same as `PullNeededBanner`: the
27
+ * condition is real until the server says otherwise, and the next failing save
28
+ * would re-raise it anyway.
29
+ */
30
+ export function GitSyncFailedBanner() {
31
+ const workspace = useWorkspace();
32
+ const workspaceId = workspace.workspaceId;
33
+ // Local state (`workspace.id`) is URL-encoded (`user%2Ffeat`); event ids
34
+ // arrive URL-decoded (`user/feat`, Express auto-decodes `req.params.id`).
35
+ // Comparing them raw drops every event on a slashed feature branch — the
36
+ // exact silent-failure symptom this banner exists to surface — so both
37
+ // sides are canonicalised, the same way every other SSE consumer does.
38
+ const canonId = workspaceId ? canonicalizeWorkspaceId(workspaceId) : null;
39
+ // One record PER workspace, keyed by canonical id. FileViewer is mounted at
40
+ // a catch-all route and is NOT keyed by workspace, so this component
41
+ // survives every branch switch: a single record would let branch B's
42
+ // failure overwrite branch A's, hiding A's unresolved state on return. The
43
+ // render gate below shows only the focused workspace's record.
44
+ //
45
+ // Known limit, accepted deliberately: SSE events are focus-scoped, so a
46
+ // recovery that happens while the user is on another branch never arrives —
47
+ // a retained record can be stale on return until that branch's next push
48
+ // settles it (failures re-emit on every attempt, recoveries on the next
49
+ // transition). The alternative — clearing on switch — hides real, still-
50
+ // broken state, which is the exact failure mode this PR exists to fix.
51
+ const [failures, setFailures] = useState<ReadonlyMap<string, { branch: string; reason: string }>>(
52
+ new Map(),
53
+ );
54
+
55
+ useEventBusSubscription(
56
+ 'git-sync-failed',
57
+ useCallback(
58
+ (e) => {
59
+ // The bus already filters to the focused workspace, but a focus change
60
+ // races with in-flight events — checking here keeps another branch's
61
+ // failure from being recorded under this one's key.
62
+ if (!canonId || canonicalizeWorkspaceId(e.workspaceId) !== canonId) return;
63
+ setFailures((prev) =>
64
+ new Map(prev).set(canonId, { branch: e.branch, reason: e.reason }),
65
+ );
66
+ },
67
+ [canonId],
68
+ ),
69
+ );
70
+
71
+ useEventBusSubscription(
72
+ 'git-sync-recovered',
73
+ useCallback(
74
+ (e) => {
75
+ if (!canonId || canonicalizeWorkspaceId(e.workspaceId) !== canonId) return;
76
+ setFailures((prev) => {
77
+ if (!prev.has(canonId)) return prev;
78
+ const next = new Map(prev);
79
+ next.delete(canonId);
80
+ return next;
81
+ });
82
+ },
83
+ [canonId],
84
+ ),
85
+ );
86
+
87
+ const failure = canonId ? failures.get(canonId) : undefined;
88
+ if (!failure) return null;
89
+
90
+ return (
91
+ <div
92
+ role="alert"
93
+ className="px-3 py-1.5 bg-sunken border-b border-line text-xs text-ink shrink-0"
94
+ >
95
+ <div className="flex items-center gap-2">
96
+ <CloudOff size={13} className="shrink-0" />
97
+ <span className="flex-1">
98
+ Changes on <span className="font-mono font-semibold">{failure.branch}</span> aren’t
99
+ reaching the remote repository. Your work is saved here — an administrator should check
100
+ the server logs.
101
+ </span>
102
+ </div>
103
+ <div className="mt-1 ml-5 text-ink-muted break-words">{failure.reason}</div>
104
+ </div>
105
+ );
106
+ }
@@ -1,313 +1,313 @@
1
- import { useCallback, useEffect, useState } from 'react';
2
- import { Link } from 'react-router-dom';
3
- import { Badge, Banner, Button, Surface, TextField } from '../../../shared/components';
4
- import { PageShell } from '../../../shared/components/PageShell';
5
- import { pathForTool } from '../../library/routes/library-paths';
6
- import { ToolLogo } from '../../library/components/ToolLogo';
7
- import {
8
- listSecrets,
9
- createOAuthSecret,
10
- deleteSecret,
11
- startOAuth,
12
- type SecretSummary,
13
- } from '../services/secrets.api';
14
- import { listToolSecrets, type ToolSecrets } from '../services/tool-secrets.api';
15
- import { ToolSecretsPanel } from './ToolSecretsPanel';
16
-
17
- /**
18
- * The Secrets page, routed standalone at `/secrets` (below the persistent
19
- * toolbar). Primary surface is PER-TOOL: each `.tool` manual declares which
20
- * `${VAR}`s are set by the tool owner (shared) vs by each user, and the panels
21
- * let the right people fill the right values. OAuth credentials (per-user)
22
- * live under "Advanced" — the callback/refresh flow is keyed by secret id.
23
- *
24
- * `/secrets` is also the standalone-secret OAuth landing: the backend
25
- * callback returns the browser here with the outcome in the URL fragment
26
- * (`#authorized` / `#error`), which the page surfaces and then strips.
27
- *
28
- * Visually this is the Library's sibling: tool logos lead the cards, statuses
29
- * say `Connected` / `Set` / `Needs …` in the same grammar, and everything sits
30
- * on the shared components rather than hand-rolled borders.
31
- */
32
- /**
33
- * The OAuth-callback outcome carried in the URL fragment
34
- * (`#authorized` / `#error=<message>`), or null when there is none.
35
- * `URLSearchParams` already percent-decodes, so the value is used as-is (a
36
- * second `decodeURIComponent` would corrupt messages containing `%`).
37
- */
38
- function readHashOutcome(): { kind: 'authorized' | 'error'; text: string } | null {
39
- const hash = window.location.hash.replace(/^#/, '');
40
- if (!hash) return null;
41
- const params = new URLSearchParams(hash);
42
- if (params.has('authorized')) return { kind: 'authorized', text: 'Authorization complete.' };
43
- if (params.has('error'))
44
- return { kind: 'error', text: params.get('error') || 'Authorization failed.' };
45
- return null;
46
- }
47
-
48
- export function SecretsPage() {
49
- const [tools, setTools] = useState<ToolSecrets[]>([]);
50
- const [secrets, setSecrets] = useState<SecretSummary[]>([]);
51
- const [loading, setLoading] = useState(true);
52
- const [error, setError] = useState<string | null>(null);
53
- // Read ONCE, synchronously, before the fragment is stripped below. Kept in
54
- // its own slot (not the API `error` above) so the initial refresh() — whose
55
- // success path clears the API error — can't race the outcome away.
56
- const [oauthOutcome] = useState(readHashOutcome);
57
-
58
- const refresh = useCallback(async () => {
59
- setLoading(true);
60
- try {
61
- const [t, s] = await Promise.all([listToolSecrets(), listSecrets()]);
62
- setTools(t);
63
- setSecrets(s);
64
- setError(null);
65
- } catch (err) {
66
- setError(err instanceof Error ? err.message : String(err));
67
- } finally {
68
- setLoading(false);
69
- }
70
- }, []);
71
-
72
- useEffect(() => {
73
- void refresh();
74
- }, [refresh]);
75
-
76
- // Strip the consumed fragment so a refresh doesn't re-announce the outcome.
77
- useEffect(() => {
78
- if (oauthOutcome) window.history.replaceState(null, '', window.location.pathname);
79
- }, [oauthOutcome]);
80
-
81
- // A live API error wins over the (historical) callback outcome; otherwise
82
- // the callback error stays visible even after the list load succeeds.
83
- const shownError = error ?? (oauthOutcome?.kind === 'error' ? oauthOutcome.text : null);
84
- const notice = oauthOutcome?.kind === 'authorized' ? oauthOutcome.text : null;
85
-
86
- const oauthSecrets = secrets.filter((s) => s.kind === 'oauth');
87
-
88
- const onDelete = async (id: string) => {
89
- try {
90
- await deleteSecret(id);
91
- await refresh();
92
- } catch (err) {
93
- setError(err instanceof Error ? err.message : String(err));
94
- }
95
- };
96
-
97
- const onAuthorize = async (id: string) => {
98
- try {
99
- const url = await startOAuth(id);
100
- window.location.href = url;
101
- } catch (err) {
102
- setError(err instanceof Error ? err.message : String(err));
103
- }
104
- };
105
-
106
- return (
107
- <PageShell
108
- title="Secrets"
109
- actions={
110
- <Button variant="quiet" size="sm" disabled={loading} onClick={() => void refresh()}>
111
- Refresh
112
- </Button>
113
- }
114
- >
115
- {shownError && (
116
- <Banner role="alert" tone="danger" className="mb-3">
117
- {shownError}
118
- </Banner>
119
- )}
120
- {notice && (
121
- <Banner role="status" tone="ok" className="mb-3">
122
- {notice}
123
- </Banner>
124
- )}
125
-
126
- <p className="mb-5 text-ui text-ink-muted">
127
- Secrets back the{' '}
128
- <code className="rounded-sm bg-sunken px-1 py-0.5 font-mono text-meta text-ink">
129
- {'${VARIABLE}'}
130
- </code>{' '}
131
- placeholders in your tool manuals. Each tool declares which variables its owner sets once
132
- (shared by everyone) and which each user sets for themselves. Values are never displayed
133
- after saving.
134
- </p>
135
-
136
- {loading ? (
137
- <p className="py-10 text-center text-ui text-ink-faint">Loading…</p>
138
- ) : tools.length === 0 ? (
139
- <p className="py-10 text-center text-ui text-ink-faint">
140
- No tools you can access declare secrets yet.
141
- </p>
142
- ) : (
143
- <ul className="mb-6 flex flex-col gap-2.5">
144
- {tools.map((tool) => (
145
- <li key={tool.slug}>
146
- <Surface tone="surface" radius="xl" elevation="card" padded>
147
- <div className="mb-3 flex items-center gap-2.5">
148
- <ToolLogo slug={tool.slug} name={tool.name} />
149
- {/* The tool's own page is where its description, capabilities
150
- and owner-side setup live — this panel only shows the
151
- values. */}
152
- <Link
153
- to={pathForTool(tool.slug)}
154
- className="truncate rounded-xs text-ui font-semibold text-ink hover:underline"
155
- aria-label={`Open ${tool.name}`}
156
- >
157
- {tool.name}
158
- </Link>
159
- <span className="truncate text-meta text-ink-faint">{tool.path}</span>
160
- {tool.canWrite && (
161
- <Badge tone="outline" size="xs" className="ml-auto shrink-0">
162
- You can edit shared secrets
163
- </Badge>
164
- )}
165
- </div>
166
- <ToolSecretsPanel tool={tool} onChanged={() => void refresh()} />
167
- </Surface>
168
- </li>
169
- ))}
170
- </ul>
171
- )}
172
-
173
- <details>
174
- <summary className="cursor-pointer text-detail font-semibold text-ink-muted">
175
- Advanced: OAuth credentials
176
- </summary>
177
- <div className="mt-3 flex flex-col gap-3.5">
178
- <p className="text-detail text-ink-muted">
179
- OAuth secrets are per-user. Name the variable key exactly as the tool references it{' '}
180
- <code className="rounded-sm bg-sunken px-1 py-0.5 font-mono text-meta text-ink">
181
- {'<Manual>_<VAR>'}
182
- </code>
183
- , then sign in to complete the flow.
184
- </p>
185
- {oauthSecrets.length > 0 && (
186
- <ul className="flex flex-col gap-1.5">
187
- {oauthSecrets.map((s) => (
188
- <li
189
- key={s.id}
190
- className="flex items-center gap-2 rounded-lg border border-line bg-surface px-3 py-2.5"
191
- >
192
- <code className="rounded-sm bg-sunken px-1.5 py-0.5 font-mono text-meta text-ink">
193
- {`\${${s.key}}`}
194
- </code>
195
- <Badge tone={s.authorized ? 'ok' : 'wait'} size="xs" className="shrink-0">
196
- {s.authorized ? 'Connected' : 'Needs your sign-in'}
197
- </Badge>
198
- <span className="ml-auto flex shrink-0 items-center gap-1.5">
199
- <Button variant="outline" size="tiny" onClick={() => void onAuthorize(s.id)}>
200
- {s.authorized ? 'Reconnect' : 'Sign in'}
201
- </Button>
202
- {/* The accessible name has to START with the visible word
203
- (WCAG 2.5.3): "Delete secret" meant voice control could
204
- not act on a button that reads "Remove". The key is what
205
- makes it unambiguous in a list of otherwise identical
206
- rows, so it comes after. */}
207
- <Button
208
- variant="quiet"
209
- size="tiny"
210
- aria-label={`Remove ${s.key}`}
211
- onClick={() => void onDelete(s.id)}
212
- >
213
- Remove
214
- </Button>
215
- </span>
216
- </li>
217
- ))}
218
- </ul>
219
- )}
220
- <Surface tone="sunken" radius="lg" elevation="none" padded>
221
- <OAuthSecretForm onSaved={() => void refresh()} onError={setError} />
222
- </Surface>
223
- </div>
224
- </details>
225
- </PageShell>
226
- );
227
- }
228
-
229
- function OAuthSecretForm({ onSaved, onError }: { onSaved: () => void; onError: (m: string) => void }) {
230
- const [key, setKey] = useState('');
231
- const [authorizationUrl, setAuthorizationUrl] = useState('');
232
- const [tokenUrl, setTokenUrl] = useState('');
233
- const [clientId, setClientId] = useState('');
234
- const [clientSecret, setClientSecret] = useState('');
235
- const [scopes, setScopes] = useState('');
236
- const [busy, setBusy] = useState(false);
237
-
238
- const submit = async () => {
239
- setBusy(true);
240
- try {
241
- await createOAuthSecret({
242
- key: key.trim(),
243
- provider: {
244
- authorizationUrl: authorizationUrl.trim(),
245
- tokenUrl: tokenUrl.trim(),
246
- clientId: clientId.trim(),
247
- clientSecret: clientSecret.trim() || undefined,
248
- scopes: scopes.split(/[\s,]+/).filter(Boolean),
249
- },
250
- });
251
- onSaved();
252
- } catch (err) {
253
- onError(err instanceof Error ? err.message : String(err));
254
- } finally {
255
- setBusy(false);
256
- }
257
- };
258
-
259
- return (
260
- <div className="flex flex-col gap-2.5">
261
- <Field label="Variable key (Manual_VAR)">
262
- <TextField
263
- className="w-full"
264
- value={key}
265
- onChange={(e) => setKey(e.target.value)}
266
- placeholder="github_GITHUB_TOKEN"
267
- />
268
- </Field>
269
- <Field label="Authorization URL">
270
- <TextField className="w-full" value={authorizationUrl} onChange={(e) => setAuthorizationUrl(e.target.value)} />
271
- </Field>
272
- <Field label="Token URL">
273
- <TextField className="w-full" value={tokenUrl} onChange={(e) => setTokenUrl(e.target.value)} />
274
- </Field>
275
- <Field label="Client ID">
276
- <TextField className="w-full" value={clientId} onChange={(e) => setClientId(e.target.value)} />
277
- </Field>
278
- <Field label="Client secret (optional)">
279
- <TextField
280
- className="w-full"
281
- type="password"
282
- value={clientSecret}
283
- onChange={(e) => setClientSecret(e.target.value)}
284
- />
285
- </Field>
286
- <Field label="Scopes (space or comma separated)">
287
- <TextField className="w-full" value={scopes} onChange={(e) => setScopes(e.target.value)} />
288
- </Field>
289
- <p className="text-detail text-ink-muted">
290
- Save first, then click “Sign in” on the secret to complete the flow.
291
- </p>
292
- <div>
293
- <Button
294
- variant="primary"
295
- size="sm"
296
- disabled={busy || !key.trim() || !authorizationUrl.trim() || !tokenUrl.trim() || !clientId.trim()}
297
- onClick={() => void submit()}
298
- >
299
- Save OAuth secret
300
- </Button>
301
- </div>
302
- </div>
303
- );
304
- }
305
-
306
- function Field({ label, children }: { label: string; children: React.ReactNode }) {
307
- return (
308
- <label className="block">
309
- <span className="mb-0.5 block text-detail font-medium text-ink-muted">{label}</span>
310
- {children}
311
- </label>
312
- );
313
- }
1
+ import { useCallback, useEffect, useState } from 'react';
2
+ import { Link } from 'react-router-dom';
3
+ import { Badge, Banner, Button, Surface, TextField } from '../../../shared/components';
4
+ import { PageShell } from '../../../shared/components/PageShell';
5
+ import { pathForTool } from '../../library/routes/library-paths';
6
+ import { ToolLogo } from '../../library/components/ToolLogo';
7
+ import {
8
+ listSecrets,
9
+ createOAuthSecret,
10
+ deleteSecret,
11
+ startOAuth,
12
+ type SecretSummary,
13
+ } from '../services/secrets.api';
14
+ import { listToolSecrets, type ToolSecrets } from '../services/tool-secrets.api';
15
+ import { ToolSecretsPanel } from './ToolSecretsPanel';
16
+
17
+ /**
18
+ * The Secrets page, routed standalone at `/secrets` (below the persistent
19
+ * toolbar). Primary surface is PER-TOOL: each `.tool` manual declares which
20
+ * `${VAR}`s are set by the tool owner (shared) vs by each user, and the panels
21
+ * let the right people fill the right values. OAuth credentials (per-user)
22
+ * live under "Advanced" — the callback/refresh flow is keyed by secret id.
23
+ *
24
+ * `/secrets` is also the standalone-secret OAuth landing: the backend
25
+ * callback returns the browser here with the outcome in the URL fragment
26
+ * (`#authorized` / `#error`), which the page surfaces and then strips.
27
+ *
28
+ * Visually this is the Library's sibling: tool logos lead the cards, statuses
29
+ * say `Connected` / `Set` / `Needs …` in the same grammar, and everything sits
30
+ * on the shared components rather than hand-rolled borders.
31
+ */
32
+ /**
33
+ * The OAuth-callback outcome carried in the URL fragment
34
+ * (`#authorized` / `#error=<message>`), or null when there is none.
35
+ * `URLSearchParams` already percent-decodes, so the value is used as-is (a
36
+ * second `decodeURIComponent` would corrupt messages containing `%`).
37
+ */
38
+ function readHashOutcome(): { kind: 'authorized' | 'error'; text: string } | null {
39
+ const hash = window.location.hash.replace(/^#/, '');
40
+ if (!hash) return null;
41
+ const params = new URLSearchParams(hash);
42
+ if (params.has('authorized')) return { kind: 'authorized', text: 'Authorization complete.' };
43
+ if (params.has('error'))
44
+ return { kind: 'error', text: params.get('error') || 'Authorization failed.' };
45
+ return null;
46
+ }
47
+
48
+ export function SecretsPage() {
49
+ const [tools, setTools] = useState<ToolSecrets[]>([]);
50
+ const [secrets, setSecrets] = useState<SecretSummary[]>([]);
51
+ const [loading, setLoading] = useState(true);
52
+ const [error, setError] = useState<string | null>(null);
53
+ // Read ONCE, synchronously, before the fragment is stripped below. Kept in
54
+ // its own slot (not the API `error` above) so the initial refresh() — whose
55
+ // success path clears the API error — can't race the outcome away.
56
+ const [oauthOutcome] = useState(readHashOutcome);
57
+
58
+ const refresh = useCallback(async () => {
59
+ setLoading(true);
60
+ try {
61
+ const [t, s] = await Promise.all([listToolSecrets(), listSecrets()]);
62
+ setTools(t);
63
+ setSecrets(s);
64
+ setError(null);
65
+ } catch (err) {
66
+ setError(err instanceof Error ? err.message : String(err));
67
+ } finally {
68
+ setLoading(false);
69
+ }
70
+ }, []);
71
+
72
+ useEffect(() => {
73
+ void refresh();
74
+ }, [refresh]);
75
+
76
+ // Strip the consumed fragment so a refresh doesn't re-announce the outcome.
77
+ useEffect(() => {
78
+ if (oauthOutcome) window.history.replaceState(null, '', window.location.pathname);
79
+ }, [oauthOutcome]);
80
+
81
+ // A live API error wins over the (historical) callback outcome; otherwise
82
+ // the callback error stays visible even after the list load succeeds.
83
+ const shownError = error ?? (oauthOutcome?.kind === 'error' ? oauthOutcome.text : null);
84
+ const notice = oauthOutcome?.kind === 'authorized' ? oauthOutcome.text : null;
85
+
86
+ const oauthSecrets = secrets.filter((s) => s.kind === 'oauth');
87
+
88
+ const onDelete = async (id: string) => {
89
+ try {
90
+ await deleteSecret(id);
91
+ await refresh();
92
+ } catch (err) {
93
+ setError(err instanceof Error ? err.message : String(err));
94
+ }
95
+ };
96
+
97
+ const onAuthorize = async (id: string) => {
98
+ try {
99
+ const url = await startOAuth(id);
100
+ window.location.href = url;
101
+ } catch (err) {
102
+ setError(err instanceof Error ? err.message : String(err));
103
+ }
104
+ };
105
+
106
+ return (
107
+ <PageShell
108
+ title="Secrets"
109
+ actions={
110
+ <Button variant="quiet" size="sm" disabled={loading} onClick={() => void refresh()}>
111
+ Refresh
112
+ </Button>
113
+ }
114
+ >
115
+ {shownError && (
116
+ <Banner role="alert" tone="danger" className="mb-3">
117
+ {shownError}
118
+ </Banner>
119
+ )}
120
+ {notice && (
121
+ <Banner role="status" tone="ok" className="mb-3">
122
+ {notice}
123
+ </Banner>
124
+ )}
125
+
126
+ <p className="mb-5 text-ui text-ink-muted">
127
+ Secrets back the{' '}
128
+ <code className="rounded-sm bg-sunken px-1 py-0.5 font-mono text-meta text-ink">
129
+ {'${VARIABLE}'}
130
+ </code>{' '}
131
+ placeholders in your tool manuals. Each tool declares which variables its owner sets once
132
+ (shared by everyone) and which each user sets for themselves. Values are never displayed
133
+ after saving.
134
+ </p>
135
+
136
+ {loading ? (
137
+ <p className="py-10 text-center text-ui text-ink-faint">Loading…</p>
138
+ ) : tools.length === 0 ? (
139
+ <p className="py-10 text-center text-ui text-ink-faint">
140
+ No tools you can access declare secrets yet.
141
+ </p>
142
+ ) : (
143
+ <ul className="mb-6 flex flex-col gap-2.5">
144
+ {tools.map((tool) => (
145
+ <li key={tool.slug}>
146
+ <Surface tone="surface" radius="xl" elevation="card" padded>
147
+ <div className="mb-3 flex items-center gap-2.5">
148
+ <ToolLogo slug={tool.slug} name={tool.name} />
149
+ {/* The tool's own page is where its description, capabilities
150
+ and owner-side setup live — this panel only shows the
151
+ values. */}
152
+ <Link
153
+ to={pathForTool(tool.slug)}
154
+ className="truncate rounded-xs text-ui font-semibold text-ink hover:underline"
155
+ aria-label={`Open ${tool.name}`}
156
+ >
157
+ {tool.name}
158
+ </Link>
159
+ <span className="truncate text-meta text-ink-faint">{tool.path}</span>
160
+ {tool.canWrite && (
161
+ <Badge tone="outline" size="xs" className="ml-auto shrink-0">
162
+ You can edit shared secrets
163
+ </Badge>
164
+ )}
165
+ </div>
166
+ <ToolSecretsPanel tool={tool} onChanged={() => void refresh()} />
167
+ </Surface>
168
+ </li>
169
+ ))}
170
+ </ul>
171
+ )}
172
+
173
+ <details>
174
+ <summary className="cursor-pointer text-detail font-semibold text-ink-muted">
175
+ Advanced: OAuth credentials
176
+ </summary>
177
+ <div className="mt-3 flex flex-col gap-3.5">
178
+ <p className="text-detail text-ink-muted">
179
+ OAuth secrets are per-user. Name the variable key exactly as the tool references it{' '}
180
+ <code className="rounded-sm bg-sunken px-1 py-0.5 font-mono text-meta text-ink">
181
+ {'<Manual>_<VAR>'}
182
+ </code>
183
+ , then sign in to complete the flow.
184
+ </p>
185
+ {oauthSecrets.length > 0 && (
186
+ <ul className="flex flex-col gap-1.5">
187
+ {oauthSecrets.map((s) => (
188
+ <li
189
+ key={s.id}
190
+ className="flex items-center gap-2 rounded-lg border border-line bg-surface px-3 py-2.5"
191
+ >
192
+ <code className="rounded-sm bg-sunken px-1.5 py-0.5 font-mono text-meta text-ink">
193
+ {`\${${s.key}}`}
194
+ </code>
195
+ <Badge tone={s.authorized ? 'ok' : 'wait'} size="xs" className="shrink-0">
196
+ {s.authorized ? 'Connected' : 'Needs your sign-in'}
197
+ </Badge>
198
+ <span className="ml-auto flex shrink-0 items-center gap-1.5">
199
+ <Button variant="outline" size="tiny" onClick={() => void onAuthorize(s.id)}>
200
+ {s.authorized ? 'Reconnect' : 'Sign in'}
201
+ </Button>
202
+ {/* The accessible name has to START with the visible word
203
+ (WCAG 2.5.3): "Delete secret" meant voice control could
204
+ not act on a button that reads "Remove". The key is what
205
+ makes it unambiguous in a list of otherwise identical
206
+ rows, so it comes after. */}
207
+ <Button
208
+ variant="quiet"
209
+ size="tiny"
210
+ aria-label={`Remove ${s.key}`}
211
+ onClick={() => void onDelete(s.id)}
212
+ >
213
+ Remove
214
+ </Button>
215
+ </span>
216
+ </li>
217
+ ))}
218
+ </ul>
219
+ )}
220
+ <Surface tone="sunken" radius="lg" elevation="none" padded>
221
+ <OAuthSecretForm onSaved={() => void refresh()} onError={setError} />
222
+ </Surface>
223
+ </div>
224
+ </details>
225
+ </PageShell>
226
+ );
227
+ }
228
+
229
+ function OAuthSecretForm({ onSaved, onError }: { onSaved: () => void; onError: (m: string) => void }) {
230
+ const [key, setKey] = useState('');
231
+ const [authorizationUrl, setAuthorizationUrl] = useState('');
232
+ const [tokenUrl, setTokenUrl] = useState('');
233
+ const [clientId, setClientId] = useState('');
234
+ const [clientSecret, setClientSecret] = useState('');
235
+ const [scopes, setScopes] = useState('');
236
+ const [busy, setBusy] = useState(false);
237
+
238
+ const submit = async () => {
239
+ setBusy(true);
240
+ try {
241
+ await createOAuthSecret({
242
+ key: key.trim(),
243
+ provider: {
244
+ authorizationUrl: authorizationUrl.trim(),
245
+ tokenUrl: tokenUrl.trim(),
246
+ clientId: clientId.trim(),
247
+ clientSecret: clientSecret.trim() || undefined,
248
+ scopes: scopes.split(/[\s,]+/).filter(Boolean),
249
+ },
250
+ });
251
+ onSaved();
252
+ } catch (err) {
253
+ onError(err instanceof Error ? err.message : String(err));
254
+ } finally {
255
+ setBusy(false);
256
+ }
257
+ };
258
+
259
+ return (
260
+ <div className="flex flex-col gap-2.5">
261
+ <Field label="Variable key (Manual_VAR)">
262
+ <TextField
263
+ className="w-full"
264
+ value={key}
265
+ onChange={(e) => setKey(e.target.value)}
266
+ placeholder="github_GITHUB_TOKEN"
267
+ />
268
+ </Field>
269
+ <Field label="Authorization URL">
270
+ <TextField className="w-full" value={authorizationUrl} onChange={(e) => setAuthorizationUrl(e.target.value)} />
271
+ </Field>
272
+ <Field label="Token URL">
273
+ <TextField className="w-full" value={tokenUrl} onChange={(e) => setTokenUrl(e.target.value)} />
274
+ </Field>
275
+ <Field label="Client ID">
276
+ <TextField className="w-full" value={clientId} onChange={(e) => setClientId(e.target.value)} />
277
+ </Field>
278
+ <Field label="Client secret (optional)">
279
+ <TextField
280
+ className="w-full"
281
+ type="password"
282
+ value={clientSecret}
283
+ onChange={(e) => setClientSecret(e.target.value)}
284
+ />
285
+ </Field>
286
+ <Field label="Scopes (space or comma separated)">
287
+ <TextField className="w-full" value={scopes} onChange={(e) => setScopes(e.target.value)} />
288
+ </Field>
289
+ <p className="text-detail text-ink-muted">
290
+ Save first, then click “Sign in” on the secret to complete the flow.
291
+ </p>
292
+ <div>
293
+ <Button
294
+ variant="primary"
295
+ size="sm"
296
+ disabled={busy || !key.trim() || !authorizationUrl.trim() || !tokenUrl.trim() || !clientId.trim()}
297
+ onClick={() => void submit()}
298
+ >
299
+ Save OAuth secret
300
+ </Button>
301
+ </div>
302
+ </div>
303
+ );
304
+ }
305
+
306
+ function Field({ label, children }: { label: string; children: React.ReactNode }) {
307
+ return (
308
+ <label className="block">
309
+ <span className="mb-0.5 block text-detail font-medium text-ink-muted">{label}</span>
310
+ {children}
311
+ </label>
312
+ );
313
+ }
@@ -1,82 +1,82 @@
1
- import { describe, it, expect, vi, beforeEach } from 'vitest';
2
- import { render, screen } from '@testing-library/react';
3
- import { MemoryRouter } from 'react-router-dom';
4
- import type { ToolSecrets } from '../../services/tool-secrets.api';
5
- import { SecretsPage } from '../SecretsPage';
6
-
7
- const toolSecretsMock = vi.hoisted(() => ({ listToolSecrets: vi.fn() }));
8
-
9
- vi.mock('../../services/secrets.api', () => ({
10
- listSecrets: vi.fn(async () => []),
11
- createOAuthSecret: vi.fn(async () => {}),
12
- deleteSecret: vi.fn(async () => {}),
13
- startOAuth: vi.fn(async () => ''),
14
- }));
15
- vi.mock('../../services/tool-secrets.api', () => ({
16
- listToolSecrets: toolSecretsMock.listToolSecrets,
17
- setAdminVar: vi.fn(async () => {}),
18
- setUserVar: vi.fn(async () => {}),
19
- setOAuthClientSecret: vi.fn(async () => {}),
20
- deleteAdminVar: vi.fn(async () => {}),
21
- deleteUserVar: vi.fn(async () => {}),
22
- }));
23
-
24
- /** The page carries links now, so it needs a router around it. */
25
- function renderPage() {
26
- return render(
27
- <MemoryRouter>
28
- <SecretsPage />
29
- </MemoryRouter>,
30
- );
31
- }
32
-
33
- describe('SecretsPage', () => {
34
- beforeEach(() => {
35
- // Each test starts on a clean /secrets URL (no leftover fragment).
36
- window.history.replaceState(null, '', '/secrets');
37
- toolSecretsMock.listToolSecrets.mockReset().mockResolvedValue([]);
38
- });
39
-
40
- it('renders as a full page (no dialog) and loads the secret lists', async () => {
41
- renderPage();
42
- expect(screen.getByRole('heading', { name: 'Secrets' })).toBeInTheDocument();
43
- expect(
44
- await screen.findByText('No tools you can access declare secrets yet.'),
45
- ).toBeInTheDocument();
46
- // Converted from the old gear-menu dialog: nothing modal is mounted.
47
- expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
48
- });
49
-
50
- it('links each tool name at its own page', async () => {
51
- const heyreach: ToolSecrets = {
52
- slug: 'heyreach',
53
- name: 'heyreach',
54
- path: 'Plugins/GTM/heyreach.tool',
55
- type: 'inline',
56
- setup: null,
57
- canWrite: false,
58
- variables: [],
59
- };
60
- toolSecretsMock.listToolSecrets.mockResolvedValue([heyreach]);
61
-
62
- renderPage();
63
- const link = await screen.findByRole('link', { name: 'Open heyreach' });
64
- expect(link).toHaveAttribute('href', '/skills-and-tools/tools/heyreach');
65
- });
66
-
67
- it('surfaces the OAuth-callback success carried in the #authorized fragment and strips it', async () => {
68
- window.history.replaceState(null, '', '/secrets#authorized');
69
- renderPage();
70
- expect(await screen.findByText('Authorization complete.')).toBeInTheDocument();
71
- // The fragment is consumed so a refresh doesn't re-announce it.
72
- expect(window.location.hash).toBe('');
73
- expect(window.location.pathname).toBe('/secrets');
74
- });
75
-
76
- it('surfaces the OAuth-callback error carried in the #error fragment and strips it', async () => {
77
- window.history.replaceState(null, '', '/secrets#error=Access%20denied');
78
- renderPage();
79
- expect(await screen.findByText('Access denied')).toBeInTheDocument();
80
- expect(window.location.hash).toBe('');
81
- });
82
- });
1
+ import { describe, it, expect, vi, beforeEach } from 'vitest';
2
+ import { render, screen } from '@testing-library/react';
3
+ import { MemoryRouter } from 'react-router-dom';
4
+ import type { ToolSecrets } from '../../services/tool-secrets.api';
5
+ import { SecretsPage } from '../SecretsPage';
6
+
7
+ const toolSecretsMock = vi.hoisted(() => ({ listToolSecrets: vi.fn() }));
8
+
9
+ vi.mock('../../services/secrets.api', () => ({
10
+ listSecrets: vi.fn(async () => []),
11
+ createOAuthSecret: vi.fn(async () => {}),
12
+ deleteSecret: vi.fn(async () => {}),
13
+ startOAuth: vi.fn(async () => ''),
14
+ }));
15
+ vi.mock('../../services/tool-secrets.api', () => ({
16
+ listToolSecrets: toolSecretsMock.listToolSecrets,
17
+ setAdminVar: vi.fn(async () => {}),
18
+ setUserVar: vi.fn(async () => {}),
19
+ setOAuthClientSecret: vi.fn(async () => {}),
20
+ deleteAdminVar: vi.fn(async () => {}),
21
+ deleteUserVar: vi.fn(async () => {}),
22
+ }));
23
+
24
+ /** The page carries links now, so it needs a router around it. */
25
+ function renderPage() {
26
+ return render(
27
+ <MemoryRouter>
28
+ <SecretsPage />
29
+ </MemoryRouter>,
30
+ );
31
+ }
32
+
33
+ describe('SecretsPage', () => {
34
+ beforeEach(() => {
35
+ // Each test starts on a clean /secrets URL (no leftover fragment).
36
+ window.history.replaceState(null, '', '/secrets');
37
+ toolSecretsMock.listToolSecrets.mockReset().mockResolvedValue([]);
38
+ });
39
+
40
+ it('renders as a full page (no dialog) and loads the secret lists', async () => {
41
+ renderPage();
42
+ expect(screen.getByRole('heading', { name: 'Secrets' })).toBeInTheDocument();
43
+ expect(
44
+ await screen.findByText('No tools you can access declare secrets yet.'),
45
+ ).toBeInTheDocument();
46
+ // Converted from the old gear-menu dialog: nothing modal is mounted.
47
+ expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
48
+ });
49
+
50
+ it('links each tool name at its own page', async () => {
51
+ const heyreach: ToolSecrets = {
52
+ slug: 'heyreach',
53
+ name: 'heyreach',
54
+ path: 'Plugins/GTM/heyreach.tool',
55
+ type: 'inline',
56
+ setup: null,
57
+ canWrite: false,
58
+ variables: [],
59
+ };
60
+ toolSecretsMock.listToolSecrets.mockResolvedValue([heyreach]);
61
+
62
+ renderPage();
63
+ const link = await screen.findByRole('link', { name: 'Open heyreach' });
64
+ expect(link).toHaveAttribute('href', '/skills-and-tools/tools/heyreach');
65
+ });
66
+
67
+ it('surfaces the OAuth-callback success carried in the #authorized fragment and strips it', async () => {
68
+ window.history.replaceState(null, '', '/secrets#authorized');
69
+ renderPage();
70
+ expect(await screen.findByText('Authorization complete.')).toBeInTheDocument();
71
+ // The fragment is consumed so a refresh doesn't re-announce it.
72
+ expect(window.location.hash).toBe('');
73
+ expect(window.location.pathname).toBe('/secrets');
74
+ });
75
+
76
+ it('surfaces the OAuth-callback error carried in the #error fragment and strips it', async () => {
77
+ window.history.replaceState(null, '', '/secrets#error=Access%20denied');
78
+ renderPage();
79
+ expect(await screen.findByText('Access denied')).toBeInTheDocument();
80
+ expect(window.location.hash).toBe('');
81
+ });
82
+ });
@@ -12,6 +12,7 @@ import { LayoutContext } from '../../layout/state/layout.context';
12
12
  import { useParams } from 'react-router-dom';
13
13
  import { useCanonicalFileUrl, useFileNav } from '../routing/kb-routes';
14
14
  import { PullNeededBanner } from '../../git/components/PullNeededBanner';
15
+ import { GitSyncFailedBanner } from '../../git/components/GitSyncFailedBanner';
15
16
  import { useFileAccess } from '../../access/hooks/useFileAccess';
16
17
  import { FileHistoryPanel } from '../../git/components/FileHistoryPanel';
17
18
  import { FileComparisonPanel } from '../../git/components/FileComparisonPanel';
@@ -836,6 +837,7 @@ export function FileViewer() {
836
837
  return (
837
838
  <div className="h-full w-full flex flex-col bg-white min-w-0 relative">
838
839
  <PullNeededBanner />
840
+ <GitSyncFailedBanner />
839
841
  <EditorTabs />
840
842
  <div className="flex-1 flex items-center justify-center px-6">
841
843
  <div className="w-full max-w-md text-center">
@@ -1056,6 +1058,7 @@ export function FileViewer() {
1056
1058
  return (
1057
1059
  <div className="h-full w-full flex flex-col bg-white min-w-0 relative">
1058
1060
  <PullNeededBanner />
1061
+ <GitSyncFailedBanner />
1059
1062
  {/* No "you don't have permission to edit" banner, deliberately: for a
1060
1063
  reader the restriction is not news worth a stripe across every page —
1061
1064
  the Propose changes affordance already says what they CAN do, and the