Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion .claude/settings.local.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,27 @@
"Bash(git commit:*)",
"Bash(git push:*)",
"Bash(npx vitest run:*)",
"Bash(cp /Users/harsh/Data/vw/verifywise/Servers/structures/ISO-27001/annexes/iso27001.annex.struct.ts /tmp/annex.bak.ts)",
"Bash(cp /Users/harsh/Data/vw/verifywise/Servers/structures/ISO-27001/clauses/iso27001.clause.struct.ts /tmp/clause.bak.ts)",
"Bash(node /tmp/apply-iso27001-content.js)",
"Bash(node /tmp/rename-iso27001-titles.js)",
"Bash(awk 'NR>=3200 && NR<=3260' /Users/harsh/Data/vw/verifywise/Servers/structures/ISO-27001/annexes/iso27001.annex.struct.ts)",
"Bash(awk '/^ \\\\],$/ && prev ~ /^ \\\\],$/ { print NR\": stray at line \"NR; } { prev = $0 }' /Users/harsh/Data/vw/verifywise/Servers/structures/ISO-27001/annexes/iso27001.annex.struct.ts)",
"Bash(awk 'BEGIN{ prev=\"\" } *)",
"Bash(awk '/^ \\\\],$/ && prev ~ /^ \\\\],$/ { c++ } { prev = $0 } END { print c+0 }' /Users/harsh/Data/vw/verifywise/Servers/structures/ISO-27001/annexes/iso27001.annex.struct.ts)",
"Bash(awk *)",
"Bash(cmd.exe /c \"where gh\")",
"Bash(curl:*)",
"WebFetch(domain:api.github.com)",
"Bash(git status:*)",
"Bash(node -c database/migrations/20260417150653-reseed-eu-act-struct-with-metadata.js)",
"Bash(node -c database/migrations/20260420105041-iso42001-split-clause-6-1.js)",
"Bash(node -c database/migrations/20260420105042-iso42001-add-clause-6-3.js)",
"Bash(PGPASSWORD=test psql *)",
"Bash(lsof *)",
"Bash(node *)",
"Bash(npx sequelize *)",
"Bash(psql -h localhost -p 5433 -U postgres -d vwtest4 -c ' *)",
"Bash(node -e:*)",
"Bash(test:*)",
"Bash(npx ts-node:*)",
Expand All @@ -37,7 +54,10 @@
"Bash(kill:*)",
"Bash(wait:*)",
"WebSearch",
"Bash(git --version)"
"Bash(git --version)",
"Bash(npm run *)",
"Bash(grep \"error TS\" /tmp/buildout.txt)",
"Bash(npm install *)"
]
}
}
27 changes: 7 additions & 20 deletions Clients/src/application/mappers/project.mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,14 @@ export function mapRiskClassification(
*/
export function mapHighRiskRole(value: number | string): HighRiskRole {
if (typeof value === "number") {
// Map numeric values to enum (assuming 0-5 mapping)
const numericMapping: Record<number, HighRiskRole> = {
0: HighRiskRole.DEPLOYER,
1: HighRiskRole.PROVIDER,
2: HighRiskRole.DISTRIBUTOR,
3: HighRiskRole.IMPORTER,
4: HighRiskRole.PRODUCT_MANUFACTURER,
5: HighRiskRole.AUTHORIZED_REPRESENTATIVE,
};
return numericMapping[value] || HighRiskRole.DEPLOYER;
return value === 1 ? HighRiskRole.PROVIDER : HighRiskRole.DEPLOYER;
}
// Map string values to enum
const mapping: Record<string, HighRiskRole> = {
"deployer": HighRiskRole.DEPLOYER,
"provider": HighRiskRole.PROVIDER,
"distributor": HighRiskRole.DISTRIBUTOR,
"importer": HighRiskRole.IMPORTER,
"product manufacturer": HighRiskRole.PRODUCT_MANUFACTURER,
"authorized representative": HighRiskRole.AUTHORIZED_REPRESENTATIVE,
};
return mapping[value.toLowerCase()] || HighRiskRole.DEPLOYER;
// Legacy values (Distributor, Importer, Product manufacturer,
// Authorized representative) collapse onto Provider; not_applicable onto
// Deployer — matches the DB migration's remap.
const v = value.toLowerCase();
if (v === "deployer" || v === "not_applicable") return HighRiskRole.DEPLOYER;
return HighRiskRole.PROVIDER;
}

/**
Expand Down
35 changes: 15 additions & 20 deletions Clients/src/application/mappers/tests/project.mappers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,36 +54,31 @@
expect(result).toBe(HighRiskRole.DEPLOYER);
result = mapHighRiskRole(1);
expect(result).toBe(HighRiskRole.PROVIDER);
result = mapHighRiskRole(2);
expect(result).toBe(HighRiskRole.DISTRIBUTOR);
result = mapHighRiskRole(3);
expect(result).toBe(HighRiskRole.IMPORTER);
result = mapHighRiskRole(4);
expect(result).toBe(HighRiskRole.PRODUCT_MANUFACTURER);
result = mapHighRiskRole(5);
expect(result).toBe(HighRiskRole.AUTHORIZED_REPRESENTATIVE);
});
it("should receive a valid string and return the mapped value", () => {
let result = mapHighRiskRole("Deployer");
expect(result).toBe(HighRiskRole.DEPLOYER);
result = mapHighRiskRole("Provider");
expect(result).toBe(HighRiskRole.PROVIDER);
result = mapHighRiskRole("Distributor");
expect(result).toBe(HighRiskRole.DISTRIBUTOR);
result = mapHighRiskRole("Importer");
expect(result).toBe(HighRiskRole.IMPORTER);
result = mapHighRiskRole("Product Manufacturer");
expect(result).toBe(HighRiskRole.PRODUCT_MANUFACTURER);
result = mapHighRiskRole("Authorized Representative");
expect(result).toBe(HighRiskRole.AUTHORIZED_REPRESENTATIVE);
});
it("should receive an invalid number and return the default value", () => {
it("should collapse legacy provider-tier strings onto PROVIDER", () => {
// Pre-reduction values (Distributor/Importer/Product manufacturer/
// Authorized representative) now map to Provider.
expect(mapHighRiskRole("Distributor")).toBe(HighRiskRole.PROVIDER);
expect(mapHighRiskRole("Importer")).toBe(HighRiskRole.PROVIDER);
expect(mapHighRiskRole("Product Manufacturer")).toBe(HighRiskRole.PROVIDER);
expect(mapHighRiskRole("Authorized Representative")).toBe(HighRiskRole.PROVIDER);
});
it("should collapse legacy 'not_applicable' onto DEPLOYER", () => {
expect(mapHighRiskRole("not_applicable")).toBe(HighRiskRole.DEPLOYER);
});
it("should receive an invalid number and return PROVIDER (non-zero fallback)", () => {
const result = mapHighRiskRole(99);
expect(result).toBe(HighRiskRole.DEPLOYER);
expect(result).toBe(HighRiskRole.PROVIDER);

Check failure on line 77 in Clients/src/application/mappers/tests/project.mappers.test.ts

View workflow job for this annotation

GitHub Actions / Unit & Component Tests

src/application/mappers/tests/project.mappers.test.ts > Test project mappers functions > mapHighRiskRole > should receive an invalid number and return PROVIDER (non-zero fallback)

AssertionError: expected 'Deployer' to be 'Provider' // Object.is equality Expected: "Provider" Received: "Deployer" ❯ src/application/mappers/tests/project.mappers.test.ts:77:22
});
it("should receive an invalid string and return the default value", () => {
it("should receive an invalid string and return PROVIDER (non-matching fallback)", () => {
const result = mapHighRiskRole("InvalidString");
expect(result).toBe(HighRiskRole.DEPLOYER);
expect(result).toBe(HighRiskRole.PROVIDER);
});
});
describe("mapProjectResponseDTOToProject", () => {
Expand Down
4 changes: 2 additions & 2 deletions Clients/src/application/utils/lazyRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ export const LazyFallback = () => (
* Wraps React.lazy() with retry logic for chunk load failures.
* Retries up to 3 times with exponential backoff (1.5s, 3s, 6s).
*/
export function lazyRoute<T extends ComponentType<unknown>>(
export function lazyRoute<T extends ComponentType<any>>(
factory: () => Promise<{ default: T }>
) {
return lazy(() => retryImport(factory));
}

function retryImport<T extends ComponentType<unknown>>(
function retryImport<T extends ComponentType<any>>(
factory: () => Promise<{ default: T }>,
retries = 3,
delay = 1500
Expand Down
2 changes: 2 additions & 0 deletions Clients/src/domain/enums/aiRiskClassification.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ export enum AiRiskClassification {
HIGH_RISK = "High risk",
LIMITED_RISK = "Limited risk",
MINIMAL_RISK = "Minimal risk",
GPAI = "GPAI",
GENERAL_RISK = "General Risk",
}
4 changes: 0 additions & 4 deletions Clients/src/domain/enums/highRiskRole.enum.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
export enum HighRiskRole {
DEPLOYER = "Deployer",
PROVIDER = "Provider",
DISTRIBUTOR = "Distributor",
IMPORTER = "Importer",
PRODUCT_MANUFACTURER = "Product manufacturer",
AUTHORIZED_REPRESENTATIVE = "Authorized representative",
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ vi.mock("../customAxios", () => ({
import { automationsService } from "../automationsService";
import CustomAxios from "../customAxios";

const mockAxios = vi.mocked(CustomAxios);
const mockAxios = vi.mocked(CustomAxios, { deep: true });

describe("automationsService", () => {
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ vi.mock("../customAxios", () => ({
import { biasAuditService } from "../biasAuditService";
import CustomAxios from "../customAxios";

const mockAxios = vi.mocked(CustomAxios);
const mockAxios = vi.mocked(CustomAxios, { deep: true });

describe("biasAuditService", () => {
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ vi.mock("../customAxios", () => ({
import { ceMarkingService } from "../ceMarkingService";
import CustomAxios from "../customAxios";

const mockAxios = vi.mocked(CustomAxios);
const mockAxios = vi.mocked(CustomAxios, { deep: true });

describe("ceMarkingService", () => {
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ vi.mock("../customAxios", () => ({
import { deepEvalArenaService } from "../deepEvalArenaService";
import CustomAxios from "../customAxios";

const mockAxios = vi.mocked(CustomAxios);
const mockAxios = vi.mocked(CustomAxios, { deep: true });

describe("deepEvalArenaService", () => {
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ vi.mock("../deepEvalOrgsService", () => ({
import { deepEvalDatasetsService } from "../deepEvalDatasetsService";
import CustomAxios from "../customAxios";

const mockAxios = vi.mocked(CustomAxios);
const mockAxios = vi.mocked(CustomAxios, { deep: true });

describe("deepEvalDatasetsService", () => {
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ vi.mock("../customAxios", () => ({
import { deepEvalOrgsService } from "../deepEvalOrgsService";
import CustomAxios from "../customAxios";

const mockAxios = vi.mocked(CustomAxios);
const mockAxios = vi.mocked(CustomAxios, { deep: true });

describe("deepEvalOrgsService", () => {
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ vi.mock("../customAxios", () => ({
import { deepEvalProjectsService } from "../deepEvalProjectsService";
import CustomAxios from "../customAxios";

const mockAxios = vi.mocked(CustomAxios);
const mockAxios = vi.mocked(CustomAxios, { deep: true });

describe("deepEvalProjectsService", () => {
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ vi.mock("../deepEvalOrgsService", () => ({
import { deepEvalScorersService } from "../deepEvalScorersService";
import CustomAxios from "../customAxios";

const mockAxios = vi.mocked(CustomAxios);
const mockAxios = vi.mocked(CustomAxios, { deep: true });

describe("deepEvalScorersService", () => {
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ vi.mock("../customAxios", () => ({
import { evalModelsService } from "../evalModelsService";
import CustomAxios from "../customAxios";

const mockAxios = vi.mocked(CustomAxios);
const mockAxios = vi.mocked(CustomAxios, { deep: true });

describe("evalModelsService", () => {
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ vi.mock("../customAxios", () => ({
import { evaluationLlmApiKeysService } from "../evaluationLlmApiKeysService";
import CustomAxios from "../customAxios";

const mockAxios = vi.mocked(CustomAxios);
const mockAxios = vi.mocked(CustomAxios, { deep: true });

describe("evaluationLlmApiKeysService", () => {
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
} from "../evaluationLogsService";
import CustomAxios from "../customAxios";

const mockAxios = vi.mocked(CustomAxios);
const mockAxios = vi.mocked(CustomAxios, { deep: true });

describe("evaluationLogsService", () => {
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ vi.mock("axios", () => {
import { apiServices } from "../networkServices";
import CustomAxios from "../customAxios";

const mockAxios = vi.mocked(CustomAxios);
const mockAxios = vi.mocked(CustomAxios, { deep: true });

describe("apiServices", () => {
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
} from "../postMarketMonitoringService";
import CustomAxios from "../customAxios";

const mockAxios = vi.mocked(CustomAxios);
const mockAxios = vi.mocked(CustomAxios, { deep: true });

describe("postMarketMonitoringService", () => {
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ vi.mock("../customAxios", () => ({
import { wiseSearch, getEntityDisplayName, ENTITY_DISPLAY_NAMES } from "../searchService";
import CustomAxios from "../customAxios";

const mockAxios = vi.mocked(CustomAxios);
const mockAxios = vi.mocked(CustomAxios, { deep: true });

describe("searchService", () => {
beforeEach(() => {
Expand Down
11 changes: 0 additions & 11 deletions Clients/src/presentation/components/AddNewRiskForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,6 @@ const COMPONENT_CONSTANTS = {
COMPACT_CONTENT_WIDTH: 970, // Account for scrollbar (~17px)
} as const;

const VALIDATION_LIMITS = {
RISK_NAME: { MIN: 3, MAX: 255 },
RISK_DESCRIPTION: { MIN: 1, MAX: 256 },
POTENTIAL_IMPACT: { MIN: 1, MAX: 256 },
REVIEW_NOTES: { MIN: 0, MAX: 1024 },
MITIGATION_PLAN: { MIN: 1, MAX: 1024 },
IMPLEMENTATION_STRATEGY: { MIN: 1, MAX: 1024 },
RECOMMENDATIONS: { MIN: 1, MAX: 1024 },
REQUIRED_FIELD: { MIN: 1 },
} as const;

const riskInitialState: RiskFormValues = {
riskName: "",
actionOwner: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ export const ProjectCard = React.memo(function ProjectCard({ project, isLoading
/>
<Stack direction="row" alignItems="center" spacing={0.5}>
<Typography sx={progressStyle}>
{`Subcontrols: ${
{`Requirements: ${
complianceProgressData?.allDonesubControls ?? 0
} out of ${complianceProgressData?.allsubControls ?? 0}`}
</Typography>
Expand Down Expand Up @@ -303,7 +303,7 @@ export const ProjectCard = React.memo(function ProjectCard({ project, isLoading
/>
<Stack direction="row" alignItems="center" spacing={0.5}>
<Typography sx={progressStyle}>
{`Assessments: ${
{`Controls: ${
assessmentProgressData?.answeredQuestions ?? 0
} out of ${assessmentProgressData?.totalQuestions ?? 0}`}
</Typography>
Expand Down Expand Up @@ -373,7 +373,7 @@ export const ProjectCard = React.memo(function ProjectCard({ project, isLoading
/>
<Stack direction="row" alignItems="center" spacing={0.5}>
<Typography sx={progressStyle}>
{`Subcontrols: ${
{`Requirements: ${
complianceProgressData?.allDonesubControls ?? 0
} out of ${complianceProgressData?.allsubControls ?? 0}`}
</Typography>
Expand Down Expand Up @@ -411,7 +411,7 @@ export const ProjectCard = React.memo(function ProjectCard({ project, isLoading
/>
<Stack direction="row" alignItems="center" spacing={0.5}>
<Typography sx={progressStyle}>
{`Assessments: ${
{`Controls: ${
assessmentProgressData?.answeredQuestions ?? 0
} out of ${assessmentProgressData?.totalQuestions ?? 0}`}
</Typography>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,6 @@ export function CreateProjectForm({
() => [
{ _id: 1, name: HighRiskRole.DEPLOYER },
{ _id: 2, name: HighRiskRole.PROVIDER },
{ _id: 3, name: HighRiskRole.DISTRIBUTOR },
{ _id: 4, name: HighRiskRole.IMPORTER },
{ _id: 5, name: HighRiskRole.PRODUCT_MANUFACTURER },
{ _id: 6, name: HighRiskRole.AUTHORIZED_REPRESENTATIVE },
],
[]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -725,9 +725,10 @@ const ISO42001ClauseDrawerDialog: React.FC<ISO42001ClauseDrawerProps> = ({
padding="15px 20px"
>
<Typography fontSize={15} fontWeight={700}>
{clause?.clause_no
? `${clause.clause_no}.${subclause?.order_no || 1}`
: "Clause"}{" "}
{subclause?.subclause_id
?? (clause?.clause_no
? `${clause.clause_no}.${subclause?.order_no || 1}`
: "Clause")}{" "}
{subclause?.title}
</Typography>
<Button
Expand Down
Loading
Loading