On 5 April 2026 the Ministry of Human Resources and Social Development issued Ministerial Decision 132249 and an updated procedural guide for administrative support professions. It reserves 69 occupations for Saudis at 100%. Nineteen of them applied on the day of issue. The other fifty applied on 4 October 2026, when the six-month grace period ended, and the ministry announced that its inspection teams had started work.
Most Saudization decisions are a counting problem: a rate, a threshold, a rounding rule. This one is not. At 100%, with no minimum headcount, there is nothing to round. One non-Saudi receptionist in one branch puts the whole entity out of compliance. The question changes from "how many Saudis do we need?" to "which people are in breach, since when, and is the breach in the record or in the work?"
This tutorial builds that audit in TypeScript, from the ministry's own guide, with tests you can run. It is written for the developer or HR systems lead who has to produce the list before an inspector does.
Prerequisites
- Node.js 20 or later and TypeScript 5
- A workforce export with, for each worker: nationality, the occupation code registered with GOSI, branch, entity and the date the person started their current work
- A short list of duties per person, from line managers. This is the column that catches the expensive cases, and no HR system holds it today
- Basic familiarity with Qiwa, GOSI and Nitaqat terms
What You'll Build
A small module that answers four questions for each entity:
- Who is registered under one of the 69 codes, and which of them are not Saudi?
- Who does the work of a localised occupation under another job title?
- For each breach, from which date does it count: the decision's date or the day the person started?
- What should HR do with each person: replace, move, or correct a record?
The output is a list of plain lines, ordered by risk.
Step 1: What the Guide Actually Says
Everything below comes from the seven-page procedural guide for Decision 132249, published on the ministry's site. We read the tables from the page images, not from extracted text, because the PDF scrambles table columns.
The rate. Work in the targeted occupations is restricted to Saudis at 100%, at entity level (section 3.1).
The scope. Section 3.2 applies the decision to every private establishment in the Saudi market that employs one or more workers in the administrative support occupations of table 1. There is no threshold to model. Compare the accounting decision, which starts at five, or procurement, at three.
The entity. The definitions describe the entity as the capacity in which the ministry deals with the business for localisation purposes, representing all branches of the same economic activity owned by one establishment. A branch is not a unit of compliance.
The occupations. Table 1 lists 69 codes from the Saudi Unified Classification of Occupations. Section 4.3 splits them by date:
| Table | Codes | In force |
|---|---|---|
| Table 2 | 19 | 5 April 2026, the date of issue |
| Table 3 | 50 | 4 October 2026, after a six-month grace period |
The 19 immediate codes include translators, secretaries, data entry clerks, security guards, storekeepers, customs clearance agents and the treasurer. The 50 later codes are mostly HR and public relations: managers and specialists for recruitment, compensation, workforce planning and protocol, plus the receptionist, administrative assistant and government relations clerk. Our news report on the decision lists all 69 by name. In the code below, the codes are the reference and the English titles are our translation.
Overlap. If an earlier or later decision targets one of these occupations at a different rate, the higher rate applies (section 3.2). Since 100% is the ceiling, this decision governs any code it shares with another one, from its own effective date.
Penalties. Section 5 applies the localisation violations of Ministerial Decision 75913 (19/5/1445 AH) and Ministerial Decision 44558 (3/4/1446 AH), as amended. It names two breaches: not meeting the rate, and assigning any task of a localised occupation to a non-Saudi worker "directly or indirectly" under any other job title.
The FAQ adds three points that shape the code:
- The decision applies whatever the establishment's Nitaqat band. The band does not affect the calculation and does not protect from the penalty.
- It applies to the occupation titles classified in the Saudi Unified Classification of Occupations and to the work the employee actually performs.
- Monitoring is automatic. The system applies the formula to the job titles in the GOSI database, then checks wages and professional accreditation through its links with the supervising bodies.
The guide sets no minimum wage for a Saudi to count in these occupations. It does list support for employers: help sourcing candidates, training support, hiring and retention support, and priority access to the ministry's localisation programmes.
Step 2: The Code List as Data
Keep the list in one record with the table each code belongs to. The effective date follows from the table, so a code can never carry the wrong date.
// src/rules.ts
// Decision 132249 (5 April 2026), procedural guide tables 2 and 3.
// Codes are from the Saudi Unified Classification of Occupations.
// The English titles and the groups are our own translation and grouping.
export type Group =
| "hr" | "pr" | "front-office" | "clerical"
| "language" | "security" | "logistics" | "finance";
export interface Occupation {
title: string;
group: Group;
table: 2 | 3;
}
export const DECISION = "132249";
export const RATE_PERCENT = 100;
export const MIN_WORKERS = 1;
// Table 2 applies from the date of issue, table 3 after six months.
export const EFFECTIVE: Record<2 | 3, string> = {
2: "2026-04-05",
3: "2026-10-04",
};
export const OCCUPATIONS: Record<string, Occupation> = {
// Table 2: in force from 5 April 2026 (19 codes)
"264301": { title: "Translator", group: "language", table: 2 },
"264302": { title: "Simultaneous interpreter", group: "language", table: 2 },
"264305": { title: "Linguist", group: "language", table: 2 },
"541402": { title: "Security guard", group: "security", table: 2 },
"541403": { title: "Personal guard", group: "security", table: 2 },
"441601": { title: "HR clerk", group: "hr", table: 2 },
"121208": { title: "Personnel relations manager", group: "hr", table: 2 },
"121211": { title: "Labour affairs manager", group: "hr", table: 2 },
"441401": { title: "Copyist", group: "clerical", table: 2 },
"412002": { title: "Secretary", group: "clerical", table: 2 },
"334301": { title: "Executive secretary", group: "clerical", table: 2 },
"413101": { title: "Stenographer", group: "clerical", table: 2 },
"413201": { title: "Data entry clerk", group: "clerical", table: 2 },
"422401": { title: "Hotel receptionist", group: "front-office", table: 2 },
"422502": { title: "Complaints clerk", group: "front-office", table: 2 },
"422602": { title: "Patient reception clerk", group: "front-office", table: 2 },
"432101": { title: "Storekeeper", group: "logistics", table: 2 },
"333103": { title: "Customs clearance agent", group: "logistics", table: 2 },
"241104": { title: "Treasurer", group: "finance", table: 2 },
// Table 3: in force from 4 October 2026 (50 codes)
"121201": { title: "HR operations manager", group: "hr", table: 3 },
"121202": { title: "Workforce planning manager", group: "hr", table: 3 },
"121203": { title: "Occupational classification manager", group: "hr", table: 3 },
"121204": { title: "Hiring manager", group: "hr", table: 3 },
"121205": { title: "Compensation manager", group: "hr", table: 3 },
"121206": { title: "Talent manager", group: "hr", table: 3 },
"121207": { title: "HR development manager", group: "hr", table: 3 },
"121209": { title: "Recruitment office manager", group: "hr", table: 3 },
"121210": { title: "Labour office manager", group: "hr", table: 3 },
"121212": { title: "Civil service office manager", group: "hr", table: 3 },
"121213": { title: "Institutional development manager", group: "hr", table: 3 },
"121214": { title: "Administrative organisation manager", group: "hr", table: 3 },
"121215": { title: "Administrative investigation manager", group: "hr", table: 3 },
"121216": { title: "Cybersecurity HR manager", group: "hr", table: 3 },
"242301": { title: "Job placement specialist", group: "hr", table: 3 },
"242302": { title: "HR operations specialist", group: "hr", table: 3 },
"242303": { title: "Job classification specialist", group: "hr", table: 3 },
"242304": { title: "Hiring specialist", group: "hr", table: 3 },
"242305": { title: "Compensation specialist", group: "hr", table: 3 },
"242306": { title: "Career guidance specialist", group: "hr", table: 3 },
"242307": { title: "Labour investigator", group: "hr", table: 3 },
"242308": { title: "Labour committee member", group: "hr", table: 3 },
"242309": { title: "Workforce planning specialist", group: "hr", table: 3 },
"242310": { title: "HR monitoring specialist", group: "hr", table: 3 },
"242311": { title: "Recruitment specialist", group: "hr", table: 3 },
"242312": { title: "HR consultant", group: "hr", table: 3 },
"242313": { title: "HR expert", group: "hr", table: 3 },
"122203": { title: "Public relations manager", group: "pr", table: 3 },
"122205": { title: "Fundraising manager", group: "pr", table: 3 },
"122206": { title: "Protocol manager", group: "pr", table: 3 },
"243202": { title: "Public relations specialist", group: "pr", table: 3 },
"243204": { title: "Internal communication specialist", group: "pr", table: 3 },
"243205": { title: "Public awareness specialist", group: "pr", table: 3 },
"243206": { title: "Conference and events specialist", group: "pr", table: 3 },
"243207": { title: "Protocol specialist", group: "pr", table: 3 },
"243208": { title: "Public relations consultant", group: "pr", table: 3 },
"243209": { title: "Public relations expert", group: "pr", table: 3 },
"422501": { title: "Enquiries clerk", group: "front-office", table: 3 },
"422601": { title: "Receptionist", group: "front-office", table: 3 },
"411001": { title: "Government relations clerk", group: "clerical", table: 3 },
"411002": { title: "Registry clerk", group: "clerical", table: 3 },
"412001": { title: "Administrative assistant", group: "clerical", table: 3 },
"413102": { title: "Typist", group: "clerical", table: 3 },
"264303": { title: "Proofreader", group: "language", table: 3 },
"264304": { title: "Sign language interpreter", group: "language", table: 3 },
"541401": { title: "Security camera monitor", group: "security", table: 3 },
"333101": { title: "Freight agent", group: "logistics", table: 3 },
"333102": { title: "Customs agent", group: "logistics", table: 3 },
"432102": { title: "Shipping clerk", group: "logistics", table: 3 },
"432103": { title: "Stock movement clerk", group: "logistics", table: 3 },
};
export function effectiveFrom(code: string): string | undefined {
const o = OCCUPATIONS[code];
return o ? EFFECTIVE[o.table] : undefined;
}
export function inForce(code: string, onDate: string): boolean {
const from = effectiveFrom(code);
return from !== undefined && from <= onDate;
}The group field is our own grouping. The guide gives one table without departments. We add it because a report that says "eleven HR codes, three front office" tells HR where to look, and because the replacement search for a recruitment specialist and a security camera monitor are very different.
The comparison from <= onDate uses ISO date strings. They sort in date order, which keeps the check free of time zones.
Step 3: Duties, Not Only Titles
The system reads GOSI titles. The inspector reads the work. The guide makes the second one a breach in its own right, and it is the one your data will not show: a non-Saudi "operations officer" who follows the company's files with government agencies is doing a government relations clerk's job; an "office coordinator" who greets visitors and answers the phone is doing a receptionist's job.
To see that, you need one more input per person: what they actually do. We ask line managers to tick from a fixed list of duties, and map each duty to the localised occupation it belongs to.
// src/duties.ts
// Duties a line manager can tick for each person, mapped to the localised
// occupation they belong to. This mapping is ours, not the guide's: extend it
// with the duties your own organisation hands out under other titles.
export type Duty =
| "reception" | "enquiries" | "complaints" | "government-relations"
| "data-entry" | "typing" | "secretarial" | "admin-assistance"
| "translation" | "proofreading" | "recruitment" | "compensation"
| "guarding" | "cctv-monitoring" | "storekeeping" | "stock-movement"
| "shipping-documents" | "customs-clearance" | "cash-custody"
| "public-relations" | "events";
export const DUTY_TO_CODE: Record<Duty, string> = {
"reception": "422601",
"enquiries": "422501",
"complaints": "422502",
"government-relations": "411001",
"data-entry": "413201",
"typing": "413102",
"secretarial": "412002",
"admin-assistance": "412001",
"translation": "264301",
"proofreading": "264303",
"recruitment": "242311",
"compensation": "242305",
"guarding": "541402",
"cctv-monitoring": "541401",
"storekeeping": "432101",
"stock-movement": "432103",
"shipping-documents": "432102",
"customs-clearance": "333103",
"cash-custody": "241104",
"public-relations": "243202",
"events": "243206",
};This mapping is a judgment, and it is ours. The guide does not define duties; it relies on the classification. Start with these 21 duties, which cover the roles most often handed out under other titles, and add the ones your organisation uses. A test in Step 6 makes sure each duty still points to a code in the decision.
Step 4: Classify Each Worker
There are four ways a worker can show up, and each needs a different fix:
| Status | Who | Fix |
|---|---|---|
breach-registered | Non-Saudi under a localised code, doing that work | Replace, or move to other work and change the code |
breach-disguised | Non-Saudi doing localised work under another code | Remove those duties from the person |
code-only | Non-Saudi under a localised code, doing other work | Correct the GOSI record |
saudi-wrong-code | Saudi doing localised work under another code | Register the right code |
The last one is not a breach. At 100% a Saudi can never create a gap, but a Saudi receptionist registered as something else is a mismatch an inspector will ask about, and correcting it costs nothing.
// src/assess.ts
import { effectiveFrom, inForce } from "./rules";
import { Duty, DUTY_TO_CODE } from "./duties";
export interface Worker {
id: string;
entityId: string; // the establishment as the ministry groups it
branchId: string;
saudi: boolean;
occupationCode: string; // as registered with GOSI
duties: Duty[]; // what the person actually does, from the line manager
inRoleSince: string; // ISO date the person started this work
}
export type Status =
| "ok"
| "breach-registered" // non-Saudi under a localised code that does the work
| "code-only" // non-Saudi under a localised code, work is different
| "breach-disguised" // non-Saudi doing localised work under another code
| "saudi-wrong-code"; // Saudi doing localised work under another code
export interface Finding {
workerId: string;
status: Exclude<Status, "ok">;
codes: string[]; // the localised codes involved
breachSince?: string; // when the system starts counting it against you
}
function laterOf(a: string, b: string): string {
return a > b ? a : b;
}
export function assessWorker(w: Worker, onDate: string): Finding | undefined {
const registered = inForce(w.occupationCode, onDate);
const dutyCodes = [
...new Set(w.duties.map((d) => DUTY_TO_CODE[d]).filter((c) => inForce(c, onDate))),
].sort();
if (w.saudi) {
// At 100% a Saudi never creates a gap, but the GOSI record should match the work.
if (!registered && dutyCodes.length > 0) {
return { workerId: w.id, status: "saudi-wrong-code", codes: dutyCodes };
}
return undefined;
}
if (registered) {
const doesTheWork = w.duties.some((d) => DUTY_TO_CODE[d] === w.occupationCode);
const others = dutyCodes.filter((c) => c !== w.occupationCode);
if (!doesTheWork && others.length === 0) {
// The system still counts the GOSI title. Fix the record if the job differs.
return {
workerId: w.id,
status: "code-only",
codes: [w.occupationCode],
breachSince: laterOf(effectiveFrom(w.occupationCode)!, w.inRoleSince),
};
}
return {
workerId: w.id,
status: "breach-registered",
codes: [...new Set([w.occupationCode, ...others])].sort(),
breachSince: laterOf(effectiveFrom(w.occupationCode)!, w.inRoleSince),
};
}
if (dutyCodes.length > 0) {
const earliest = dutyCodes.map((c) => effectiveFrom(c)!).sort()[0];
return {
workerId: w.id,
status: "breach-disguised",
codes: dutyCodes,
breachSince: laterOf(earliest, w.inRoleSince),
};
}
return undefined;
}Three choices in this function deserve a note.
code-only still counts. The system computes from the GOSI title, so a non-Saudi registered as a data entry clerk is counted against you even if the person actually runs the warehouse. We keep it as a separate status because the fix is a record correction, not a hire, but we give it a start date like any breach.
A breach starts at the later of two dates. A secretary hired in 2023 has been in breach since 5 April 2026. A security guard hired on 1 September 2026 has been in breach since the day that person started. This is the number to put next to each name.
Duties not yet in force are ignored. Before 4 October 2026, a non-Saudi doing reception work under another title was not in breach, because reception sits in table 3. The filter on inForce keeps reports for earlier dates correct.
Step 5: The Entity Report and the Plan
Group by entity, never by branch. Count what the system would count, which is everyone under a localised code that is in force, and add the findings.
// src/report.ts
import { OCCUPATIONS, Group, inForce } from "./rules";
import { Worker, Finding, assessWorker } from "./assess";
export interface EntityReport {
entityId: string;
onDate: string;
inScope: number; // workers registered under a localised code in force
saudis: number;
required: number; // at 100%, everyone in scope
gap: number; // non-Saudis to move or replace
byGroup: Partial<Record<Group, { inScope: number; nonSaudi: number }>>;
findings: Finding[];
breachDays: number; // sum over breaches, in worker-days
}
export function daysBetween(from: string, to: string): number {
return Math.round((Date.parse(to) - Date.parse(from)) / 86_400_000);
}
export function reportEntity(entityId: string, workers: Worker[], onDate: string): EntityReport {
const mine = workers.filter((w) => w.entityId === entityId);
const scoped = mine.filter((w) => inForce(w.occupationCode, onDate));
const byGroup: EntityReport["byGroup"] = {};
for (const w of scoped) {
const g = OCCUPATIONS[w.occupationCode].group;
const slot = (byGroup[g] ??= { inScope: 0, nonSaudi: 0 });
slot.inScope += 1;
if (!w.saudi) slot.nonSaudi += 1;
}
const findings = mine
.map((w) => assessWorker(w, onDate))
.filter((f): f is Finding => f !== undefined);
const breachDays = findings.reduce(
(sum, f) => sum + (f.breachSince ? Math.max(0, daysBetween(f.breachSince, onDate)) : 0),
0,
);
const saudis = scoped.filter((w) => w.saudi).length;
return {
entityId,
onDate,
inScope: scoped.length,
saudis,
required: scoped.length,
gap: scoped.length - saudis,
byGroup,
findings,
breachDays,
};
}At 100%, required equals inScope and gap is simply the number of non-Saudis in scope. We keep both fields so the report has the same shape as the other Saudization checks and can sit next to them in one dashboard.
breachDays adds up the days of every breach. It is not a fine. The guide refers to the penalty tables without amounts, and we do not invent them. It is a way to see whether the exposure is growing or shrinking from one month to the next.
HR does not read objects, so the last step turns the report into lines, registered breaches first:
// src/plan.ts
import { OCCUPATIONS } from "./rules";
import { EntityReport, daysBetween } from "./report";
function titles(codes: string[]): string {
return codes.map((c) => `${OCCUPATIONS[c].title} (${c})`).join(", ");
}
export function actionPlan(r: EntityReport): string[] {
const lines = [
`Entity ${r.entityId} on ${r.onDate}: ${r.saudis}/${r.inScope} Saudi in localised codes, ` +
`${r.gap} to move or replace.`,
];
const order = { "breach-registered": 0, "breach-disguised": 1, "code-only": 2, "saudi-wrong-code": 3 };
const sorted = [...r.findings].sort(
(a, b) => order[a.status] - order[b.status] || a.workerId.localeCompare(b.workerId),
);
for (const f of sorted) {
const since = f.breachSince ? `, ${daysBetween(f.breachSince, r.onDate)} days since ${f.breachSince}` : "";
switch (f.status) {
case "breach-registered":
lines.push(`${f.workerId}: non-Saudi in ${titles(f.codes)}${since}. Replace, or move to other work and change the code.`);
break;
case "breach-disguised":
lines.push(`${f.workerId}: non-Saudi doing ${titles(f.codes)} under another title${since}. Remove these duties.`);
break;
case "code-only":
lines.push(`${f.workerId}: registered as ${titles(f.codes)} but does other work${since}. Correct the GOSI record.`);
break;
case "saudi-wrong-code":
lines.push(`${f.workerId}: Saudi doing ${titles(f.codes)} under another code. Register the right code.`);
break;
}
}
return lines;
}Testing Your Implementation
These tests pin what the guide states: the 69 codes and their split, the two dates, the threshold of one, the entity rule, and the four statuses. Run them with npx tsx --test src/audit.test.ts.
// src/audit.test.ts
import { test } from "node:test";
import assert from "node:assert/strict";
import { OCCUPATIONS, EFFECTIVE, inForce } from "./rules";
import { DUTY_TO_CODE } from "./duties";
import { Worker, assessWorker } from "./assess";
import { reportEntity, daysBetween } from "./report";
import { actionPlan } from "./plan";
const w = (id: string, saudi: boolean, code: string, extra: Partial<Worker> = {}): Worker => ({
id, entityId: "E1", branchId: "B1", saudi, occupationCode: code,
duties: [], inRoleSince: "2024-01-01", ...extra,
});
test("the guide lists 69 codes: 19 in table 2 and 50 in table 3", () => {
const codes = Object.keys(OCCUPATIONS);
assert.equal(codes.length, 69);
assert.equal(codes.filter((c) => OCCUPATIONS[c].table === 2).length, 19);
assert.equal(codes.filter((c) => OCCUPATIONS[c].table === 3).length, 50);
assert.ok(codes.every((c) => /^\d{6}$/.test(c)));
});
test("table 2 from 5 April 2026, table 3 from 4 October 2026", () => {
assert.equal(daysBetween(EFFECTIVE[2], EFFECTIVE[3]), 182);
assert.equal(inForce("412002", "2026-04-04"), false);
assert.equal(inForce("412002", "2026-04-05"), true);
assert.equal(inForce("422601", "2026-10-03"), false);
assert.equal(inForce("422601", "2026-10-04"), true);
assert.equal(inForce("999999", "2026-11-20"), false);
});
test("every duty maps to a code in the decision", () => {
for (const code of Object.values(DUTY_TO_CODE)) assert.ok(code in OCCUPATIONS, code);
});
test("one non-Saudi receptionist is enough: there is no headcount threshold", () => {
const r = reportEntity("E1", [w("a", false, "422601", { duties: ["reception"] })], "2026-11-20");
assert.equal(r.inScope, 1);
assert.equal(r.required, 1);
assert.equal(r.gap, 1);
assert.equal(r.findings[0].status, "breach-registered");
});
test("Saudis in localised codes create no finding", () => {
const r = reportEntity("E1", [w("a", true, "412002", { duties: ["secretarial"] })], "2026-11-20");
assert.equal(r.gap, 0);
assert.deepEqual(r.findings, []);
});
test("a table 3 code is not a breach before 4 October", () => {
const ws = [w("a", false, "412001", { duties: ["admin-assistance"] })];
assert.equal(reportEntity("E1", ws, "2026-10-03").gap, 0);
assert.equal(reportEntity("E1", ws, "2026-10-04").gap, 1);
});
test("localised work under another title is a breach of its own", () => {
// "Operations officer" (code outside the list) who follows files with government agencies
const f = assessWorker(w("a", false, "334101", { duties: ["government-relations"] }), "2026-11-20");
assert.equal(f?.status, "breach-disguised");
assert.deepEqual(f?.codes, ["411001"]);
assert.equal(f?.breachSince, "2026-10-04");
});
test("a disguised breach starts at the earliest duty in force", () => {
const f = assessWorker(
w("a", false, "334101", { duties: ["reception", "data-entry", "reception"] }),
"2026-11-20",
);
assert.deepEqual(f?.codes, ["413201", "422601"]);
assert.equal(f?.breachSince, "2026-04-05");
const before = assessWorker(w("b", false, "334101", { duties: ["reception"] }), "2026-10-03");
assert.equal(before, undefined);
});
test("a localised code without the work is still counted by the system", () => {
const f = assessWorker(w("a", false, "413201", { duties: [] }), "2026-11-20");
assert.equal(f?.status, "code-only");
assert.equal(f?.breachSince, "2026-04-05");
const r = reportEntity("E1", [w("a", false, "413201")], "2026-11-20");
assert.equal(r.gap, 1);
});
test("a registered breach lists every localised duty the person does", () => {
const f = assessWorker(w("a", false, "412002", { duties: ["translation"] }), "2026-11-20");
assert.equal(f?.status, "breach-registered");
assert.deepEqual(f?.codes, ["264301", "412002"]);
});
test("a Saudi doing localised work under another code is flagged for the record", () => {
const f = assessWorker(w("a", true, "334101", { duties: ["storekeeping"] }), "2026-11-20");
assert.equal(f?.status, "saudi-wrong-code");
assert.equal(f?.breachSince, undefined);
});
test("breach starts on the later of the effective date and the start in role", () => {
const f = assessWorker(
w("a", false, "541402", { duties: ["guarding"], inRoleSince: "2026-09-01" }),
"2026-11-20",
);
assert.equal(f?.breachSince, "2026-09-01");
});
test("branches of one entity are counted together, other entities are not", () => {
const ws = [
w("a", true, "422601", { duties: ["reception"] }),
w("b", false, "422601", { branchId: "B2", duties: ["reception"] }),
w("c", false, "242311", { branchId: "B3", duties: ["recruitment"] }),
w("x", false, "422601", { entityId: "E2", duties: ["reception"] }),
w("y", false, "214201"),
];
const r = reportEntity("E1", ws, "2026-11-20");
assert.equal(r.inScope, 3);
assert.equal(r.gap, 2);
assert.deepEqual(r.byGroup, {
"front-office": { inScope: 2, nonSaudi: 1 },
hr: { inScope: 1, nonSaudi: 1 },
});
assert.equal(r.breachDays, 47 * 2);
});
test("action plan puts registered breaches first and counts days", () => {
const ws = [
w("d", true, "334101", { duties: ["data-entry"] }),
w("c", false, "413201"),
w("b", false, "334101", { duties: ["government-relations"] }),
w("a", false, "412002", { duties: ["secretarial"] }),
];
const lines = actionPlan(reportEntity("E1", ws, "2026-11-20"));
assert.deepEqual(lines, [
"Entity E1 on 2026-11-20: 0/2 Saudi in localised codes, 2 to move or replace.",
"a: non-Saudi in Secretary (412002), 229 days since 2026-04-05. Replace, or move to other work and change the code.",
"b: non-Saudi doing Government relations clerk (411001) under another title, 47 days since 2026-10-04. Remove these duties.",
"c: registered as Data entry clerk (413201) but does other work, 229 days since 2026-04-05. Correct the GOSI record.",
"d: Saudi doing Data entry clerk (413201) under another code. Register the right code.",
]);
});Fourteen tests, all passing on Node 20 and later with tsc --strict clean. We checked the code list against an independent reading of the same guide (69 codes, the same 19 in table 2). We also broke the code on purpose fourteen times: shifting the table 3 date by one day, making the date comparison strict, deleting a code, moving the treasurer to table 3, taking the earlier of the two start dates, flagging Saudis under localised codes, treating every code-only case as a registered breach, ignoring the effective date of duties, taking the latest duty date, counting other entities, adding a day to the breach count, pointing a duty at the wrong code, swapping the order of the plan, and dropping the start date of code-only cases. At least one test failed every time.
One check the tests cannot do: compare your list with what Qiwa shows for the same entity. The ministry computes from its own records. When the two disagree, the cause is almost always data: a code registered differently with GOSI than in your HR system, or a branch attached to another entity.
Troubleshooting
Qiwa shows a violation and your report is empty. Look at the codes first. Your system may hold a free-text title while GOSI holds a code from the list, and the system reads GOSI.
A long list of code-only findings. This is common after years of registering everyone under the nearest code. Each one is a record to correct, not a person to replace. Fix the record only if the person really does other work, because the inspector checks the work.
Line managers tick nothing. An empty duties list means the disguised case is invisible, not absent. Make the duties field required and review it with each manager once. It is the only input that catches the breach the guide names explicitly.
Your October report jumped. That is the 50 table 3 codes entering scope on 4 October 2026. HR and public relations roles usually account for most of the jump.
A worker is covered by two decisions. Some of these codes may also sit in a sector decision at a lower rate. The guide says the higher rate wins, so from its effective date this decision decides.
Next Steps
- The Saudis you move into these roles also count toward your entity-wide Nitaqat rate, which is computed separately and at the same time. Test the effect on your band with the free Nitaqat calculator, and see the general Saudization engine for the full calculation.
- For a decision with a rate under 100%, where rounding and replacement versus hiring matter, see our procurement Saudization check.
- Read what happens when Saudization is faked on paper before you decide that re-titling a role is a fix.
- Connect the module to live data instead of a monthly export. The Qiwa and HR systems integration guide covers where each field comes from.
Conclusion
A rate of 100% from the first worker removes the arithmetic and leaves the data. The audit is a list of names, each with a status and a start date, and most of its value is in two places the system does not show: the duties people do under other titles, and the records that say one thing while the person does another.
Both grace periods are over. Table 2 has been enforced for more than seven months, table 3 for more than six weeks. Correcting records costs nothing and can be done this week; moving duties takes a conversation with each manager; replacing people takes months. Start with the list.
If you want this audit wired to your HR system and run before every hire, book a free diagnostic session and we will review your data against Decision 132249 with you.