Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🔧 chore(alint): add focused test-value rules (#20672)

Bryan7262db0f10f9
diff --git a/alint.config.toml b/alint.config.toml
index 1a4cafee7c6..416004230a4 100644
--- a/alint.config.toml
+++ b/alint.config.toml
@@ -187,7 +187,31 @@ lobehub = "./packages/alint/rules"
[config.group.rules]
"lobehub/ui-content-width" = "warn"
+# Test value: semantic checks of retained behavior, not assertion syntax.
+[[config.group]]
+files = [ "src/**/*.{test,spec}.{ts,tsx,mts,cts,js,jsx,mjs}", "apps/**/*.{test,spec}.{ts,tsx,mts,cts,js,jsx,mjs}", "packages/**/*.{test,spec}.{ts,tsx,mts,cts,js,jsx,mjs}" ]
+ignores = [ "**/fixtures/**", "**/__mocks__/**" ]
+[config.group.plugins]
+lobehub = "./packages/alint/rules"
+[config.group.rules]
+"lobehub/no-removal-only-tests" = "warn"
+"lobehub/no-constant-stub-tests" = "warn"
+
# Calibration fixtures: one group per rule so a fixture only meets its own rule.
+[[config.group]]
+files = [ "packages/alint/fixtures/no-constant-stub-tests/**" ]
+[config.group.plugins]
+lobehub = "./packages/alint/rules"
+[config.group.rules]
+"lobehub/no-constant-stub-tests" = "warn"
+
+[[config.group]]
+files = [ "packages/alint/fixtures/no-removal-only-tests/**" ]
+[config.group.plugins]
+lobehub = "./packages/alint/rules"
+[config.group.rules]
+"lobehub/no-removal-only-tests" = "warn"
+
[[config.group]]
files = [ "packages/alint/fixtures/pmap-over-promise-all/**" ]
[config.group.plugins]
diff --git a/packages/alint/fixtures/no-constant-stub-tests/bad-fixed-error.ts b/packages/alint/fixtures/no-constant-stub-tests/bad-fixed-error.ts
new file mode 100644
index 00000000000..e710a109082
--- /dev/null
+++ b/packages/alint/fixtures/no-constant-stub-tests/bad-fixed-error.ts
@@ -0,0 +1,15 @@
+import { TRPCError } from '@trpc/server';
+import { expect, it } from 'vitest';
+
+// Retired API: no input, authorization or data-dependent work in this handler.
+const moveTask = async (_input: { id: string; taskId: string }) => {
+ throw new TRPCError({ code: 'PRECONDITION_FAILED', message: 'Project moves are disabled' });
+};
+
+// alint-expect
+it('returns the disabled status from moveTask', async () => {
+ await expect(moveTask({ id: 'target', taskId: 'parent' })).rejects.toMatchObject({
+ code: 'PRECONDITION_FAILED',
+ message: 'Project moves are disabled',
+ });
+});
diff --git a/packages/alint/fixtures/no-constant-stub-tests/bad-fixed-placeholder-response.ts b/packages/alint/fixtures/no-constant-stub-tests/bad-fixed-placeholder-response.ts
new file mode 100644
index 00000000000..26d13b0dc5f
--- /dev/null
+++ b/packages/alint/fixtures/no-constant-stub-tests/bad-fixed-placeholder-response.ts
@@ -0,0 +1,9 @@
+import { expect, it } from 'vitest';
+
+// Disabled legacy endpoint: returns a literal placeholder without any computation.
+const legacyStatus = () => ({ enabled: false, reason: 'Legacy workflow retired' });
+
+// alint-expect
+it('returns the legacy status placeholder', () => {
+ expect(legacyStatus()).toEqual({ enabled: false, reason: 'Legacy workflow retired' });
+});
diff --git a/packages/alint/fixtures/no-constant-stub-tests/bad-inert-stub-with-db-fixture.ts b/packages/alint/fixtures/no-constant-stub-tests/bad-inert-stub-with-db-fixture.ts
new file mode 100644
index 00000000000..a90c6b0c4e9
--- /dev/null
+++ b/packages/alint/fixtures/no-constant-stub-tests/bad-inert-stub-with-db-fixture.ts
@@ -0,0 +1,19 @@
+import { expect, it } from 'vitest';
+
+import { createProjectTree, projectCaller, readTaskRows } from './fixtures';
+
+// The shipped project.moveTask handler is an unconditional compatibility stub:
+// it only throws PRECONDITION_FAILED with the disabled message, without reading or writing tasks.
+// alint-expect
+it('rejects moves without changing the parent and child rows', async () => {
+ const { target, parent, child } = await createProjectTree();
+ const ids = [parent.id, child.id];
+ const before = await readTaskRows(ids);
+ for (const taskId of ids) {
+ await expect(projectCaller.moveTask({ id: target.id, taskId })).rejects.toMatchObject({
+ code: 'PRECONDITION_FAILED',
+ message: 'Moving tasks between projects is temporarily disabled',
+ });
+ expect(await readTaskRows(ids)).toEqual(before);
+ }
+});
diff --git a/packages/alint/fixtures/no-constant-stub-tests/good-authenticated-stub.ts b/packages/alint/fixtures/no-constant-stub-tests/good-authenticated-stub.ts
new file mode 100644
index 00000000000..9eff412b45a
--- /dev/null
+++ b/packages/alint/fixtures/no-constant-stub-tests/good-authenticated-stub.ts
@@ -0,0 +1,12 @@
+import { expect, it } from 'vitest';
+
+const disabledEndpoint = () => ({ status: 410 });
+const request = (token?: string) => {
+ if (token !== 'owner-token') return { status: 401 };
+ return disabledEndpoint();
+};
+
+it('checks authentication before reaching the disabled endpoint', () => {
+ expect(request()).toEqual({ status: 401 });
+ expect(request('owner-token')).toEqual({ status: 410 });
+});
diff --git a/packages/alint/fixtures/no-constant-stub-tests/good-compatibility-translation.ts b/packages/alint/fixtures/no-constant-stub-tests/good-compatibility-translation.ts
new file mode 100644
index 00000000000..c7141e4fd1c
--- /dev/null
+++ b/packages/alint/fixtures/no-constant-stub-tests/good-compatibility-translation.ts
@@ -0,0 +1,12 @@
+import { expect, it } from 'vitest';
+
+const translateLegacyTask = (input: { instruction?: string; prompt?: string }) => {
+ const instruction = input.instruction ?? input.prompt;
+ if (!instruction?.trim()) throw new Error('Missing task instruction');
+ return { instruction };
+};
+
+it('translates old task input and rejects invalid old input', () => {
+ expect(translateLegacyTask({ prompt: 'Launch' })).toEqual({ instruction: 'Launch' });
+ expect(() => translateLegacyTask({ prompt: '' })).toThrow('Missing task instruction');
+});
diff --git a/packages/alint/fixtures/no-constant-stub-tests/good-custom-client-recovery.ts b/packages/alint/fixtures/no-constant-stub-tests/good-custom-client-recovery.ts
new file mode 100644
index 00000000000..bb23aecb5b0
--- /dev/null
+++ b/packages/alint/fixtures/no-constant-stub-tests/good-custom-client-recovery.ts
@@ -0,0 +1,15 @@
+import { expect, it, vi } from 'vitest';
+
+const submitWithRecovery = async (submit: () => Promise<void>) => {
+ try {
+ await submit();
+ return { draft: '', retry: false };
+ } catch (error) {
+ return { draft: 'Launch', retry: error instanceof Error && error.message === 'offline' };
+ }
+};
+
+it('retains the draft and offers retry after an offline response', async () => {
+ const submit = vi.fn().mockRejectedValue(new Error('offline'));
+ expect(await submitWithRecovery(submit)).toEqual({ draft: 'Launch', retry: true });
+});
diff --git a/packages/alint/fixtures/no-constant-stub-tests/good-custom-error-mapping.ts b/packages/alint/fixtures/no-constant-stub-tests/good-custom-error-mapping.ts
new file mode 100644
index 00000000000..0f6cd1fdb09
--- /dev/null
+++ b/packages/alint/fixtures/no-constant-stub-tests/good-custom-error-mapping.ts
@@ -0,0 +1,22 @@
+import { expect, it } from 'vitest';
+
+const retiredEndpoint = () => {
+ throw new Error('Disabled');
+};
+const respond = (handler: () => void) => {
+ try {
+ handler();
+ return { status: 200 };
+ } catch (error) {
+ return { status: error instanceof Error && error.message === 'Disabled' ? 410 : 500 };
+ }
+};
+
+it('maps retired endpoint errors into the client protocol', () => {
+ expect(respond(retiredEndpoint)).toEqual({ status: 410 });
+ expect(
+ respond(() => {
+ throw new Error('Unexpected');
+ }),
+ ).toEqual({ status: 500 });
+});
diff --git a/packages/alint/fixtures/no-constant-stub-tests/good-live-readiness.ts b/packages/alint/fixtures/no-constant-stub-tests/good-live-readiness.ts
new file mode 100644
index 00000000000..8c9a55c0c9a
--- /dev/null
+++ b/packages/alint/fixtures/no-constant-stub-tests/good-live-readiness.ts
@@ -0,0 +1,9 @@
+import { expect, it, vi } from 'vitest';
+
+const readiness = async (probe: () => Promise<boolean>) => ({
+ status: (await probe()) ? 200 : 503,
+});
+
+it('reports unavailable when its dependency is unhealthy', async () => {
+ expect(await readiness(vi.fn().mockResolvedValue(false))).toEqual({ status: 503 });
+});
diff --git a/packages/alint/fixtures/no-constant-stub-tests/good-mixed-business-flow.ts b/packages/alint/fixtures/no-constant-stub-tests/good-mixed-business-flow.ts
new file mode 100644
index 00000000000..35b3e79b9bf
--- /dev/null
+++ b/packages/alint/fixtures/no-constant-stub-tests/good-mixed-business-flow.ts
@@ -0,0 +1,13 @@
+import { expect, it } from 'vitest';
+
+const createTask = (instruction: string) => {
+ if (!instruction.trim()) throw new Error('Missing task instruction');
+ return { instruction, status: 'backlog' };
+};
+const retiredTransfer = () => ({ enabled: false });
+
+it('keeps task creation working while the old transfer is retired', () => {
+ const task = createTask('Launch');
+ expect(task).toEqual({ instruction: 'Launch', status: 'backlog' });
+ expect(retiredTransfer()).toEqual({ enabled: false });
+});
diff --git a/packages/alint/fixtures/no-constant-stub-tests/good-runtime-data-change.ts b/packages/alint/fixtures/no-constant-stub-tests/good-runtime-data-change.ts
new file mode 100644
index 00000000000..857a50b71bd
--- /dev/null
+++ b/packages/alint/fixtures/no-constant-stub-tests/good-runtime-data-change.ts
@@ -0,0 +1,10 @@
+import { expect, it } from 'vitest';
+
+import { createTaskTree, deleteTask, readTaskRows } from './fixtures';
+
+it('deletes the selected subtree while preserving its sibling', async () => {
+ const { parent, child, sibling } = await createTaskTree();
+ await deleteTask(parent.id);
+ expect(await readTaskRows([parent.id, child.id])).toEqual([]);
+ expect(await readTaskRows([sibling.id])).toEqual([sibling]);
+});
diff --git a/packages/alint/fixtures/no-constant-stub-tests/good-state-dependent-rejection.ts b/packages/alint/fixtures/no-constant-stub-tests/good-state-dependent-rejection.ts
new file mode 100644
index 00000000000..62ec814b8c3
--- /dev/null
+++ b/packages/alint/fixtures/no-constant-stub-tests/good-state-dependent-rejection.ts
@@ -0,0 +1,13 @@
+import { TRPCError } from '@trpc/server';
+import { expect, it } from 'vitest';
+
+const requestCompletion = (project: { status: string }) => {
+ if (project.status !== 'active') {
+ throw new TRPCError({ code: 'PRECONDITION_FAILED', message: 'Project must be active' });
+ }
+ return { ...project, status: 'reviewing' };
+};
+
+it('rejects completion for a canceled project', () => {
+ expect(() => requestCompletion({ status: 'canceled' })).toThrow('Project must be active');
+});
diff --git a/packages/alint/fixtures/no-constant-stub-tests/good-unknown-imported-handler.ts b/packages/alint/fixtures/no-constant-stub-tests/good-unknown-imported-handler.ts
new file mode 100644
index 00000000000..b128b9118b7
--- /dev/null
+++ b/packages/alint/fixtures/no-constant-stub-tests/good-unknown-imported-handler.ts
@@ -0,0 +1,9 @@
+import { expect, it } from 'vitest';
+
+import { projectCaller } from './fixtures';
+
+it('rejects the supplied request', async () => {
+ await expect(projectCaller.moveTask({ id: 'target', taskId: 'child' })).rejects.toMatchObject({
+ code: 'PRECONDITION_FAILED',
+ });
+});
diff --git a/packages/alint/fixtures/no-constant-stub-tests/good-validation-and-authorization.ts b/packages/alint/fixtures/no-constant-stub-tests/good-validation-and-authorization.ts
new file mode 100644
index 00000000000..2238cba384f
--- /dev/null
+++ b/packages/alint/fixtures/no-constant-stub-tests/good-validation-and-authorization.ts
@@ -0,0 +1,25 @@
+import { TRPCError } from '@trpc/server';
+import { expect, it, vi } from 'vitest';
+
+const writeTask = async (
+ input: { instruction: string; role: string },
+ save: () => Promise<void>,
+) => {
+ if (input.role !== 'owner') throw new TRPCError({ code: 'FORBIDDEN' });
+ if (!input.instruction.trim()) throw new TRPCError({ code: 'BAD_REQUEST' });
+ await save();
+};
+
+it('prevents viewer writes', async () => {
+ const save = vi.fn();
+ await expect(writeTask({ instruction: 'Launch', role: 'viewer' }, save)).rejects.toMatchObject({
+ code: 'FORBIDDEN',
+ });
+ expect(save).not.toHaveBeenCalled();
+});
+
+it('rejects empty instructions', async () => {
+ await expect(writeTask({ instruction: ' ', role: 'owner' }, vi.fn())).rejects.toMatchObject({
+ code: 'BAD_REQUEST',
+ });
+});
diff --git a/packages/alint/fixtures/no-removal-only-tests/bad-deleted-command-help.ts b/packages/alint/fixtures/no-removal-only-tests/bad-deleted-command-help.ts
new file mode 100644
index 00000000000..56486029996
--- /dev/null
+++ b/packages/alint/fixtures/no-removal-only-tests/bad-deleted-command-help.ts
@@ -0,0 +1,14 @@
+import { Command } from 'commander';
+import { expect, it } from 'vitest';
+
+import { registerProjectCommand } from './project';
+
+// The project task move registration was deleted; no replacement handler exists.
+// alint-expect
+it('confirms the removed move command is absent from help', () => {
+ const program = new Command();
+ registerProjectCommand(program);
+ const project = program.commands.find((command) => command.name() === 'project')!;
+ const task = project.commands.find((command) => command.name() === 'task')!;
+ expect(task.helpInformation()).not.toContain('move');
+});
diff --git a/packages/alint/fixtures/no-removal-only-tests/bad-deleted-command-parse.ts b/packages/alint/fixtures/no-removal-only-tests/bad-deleted-command-parse.ts
new file mode 100644
index 00000000000..34961d6ee3d
--- /dev/null
+++ b/packages/alint/fixtures/no-removal-only-tests/bad-deleted-command-parse.ts
@@ -0,0 +1,16 @@
+import { Command } from 'commander';
+import { expect, it, vi } from 'vitest';
+
+import { registerProjectCommand } from './project';
+
+// The move registration and handler were deleted. Commander alone rejects it.
+// alint-expect
+it('confirms the deleted move command cannot be parsed', async () => {
+ const moveTask = vi.fn();
+ const program = new Command().exitOverride().configureOutput({ writeErr: () => {} });
+ registerProjectCommand(program, { moveTask });
+ await expect(
+ program.parseAsync(['node', 'test', 'project', 'task', 'move', 'project', 'task']),
+ ).rejects.toMatchObject({ code: 'commander.unknownCommand', exitCode: 1 });
+ expect(moveTask).not.toHaveBeenCalled();
+});
diff --git a/packages/alint/fixtures/no-removal-only-tests/bad-deleted-source.ts b/packages/alint/fixtures/no-removal-only-tests/bad-deleted-source.ts
new file mode 100644
index 00000000000..f4c0199cd48
--- /dev/null
+++ b/packages/alint/fixtures/no-removal-only-tests/bad-deleted-source.ts
@@ -0,0 +1,10 @@
+import { readFile } from 'node:fs/promises';
+
+import { expect, it } from 'vitest';
+
+// moveTaskTree was deleted from the model, with no replacement implementation.
+// alint-expect
+it('confirms the old moveTaskTree implementation has been deleted', async () => {
+ const source = await readFile(new URL('./project.ts', import.meta.url), 'utf8');
+ expect(source).not.toContain('async moveTaskTree(');
+});
diff --git a/packages/alint/fixtures/no-removal-only-tests/bad-deleted-ui-registration.ts b/packages/alint/fixtures/no-removal-only-tests/bad-deleted-ui-registration.ts
new file mode 100644
index 00000000000..d856abaaba4
--- /dev/null
+++ b/packages/alint/fixtures/no-removal-only-tests/bad-deleted-ui-registration.ts
@@ -0,0 +1,9 @@
+import { expect, it } from 'vitest';
+
+import { navigationItems } from './navigation';
+
+// The legacy dashboard registration and page implementation were deleted.
+// alint-expect
+it('confirms the removed dashboard is absent from navigation', () => {
+ expect(navigationItems.map((item) => item.id)).not.toContain('legacy-dashboard');
+});
diff --git a/packages/alint/fixtures/no-removal-only-tests/good-architecture-boundary.ts b/packages/alint/fixtures/no-removal-only-tests/good-architecture-boundary.ts
new file mode 100644
index 00000000000..9fbc909d003
--- /dev/null
+++ b/packages/alint/fixtures/no-removal-only-tests/good-architecture-boundary.ts
@@ -0,0 +1,9 @@
+import { readFile } from 'node:fs/promises';
+
+import { expect, it } from 'vitest';
+
+it('keeps Node capabilities out of browser-reachable source', async () => {
+ const source = await readFile(new URL('./browser.ts', import.meta.url), 'utf8');
+ // This is an ongoing browser isolation policy, not confirmation of a removed helper.
+ expect(source).not.toMatch(/from ['"]node:/);
+});
diff --git a/packages/alint/fixtures/no-removal-only-tests/good-compatibility-rejection.ts b/packages/alint/fixtures/no-removal-only-tests/good-compatibility-rejection.ts
new file mode 100644
index 00000000000..3f90e8e5119
--- /dev/null
+++ b/packages/alint/fixtures/no-removal-only-tests/good-compatibility-rejection.ts
@@ -0,0 +1,12 @@
+import { expect, it } from 'vitest';
+
+const legacyCreateTask = (input: { instruction?: string; prompt?: string }) => {
+ const instruction = input.instruction ?? input.prompt;
+ if (!instruction?.trim()) throw new Error('Missing task instruction');
+ return { instruction };
+};
+
+it('translates supported legacy input and rejects invalid input', () => {
+ expect(legacyCreateTask({ prompt: 'Launch' })).toEqual({ instruction: 'Launch' });
+ expect(() => legacyCreateTask({ prompt: '' })).toThrow('Missing task instruction');
+});
diff --git a/packages/alint/fixtures/no-removal-only-tests/good-conditional-command.ts b/packages/alint/fixtures/no-removal-only-tests/good-conditional-command.ts
new file mode 100644
index 00000000000..3a04b8ed9a9
--- /dev/null
+++ b/packages/alint/fixtures/no-removal-only-tests/good-conditional-command.ts
@@ -0,0 +1,10 @@
+import { expect, it } from 'vitest';
+
+import { createProgramForCapabilities } from './commands';
+
+it('omits device commands only when the host has no device capability', () => {
+ const unsupported = createProgramForCapabilities({ device: false });
+ const supported = createProgramForCapabilities({ device: true });
+ expect(unsupported.helpInformation()).not.toContain('device');
+ expect(supported.helpInformation()).toContain('device');
+});
diff --git a/packages/alint/fixtures/no-removal-only-tests/good-custom-command-validator.ts b/packages/alint/fixtures/no-removal-only-tests/good-custom-command-validator.ts
new file mode 100644
index 00000000000..240e0e9c9ae
--- /dev/null
+++ b/packages/alint/fixtures/no-removal-only-tests/good-custom-command-validator.ts
@@ -0,0 +1,8 @@
+import { expect, it } from 'vitest';
+
+import { checkDocumentationCommand } from './modelFacingDocs';
+
+it('detects a removed command in documentation using the custom validator', () => {
+ expect(checkDocumentationCommand('lh config whoami')).toEqual(['unknown command lh config']);
+ expect(checkDocumentationCommand('lh whoami --json')).toEqual([]);
+});
diff --git a/packages/alint/fixtures/no-removal-only-tests/good-deployment-routing-boundary.ts b/packages/alint/fixtures/no-removal-only-tests/good-deployment-routing-boundary.ts
new file mode 100644
index 00000000000..dea656e3b12
--- /dev/null
+++ b/packages/alint/fixtures/no-removal-only-tests/good-deployment-routing-boundary.ts
@@ -0,0 +1,14 @@
+import { matchRoutes } from 'react-router-dom';
+import { expect, it } from 'vitest';
+
+import { electronRoutes, webRoutes } from './routes';
+
+it.each([
+ ['Web', webRoutes],
+ ['Electron', electronRoutes],
+])('%s leaves the visitor surface to the deployment that owns its accounting', (_, routes) => {
+ // This shell must delegate visitor conversations to the deployment's business slot,
+ // because that deployment owns charging the creator's account for the visitor's usage.
+ // The base shell intentionally has no visitor registration of its own.
+ expect(matchRoutes(routes, '/a/example')?.at(-1)?.route.path).toBe('*');
+});
diff --git a/packages/alint/fixtures/no-removal-only-tests/good-empty-state.ts b/packages/alint/fixtures/no-removal-only-tests/good-empty-state.ts
new file mode 100644
index 00000000000..0838f6b3ad7
--- /dev/null
+++ b/packages/alint/fixtures/no-removal-only-tests/good-empty-state.ts
@@ -0,0 +1,9 @@
+import { expect, it } from 'vitest';
+
+import { renderProjectList } from './render';
+
+it('shows no task rows for a project with no tasks', () => {
+ const view = renderProjectList({ tasks: [] });
+ expect(view.taskRows).toEqual([]);
+ expect(view.message).toBe('No tasks yet');
+});
diff --git a/packages/alint/fixtures/no-removal-only-tests/good-legacy-input-transform.ts b/packages/alint/fixtures/no-removal-only-tests/good-legacy-input-transform.ts
new file mode 100644
index 00000000000..7d92cc464d2
--- /dev/null
+++ b/packages/alint/fixtures/no-removal-only-tests/good-legacy-input-transform.ts
@@ -0,0 +1,9 @@
+import { expect, it } from 'vitest';
+
+import { normalizeTaskInput } from './normalize';
+
+it('strips retired fields from old inputs and preserves the supported instruction', () => {
+ const task = normalizeTaskInput({ instruction: 'Launch', legacyProjectAlias: 'OLD' });
+ expect(task).not.toHaveProperty('legacyProjectAlias');
+ expect(task.instruction).toBe('Launch');
+});
diff --git a/packages/alint/fixtures/no-removal-only-tests/good-runtime-data-deletion.ts b/packages/alint/fixtures/no-removal-only-tests/good-runtime-data-deletion.ts
new file mode 100644
index 00000000000..86b79c0a62e
--- /dev/null
+++ b/packages/alint/fixtures/no-removal-only-tests/good-runtime-data-deletion.ts
@@ -0,0 +1,11 @@
+import { expect, it } from 'vitest';
+
+import { createProject, findProject, projectCaller } from './fixtures';
+
+it('deletes a project record while preserving another project', async () => {
+ const removed = await createProject('Removed');
+ const retained = await createProject('Retained');
+ await projectCaller.delete({ id: removed.id });
+ expect(await findProject(removed.id)).toBeNull();
+ expect(await findProject(retained.id)).toEqual(retained);
+});
diff --git a/packages/alint/fixtures/no-removal-only-tests/good-security-policy.ts b/packages/alint/fixtures/no-removal-only-tests/good-security-policy.ts
new file mode 100644
index 00000000000..9f2736e0379
--- /dev/null
+++ b/packages/alint/fixtures/no-removal-only-tests/good-security-policy.ts
@@ -0,0 +1,12 @@
+import { expect, it, vi } from 'vitest';
+
+import { createTaskService } from './service';
+
+it('denies unauthorized task deletion before a database write', async () => {
+ const database = { deleteTask: vi.fn() };
+ const service = createTaskService(database);
+ await expect(service.deleteTask({ role: 'viewer', taskId: 'task-1' })).rejects.toMatchObject({
+ code: 'FORBIDDEN',
+ });
+ expect(database.deleteTask).not.toHaveBeenCalled();
+});
diff --git a/packages/alint/fixtures/no-removal-only-tests/good-surviving-path.ts b/packages/alint/fixtures/no-removal-only-tests/good-surviving-path.ts
new file mode 100644
index 00000000000..e5304928823
--- /dev/null
+++ b/packages/alint/fixtures/no-removal-only-tests/good-surviving-path.ts
@@ -0,0 +1,9 @@
+import { expect, it } from 'vitest';
+
+import { createProjectTask } from './commands';
+
+it('still creates project tasks after removing the move command', async () => {
+ const created = await createProjectTask({ projectId: 'project-1', instruction: 'Launch' });
+ expect(created.projectId).toBe('project-1');
+ expect(created.identifier).toBeTruthy();
+});
diff --git a/packages/alint/fixtures/no-removal-only-tests/good-unknown-registration.ts b/packages/alint/fixtures/no-removal-only-tests/good-unknown-registration.ts
new file mode 100644
index 00000000000..ee83dda64cf
--- /dev/null
+++ b/packages/alint/fixtures/no-removal-only-tests/good-unknown-registration.ts
@@ -0,0 +1,10 @@
+import { expect, it } from 'vitest';
+
+import { createProgram } from './commands';
+
+it('rejects an unknown command', async () => {
+ const program = createProgram();
+ await expect(program.parseAsync(['node', 'test', 'missing'])).rejects.toMatchObject({
+ code: 'commander.unknownCommand',
+ });
+});
diff --git a/packages/alint/rules/no-constant-stub-tests/rule.alint.toml b/packages/alint/rules/no-constant-stub-tests/rule.alint.toml
new file mode 100644
index 00000000000..9671602bda2
--- /dev/null
+++ b/packages/alint/rules/no-constant-stub-tests/rule.alint.toml
@@ -0,0 +1,13 @@
+name = "no-constant-stub-tests"
+builtInAgent = "basic-structured"
+instruction = """
+Review one test file. Team rule: dedicated tests that only repeat a disabled/compatibility endpoint's unconditional error or placeholder constant add no behavioral coverage.
+
+Do not report input-, authorization-, state- or dependency-dependent decisions, mutations, compatibility conversion, custom routing/error mapping/serialization, recovery, or tests that also exercise surviving business behavior.
+
+Report only when an implementation or explicit implementation comment in this file establishes an inert disabled/retired endpoint AND the test only matches its fixed error/status/response. DB fixtures, equivalent-input loops, unchanged snapshots and mock-not-called assertions around that inert stub add no business branch.
+
+Anchor once on the it/test declaration. Name the stub and the constant being repeated; explain any inert setup and suggest deleting the dedicated test and unused fixtures while preserving separate business/safety coverage. Do not demand a replacement test of the same constant.
+
+A fixed expected status, test title or mock cannot establish that an imported endpoint is inert. If its implementation or the lack of meaningful behavior is uncertain, return no finding.
+"""
diff --git a/packages/alint/rules/no-removal-only-tests/rule.alint.toml b/packages/alint/rules/no-removal-only-tests/rule.alint.toml
new file mode 100644
index 00000000000..a93988a98fe
--- /dev/null
+++ b/packages/alint/rules/no-removal-only-tests/rule.alint.toml
@@ -0,0 +1,13 @@
+name = "no-removal-only-tests"
+builtInAgent = "basic-structured"
+instruction = """
+Review one test file. Team rule: a dedicated test that only confirms deleted implementation is absent adds no behavioral coverage.
+
+Do not report tests of runtime data deletion, security/isolation policies, conditional registration, explicit ongoing architecture/deployment registration boundaries (even when only the unsupported side is asserted), custom validation or compatibility conversion, or surviving business behavior. Negative assertions alone are not evidence of deleted implementation.
+
+Report only when the file establishes removal of a specific command, source/export or UI registration AND the test merely checks its absence or the framework's default rejection of the missing registration. A mock-not-called assertion around that same missing command adds no behavior. Constant disabled endpoint stubs belong to no-constant-stub-tests.
+
+Anchor once on the it/test declaration. Name the removed artifact and the absence being repeated; suggest deleting that dedicated test and unused setup, preserving tests of retained behavior. Do not invent another test to confirm the deletion.
+
+Analyze only supplied evidence. If removal or the lack of retained behavior is uncertain, return no finding; do not guess about imported implementations.
+"""