Skip to content

[codex] Add ERPNext engineer onboarding flows#292

Merged
michaelmwu merged 19 commits into
mainfrom
michaelmwu/engineer-onboarding-flow
May 20, 2026
Merged

[codex] Add ERPNext engineer onboarding flows#292
michaelmwu merged 19 commits into
mainfrom
michaelmwu/engineer-onboarding-flow

Conversation

@michaelmwu
Copy link
Copy Markdown
Member

@michaelmwu michaelmwu commented May 19, 2026

Summary

  • Add shared ERPNext engineer onboarding orchestration for User, Employee, Supplier, and project Activity Cost setup.
  • Expose dashboard API/UI flows for standalone engineer setup and project roster add with optional bill/cost rates.
  • Add Discord Steering Committee commands for engineer setup and project assignment, plus focused unit coverage.

Notes

  • Engineer setup requires a @508.dev email and uses that email as the idempotency key.
  • New setup checks for similar existing User, Employee, or Supplier names and returns a conflict so the operator can confirm before creating a duplicate.
  • Project rate configuration remains a separate optional step when adding an engineer to a project.

Validation

  • uv run pytest tests/unit
  • uv run ruff check packages/shared/src/five08/engineer_onboarding.py packages/shared/src/five08/clients/erpnext.py apps/api/src/five08/backend/api.py apps/discord_bot/src/five08/discord_bot/cogs/engineer_onboarding.py tests/unit/test_engineer_onboarding.py
  • uv run mypy packages/shared/src/five08/engineer_onboarding.py apps/discord_bot/src/five08/discord_bot/cogs/engineer_onboarding.py apps/api/src/five08/backend/api.py
  • bun run lint && bun run typecheck && bun run test in apps/admin_dashboard
  • bun run build in apps/admin_dashboard
  • Live ERPNext read-only checks for relevant DocType fields; no live create/update/delete calls were made.

Summary by CodeRabbit

Engineer Onboarding and Project Costing

  • New Features

    • Added complete engineer onboarding workflow to the admin dashboard
    • Introduced activity cost configuration with configurable billing and costing rates for engineers assigned to projects
    • Added Discord bot slash commands for engineer setup and project assignments
  • Tests

    • Comprehensive test coverage for engineer onboarding and project operations

Review Change Stack

Copilot AI review requested due to automatic review settings May 19, 2026 22:29
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bbc147bd-e2b3-455b-95d0-35103cc4f547

📥 Commits

Reviewing files that changed from the base of the PR and between fb5dcc1 and 622cfd9.

📒 Files selected for processing (9)
  • apps/admin_dashboard/src/main.tsx
  • apps/api/src/five08/backend/api.py
  • apps/api/src/five08/backend/static/dashboard/.vite/manifest.json
  • apps/api/src/five08/backend/static/dashboard/assets/index-0wkHV6At.css
  • apps/api/src/five08/backend/static/dashboard/assets/index-B41mWS5m.js
  • apps/api/src/five08/backend/static/dashboard/index.html
  • packages/shared/src/five08/engineer_onboarding.py
  • tests/unit/test_backend_api.py
  • tests/unit/test_engineer_onboarding.py

📝 Walkthrough

Walkthrough

This pull request implements a complete engineer onboarding workflow for ERPNext with optional activity cost configuration. It introduces shared orchestration for creating and linking User/Employee/Supplier records, backend API support for dashboard engineer setup and project roster updates with activity cost details, Discord slash commands for both workflows, and React dashboard components for engineer setup and project roster activity rate management.

Changes

Engineer Onboarding and Activity Cost Configuration

Layer / File(s) Summary
ERPNext Client Enhancements
packages/shared/src/five08/clients/erpnext.py, tests/unit/test_erpnext_client.py
ERPNextAPIError now stores HTTP status codes; create_record sanitizes payloads by removing doctype fields; new call_method helper invokes whitelisted Frappe methods with GET/POST selection based on payload presence. Tests validate HTTP method selection, payload handling, and response validation.
Engineer Onboarding Core Library
packages/shared/src/five08/engineer_onboarding.py
End-to-end orchestration module for engineer onboarding: creates/links User/Employee/Supplier records, enforces @508.dev email validation, detects duplicate names, manages engineer role access, and supports optional Activity Cost configuration. Includes validation helpers for dates, text fields, genders, and email preferences, with partial-success semantics when Activity Cost setup fails during project assignment.
Engineer Onboarding Test Suite
tests/unit/test_engineer_onboarding.py
Comprehensive pytest coverage using FakeERPNextClient test double: validates User/Employee/Supplier creation and linkage, enforces email/field validation, covers error propagation, duplicate-name detection, Supplier reuse, preconditions, Activity Cost validation, orchestration ordering, and partial-success scenarios.
Backend Engineer Setup Endpoint
apps/api/src/five08/backend/api.py (lines 121–128, 234–251, 4513–4612)
New POST /dashboard/api/onboarding/engineers endpoint accepting DashboardEngineerSetupRequest, normalizing/validating email and names, calling orchestrator, mapping errors to HTTP 409/400/502, and auditing with created/updated entity details and timestamps.
Backend Activity Cost Extension
apps/api/src/five08/backend/api.py (lines 291–306, 3969–4046)
Extends _add_erpnext_project_user and dashboard_add_project_user_handler to accept optional activity_type, billing_rate, costing_rate; validates cross-field rules; conditionally constructs ActivityCostRequest; handles partial-success with audit metadata; returns full project_user_result payload including activity cost state.
Backend API and Activity Cost Tests
tests/unit/test_backend_api.py
Test helper for consistent dashboard auth context; unit tests for engineer setup endpoint covering success, invalid inputs, duplicate-name conflicts, and error mappings; activity cost tests validating input combinations, type conversion, partial-success scenarios, email validation, and cache refresh on partial success.
Discord Bot Engineer Onboarding Cog
apps/discord_bot/src/five08/discord_bot/cogs/engineer_onboarding.py
Two slash commands: /setup-engineer (normalizes inputs, validates @508.dev, calls orchestrator in background, reports duplicates/errors, audits results) and /add-engineer-to-project (validates project id and email, enforces rate/activity pairing, constructs ActivityCostRequest, reports success vs partial-success). Manages ERPNext client lifecycle with finally-block cleanup.
Frontend Engineer Setup Panel
apps/admin_dashboard/src/main.tsx (lines 15, 78–79, 314–336, 1645–1695, 2156–2177, 5261–5736)
New EngineerSetupPanel component collecting email, names, country, department, gender, DOB via form inputs with CRM search; calls /dashboard/api/onboarding/engineers, shows success toast, handles 409 conflicts by displaying similar accounts, resets form on success. Conditionally rendered when canWrite is true; updates OnboardingView props for canWrite and onSetupEngineer.
Frontend Activity Cost for Project Roster
apps/admin_dashboard/src/main.tsx (lines 1201–1235, 2618–2624, 2675–2680, 3941–3962, 3981–4256)
Adds activity type, billing rate, costing rate inputs to "Add ERP user" card with optionalNumber parser and validation state derivation; constructs ratePayload only when complete/valid; disables add when invalid; resets inputs after success; varies toast messaging based on activity_cost_error presence. Updates ProjectsView/ProjectDetailPage prop signatures for optional rates parameter. Adjusts grid layout for new controls.
Build Artifacts
apps/api/src/five08/backend/static/dashboard/.vite/manifest.json, apps/api/src/five08/backend/static/dashboard/index.html, apps/api/src/five08/backend/static/dashboard/assets/index-0wkHV6At.css
Updated Vite manifest entry and HTML asset references to new hashed filenames; regenerated Tailwind CSS bundle for dashboard build output.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • 508-dev/508-workflows#296: Modifies the same "add project user" dashboard flow by extending DashboardProjectUserRequest and addProjectUser/project handler for candidate validation, directly overlapping with this PR's activity cost extension of the same request and handler signatures.

Poem

🐇 Engineers join with a bound and a hop,

With roles, names, and suppliers—our orchestration won't stop!

Activity costs flow through projects so clear,

While partial success keeps the discord cogs near. 🚀

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 19.46% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title '[codex] Add ERPNext engineer onboarding flows' directly summarizes the main change—introducing ERPNext engineer onboarding capabilities—which aligns with the primary objective and the substantial changes across frontend, backend, and Discord bot components.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch michaelmwu/engineer-onboarding-flow

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an end-to-end ERPNext engineer onboarding flow that creates/links User, Employee, and Supplier records, optionally configures project Activity Cost (bill/cost rates), and surfaces the flow in both the dashboard UI/API and Discord Steering Committee commands. Shared orchestration logic lives in a new engineer_onboarding module, backed by new generic CRUD helpers on ERPNextClient and unit tests.

Changes:

  • New five08.engineer_onboarding module orchestrating User/Employee/Supplier/Activity Cost setup with duplicate-name detection and @508.dev email enforcement.
  • Generic get/create/update_record and call_method helpers added to ERPNextClient.
  • Dashboard API endpoint + UI panel and a Discord cog with setup-engineer / add-engineer-to-project commands, all role-gated and audited.

Reviewed changes

Copilot reviewed 9 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/shared/src/five08/engineer_onboarding.py New orchestration module for engineer onboarding and project rate config.
packages/shared/src/five08/clients/erpnext.py Adds generic record CRUD + Frappe method helpers used by the new module.
apps/api/src/five08/backend/api.py New dashboard endpoint for engineer setup; extends add-project-user with optional Activity Cost rates.
apps/discord_bot/src/five08/discord_bot/cogs/engineer_onboarding.py New Discord cog exposing engineer setup and project assignment commands.
apps/admin_dashboard/src/main.tsx Adds Engineer Setup panel and roster add form with optional rate fields.
apps/api/src/five08/backend/static/dashboard/{index.html,.vite/manifest.json,assets/index-Bu9GOZtL.css} Rebuilt dashboard bundle assets.
tests/unit/test_engineer_onboarding.py Unit tests covering setup, duplicate-name guard, email validation, and project add with Activity Cost.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/shared/src/five08/engineer_onboarding.py
Comment thread apps/api/src/five08/backend/api.py Outdated
Comment thread apps/admin_dashboard/src/main.tsx Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 698b44b77d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/shared/src/five08/engineer_onboarding.py Outdated
Comment thread apps/api/src/five08/backend/api.py Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 12 changed files in this pull request and generated 5 comments.

Comment thread packages/shared/src/five08/engineer_onboarding.py Outdated
Comment thread packages/shared/src/five08/engineer_onboarding.py Outdated
Comment thread packages/shared/src/five08/engineer_onboarding.py
Comment thread packages/shared/src/five08/engineer_onboarding.py
Comment thread packages/shared/src/five08/engineer_onboarding.py Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0a1ef925b7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/discord_bot/src/five08/discord_bot/cogs/engineer_onboarding.py
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6bf1e4f13c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/api/src/five08/backend/api.py Outdated
…nboarding-flow

# Conflicts:
#	apps/admin_dashboard/src/main.tsx
#	apps/api/src/five08/backend/static/dashboard/.vite/manifest.json
#	apps/api/src/five08/backend/static/dashboard/assets/index-Bu9GOZtL.css
#	apps/api/src/five08/backend/static/dashboard/index.html
Copilot AI review requested due to automatic review settings May 20, 2026 02:12
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 13 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 92456610c3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +642 to +643
def _is_not_found_error(client: ERPNextClient, _exc: ERPNextAPIError) -> bool:
return getattr(client, "status_code", None) == 404
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use exception status for not-found detection

_is_not_found_error ignores the raised exception and relies only on client.status_code, which can be stale. In ERPNextClient.request, status_code is only updated after receiving an HTTP response; transport failures (timeouts/TLS/DNS) keep the previous code. If a prior call set status_code to 404, later network errors will be misclassified as "not found" by paths like ensure_user/supplier_by_id, leading onboarding to create new User/Supplier records instead of failing fast, which can introduce duplicate ERP records during transient outages.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 13 changed files in this pull request and generated 1 comment.

Comment on lines 4592 to 4597
"source": "dashboard",
"user": normalized_user,
"candidate_id": payload.candidate_id,
"activity_cost": project_user_result.get("activity_cost"),
"activity_cost_error": project_user_result.get("activity_cost_error"),
"local_project_id": project_id,
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 81797b0669

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +4595 to 4597
"activity_cost": project_user_result.get("activity_cost"),
"activity_cost_error": project_user_result.get("activity_cost_error"),
"local_project_id": project_id,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Mark partial rate failures as non-success in audit events

In dashboard_add_project_user_handler, the new partial-success path is surfaced via activity_cost_error, but this audit call still records the action as success, so downstream audit consumers that key on result will miss failed Activity Cost writes even though billing/costing were not applied. When project_user_result contains partial_success/activity_cost_error, record a non-success audit result to keep operational monitoring accurate.

Useful? React with 👍 / 👎.

Comment on lines +155 to +158
except ERPNextAPIError:
fields.pop("role_profile_name", None)
fields["roles"] = [{"role": EMPLOYEE_ROLE}]
return client.create_record("User", fields), True
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restrict User-create fallback to role-profile-specific errors

ensure_user catches any ERPNextAPIError from the first create_record("User", ...) attempt and immediately retries with a different payload. This broad retry can turn transient/transport failures into duplicate-create attempts and partial onboarding side effects (e.g., first create may have succeeded server-side, then the fallback attempt fails with duplicate state). Only fallback when the first failure is specifically the role-profile incompatibility case.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e9dd63b7a4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +99 to +100
if not user_exists:
ensure_no_similar_engineer_name(client, email=email, full_name=full_name)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Run duplicate-name guard even when User already exists

The duplicate-name check is skipped whenever the ERPNext User record already exists, but setup_engineer still resolves/creates Supplier by employee/full name afterward. In the common pre-provisioned-user case (existing User, no Employee yet), this can silently attach the engineer to an unrelated existing Supplier with the same name and append their portal user, creating incorrect cross-linking and access side effects instead of returning a conflict for operator confirmation.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 13 changed files in this pull request and generated 2 comments.

Comment on lines +212 to +213
except ERPNextAPIError:
pass
Comment thread apps/admin_dashboard/src/main.tsx Outdated
const preferredEmailOptions = ["Company Email", "Personal Email", "User ID"]

function todayInputDate() {
return new Date().toISOString().slice(0, 10)
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/admin_dashboard/src/main.tsx`:
- Line 5404: Remove fabricated defaults and stop sending gender/dateOfBirth when
the operator hasn’t provided them: delete or stop using the hardcoded constant
defaultEmployeeDateOfBirth and the hardcoded gender "Male", and update the
payload construction for EngineerSetupRequest (the form submit/handleSubmit code
that currently includes dateOfBirth and gender on lines around the submission)
to only include dateOfBirth and gender keys if the user explicitly entered
values (e.g., check for non-empty/undefined form fields before adding them to
the request object). Ensure default constants are not used as fallbacks that
cause unedited fields to be submitted.
- Line 5460: The current flow auto-populates dateOfJoining (state managed by
dateOfJoining and setDateOfJoining) with todayInputDate() and then overwrites it
with person.created_at, causing incorrect date_of_joining to be submitted;
change the initial state to empty (null/""), remove or guard the effect that
assigns person.created_at to dateOfJoining unless that value is a verified join
date or the operator explicitly toggles/accepts it in Advanced options, and
update the submit logic so the payload only includes date_of_joining when
dateOfJoining is non-empty/explicitly provided by the user (do not always
include person.created_at).

In `@apps/api/src/five08/backend/api.py`:
- Around line 4453-4461: The audit call is currently persisting potentially
identifying duplicate-match payloads by putting exc.matches into the audit
metadata; update the call to _audit_dashboard_engineer_setup (the
AuditResult.DENIED branch) to stop saving exc.matches directly and instead store
only minimal diagnostics (e.g., "matches_count": len(exc.matches) or a redacted
summary) in the metadata, while leaving the full exc.matches data only in the
HTTP response logic. Modify the metadata dict passed to
_audit_dashboard_engineer_setup to replace "matches": exc.matches with a
non-identifying field such as "matches_count" or a masked summary.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5ddf5f78-005e-43d5-bf46-2373872534db

📥 Commits

Reviewing files that changed from the base of the PR and between 2856f52 and fb5dcc1.

📒 Files selected for processing (11)
  • apps/admin_dashboard/src/main.tsx
  • apps/api/src/five08/backend/api.py
  • apps/api/src/five08/backend/static/dashboard/.vite/manifest.json
  • apps/api/src/five08/backend/static/dashboard/assets/index-Cn-kslAB.css
  • apps/api/src/five08/backend/static/dashboard/assets/index-DuHixsFk.js
  • apps/api/src/five08/backend/static/dashboard/index.html
  • apps/discord_bot/src/five08/discord_bot/cogs/engineer_onboarding.py
  • packages/shared/src/five08/clients/erpnext.py
  • packages/shared/src/five08/engineer_onboarding.py
  • tests/unit/test_backend_api.py
  • tests/unit/test_engineer_onboarding.py
✅ Files skipped from review due to trivial changes (1)
  • apps/api/src/five08/backend/static/dashboard/.vite/manifest.json

Comment thread apps/admin_dashboard/src/main.tsx Outdated
Comment thread apps/admin_dashboard/src/main.tsx Outdated
Comment thread apps/api/src/five08/backend/api.py
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fb5dcc1c21

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/admin_dashboard/src/main.tsx Outdated
Comment on lines +5407 to +5408
function todayInputDate() {
return new Date().toISOString().slice(0, 10)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use local calendar date for default join date

todayInputDate() derives the default from new Date().toISOString().slice(0, 10), which is UTC-based rather than local time. In US time zones this flips to the next day during evening hours, so the Engineer Setup form can prefill date_of_joining as tomorrow and submit an incorrect future join date if the operator accepts defaults.

Useful? React with 👍 / 👎.

…nboarding-flow

# Conflicts:
#	apps/api/src/five08/backend/static/dashboard/.vite/manifest.json
#	apps/api/src/five08/backend/static/dashboard/assets/index-Cn-kslAB.css
#	apps/api/src/five08/backend/static/dashboard/index.html
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 622cfd994c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +99 to +100
if preflight_employee is None:
ensure_no_similar_engineer_name(client, email=email, full_name=full_name)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Run duplicate-name guard for existing employees

Fresh evidence from this revision: the new gate at setup_engineer only runs ensure_no_similar_engineer_name when preflight_employee is None. If an Employee already exists but has no supplier link, the flow proceeds to ensure_supplier_preconditions/ensure_supplier using employee_name, and ensure_supplier will attach portal access to the first Supplier name match. In environments with duplicate human names, this can silently link the engineer to an unrelated Supplier and grant unintended portal access, so conflict/ownership checks must also run for existing-employee paths (at least when Employee.supplier is empty).

Useful? React with 👍 / 👎.

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