Project

General

Profile

Actions

Feature #3242

open

[oms-rbac-v2] web: "We have two major changes to implement in the OMS application. Please inspect the existing application, database schema, authentication/authorization flow, and menu structure befor

Added by Bot AI 3 days ago. Updated 3 days ago.

Status:
Resolved
Priority:
Normal
Assignee:
Start date:
08/27/2026
Due date:
% Done:

0%

Estimated time:
Source:

Description

Overview

Feature for the web side. 19 test case(s) generated.

Requirement

"We have two major changes to implement in the OMS application. Please inspect the existing application, database schema, authentication/authorization flow, and menu structure before making any changes.
Dont create any screen we dont want any screen for this rereuiment so just so the functionalities

1. Role & Permission Management

We need to implement a proper role-based permission system for OMS.

User Types

We have two types of users:

  1. Supplier
  2. Manufacturer

Each user type has two roles:

  • Admin
  • Staff

So the structure is:

Supplier
├── Admin
└── Staff

Manufacturer
├── Admin
└── Staff

Each role will have different permissions.

Permission-Based Access

All menus and functionalities in the OMS application must be displayed and accessible based on the user's permissions.

This should not be implemented only at the UI/menu level.

We need proper authorization at both:

  • Frontend/UI level
  • Backend/API level

If a user does not have permission for a particular functionality:

  • The corresponding menu should not be shown.
  • The user should not be able to access the functionality directly through a URL.
  • The corresponding API should reject unauthorized requests.
  • Do not rely only on hiding the menu for security.

Permission Design

Please inspect all existing OMS menus/features and design the permission structure accordingly.

Permissions should preferably be granular enough to support future requirements.

Do not blindly use a fixed example permission list. Inspect the actual OMS functionality and determine the appropriate permission model.

The permission system should also be designed so that adding new menus/features in the future does not require redesigning the entire authorization system.

Initial Super Admin

Initially, we need one default user with Role: Super Admin, Permissions: All.

The Super Admin should have access to all current and future functionalities unless explicitly restricted later.

Please determine the best way to implement this based on the existing authentication/database architecture.

Also ensure that the initial Super Admin creation is safe and does not create duplicate users when the application is initialized multiple times.

2. Database ID Format

Currently, database unique IDs are being generated in a cuid-style format. We do not want this. We need to standardize on proper UUID format instead.

This change must be applied consistently across all existing tables, primary keys, foreign keys, join/relationship tables, and any other fields using the old format — and future tables/models must automatically follow the UUID standard.

Do not simply change the column type without considering existing relationships and data. We need to preserve existing records and relationships wherever possible.

Important: Do not implement these as isolated changes. First understand the existing OMS architecture and make the role/permission system and UUID strategy consistent, reusable, and maintainable for future development.

Explicit Constraints

  • Dont create any screen we dont want any screen for this rereuiment so just so the functionalities screens/UI
  • This should not be implemented only at the UI/menu level. authorization/security
  • Do not rely only on hiding the menu for security. authorization/security
  • Do not blindly use a fixed example permission list. Inspect the actual OMS functionality and determine the appropriate permission model. permission design
  • We do not want this [cuid-style format]. We need to standardize on proper UUID format instead. database schema
  • Do not simply change the column type without considering existing relationships and data. database schema/migration
  • Do not implement these as isolated changes. scope/implementation approach
  • ensure that the initial Super Admin creation is safe and does not create duplicate users when the application is initialized multiple times. super admin seeding

Task Breakdown

Parent: OMS — Role/Permission system + UUID ID standardization

  1. Architecture inspection + combined design spec (permission model & UUID strategy)
    • Inspect existing OMS app, DB schema, auth/authz flow and menu structure. Produce: (a) full inventory of existing menus/features → derived granular permission catalogue and naming convention that is extensible for future features without redesign; (b) UUID strategy (generation point, column type, ORM/model default so future tables inherit it automatically, migration approach preserving existing rows and relationships). Deliverable is a written design, no code shipped.
  2. RBAC data model, migrations, and idempotent Super Admin seed
    • Tables/models for user_type (Supplier | Manufacturer), role (Admin | Staff, plus Super Admin), permission, and their join tables; assignment of the designed permission catalogue to each user_type×role combination; a default Super Admin with all permissions, seeded idempotently so repeated app initialization creates no duplicate user. Super Admin implicitly grants current and future permissions rather than a frozen snapshot.
  3. Backend/API authorization enforcement across all existing endpoints
    • Middleware/policy/guard layer resolving the acting user's permissions; every existing OMS API endpoint mapped to its permission and rejecting unauthorized requests with the correct status; a permissions endpoint the frontend consumes; default-deny for unmapped routes so future endpoints fail closed.
  4. Frontend permission gating — menu rendering and route guards
    • Consume the permission set at login/session; render only permitted menu entries; guard direct URL access to unpermitted routes (redirect/403 view using existing components). No new screens, no redesign — gating of what already exists.
  5. cuid → UUID standardization across schema, with data-preserving migration
    • Convert all existing PKs, FKs, join/relationship tables and any other cuid-format fields to UUID; forward migration that preserves existing records and relationships (mapping table / staged FK rewrite rather than a bare column-type change); base model/ORM default so future tables and models inherit UUID automatically; referential-integrity verification and a documented rollback.

Acceptance Criteria

(none extracted — spec-extract has not run for this session)

Test Cases

☐ The system's user-type definition contains exactly two values, Supplier and Manufacturer, with none added or missing.
☐ Each of Supplier and Manufacturer supports exactly two roles, Admin and Staff.
☐ Menus and functionalities shown to a logged-in user match exactly that user's assigned permission set.
☐ Authorization is enforced independently on the frontend/UI and on the backend/API — removing or bypassing one layer does not expose the functionality via the other.
☐ A user lacking permission for a functionality does not see the corresponding menu entry.
☐ A user lacking permission for a functionality cannot reach it by navigating directly to its URL.
☐ A user lacking permission for a functionality has the corresponding backend API reject the request as unauthorized.
☐ The permission registry is derived from the actual current inventory of OMS menus/features rather than a fixed example list — every real menu and API route has a corresponding permission mapping.
☐ The permission model is granular (resource+action level, not just module-level) so it can support permission requirements beyond the initial rollout.
☐ A new menu/feature can be added later using only the standard registration mechanism, without modifying the core authorization engine.
☐ After application initialization, exactly one Super Admin user exists, holding every permission.
☐ The Super Admin automatically retains access to functionality added after initial setup, unless an explicit restriction record has been placed on that Super Admin.
☐ Re-running application initialization never creates a duplicate Super Admin user.
☐ All existing cuid-style unique IDs are converted to standard UUID format.
☐ The UUID conversion is applied consistently to every table's primary keys, foreign keys, and join/relationship tables, with none skipped.
☐ Newly added tables/models automatically get UUID-formatted IDs without any extra per-model configuration.
☐ Existing records and their relationships remain intact and functional after the ID-format migration, with no data loss.
☐ No new UI screens are introduced while implementing this requirement.
☐ The role/permission system and the UUID id-format strategy are built as one consistent design, not as two isolated efforts — the new authorization tables follow the same UUID convention as everything else.

Implementation Details

(populated once implementation completes — see the run's completion note on this ticket for the real commit list and MR link)

Verification

(populated once verification completes — see the run's completion note on this ticket for UI/live-verification evidence)


Orchestration slug: oms-rbac-v2 (side: web)

Actions #1

Updated by Bot AI 3 days ago

  • Status changed from New to In Progress
Actions #2

Updated by Bot AI 3 days ago · Edited

Phase Timeline

# Process Start (IST) End (IST) Duration Tokens Cost Model
1 Requirement scope detection 27-08-2026 21:16:35 27-08-2026 21:16:54 19s 50,296 not available claude-sonnet-5
2 Extract explicit constraints 27-08-2026 21:16:54 27-08-2026 21:17:04 10s 36,470 not available claude-sonnet-5
3 Probe environment 27-08-2026 21:17:05 27-08-2026 21:17:11 5s not available not available not recorded
4 Execution environment — discover runners 27-08-2026 21:17:11 27-08-2026 21:18:14 1m 435,651 not available claude-sonnet-5
5 GAP — unattributed 27-08-2026 21:18:14 27-08-2026 21:32:47 15m n/a — wait time, not compute n/a — wait time, not compute n/a
6 Task Granularity 27-08-2026 21:32:47 27-08-2026 21:33:41 54s 41,077 not available claude-opus-5
7 Start Confirmation 27-08-2026 21:35:15 27-08-2026 21:36:44 1m 47,684 not available claude-opus-5
8 Determine web connection 27-08-2026 21:37:34 27-08-2026 21:39:57 2m 1,541,894 not available claude-sonnet-5
9 Extract ticket-spec / acceptance criteria 27-08-2026 21:39:58 27-08-2026 21:41:26 1m 561,017 not available claude-sonnet-5
10 Generate test-spec scenarios and assertions 27-08-2026 21:41:26 27-08-2026 21:43:11 2m 61,548 not available claude-sonnet-5
11 Create/Reuse Web Redmine Ticket 27-08-2026 21:43:11 27-08-2026 21:43:12 1s not available not available not recorded
12 Cross-link tickets 27-08-2026 21:43:13 27-08-2026 21:43:13 0s not available not available not recorded
13 Initialise timing note 27-08-2026 21:43:13 27-08-2026 21:43:14 0s not available not available not recorded
14 Analyze → Implementation Plan 27-08-2026 21:43:14 27-08-2026 21:49:49 7m 864,709 not available claude-opus-5
15 Design 27-08-2026 21:49:50 27-08-2026 21:50:41 51s 241,361 not available claude-sonnet-5
16 Schema Review 27-08-2026 21:50:41 27-08-2026 21:55:45 5m 627,204 not available claude-opus-5
17 Create Branch 27-08-2026 21:55:45 27-08-2026 21:55:50 4s not available not available not recorded
18 Data Layer 27-08-2026 21:55:50 27-08-2026 22:22:07 26m 21,095,171 not available claude-sonnet-5
19 UI Implementation 27-08-2026 22:22:08 27-08-2026 22:25:02 3m 1,238,371 not available claude-sonnet-5
20 1. Unit Tests 27-08-2026 22:25:02 27-08-2026 22:30:21 5m 1,933,182 not available claude-sonnet-5
21 GAP — unattributed 27-08-2026 22:30:21 27-08-2026 22:48:54 19m n/a — wait time, not compute n/a — wait time, not compute n/a
22 2. TypeScript (re-dispatched ×3; first attempt 27-08-2026 22:30:22) FAILED 27-08-2026 22:48:54 27-08-2026 22:49:03 9s not available not available not recorded
23 GAP — unattributed 27-08-2026 22:49:03 27-08-2026 23:02:07 13m n/a — wait time, not compute n/a — wait time, not compute n/a
24 3. Lint (re-dispatched ×2; first attempt 27-08-2026 22:57:00) FAILED 27-08-2026 23:02:07 27-08-2026 23:02:14 6s not available not available not recorded
25 4. Dead Code 27-08-2026 23:06:41 27-08-2026 23:11:42 5m 901,584 not available claude-opus-5
26 5. Code & Style Quality Audit 27-08-2026 23:11:43 27-08-2026 23:30:36 19m 2,221,307 not available claude-opus-5
27 6. Design Consistency Audit 27-08-2026 23:30:37 27-08-2026 23:40:51 10m 2,089,509 not available claude-opus-5
28 7. Responsive Audit 27-08-2026 23:40:52 27-08-2026 23:46:05 5m 1,004,347 not available claude-opus-5
29 Code Review 27-08-2026 23:46:05 27-08-2026 23:48:38 3m 1,373,039 not available claude-sonnet-5
30 UI Verify 27-08-2026 23:48:38 27-08-2026 23:50:44 2m 560,954 not available claude-opus-5
31 GAP — unattributed 27-08-2026 23:50:44 28-08-2026 00:06:43 16m n/a — wait time, not compute n/a — wait time, not compute n/a
32 Web: Live verification (re-dispatched ×2; first attempt 27-08-2026 23:50:44) 28-08-2026 00:06:43 28-08-2026 00:21:59 15m 6,087,578 not available claude-sonnet-5
33 GAP — unattributed 28-08-2026 00:21:59 28-08-2026 01:14:59 53m n/a — wait time, not compute n/a — wait time, not compute n/a
34 Contract (re-dispatched ×6; first attempt 28-08-2026 00:22:01) 28-08-2026 01:14:59 28-08-2026 01:16:04 1m 414,863 not available claude-sonnet-5
35 GAP — unattributed 28-08-2026 01:16:04 28-08-2026 01:48:26 32m n/a — wait time, not compute n/a — wait time, not compute n/a
36 Git & MR (retried ×4) (re-dispatched ×7; first attempt 28-08-2026 01:16:04) 28-08-2026 01:48:26 28-08-2026 01:48:29 2s not available not available not recorded
37 Trigger GitLab Local Verification (retried ×6) (re-dispatched ×9; first attempt 28-08-2026 01:49:13) FAILED 28-08-2026 01:53:23 28-08-2026 01:53:24 0s not available not available not recorded
38 Poll verification jobs 28-08-2026 01:57:11 28-08-2026 01:58:46 2m 542,469 not available claude-sonnet-5
39 GAP — unattributed 28-08-2026 01:58:46 28-08-2026 02:33:25 35m n/a — wait time, not compute n/a — wait time, not compute n/a
40 Validate verification evidence (re-dispatched ×2; first attempt 28-08-2026 01:58:47) FAILED 28-08-2026 02:33:25 28-08-2026 02:33:25 0s not available not available not recorded
41 Completion Summary 28-08-2026 02:38:32 28-08-2026 02:38:32 0s not available not available not recorded
42 Write handoff doc 28-08-2026 02:38:33 28-08-2026 02:38:33 0s not available not available not recorded
43 Resolve tickets + post usage summary 28-08-2026 02:38:34 28-08-2026 02:38:37 3s not available not available not recorded
44 Execution environment — confirm -- 27-08-2026 21:32:43 -- not available not available not recorded
45 Task Granularity — human gate -- 27-08-2026 21:35:11 -- not available not available not recorded
46 Start Confirmation — human gate -- 27-08-2026 21:37:30 -- not available not available not recorded
47 Gate failure decision -- 27-08-2026 23:06:36 -- not available not available not recorded
48 Human intervention (escape hatch) -- 28-08-2026 02:37:01 -- not available not available not recorded
49 Join — all active sides implemented -- 28-08-2026 01:49:12 -- not available not available not recorded
50 Verification approval -- 28-08-2026 02:38:25 -- not available not available not recorded

ORCHESTRATOR TOTAL: 0s, 0 tokens, $0.0000, 7 row(s) with no token data (rows 44–50)
SHARED TOTAL: 1h 59m, 43,971,285 tokens, $0.0000, 13 row(s) with no token data (rows 1–43)

Total Run Time: 5h 22m (wall clock, 27-08-2026 21:16:35 → 28-08-2026 02:38:37 IST — not a sum of the per-side totals above, since sides overlap)
Active time: 2h 20m | Waiting (session limits, approvals, dead sessions): 3h 2m — 7 gap(s) still unattributed; label them with driver.py gap <slug> --from <ISO> --to <ISO> --reason '<why>'
Total Tokens Consumed: 43,971,285 (plus 20 row(s) whose usage was never captured — run execution_tracker.py enrich-audit to backfill. This is a floor, not the total.)
Total Cost: $0.0000 (plus 20 row(s) whose usage was never captured — run execution_tracker.py enrich-audit to backfill. This is a floor, not the total.)

Actions #3

Updated by Bot AI 3 days ago · Edited

  • Status changed from In Progress to Resolved

Run oms-rbac-v2 — web side complete

Merge Request

Commits

  • 67cea86 Contract (oms-rbac-v2)
  • 82249b7 4. Dead Code (oms-rbac-v2)
  • cc47f6e 1. Unit Tests (oms-rbac-v2)
  • 6dab0ad UI Implementation (oms-rbac-v2)
  • 1e617eb Data Layer (oms-rbac-v2)

UI Verification

N/A

  • (Verified UI evidence at docs/gate-evidence/w21-ui-verify-run-3242.md could not be attached — see log above)

Live verification: FAILED

  • (Live verification evidence at verification/W30_LIVE_VERIFY_3242.md could not be attached — see log above)

(Formatting corrected 2026-08-28 — this note originally used Textile heading/bold syntax on a Redmine instance that renders Markdown; content is unchanged from the original post.)

Actions #4

Updated by Bot AI 3 days ago

Token usage summary (grouped by model):
Total known tokens: 0
Processes with no token data: 0
processesWithNoTokenData are orchestrator-internal steps with no sub-agent spawn — their token cost is real but not measurable in this environment, not zero. Do not treat totalKnownTokens as full spend.

Actions #5

Updated by Bot AI 3 days ago

Real app bug found+fixed (not part of the original gate/orchestration run): every authenticated page returned HTTP 500 because lib/nav.ts stored a Lucide icon component (a function) on each NavItem, and app/layout.tsx (Server Component) passed it into Sidebar (a Client Component) — functions cannot cross that serialization boundary. Fixed by making icon a string name resolved to the real component client-side in Sidebar.tsx. Verified: tsc clean, all 8 Sidebar tests pass, next build succeeds, and a real headless-browser login + /orders load now returns 200 with zero console errors (previously 500). Pushed to MR !5 (755501d).

Actions #6

Updated by Bot AI 3 days ago

  • Description updated (diff)
Actions

Also available in: Atom PDF