Skip to content

[Bug/错误]: UI caps model association priority at 10, but docs and backend allows up to 100 #1507

@Sewer56

Description

@Sewer56

The model association priority field in the AxonHub Admin UI is capped at 10, but the backend schema and documentation allow values up to 100. This creates an inconsistency where higher priority values can be set via API but not via the UI.

Steps to Reproduce

  1. Navigate to Models in Admin UI
  2. Open a model's Association dialog
  3. Try to set a rule's priority to any value above 10

Expected: UI and backend/schema use the same max priority value
Actual: UI caps at 10 while backend/schema cap at 100, creating an inconsistency

Root Cause

In frontend/src/features/models/components/models-association-dialog.tsx, the priority field is capped at 10 in three locations:

  1. Zod form schema - .max(10)
  2. HTML input attribute - max={10}
  3. onChange handler - Math.max(0, Math.min(10, ...))

Additionally, handleAddAssociation() auto-assigns priority to newly added rules using Math.min(lastPriority + 1, 10), preventing the auto-increment from exceeding 10.

Origin

PR #344 (Dec 24, 2025) - "fix: model association priority and ui align" - introduced both .max(10) in the dialog AND .max(100) in schema.ts in the same PR, creating the inconsistency from the start.

Prior to PR #344, priority had no max constraint (z.number().optional().default(0) from PR #330).

Documentation vs UI Contradiction

The Model Management Guide explicitly recommends:

Priority Settings - Primary channels: 0-10, backup channels: 10-100

The documentation clearly intends for priority values above 10 to be used for backup and emergency tiers.

Proposed Fix

Files to modify

frontend/src/features/models/components/models-association-dialog.tsx

Location Current Change
Form schema Zod .max(10) .max(100)
HTML input max attr max={10} max={100}
onChange clamp Math.min(10, ...) Math.min(100, ...)
handleAddAssociation Math.min(lastPriority + 1, 10) lastPriority + 1 (no cap)

Additional improvements

  1. Extract max priority to a constant (e.g., MAX_ASSOCIATION_PRIORITY = 100) for maintainability
  2. Update i18n error message: "Priority cannot exceed 10" → "Priority cannot exceed 100"
  3. Consider adding a tooltip/hint in the priority input explaining the recommended tiers (0-10 primary, 10-100 backup)

Only trying AxonHub for first time today. Reporting quirks as I find them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions