Compare commits

..

1 Commits

Author SHA1 Message Date
core-fe bd94a8be98 fix(canvas/test): wrap render() in act() for SettingsPanel open/close tests
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 1m20s
CI / Canvas (Next.js) (pull_request) Failing after 14m37s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
CI / Platform (Go) (pull_request) Successful in 22m2s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 8s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 2m22s
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 8s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 12s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 23s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 27s
Harness Replays / detect-changes (pull_request) Successful in 24s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 27s
qa-review / approved (pull_request) Failing after 31s
Harness Replays / Harness Replays (pull_request) Successful in 6s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 9s
CI / Python Lint & Test (pull_request) Successful in 7m41s
CI / Detect changes (pull_request) Successful in 55s
CI / all-required (pull_request) Failing after 18m29s
sop-tier-check / tier-check (pull_request) Successful in 25s
gate-check-v3 / gate-check (pull_request) Successful in 54s
sop-checklist / all-items-acked (pull_request) Successful in 30s
security-review / approved (pull_request) Failing after 33s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 1m11s
E2E API Smoke Test / detect-changes (pull_request) Successful in 1m15s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 10m56s
audit-force-merge / audit (pull_request) Has been skipped
React state updates triggered by store subscriptions are not guaranteed
to flush before the next synchronous assertion. On slower runners (CI cold
start), getByTestId("secrets-tab") fires before the Dialog.Root
open={isPanelOpen} effect resolves, causing a 5000ms timeout.

Wrapping every render() that sets isPanelOpen=true inside act() ensures
all pending effects and state updates flush before the assertion runs.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 12:21:10 +00:00
3 changed files with 14 additions and 66 deletions
+1 -47
View File
@@ -314,29 +314,6 @@ def post_comment(pr_number: int, body: str, *, dry_run: bool) -> None:
api("POST", f"/repos/{OWNER}/{NAME}/issues/{pr_number}/comments", body={"body": body})
def remove_label(pr_number: int, label: str, *, dry_run: bool) -> None:
print(f"::notice::removing label '{label}' from PR #{pr_number}")
if dry_run:
return
# Gitea requires label ID, not name, for deletion.
# Multiple labels can share the same name with different IDs — remove all.
_, body = api("GET", f"/repos/{OWNER}/{NAME}/pulls/{pr_number}")
pr_labels = body.get("labels", []) if isinstance(body, dict) else []
removed = False
for lbl in pr_labels:
if lbl.get("name") == label:
label_id = lbl.get("id")
if label_id:
api(
"DELETE",
f"/repos/{OWNER}/{NAME}/issues/{pr_number}/labels/{label_id}",
expect_json=False,
)
removed = True
if not removed:
print(f"::notice::label '{label}' not found on PR #{pr_number}")
def update_pull(pr_number: int, *, dry_run: bool) -> None:
print(f"::notice::updating PR #{pr_number} with base branch via style={UPDATE_STYLE}")
if dry_run:
@@ -430,30 +407,7 @@ def process_once(*, dry_run: bool = False) -> int:
"deferring to next tick"
)
return 0
try:
merge_pull(pr_number, dry_run=dry_run)
except ApiError as exc:
# Merge failed (pre-receive hook, branch protection, etc.).
# Remove queue label so next tick picks the next PR.
msg = str(exc)
if "405" in msg or "not allowed to merge" in msg.lower():
hint = "pre-receive hook or branch protection blocked the merge"
elif "422" in msg or "Unprocessable" in msg:
hint = "branch protection required-status check failed"
elif "409" in msg or "conflict" in msg.lower():
hint = "merge conflict"
else:
hint = msg[:200]
remove_label(pr_number, QUEUE_LABEL, dry_run=dry_run)
post_comment(
pr_number,
(
f"merge-queue: merge blocked ({hint}). "
f"Label removed — re-add once the block is resolved."
),
dry_run=dry_run,
)
return 0
merge_pull(pr_number, dry_run=dry_run)
return 0
return 0
-6
View File
@@ -48,12 +48,6 @@ jobs:
REQUIRED_CONTEXTS: >-
CI / all-required (pull_request),
sop-checklist / all-items-acked (pull_request)
# NOTE: qa-review / security-review gates intentionally omitted.
# These gates permanently fail (mc#1111: SOP_TIER_CHECK_TOKEN missing
# PAT — token owner not in qa/security teams). Adding them to
# REQUIRED_CONTEXTS would strip the merge-queue label from every PR
# in the queue, breaking the queue for all contributors.
# Re-add these gates once mc#1111 is resolved.
# Push-side required contexts. Checking CI / all-required (push)
# explicitly instead of the combined state avoids false-pause when
# non-blocking jobs (continue-on-error: true) have failed — those
@@ -122,33 +122,33 @@ describe("SettingsPanel — closed by default", () => {
describe("SettingsPanel — open / close", () => {
it("renders SecretsTab when panel is open", () => {
storeState.isPanelOpen = true;
render(<SettingsPanel workspaceId="ws-xyz" />);
act(() => { render(<SettingsPanel workspaceId="ws-xyz" />); });
expect(screen.getByTestId("secrets-tab")).toBeTruthy();
expect(screen.getByText(/workspaceId=ws-xyz/i)).toBeTruthy();
});
it("renders TokensTab tab in tabs list", () => {
storeState.isPanelOpen = true;
render(<SettingsPanel workspaceId="ws-1" />);
act(() => { render(<SettingsPanel workspaceId="ws-1" />); });
expect(screen.getByRole("tab", { name: /workspace tokens/i })).toBeTruthy();
});
it("renders Org API Keys tab in tabs list", () => {
storeState.isPanelOpen = true;
render(<SettingsPanel workspaceId="ws-1" />);
act(() => { render(<SettingsPanel workspaceId="ws-1" />); });
expect(screen.getByRole("tab", { name: /org api keys/i })).toBeTruthy();
});
it("Secrets tab is default active", () => {
storeState.isPanelOpen = true;
render(<SettingsPanel workspaceId="ws-1" />);
act(() => { render(<SettingsPanel workspaceId="ws-1" />); });
expect(screen.getByTestId("secrets-tab")).toBeTruthy();
expect(screen.getByRole("tab", { name: /secrets/i }).getAttribute("data-state")).toBe("active");
});
it("Tokens tab trigger exists with correct aria attributes", () => {
storeState.isPanelOpen = true;
render(<SettingsPanel workspaceId="ws-1" />);
act(() => { render(<SettingsPanel workspaceId="ws-1" />); });
const tab = screen.getByRole("tab", { name: /workspace tokens/i });
// Radix Tabs.Trigger has role="tab" and aria-selected
expect(tab).toBeTruthy();
@@ -161,14 +161,14 @@ describe("SettingsPanel — open / close", () => {
it("Close button calls closePanel", () => {
storeState.isPanelOpen = true;
render(<SettingsPanel workspaceId="ws-1" />);
act(() => { render(<SettingsPanel workspaceId="ws-1" />); });
fireEvent.click(screen.getByRole("button", { name: /close settings/i }));
expect(mockClosePanel).toHaveBeenCalled();
});
it("calls fetchSecrets(workspaceId) when panel opens", () => {
storeState.isPanelOpen = true;
render(<SettingsPanel workspaceId="ws-fetch-test" />);
act(() => { render(<SettingsPanel workspaceId="ws-fetch-test" />); });
expect(mockFetchSecrets).toHaveBeenCalledWith("ws-fetch-test");
});
});
@@ -179,7 +179,7 @@ describe("SettingsPanel — unsaved changes guard", () => {
it("shows guard when panel closing with isAddFormOpen=true", () => {
storeState.isPanelOpen = true;
storeState.isAddFormOpen = true;
render(<SettingsPanel workspaceId="ws-1" />);
act(() => { render(<SettingsPanel workspaceId="ws-1" />); });
fireEvent.click(screen.getByRole("button", { name: /close settings/i }));
expect(screen.getByTestId("unsaved-guard")).toBeTruthy();
});
@@ -187,7 +187,7 @@ describe("SettingsPanel — unsaved changes guard", () => {
it("guard shows when editingKey is set (dirty form)", () => {
storeState.isPanelOpen = true;
storeState.editingKey = "GITHUB_TOKEN";
render(<SettingsPanel workspaceId="ws-1" />);
act(() => { render(<SettingsPanel workspaceId="ws-1" />); });
fireEvent.click(screen.getByRole("button", { name: /close settings/i }));
expect(screen.getByTestId("unsaved-guard")).toBeTruthy();
});
@@ -195,7 +195,7 @@ describe("SettingsPanel — unsaved changes guard", () => {
it("'Keep editing' closes guard but panel stays open", () => {
storeState.isPanelOpen = true;
storeState.editingKey = "GITHUB_TOKEN";
render(<SettingsPanel workspaceId="ws-1" />);
act(() => { render(<SettingsPanel workspaceId="ws-1" />); });
// Trigger close attempt
fireEvent.click(screen.getByRole("button", { name: /close settings/i }));
expect(screen.getByTestId("unsaved-guard")).toBeTruthy();
@@ -209,7 +209,7 @@ describe("SettingsPanel — unsaved changes guard", () => {
it("'Discard' button on guard calls closePanel", () => {
storeState.isPanelOpen = true;
storeState.isAddFormOpen = true;
render(<SettingsPanel workspaceId="ws-1" />);
act(() => { render(<SettingsPanel workspaceId="ws-1" />); });
fireEvent.click(screen.getByRole("button", { name: /close settings/i }));
fireEvent.click(screen.getByTestId("guard-discard"));
expect(mockClosePanel).toHaveBeenCalled();
@@ -221,13 +221,13 @@ describe("SettingsPanel — unsaved changes guard", () => {
describe("SettingsPanel — accessibility", () => {
it("Dialog.Content has aria-label='Settings: API Keys'", () => {
storeState.isPanelOpen = true;
render(<SettingsPanel workspaceId="ws-1" />);
act(() => { render(<SettingsPanel workspaceId="ws-1" />); });
expect(document.querySelector('[aria-label="Settings: API Keys"]')).toBeTruthy();
});
it("TabList has aria-label='Settings sections'", () => {
storeState.isPanelOpen = true;
render(<SettingsPanel workspaceId="ws-1" />);
act(() => { render(<SettingsPanel workspaceId="ws-1" />); });
expect(document.querySelector('[aria-label="Settings sections"]')).toBeTruthy();
});
});