Skip to content

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

refactor(markdown-editor): trim restating/defending comments per the zero-comment rule

Sergey Kozyrenkobca7b6747f9a
diff --git a/frontend/src/components/shared/markdown-editor/markdown-editor-highlight.test.ts b/frontend/src/components/shared/markdown-editor/markdown-editor-highlight.test.ts
index 767ae0d9..83202051 100644
--- a/frontend/src/components/shared/markdown-editor/markdown-editor-highlight.test.ts
+++ b/frontend/src/components/shared/markdown-editor/markdown-editor-highlight.test.ts
@@ -37,11 +37,11 @@ describe('TAG_RE — <xml-like tags>', () => {
it.each([
'count a < b here', // less-than, space after <
'loop x<5 times', // digit after <
- 'rating <3', // not a tag
+ 'rating <3',
'empty <>',
'spaced < tag>',
'<https://example.com>', // markdown autolink — must NOT be a tag
- '<!-- a comment -->', // html comment
+ '<!-- a comment -->',
])('does NOT match %s', (input) => {
expect(matches(TAG_RE, input)).toEqual([]);
});
diff --git a/frontend/src/components/shared/markdown-editor/markdown-editor-image-edit-form.tsx b/frontend/src/components/shared/markdown-editor/markdown-editor-image-edit-form.tsx
index 36409112..3b99e678 100644
--- a/frontend/src/components/shared/markdown-editor/markdown-editor-image-edit-form.tsx
+++ b/frontend/src/components/shared/markdown-editor/markdown-editor-image-edit-form.tsx
@@ -16,7 +16,6 @@ interface ImageEditFormProps {
editor: Editor;
initialAlt: string;
initialSrc: string;
- // true = editing the selected image (updateAttributes + Remove); false = inserting a new one (setImage).
isEditing: boolean;
onDone: () => void;
}
diff --git a/frontend/src/components/shared/markdown-editor/markdown-editor-table-commands.ts b/frontend/src/components/shared/markdown-editor/markdown-editor-table-commands.ts
index 157133f3..9752bda2 100644
--- a/frontend/src/components/shared/markdown-editor/markdown-editor-table-commands.ts
+++ b/frontend/src/components/shared/markdown-editor/markdown-editor-table-commands.ts
@@ -11,7 +11,7 @@ export const ALIGN_OPTIONS: { icon: LucideIcon; label: string; value: ColumnAlig
{ icon: AlignRight, label: 'Right', value: 'right' },
];
-// Empties every cell in the caret's row or column (Notion's "Clear contents"), leaving the structure intact.
+// Empties every cell in the caret's row or column, leaving the row/column structure intact (not a delete).
export function clearLineContents(editor: Editor, axis: 'column' | 'row'): void {
editor
.chain()
diff --git a/frontend/src/components/shared/markdown-editor/markdown-editor-table-handles.tsx b/frontend/src/components/shared/markdown-editor/markdown-editor-table-handles.tsx
index 769528bf..96c77ab7 100644
--- a/frontend/src/components/shared/markdown-editor/markdown-editor-table-handles.tsx
+++ b/frontend/src/components/shared/markdown-editor/markdown-editor-table-handles.tsx
@@ -238,9 +238,6 @@ function RowHeaderToggleItem({ cellPos, editor }: { cellPos: number; editor: Edi
);
}
-// Headless controller: owns every imperative DOM touch — hover tracking over ProseMirror's (non-React) cells,
-// layout measurement, and the scroll/menu-freeze bookkeeping — and hands the view a plain declarative state.
-// Swapping the hover strategy (e.g. to a ProseMirror decoration plugin) means rewriting only this hook.
function useTableHandles(editor: Editor): TableHandlesController {
const [target, setTarget] = useState<HoverTarget | null>(null);
const [open, setOpen] = useState<OpenMenu>(null);
diff --git a/frontend/src/components/shared/markdown-editor/markdown-editor-table-pipes.test.ts b/frontend/src/components/shared/markdown-editor/markdown-editor-table-pipes.test.ts
index 642806cc..88bd7454 100644
--- a/frontend/src/components/shared/markdown-editor/markdown-editor-table-pipes.test.ts
+++ b/frontend/src/components/shared/markdown-editor/markdown-editor-table-pipes.test.ts
@@ -229,8 +229,8 @@ describe('CRLF line endings — tables still protected', () => {
describe('TABLE_DELIMITER_LINE is linear (ReDoS guard)', () => {
it('scans a crafted delimiter-looking line with a long trailing space run in linear time', () => {
- // A `|`-line followed by "dashes + many spaces + non-matching tail" was O(n²) on the old regex
- // (~0.6s at 32k). The linear rewrite stays sub-millisecond; assert a generous budget.
+ // A crafted delimiter-looking line (dashes + a long trailing space run + non-matching tail) must scan in
+ // linear time, not O(n²).
const evil = `x|y\n${'-'.repeat(50)}${' '.repeat(60000)}z\n`;
const started = performance.now();
diff --git a/frontend/src/components/shared/markdown-editor/markdown-editor-toolbar-url.ts b/frontend/src/components/shared/markdown-editor/markdown-editor-toolbar-url.ts
index a1596b45..e4df2e58 100644
--- a/frontend/src/components/shared/markdown-editor/markdown-editor-toolbar-url.ts
+++ b/frontend/src/components/shared/markdown-editor/markdown-editor-toolbar-url.ts
@@ -54,9 +54,8 @@ const RASTER_IMAGE_DATA = /^data:image\/(?:png|jpe?g|gif|webp|bmp);base64,/i;
const KNOWN_IMAGE_SCHEME = /^(?:https?:\/\/|data:)/i;
-// Image analog of normalizeLinkUrl: a scheme-less src ("example.com/a.png") is made absolute with https://; an
-// already-schemed http(s) URL and a base64 raster data: URL pass through. data:image/svg+xml is rejected — SVG
-// can carry script. Returns the normalized src, or null for unsafe/malformed/relative input.
+// Image analog of normalizeLinkUrl. Only http(s) and base64 raster data: URLs survive — data:image/svg+xml is
+// rejected because SVG can carry script.
export const normalizeImageSrc = (raw: string): null | string => {
const src = raw.trim();
diff --git a/frontend/src/components/shared/markdown-editor/markdown-editor-variable-syntax.ts b/frontend/src/components/shared/markdown-editor/markdown-editor-variable-syntax.ts
index 41bdc3f2..ac5bfb86 100644
--- a/frontend/src/components/shared/markdown-editor/markdown-editor-variable-syntax.ts
+++ b/frontend/src/components/shared/markdown-editor/markdown-editor-variable-syntax.ts
@@ -32,9 +32,7 @@ export interface VariableRange {
start: number;
}
-// Shared by BOTH variable panels (rich ProseMirror + raw textarea) so their cycling can't drift: from the
-// currently-selected occurrence go to the next (wrapping); if the caret isn't on one, jump to the first
-// occurrence at/after it, else wrap to the first. `undefined` when there are none.
+// Shared by BOTH variable panels (rich ProseMirror + raw textarea), so their cycling can't drift.
export function nextVariableRange(
ranges: VariableRange[],
selectionStart: number,
diff --git a/frontend/src/components/shared/markdown-editor/markdown-editor.tsx b/frontend/src/components/shared/markdown-editor/markdown-editor.tsx
index 9b2cdd37..83cb5c03 100644
--- a/frontend/src/components/shared/markdown-editor/markdown-editor.tsx
+++ b/frontend/src/components/shared/markdown-editor/markdown-editor.tsx
@@ -151,9 +151,6 @@ function MarkdownEditor({
);
}
-// Owns the whole tiptap lifecycle for a markdown-controlled editor: instance creation, the RHF value-sync loop
-// (echo suppression + undo reset), disabled toggling, a11y-attribute forwarding, and the imperative handle. The
-// view below just renders whatever editor this returns — the lifecycle can be reworked here without touching it.
function useMarkdownEditor({
'aria-describedby': ariaDescribedby,
'aria-invalid': ariaInvalid,