Skip to content

Fully autonomous AI Agents system capable of performing complex penetration testing tasks

refactor: cut the comments that only explain the author

Sergey Kozyrenkof24b75f350be
diff --git a/frontend/e2e/specs/cross/responsive.spec.ts b/frontend/e2e/specs/cross/responsive.spec.ts
index f22344d0..8d47f23b 100644
--- a/frontend/e2e/specs/cross/responsive.spec.ts
+++ b/frontend/e2e/specs/cross/responsive.spec.ts
@@ -24,8 +24,6 @@ test.describe('responsive', { tag: '@cross' }, () => {
expect(await page.evaluate(hasHorizontalOverflow)).toBe(false);
await page.getByRole('row', { name: /E2E Alpha/ }).click();
- // The only load gate left here: below md the star is inside the menu, and the
- // actions trigger renders before the flow arrives.
await expect(page.locator('header').getByText('E2E Alpha')).toBeVisible();
await expect(page.getByRole('button', { name: 'Flow actions' })).toBeVisible();
expect(await page.evaluate(hasHorizontalOverflow)).toBe(false);
diff --git a/frontend/e2e/specs/crud/template-detail.spec.ts b/frontend/e2e/specs/crud/template-detail.spec.ts
index 273df168..0286f58d 100644
--- a/frontend/e2e/specs/crud/template-detail.spec.ts
+++ b/frontend/e2e/specs/crud/template-detail.spec.ts
@@ -18,7 +18,6 @@ test.describe('template detail', { tag: '@coverage' }, () => {
await page.keyboard.press('Escape');
};
- // This route has no visual baseline at all, so the header order is asserted nowhere else.
test('keeps the pager between save and the actions menu', async ({ page }) => {
await page.goto(`/templates/${TEMPLATE_DETAIL.id}`);
await expect(page.getByRole('button', { name: 'Template actions' })).toBeVisible();
diff --git a/frontend/e2e/specs/flows/pager.spec.ts b/frontend/e2e/specs/flows/pager.spec.ts
index f7bc95d2..114232eb 100644
--- a/frontend/e2e/specs/flows/pager.spec.ts
+++ b/frontend/e2e/specs/flows/pager.spec.ts
@@ -8,8 +8,6 @@ test.describe('flow pager', { tag: ['@flows', '@smoke'] }, () => {
test.describe('with a report to show', () => {
test.use({ cassette: flowTabsCassette() });
- // Not covered by the pixel baselines: the header cluster is well under the visual
- // project's maxDiffPixelRatio, so a reordering passes there unnoticed.
test('keeps the variable action left of the fixed ones', async ({ page }) => {
await page.goto('/flows/5');
await expect(page.locator('header').getByRole('button', { name: 'Report' })).toBeVisible();
@@ -31,8 +29,8 @@ test.describe('flow pager', { tag: ['@flows', '@smoke'] }, () => {
await page.goto('/flows/5');
await expect(header.getByText('E2E Alpha')).toBeVisible();
- // Hold the sibling's data back so the in-flight window is wide enough to sample: the
- // cassette answers in single-digit milliseconds, which hides an unmount entirely.
+ // Without the delay the cassette answers before the first sample and the loop below
+ // passes against an unmounting pager — measured.
await page.route('**/graphql', async (route) => {
await new Promise((resolve) => setTimeout(resolve, 300));
await route.fallback();
@@ -57,8 +55,6 @@ test.describe('flow pager', { tag: ['@flows', '@smoke'] }, () => {
await expect(page).toHaveURL(/\/flows\/6$/);
await expect(header.getByText('E2E Beta')).toBeVisible();
- // Sampled, not awaited: `toBeVisible` retries, so it passes even if the cluster
- // unmounts for the length of the fetch and comes back.
expect(samples.every((sample) => sample.hasPager)).toBe(true);
expect(samples.map((sample) => sample.path)).not.toContain('/flows');
diff --git a/frontend/src/components/layouts/app/app-header.tsx b/frontend/src/components/layouts/app/app-header.tsx
index 0a5f135d..3ab6e4fb 100644
--- a/frontend/src/components/layouts/app/app-header.tsx
+++ b/frontend/src/components/layouts/app/app-header.tsx
@@ -55,8 +55,8 @@ export function AppHeaderAction({
);
}
-// The cluster is right-pinned, so it grows leftward: controls that come and go belong at the
-// start of the children, and everything after them keeps its position when they appear.
+// Right-pinned: it grows leftward, so a control that comes and goes only leaves the ones
+// before it in place. Put those first.
export function AppHeaderActions({ children, className }: { children?: ReactNode; className?: string }) {
return <div className={cn('flex shrink-0 items-center gap-2 px-4', className)}>{children}</div>;
}
diff --git a/frontend/src/components/shared/detail-navigation/detail-navigation-buttons.tsx b/frontend/src/components/shared/detail-navigation/detail-navigation-buttons.tsx
index 10785d7c..48bd0972 100644
--- a/frontend/src/components/shared/detail-navigation/detail-navigation-buttons.tsx
+++ b/frontend/src/components/shared/detail-navigation/detail-navigation-buttons.tsx
@@ -69,8 +69,6 @@ export function DetailNavigationButtons<T extends { id: string }>({
type="button"
variant="outline"
>
- {/* Holding the widest label's width keeps Previous still when stepping past
- a digit boundary; on the button itself the reserve would go to padding. */}
<span style={{ minWidth: `${widestLabel.length}ch` }}>{controller.positionLabel}</span>
</Button>
</TooltipTrigger>
diff --git a/frontend/src/components/shared/detail-navigation/detail-navigation-toolbar.test.tsx b/frontend/src/components/shared/detail-navigation/detail-navigation-toolbar.test.tsx
index 987fd4b1..1925ffd9 100644
--- a/frontend/src/components/shared/detail-navigation/detail-navigation-toolbar.test.tsx
+++ b/frontend/src/components/shared/detail-navigation/detail-navigation-toolbar.test.tsx
@@ -87,6 +87,20 @@ describe('DetailNavigationToolbar', () => {
expect(screen.getByRole('button', { name: /–\/0/ })).toBeDisabled();
});
+ it.each([
+ { expected: '3ch', total: 4 },
+ { expected: '5ch', total: 42 },
+ { expected: '11ch', total: 99999 },
+ ])('reserves $expected of counter width for a set of $total', ({ expected, total }) => {
+ const items = Array.from({ length: total }, (_, index) => ({ id: `i${index}`, title: `Item ${index}` }));
+
+ renderToolbar({ currentId: 'i0', items });
+
+ expect(screen.getByRole('button', { name: new RegExp(`1/${total}`) }).firstElementChild).toHaveStyle({
+ minWidth: expected,
+ });
+ });
+
it('composes Buttons + Sheet: position button opens the listbox', async () => {
const user = userEvent.setup();
renderToolbar({ currentId: 'c' });
diff --git a/frontend/src/features/knowledges/knowledge-header.tsx b/frontend/src/features/knowledges/knowledge-header.tsx
index 848c8852..00f01b64 100644
--- a/frontend/src/features/knowledges/knowledge-header.tsx
+++ b/frontend/src/features/knowledges/knowledge-header.tsx
@@ -88,8 +88,7 @@ export function KnowledgeHeader({
const [isDeleteDialogOpen, setIsDeleteDialogOpen] = useState(false);
const knowledgeId = knowledge?.id ?? null;
- // The route's id, not the loaded document's: the pager walks siblings, so it has to work
- // while this document is in flight — as it already does on the flow and template pages.
+ // The route's id, not `knowledgeId` above: the pager must work while the document loads.
const knowledgeNav = useKnowledgeDetailNavigation(isNew ? null : (routeKnowledgeId ?? null));
// Title source-of-truth is the server-side `question`. We intentionally do
@@ -308,8 +307,8 @@ export function KnowledgeHeader({
) : null}
{hasEntityRows && (
<>
- {/* The View row is the only thing between the two groups, and the
- loading shell has no mode toggle: unconditional, the rules double up. */}
+ {/* Unconditional it doubles up: callers without a mode toggle
+ render nothing between the two groups. */}
{onModeChange ? <DropdownMenuSeparator /> : null}
<DropdownMenuItem
disabled={isDeleting || isEntityPending}
diff --git a/frontend/src/pages/templates/template.tsx b/frontend/src/pages/templates/template.tsx
index f04e4022..5f87e393 100644
--- a/frontend/src/pages/templates/template.tsx
+++ b/frontend/src/pages/templates/template.tsx
@@ -454,8 +454,6 @@ function Template() {
</BreadcrumbList>
</Breadcrumb>
</AppHeaderContent>
- {/* The not-found card reuses this header; a Save aimed at a form that is not
- there and a pager for an id that is not in the list are not "always meaningful". */}
{!isTemplateMissing && (
<AppHeaderActions>
<AppHeaderAction
diff --git a/frontend/src/providers/flow-provider.tsx b/frontend/src/providers/flow-provider.tsx
index 9f31249d..badfa5ae 100644
--- a/frontend/src/providers/flow-provider.tsx
+++ b/frontend/src/providers/flow-provider.tsx
@@ -85,8 +85,8 @@ export function FlowProvider({ children }: FlowProviderProps) {
variables: { id: flowId ?? '' },
});
- // A refetch that still holds the previous flow must not raise this: it drives the spinner
- // overlay and `subscriptionSkip`, so it would tear down 14 live subscriptions mid-flight.
+ // Also gates `subscriptionSkip` below: raising it on a refetch that still holds the flow
+ // would tear down 14 live subscriptions mid-flight.
const isLoading = loading && !flowData?.flow;
// A real load failure that left nothing to show (cold cache + backend error on a
@@ -94,7 +94,6 @@ export function FlowProvider({ children }: FlowProviderProps) {
// in-page ErrorState + Retry instead of silently bouncing to the list.
const flowLoadError = flowError && !flowData?.flow && !isFlowNotFoundError(flowError) ? flowError : undefined;
- // Settled outcomes only: missing data is also what an in-flight switch looks like.
const isFlowMissing = Boolean(flowData && !flowData.flow) || Boolean(flowError && isFlowNotFoundError(flowError));
const { data: assistantsData, loading: isAssistantsLoading } = useQuery(AssistantsDocument, {