Skip to content

feat: add employee level proto definitions and update buf dependencies#19

Merged
ilramdhan merged 1 commit intomutugading:mainfrom
ilramdhan:feat/formula-master-proto
Apr 15, 2026
Merged

feat: add employee level proto definitions and update buf dependencies#19
ilramdhan merged 1 commit intomutugading:mainfrom
ilramdhan:feat/formula-master-proto

Conversation

@ilramdhan
Copy link
Copy Markdown
Member

Description

Add employee level proto definitions and update buf dependencies

@ilramdhan ilramdhan requested a review from Copilot April 15, 2026 04:37
@ilramdhan ilramdhan self-assigned this Apr 15, 2026
@ilramdhan ilramdhan added the enhancement New feature or request label Apr 15, 2026
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 a new IAM “employee level” API surface (proto definitions + HTTP mappings) and refreshes Buf module dependencies to support compilation.

Changes:

  • Introduces iam/v1/employee_level.proto with enums, entity + CRUD, list/export/import/template, and workflow transition RPCs.
  • Updates buf.lock to a newer buf.build/googleapis/googleapis commit/digest.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 4 comments.

File Description
iam/v1/employee_level.proto New Employee Level service + messages, including workflow states and transition endpoints.
buf.lock Bumps googleapis dependency pin used by Buf builds.

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

Comment on lines +30 to +45
// EmployeeLevelWorkflow represents the lifecycle state of an employee level.
// State machine: DRAFT → SUBMITTED → APPROVED → RELEASED.
// Bypass: users with bypass permission can jump from any pre-release state to RELEASED.
enum EmployeeLevelWorkflow {
// Default / unset.
EMPLOYEE_LEVEL_WORKFLOW_UNSPECIFIED = 0;
// Draft — not yet published.
EMPLOYEE_LEVEL_WORKFLOW_DRAFT = 1;
// Released — active and in use.
EMPLOYEE_LEVEL_WORKFLOW_RELEASED = 2;
// Super user — reserved for top-level system access.
EMPLOYEE_LEVEL_WORKFLOW_SUPER_USER = 3;
// Submitted — pending approval.
EMPLOYEE_LEVEL_WORKFLOW_SUBMITTED = 4;
// Approved — approved, pending release.
EMPLOYEE_LEVEL_WORKFLOW_APPROVED = 5;
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

EmployeeLevelWorkflow is documented as a state machine (DRAFT → SUBMITTED → APPROVED → RELEASED), but the enum numeric ordering doesn’t follow that progression and inserts SUPER_USER in the middle. Since this is a new enum, consider reordering the values to match the lifecycle (and/or document SUPER_USER as a separate non-lifecycle state) to avoid confusion and future migration pain.

Copilot uses AI. Check for mistakes.
EmployeeLevelType type = 5;
// Sort sequence (0-999). Used to order entries in UI.
int32 sequence = 6;
// Workflow state (draft, released, super user).
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

The field comment says the workflow is "draft, released, super user", but this proto also defines SUBMITTED and APPROVED states and exposes transition RPCs for them. Please update the comment to reflect the full set of possible workflow values so generated API docs are accurate.

Suggested change
// Workflow state (draft, released, super user).
// Workflow state (draft, submitted, approved, released, super user).

Copilot uses AI. Check for mistakes.
Comment on lines +108 to +110
// Workflow state. Must not be UNSPECIFIED.
EmployeeLevelWorkflow workflow = 6 [(buf.validate.field).enum = {
not_in: [0]
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

CreateEmployeeLevelRequest requires the caller to set workflow, even though this file also introduces explicit workflow transition RPCs (Submit/Approve/Release/Bypass). Allowing clients to choose the initial workflow (e.g., RELEASED or SUPER_USER) can undermine the intended lifecycle and permission model; consider removing this field from create (default server-side to DRAFT) or constraining it to DRAFT only.

Suggested change
// Workflow state. Must not be UNSPECIFIED.
EmployeeLevelWorkflow workflow = 6 [(buf.validate.field).enum = {
not_in: [0]
// Initial workflow state. Create requests may only use DRAFT;
// subsequent transitions must go through the explicit workflow RPCs.
EmployeeLevelWorkflow workflow = 6 [(buf.validate.field).enum = {
const: 1

Copilot uses AI. Check for mistakes.
Comment on lines +165 to +168
// New workflow state (optional). Must not be UNSPECIFIED if provided.
optional EmployeeLevelWorkflow workflow = 6 [(buf.validate.field).enum = {
not_in: [0]
}];
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

UpdateEmployeeLevelRequest allows directly setting workflow, which makes the dedicated workflow transition RPCs easy to bypass and can enable skipping required approvals. To preserve the lifecycle semantics, consider removing workflow from the generic update request and only allowing workflow changes via the transition RPCs (with appropriate authorization checks).

Copilot uses AI. Check for mistakes.
@ilramdhan ilramdhan merged commit f1a7349 into mutugading:main Apr 15, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants