ADR — PR #1328
2026-05-29 10:30 — Move build tools to devDependencies and add exports field
Section titled “2026-05-29 10:30 — Move build tools to devDependencies and add exports field”- Comment: https://github.com/ERP-Unlocked/ordermatic/pull/1328/files#diff-12a7e1f2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9
- Priority: nice-to-have
- Decision: accept
- Rationale: Build tools should be in devDependencies, exports field follows repo guidelines
2026-05-29 10:32 — Remove redundant optimizationSchema spread
Section titled “2026-05-29 10:32 — Remove redundant optimizationSchema spread”- Comment: https://github.com/ERP-Unlocked/ordermatic/pull/1328/files#diff-5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4
- Priority: nice-to-have
- Decision: accept
- Rationale: Schema already re-exports optimization jobs, making the spread redundant
2026-05-29 10:35 — Remove redundant composite unique constraint
Section titled “2026-05-29 10:35 — Remove redundant composite unique constraint”- Comment: https://github.com/ERP-Unlocked/ordermatic/pull/1328/files#diff-7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5
- Priority: nice-to-have
- Decision: accept
- Rationale: jobId.unique() makes composite constraint redundant
2026-05-29 10:37 — Replace string literals with UserRole enum
Section titled “2026-05-29 10:37 — Replace string literals with UserRole enum”- Comment: https://github.com/ERP-Unlocked/ordermatic/pull/1328/files#diff-4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2
- Priority: nice-to-have
- Decision: accept
- Rationale: Use enum members for consistency and readability
2026-05-29 10:39 — Fix unsafe cast as any
Section titled “2026-05-29 10:39 — Fix unsafe cast as any”- Comment: https://github.com/ERP-Unlocked/ordermatic/pull/1328/files#diff-6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4
- Priority: nice-to-have
- Decision: accept
- Rationale: Remove type cast to maintain proper typing
2026-05-29 10:41 — Replace console.log with Pino logger
Section titled “2026-05-29 10:41 — Replace console.log with Pino logger”- Comment: https://github.com/ERP-Unlocked/ordermatic/pull/1328/files#diff-8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d6e7
- Priority: nice-to-have
- Decision: accept
- Rationale: Use structured logging with Pino for observability
2026-05-29 10:43 — Fix runtime dependencies in package.json
Section titled “2026-05-29 10:43 — Fix runtime dependencies in package.json”- Comment: https://github.com/ERP-Unlocked/ordermatic/pull/1328/files#diff-9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d4e5f6a7b8
- Priority: must-fix
- Decision: accept
- Rationale: Runtime packages incorrectly placed in devDependencies
2026-05-29 10:45 — Fix env object with undefined values
Section titled “2026-05-29 10:45 — Fix env object with undefined values”- Comment: https://github.com/ERP-Unlocked/ordermatic/pull/1328/files#diff-0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8
- Priority: must-fix
- Decision: accept
- Rationale: Filter out undefined values to prevent Record<string,string> errors
2026-05-29 10:47 — Replace racy redis flow with atomic reservation
Section titled “2026-05-29 10:47 — Replace racy redis flow with atomic reservation”- Comment: https://github.com/ERP-Unlocked/ordermatic/pull/1328/files#diff-1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9
- Priority: must-fix
- Decision: accept
- Rationale: Use atomic SET with NX to prevent race conditions
2026-05-29 10:49 — Add Zod schema validation
Section titled “2026-05-29 10:49 — Add Zod schema validation”- Comment: https://github.com/ERP-Unlocked/ordermatic/pull/1328/files#diff-2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0
- Priority: must-fix
- Decision: accept
- Rationale: Proper request body validation with try/catch and Zod
2026-05-29 10:51 — Fix jobId fabrication and use real spawn result
Section titled “2026-05-29 10:51 — Fix jobId fabrication and use real spawn result”- Comment: https://github.com/ERP-Unlocked/ordermatic/pull/1328/files#diff-3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1
- Priority: must-fix
- Decision: accept
- Rationale: Use actual jobId returned by spawnOptimization and insert into database
2026-05-29 10:53 — Fix cooldown bypass to use platform/sysadmin role
Section titled “2026-05-29 10:53 — Fix cooldown bypass to use platform/sysadmin role”- Comment: https://github.com/ERP-Unlocked/ordermatic/pull/1328/files#diff-4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2
- Priority: must-fix
- Decision: accept
- Rationale: Use isPlatformSysAdminRole for cooldown bypass instead of isInternalAdminRole
2026-05-29 10:55 — Add org ownership verification
Section titled “2026-05-29 10:55 — Add org ownership verification”- Comment: https://github.com/ERP-Unlocked/ordermatic/pull/1328/files#diff-5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3
- Priority: must-fix
- Decision: accept
- Rationale: Verify job ownership to prevent unauthorized access
2026-05-29 10:57 — Fix spawn worker path and error handling
Section titled “2026-05-29 10:57 — Fix spawn worker path and error handling”- Comment: https://github.com/ERP-Unlocked/ordermatic/pull/1328/files#diff-6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4
- Priority: must-fix
- Decision: accept
- Rationale: Use absolute worker path, check synchronous spawn failures, normalize exitCode