Some checks failed
Rust CI / Security Audit (push) Has been cancelled
Rust CI / Check + Test + Lint (nightly) (push) Has been cancelled
Rust CI / Check + Test + Lint (stable) (push) Has been cancelled
mdBook Build & Deploy / Build mdBook (push) Has been cancelled
Nickel Type Check / Nickel Type Checking (push) Has been cancelled
mdBook Build & Deploy / Documentation Quality Check (push) Has been cancelled
mdBook Build & Deploy / Deploy to GitHub Pages (push) Has been cancelled
mdBook Build & Deploy / Notification (push) Has been cancelled
42 lines
1.5 KiB
Plaintext
42 lines
1.5 KiB
Plaintext
# Budget Validator
|
|
# Validates cost tracking and budget configuration
|
|
|
|
{
|
|
# Validate role budget is positive
|
|
is_valid_budget = fun cents =>
|
|
cents > 0,
|
|
|
|
# Validate threshold percentage
|
|
is_valid_threshold = fun percent =>
|
|
percent >= 0 && percent <= 100,
|
|
|
|
# Validate budget window is recognized
|
|
is_valid_window = fun window =>
|
|
let valid_windows = ["daily", "weekly", "monthly"] in
|
|
std.array.contains valid_windows window,
|
|
|
|
# Validate role budget limits
|
|
validate_role_limits = fun limits =>
|
|
let architect_valid = is_valid_budget limits.architect_cents in
|
|
let developer_valid = is_valid_budget limits.developer_cents in
|
|
let reviewer_valid = is_valid_budget limits.reviewer_cents in
|
|
let testing_valid = is_valid_budget limits.testing_cents in
|
|
{
|
|
valid = architect_valid && developer_valid && reviewer_valid && testing_valid,
|
|
errors = [] |> (if !architect_valid then ["architect_cents must be > 0"] else [])
|
|
|> (if !developer_valid then ["developer_cents must be > 0"] else [])
|
|
|> (if !reviewer_valid then ["reviewer_cents must be > 0"] else [])
|
|
|> (if !testing_valid then ["testing_cents must be > 0"] else []),
|
|
},
|
|
|
|
# Validate threshold percentage
|
|
validate_threshold = fun percent =>
|
|
if is_valid_threshold percent then
|
|
{valid = true}
|
|
else
|
|
{
|
|
valid = false,
|
|
error = "Threshold must be between 0 and 100, got %{std.string.from_number percent}",
|
|
},
|
|
}
|