Skip to content

feat: Implement Safety Gates and Permit Management (Sprint 3 Remediat…#76

Merged
dpurandare merged 1 commit into
mainfrom
RunNFix
Dec 12, 2025
Merged

feat: Implement Safety Gates and Permit Management (Sprint 3 Remediat…#76
dpurandare merged 1 commit into
mainfrom
RunNFix

Conversation

@dpurandare

Copy link
Copy Markdown
Owner

…ion)

  • Added Permit Management API (CRUD)
  • Implemented Safety Gates in WorkOrderService to block critical work without active permits
  • Added E2E tests for Permits and Safety Gates
  • Updated documentation (GAP_REMEDIATION_PLAN, SPRINTS, SPRINT_STATUS_TRACKER) to reflect completion of Phase 0.2

…ion)

- Added Permit Management API (CRUD)
- Implemented Safety Gates in WorkOrderService to block critical work without active permits
- Added E2E tests for Permits and Safety Gates
- Updated documentation (GAP_REMEDIATION_PLAN, SPRINTS, SPRINT_STATUS_TRACKER) to reflect completion of Phase 0.2
@dpurandare dpurandare merged commit d7951c9 into main Dec 12, 2025
8 of 23 checks passed
@dpurandare dpurandare deleted the RunNFix branch December 12, 2025 15:01
@@ -0,0 +1,178 @@
import { db } from "../db";
import { permits, workOrders } from "../db/schema";
import { eq, and, desc, asc, like, or, sql } from "drizzle-orm";

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused import or.

Copilot Autofix

AI 7 months ago

To fix the problem, we need to remove the unused import or from the drizzle-orm import statement. In general, the fix is to delete the unused symbol from the import list in import { ... } from "drizzle-orm". No other parts of the file need to change. No new methods, definitions, or imports are needed; simply modify the affected line.


Suggested changeset 1
backend/src/services/permit.service.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/backend/src/services/permit.service.ts b/backend/src/services/permit.service.ts
--- a/backend/src/services/permit.service.ts
+++ b/backend/src/services/permit.service.ts
@@ -1,6 +1,6 @@
 import { db } from "../db";
 import { permits, workOrders } from "../db/schema";
-import { eq, and, desc, asc, like, or, sql } from "drizzle-orm";
+import { eq, and, desc, asc, like, sql } from "drizzle-orm";
 
 export interface CreatePermitData {
     tenantId: string;
EOF
@@ -1,6 +1,6 @@
import { db } from "../db";
import { permits, workOrders } from "../db/schema";
import { eq, and, desc, asc, like, or, sql } from "drizzle-orm";
import { eq, and, desc, asc, like, sql } from "drizzle-orm";

export interface CreatePermitData {
tenantId: string;
Copilot is powered by AI and may make mistakes. Always verify output.
import { workOrders, workOrderTasks, workOrderParts, workOrderLabor } from "../db/schema";
import { eq, and, desc, asc, sql, like, or, inArray, gte, lte } from "drizzle-orm";
import { workOrders, workOrderTasks, workOrderParts, workOrderLabor, permits } from "../db/schema";
import { eq, and, desc, asc, sql, like, or, inArray, gte, lte, gt } from "drizzle-orm";

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused import inArray.

Copilot Autofix

AI 7 months ago

To fix the problem, we should remove the unused inArray import from the import statement on line 3. This involves editing the relevant import line in backend/src/services/work-order.service.ts to delete inArray from the named imports. No other code changes are necessary, and no new imports or definitions are needed.

Suggested changeset 1
backend/src/services/work-order.service.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/backend/src/services/work-order.service.ts b/backend/src/services/work-order.service.ts
--- a/backend/src/services/work-order.service.ts
+++ b/backend/src/services/work-order.service.ts
@@ -1,6 +1,6 @@
 import { db } from "../db";
 import { workOrders, workOrderTasks, workOrderParts, workOrderLabor, permits } from "../db/schema";
-import { eq, and, desc, asc, sql, like, or, inArray, gte, lte, gt } from "drizzle-orm";
+import { eq, and, desc, asc, sql, like, or, gte, lte, gt } from "drizzle-orm";
 import { WorkOrderStateMachine, WorkOrderStatus } from "./work-order-state";
 
 export interface CreateWorkOrderData {
EOF
@@ -1,6 +1,6 @@
import { db } from "../db";
import { workOrders, workOrderTasks, workOrderParts, workOrderLabor, permits } from "../db/schema";
import { eq, and, desc, asc, sql, like, or, inArray, gte, lte, gt } from "drizzle-orm";
import { eq, and, desc, asc, sql, like, or, gte, lte, gt } from "drizzle-orm";
import { WorkOrderStateMachine, WorkOrderStatus } from "./work-order-state";

export interface CreateWorkOrderData {
Copilot is powered by AI and may make mistakes. Always verify output.
import { TestServer } from '../../tests/helpers/test-server';
import { db } from '../../tests/helpers/database';
import { UserFactory } from '../../tests/factories/user.factory';
import { permits } from '../../src/db/schema';

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note test

Unused import permits.

Copilot Autofix

AI 7 months ago

To fix the problem, you should remove the unused import statement for permits from the top of the file. This involves deleting the line import { permits } from '../../src/db/schema'; (line 4). There is no need to replace or refactor meaning elsewhere in the file, as it has no effect on runtime or test behaviour, nor is it being used for type information. No additional imports or variable definitions are needed to implement this change.


Suggested changeset 1
backend/test/e2e/permits.e2e.test.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/backend/test/e2e/permits.e2e.test.ts b/backend/test/e2e/permits.e2e.test.ts
--- a/backend/test/e2e/permits.e2e.test.ts
+++ b/backend/test/e2e/permits.e2e.test.ts
@@ -1,8 +1,8 @@
 import { TestServer } from '../../tests/helpers/test-server';
 import { db } from '../../tests/helpers/database';
 import { UserFactory } from '../../tests/factories/user.factory';
-import { permits } from '../../src/db/schema';
 
+
 describe('Permits & Safety Gates E2E', () => {
     let server: TestServer;
     let token: string;
EOF
@@ -1,8 +1,8 @@
import { TestServer } from '../../tests/helpers/test-server';
import { db } from '../../tests/helpers/database';
import { UserFactory } from '../../tests/factories/user.factory';
import { permits } from '../../src/db/schema';


describe('Permits & Safety Gates E2E', () => {
let server: TestServer;
let token: string;
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants