Uh oh!
There was an error while loading. Please reload this page.
rename to criteria config - #477
Conversation
Uh oh!
There was an error while loading. Please reload this page.
PR Summary by QodoRename rule criteria to criteria_config across agent rules UI
AI Description
Diagram
High-Level Assessment
Files changed (3) |
Code Review by Qodo
1. Legacy criteria ignored |
| message: x.message || null, | ||
| criteria: normalizeCriteria(x.criteria), | ||
| criteria_config: normalizeCriteriaConfig(x.criteria_config), | ||
| expanded: x.expanded |
There was a problem hiding this comment.
1. Legacy criteria ignored 🐞 Bug≡ Correctness
The rules UI now reads and saves only rule.criteria_config; any existing rule objects that still have the legacy criteria field will render as having no criteria (including disabling code generation) and will be saved with criteria_config: null in the rebuilt rules payload.
Agent Prompt
## Issue description
The UI migrated from `criteria` to `criteria_config` but does not map legacy rule objects that still carry `criteria`. Because `fetchRules()` rebuilds the rules payload using only `x.criteria_config`, legacy criteria can be dropped on save.
## Issue Context
This repo appears to be a frontend that consumes persisted agent rule JSON from an external API/storage; renames like this typically require handling pre-migration data.
## Fix Focus Areas
- src/routes/page/agent/[agentId]/agent-components/rules/agent-rule.svelte[41-50]
- src/routes/page/agent/[agentId]/agent-components/rules/agent-rule.svelte[164-172]
- src/routes/page/agent/[agentId]/agent-components/rules/agent-rule-item.svelte[44-47]
## What to change
1. When initializing/refreshing `innerRules` (e.g., in `init()` or `innerRefresh()`), map legacy to new:
- If `x.criteria_config` is missing but `x.criteria` exists, set `criteria_config = x.criteria` (or normalize it).
2. In `fetchRules()`, be defensive when normalizing:
- Use `normalizeCriteriaConfig(x.criteria_config ?? x.criteria)`.
3. Optionally (belt-and-suspenders), in the UI read path you can also fall back:
- `rule.criteria_config?.criteria ?? rule.criteria?.criteria` (only if `rule.criteria` can exist at runtime).
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
No description provided.