feat(FN-5442): add merge mode warning banner to SettingsModal
Added a merge mode warning banner to SettingsModal with styling and visibility tests. Fusion-Task-Id: FN-5442
This commit is contained in:
committed by
gsxdsm
parent
b3f995c857
commit
252ae24434
@@ -2014,9 +2014,29 @@
|
||||
gap: var(--space-sm);
|
||||
}
|
||||
|
||||
.settings-warning-banner {
|
||||
margin-top: var(--space-sm);
|
||||
padding: var(--space-sm) var(--space-md);
|
||||
border: 1px solid var(--color-warning);
|
||||
border-radius: var(--radius-md);
|
||||
background: color-mix(in srgb, var(--color-warning) 12%, transparent);
|
||||
color: var(--text);
|
||||
font-size: var(--font-sm, 0.875rem);
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.settings-warning-banner strong {
|
||||
color: var(--color-warning);
|
||||
margin-right: var(--space-xs);
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.auth-custom-provider-item {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.settings-warning-banner {
|
||||
padding: var(--space-sm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4639,6 +4639,22 @@ export function SettingsModal({
|
||||
<small>
|
||||
Auto-merge runs in the task worktree by default. Switch to the legacy project-root path only if you need the pre-FN-5279 fallback; worktrunk-managed projects still defer to worktrunk.
|
||||
</small>
|
||||
{(form.mergeIntegrationWorktree ?? "reuse-task-worktree") !== "reuse-task-worktree" && (
|
||||
<div
|
||||
className="settings-warning-banner"
|
||||
role="alert"
|
||||
aria-live="polite"
|
||||
data-testid="merge-integration-worktree-warning"
|
||||
>
|
||||
<strong>Legacy integration-branch mode.</strong>{" "}
|
||||
Auto-merge will run rebase, conflict resolution, and squash commits inside the
|
||||
project root (the user's checked-out integration-branch worktree) instead of
|
||||
the task worktree. Fusion assumes that directory is already on the integration
|
||||
branch and clean; if it isn't, merges may fail or touch the user's working
|
||||
tree. Reuse-task-worktree is the recommended default (FN-5279). Switch back unless
|
||||
you have a specific reason to opt in (FN-5348).
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -396,6 +396,46 @@ describe("SettingsModal", () => {
|
||||
expect(payload.mergeIntegrationWorktree).toBe("cwd-main");
|
||||
});
|
||||
|
||||
it("does NOT render the warning banner when the integration worktree is reuse-task-worktree (default)", async () => {
|
||||
renderModal({ initialSection: "merge" });
|
||||
await waitForSettingsModalReady();
|
||||
|
||||
expect(screen.queryByTestId("merge-integration-worktree-warning")).toBeNull();
|
||||
});
|
||||
|
||||
it("renders the warning banner when the legacy cwd-main mode is selected", async () => {
|
||||
renderModal({ initialSection: "merge" });
|
||||
await waitForSettingsModalReady();
|
||||
|
||||
await userEvent.selectOptions(screen.getByLabelText("Integration worktree"), "cwd-main");
|
||||
|
||||
const warning = screen.getByTestId("merge-integration-worktree-warning");
|
||||
expect(warning).toBeInTheDocument();
|
||||
expect(warning).toHaveAttribute("role", "alert");
|
||||
expect(warning).toHaveTextContent("Legacy");
|
||||
expect(warning).toHaveTextContent("FN-5348");
|
||||
});
|
||||
|
||||
it("removes the warning banner when switching back to reuse-task-worktree", async () => {
|
||||
mockFetchSettings.mockResolvedValueOnce({
|
||||
...defaultSettings,
|
||||
mergeIntegrationWorktree: "cwd-main",
|
||||
});
|
||||
mockFetchSettingsByScope.mockResolvedValueOnce({
|
||||
global: { ...defaultSettings, mergeIntegrationWorktree: "cwd-main" },
|
||||
project: {},
|
||||
});
|
||||
|
||||
renderModal({ initialSection: "merge" });
|
||||
await waitForSettingsModalReady();
|
||||
|
||||
expect(screen.getByTestId("merge-integration-worktree-warning")).toBeInTheDocument();
|
||||
|
||||
await userEvent.selectOptions(screen.getByLabelText("Integration worktree"), "reuse-task-worktree");
|
||||
|
||||
expect(screen.queryByTestId("merge-integration-worktree-warning")).toBeNull();
|
||||
});
|
||||
|
||||
it("persists the legacy sibling branch rename escape hatch in worktree settings", async () => {
|
||||
renderModal();
|
||||
await waitForSettingsModalReady();
|
||||
|
||||
Reference in New Issue
Block a user