feat(core): Adiciona funcionalidades e documentação de valuation - #6
feat(core): Adiciona funcionalidades e documentação de valuation#64sllan wants to merge 8 commits into
Conversation
Adiciona novos arquivos TypeScript para lidar com cálculo de condição, depreciação, quilometragem e tipos de avaliação de veículos. Inclui testes unitários abrangentes para as novas utilidades. Cria extensa documentação sobre especificações do MVP e regras de arquitetura e qualidade.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdded IBAV project rules, Windsurf workflows, MVP specifications, valuation types, calculation utilities, query synchronization, a Nuxt valuation interface, and Vitest coverage. ChangesIBAV MVP
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Driver as Vehicle form
participant App as app/app.vue
participant Query as vehicle-query utilities
participant VJV as calculateVjv
participant IVB as calculateIvb
participant Router as Vue Router
Driver->>App: Enter vehicle inputs
App->>Query: Parse or build query parameters
App->>VJV: Calculate fair vehicle value
App->>IVB: Calculate IVB score and label
App->>Router: Replace route query
App-->>Driver: Render valuation and classification
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 12
🧹 Nitpick comments (3)
.windsurf/rules/architecture.md (1)
73-76: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winInclude
shared/utils/in the utility-location rule.This PR places shared valuation utilities in
shared/utils/, but this rule permits onlyapp/utils/andutils/. Align the rule with the existingshared/convention to prevent future duplication or incorrect relocation.Suggested update
-- Funções utilitárias puras em `app/utils/` ou `utils/`. +- Funções utilitárias puras em `shared/utils/`, `app/utils/` ou `utils/`, conforme o escopo.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.windsurf/rules/architecture.md around lines 73 - 76, Update the “Utils” section in architecture.md to include shared/utils/ as an accepted location for pure utility functions, alongside app/utils/ and utils/. Preserve the existing guidance about keeping utilities small, testable, and side-effect free..windsurf/workflows/core/analyze-product.md (1)
13-17: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winHandle missing project paths explicitly.
If
docs/docs.md,README.md, or any listed directory is absent, these steps provide no fallback. The workflow can stop unexpectedly or cause the agent to invent project context. Apply the same conditional handling used for configuration files and record missing paths as risks or ambiguities.Proposed adjustment
-1. Read `package.json` to understand the project name, version, stack, dependencies, and scripts. -2. Read `docs/docs.md` to understand the product goals and domain. -3. Read `README.md` for the public description. -4. List `app/`, `server/`, `shared/`, `test/`, `public/`, and `docs/`. +1. If `package.json` exists, read it to understand the project name, version, stack, dependencies, and scripts. +2. If `docs/docs.md` exists, read it to understand the product goals and domain. +3. If `README.md` exists, read it for the public description. +4. List `app/`, `server/`, `shared/`, `test/`, `public/`, and `docs/` when they exist.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.windsurf/workflows/core/analyze-product.md around lines 13 - 17, Update the workflow steps for reading docs and listing directories to explicitly check whether each path exists before accessing it. Reuse the conditional handling already specified for optional configuration files, and record any missing README.md, docs/docs.md, or listed directory as a project risk or ambiguity instead of inventing context or stopping the analysis.shared/types/valuation.ts (1)
10-18: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRestrinja
ivbLabelàs classificações suportadas.A especificação define um conjunto finito de rótulos, mas
stringpermite qualquer valor. Exporte um tipo comoIvbLabele use-o emValuationResulte no retorno decalculateIvb.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@shared/types/valuation.ts` around lines 10 - 18, Define and export an IvbLabel type containing only the supported IVB classifications, then replace the ivbLabel string field in ValuationResult and the return type of calculateIvb with IvbLabel. Update any affected assignments or return paths to use only those supported labels.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.windsurf/workflows/core/create-spec.md:
- Around line 5-19: Validate the <feature-name> input before any filesystem path
interpolation in .windsurf/workflows/core/create-spec.md lines 5-19, requiring a
safe feature slug and rejecting traversal components, separators, and absolute
paths before creating the specification. Apply the same validation before
reading or creating task files in .windsurf/workflows/core/create-tasks.md lines
5-24.
- Around line 21-67: Establish one persisted approval contract across the
workflows: in .windsurf/workflows/core/create-spec.md lines 21-67, initialize
specs as Draft and define the explicit transition to Approved after user
approval; in .windsurf/workflows/core/create-tasks.md lines 13-24, require the
spec status to be Approved before task creation, and in lines 54-59 enforce that
gate rather than merely documenting it; in
.windsurf/workflows/core/execute-task.md lines 13-17, verify the persisted
Approved status before modifying project files.
In @.windsurf/workflows/core/create-tasks.md:
- Around line 15-24: Update the task definition requirements in the workflow to
include a Dependencies or Blocked by field for every task, and update the
execution instructions to verify all listed dependencies are complete before
starting a dependent task. Preserve the existing dependency ordering requirement
and task-template fields.
- Around line 26-51: Define a task-level status field in the Task template in
.windsurf/workflows/core/create-tasks.md, with the states needed by execution
and post-execution flows (pending and completed). Update the execution
instructions in .windsurf/workflows/core/execute-task.md to persist that status
in the task-list file after execution: mark the task completed on success and
retain or set it pending when unfinished.
In @.windsurf/workflows/core/execute-task.md:
- Around line 5-16: Make task selection feature-specific: in
.windsurf/workflows/core/execute-task.md lines 5-16, accept both <feature-name>
and <number> and use the feature name when reading the corresponding spec and
task list; in docs/specs/README.md lines 26-27, document the feature-specific
command syntax; in .windsurf/workflows/core/execute-tasks.md lines 5-18, pass
the feature name through to every delegated task invocation.
In @.windsurf/workflows/project/check.md:
- Around line 13-19: Update the change-inspection steps in the workflow to
include staged changes via git diff --cached and enumerate untracked paths from
git status --short. Ensure the workflow reviews tracked, staged, and untracked
files before identifying inappropriate modifications.
In `@docs/specs/ibav-mvp-tasks.md`:
- Line 3: Sincronize os títulos das Tasks 1 e 2 com seus critérios de aceite:
após validar todos os critérios, marque-os como concluídos; caso contrário,
remova o `✅` dos títulos até a conclusão. Aplique também a mesma correção às
seções indicadas no documento.
In `@docs/specs/ibav-mvp.md`:
- Around line 87-88: Normalize the VJV percentage contract across
docs/specs/ibav-mvp.md lines 87-88 and docs/specs/ibav-mvp-tasks.md lines 49-52
by defining adjustments as percentage coefficients multiplied by FIPE and
documenting the consistent age-adjustment sign used by the implementation.
Update the depreciation utility in shared/utils/depreciation.ts lines 1-3 to
return that documented sign, and update its dependent test expectation
accordingly.
- Around line 167-169: Atualize os exemplos de VJV e IVB em
`docs/specs/ibav-mvp.md` para declarar `currentYear = 2026` e injete esse valor
nos testes `vjv.test.ts` e `ivb.test.ts`, garantindo que os resultados de R$
74.800 e 842 permaneçam determinísticos.
- Line 94: Atualize o requisito FR8 em conjunto com calculateIvb para definir
faixas numéricas explícitas para cada classificação IVB e regras claras para
valores nos limites, cobrindo todo o intervalo de resultados de forma
determinística.
- Around line 89-93: Atualize o FR7 e a implementação de calculateIvb para
definir explicitamente os termos ausentes da fórmula, incluindo a referência
usada para calcular o excesso de quilometragem, e reconciliar o cálculo com o
valor de aceitação 842 para o veículo de 2022 em 2026. Após aplicar idade,
quilometragem e conservação, limite explicitamente o resultado ao intervalo de 0
a 1000, impedindo valores acima de 1000 ou abaixo de 0.
In `@shared/utils/condition.ts`:
- Around line 13-14: Altere o branch default da função de avaliação de condições
para rejeitar valores inválidos, em vez de retornar 0 como o ajuste de “bom”.
Valide a entrada antes da chamada ou lance um erro explícito no default,
preservando os resultados existentes para condições válidas.
---
Nitpick comments:
In @.windsurf/rules/architecture.md:
- Around line 73-76: Update the “Utils” section in architecture.md to include
shared/utils/ as an accepted location for pure utility functions, alongside
app/utils/ and utils/. Preserve the existing guidance about keeping utilities
small, testable, and side-effect free.
In @.windsurf/workflows/core/analyze-product.md:
- Around line 13-17: Update the workflow steps for reading docs and listing
directories to explicitly check whether each path exists before accessing it.
Reuse the conditional handling already specified for optional configuration
files, and record any missing README.md, docs/docs.md, or listed directory as a
project risk or ambiguity instead of inventing context or stopping the analysis.
In `@shared/types/valuation.ts`:
- Around line 10-18: Define and export an IvbLabel type containing only the
supported IVB classifications, then replace the ivbLabel string field in
ValuationResult and the return type of calculateIvb with IvbLabel. Update any
affected assignments or return paths to use only those supported labels.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: c8b57916-1893-4986-8390-26d1bc713442
📒 Files selected for processing (25)
.windsurf/rules/architecture.md.windsurf/rules/project.md.windsurf/rules/quality.md.windsurf/workflows/core/analyze-product.md.windsurf/workflows/core/create-spec.md.windsurf/workflows/core/create-tasks.md.windsurf/workflows/core/execute-task.md.windsurf/workflows/core/execute-tasks.md.windsurf/workflows/core/plan-product.md.windsurf/workflows/core/post-execution-tasks.md.windsurf/workflows/project/check.md.windsurf/workflows/project/release.md.windsurf/workflows/project/test.mddocs/specs/README.mddocs/specs/ibav-mvp-tasks.mddocs/specs/ibav-mvp.mdshared/types/valuation.tsshared/utils/condition.tsshared/utils/depreciation.tsshared/utils/mileage.tsshared/utils/vehicle.tstest/utils/condition.test.tstest/utils/depreciation.test.tstest/utils/mileage.test.tstest/utils/vehicle.test.ts
| # /create-spec <feature-name> | ||
|
|
||
| ## Purpose | ||
|
|
||
| Create a complete specification for a new feature or change. | ||
|
|
||
| ## Steps | ||
|
|
||
| 1. Read `package.json`. | ||
| 2. Read `docs/docs.md`. | ||
| 3. List and analyze the current project structure. | ||
| 4. Read files related to the feature area. | ||
| 5. Identify existing patterns and conventions. | ||
| 6. Identify risks and ambiguities. | ||
| 7. Create the spec file at `docs/specs/<feature-name>.md`. |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Validate feature names before path interpolation.
Both workflows use command input as a filesystem path. Reject traversal components, separators, and absolute paths. Require a safe feature slug in both workflows.
.windsurf/workflows/core/create-spec.md#L5-L19: validate<feature-name>before creating the specification..windsurf/workflows/core/create-tasks.md#L5-L24: validate<feature-name>before reading or creating task files.
📍 Affects 2 files
.windsurf/workflows/core/create-spec.md#L5-L19(this comment).windsurf/workflows/core/create-tasks.md#L5-L24
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.windsurf/workflows/core/create-spec.md around lines 5 - 19, Validate the
<feature-name> input before any filesystem path interpolation in
.windsurf/workflows/core/create-spec.md lines 5-19, requiring a safe feature
slug and rejecting traversal components, separators, and absolute paths before
creating the specification. Apply the same validation before reading or creating
task files in .windsurf/workflows/core/create-tasks.md lines 5-24.
| ## Spec template | ||
|
|
||
| ```markdown | ||
| # <Feature> | ||
|
|
||
| ## Problem | ||
|
|
||
| ## Goal | ||
|
|
||
| ## Scope | ||
|
|
||
| ## Non-goals | ||
|
|
||
| ## Current Architecture | ||
|
|
||
| ## Proposed Solution | ||
|
|
||
| ## Functional Requirements | ||
|
|
||
| ## Technical Requirements | ||
|
|
||
| ## Data Flow | ||
|
|
||
| ## API / Interfaces | ||
|
|
||
| ## Error Handling | ||
|
|
||
| ## Testing Strategy | ||
|
|
||
| ## Documentation | ||
|
|
||
| ## Acceptance Criteria | ||
|
|
||
| - [ ] ... | ||
|
|
||
| ## Risks | ||
|
|
||
| ## Open Questions | ||
| ``` | ||
|
|
||
| ## Critical rule | ||
|
|
||
| - After creating the spec: **STOP**. | ||
| - Do not create tasks. | ||
| - Do not implement code. | ||
| - Do not modify production files. | ||
| - Wait for explicit user approval before running `/create-tasks`. |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Use one persisted approval contract across the workflows.
The README defines approval states, but the workflows do not persist or verify them.
.windsurf/workflows/core/create-spec.md#L21-L67: add an initialDraftstatus and an explicit approval transition..windsurf/workflows/core/create-tasks.md#L13-L24: requireApprovedbefore creating tasks..windsurf/workflows/core/create-tasks.md#L54-L59: enforce the approval gate instead of documenting it only..windsurf/workflows/core/execute-task.md#L13-L17: verify approval before modifying project files.
🧰 Tools
🪛 LanguageTool
[style] ~66-~66: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...reate tasks. - Do not implement code. - Do not modify production files. - Wait for...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
📍 Affects 3 files
.windsurf/workflows/core/create-spec.md#L21-L67(this comment).windsurf/workflows/core/create-tasks.md#L13-L24.windsurf/workflows/core/create-tasks.md#L54-L59.windsurf/workflows/core/execute-task.md#L13-L17
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.windsurf/workflows/core/create-spec.md around lines 21 - 67, Establish one
persisted approval contract across the workflows: in
.windsurf/workflows/core/create-spec.md lines 21-67, initialize specs as Draft
and define the explicit transition to Approved after user approval; in
.windsurf/workflows/core/create-tasks.md lines 13-24, require the spec status to
be Approved before task creation, and in lines 54-59 enforce that gate rather
than merely documenting it; in .windsurf/workflows/core/execute-task.md lines
13-17, verify the persisted Approved status before modifying project files.
| 3. Divide the implementation into small, reviewable tasks. | ||
| 4. Respect dependencies between tasks. | ||
| 5. For each task define: | ||
| - Goal | ||
| - Files involved | ||
| - Implementation outline | ||
| - Tests | ||
| - Validation | ||
| - Acceptance criteria | ||
| 6. Create the task list at `docs/specs/<feature-name>-tasks.md`. |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Represent dependencies in each task.
Step 4 requires dependency ordering, but the task fields and template have no Dependencies or Blocked by field. Add one and require execution to verify that dependencies are complete before running a dependent task.
Also applies to: 31-45
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.windsurf/workflows/core/create-tasks.md around lines 15 - 24, Update the
task definition requirements in the workflow to include a Dependencies or
Blocked by field for every task, and update the execution instructions to verify
all listed dependencies are complete before starting a dependent task. Preserve
the existing dependency ordering requirement and task-template fields.
| ## Task template | ||
|
|
||
| ```markdown | ||
| # Tasks | ||
|
|
||
| ## Task 1 — <name> | ||
|
|
||
| ### Goal | ||
|
|
||
| ### Files | ||
|
|
||
| ### Implementation | ||
|
|
||
| ### Tests | ||
|
|
||
| ### Validation | ||
|
|
||
| ### Acceptance Criteria | ||
|
|
||
| - [ ] ... | ||
|
|
||
| --- | ||
|
|
||
| ## Task 2 — <name> | ||
|
|
||
| ... |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Define and persist task status.
Execution and post-execution workflows require completed and pending states, but the task schema does not define where those states live.
.windsurf/workflows/core/create-tasks.md#L26-L51: add a task-level status field to the template..windsurf/workflows/core/execute-task.md#L36-L39: update that field in the task-list file after execution.
📍 Affects 2 files
.windsurf/workflows/core/create-tasks.md#L26-L51(this comment).windsurf/workflows/core/execute-task.md#L36-L39
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.windsurf/workflows/core/create-tasks.md around lines 26 - 51, Define a
task-level status field in the Task template in
.windsurf/workflows/core/create-tasks.md, with the states needed by execution
and post-execution flows (pending and completed). Update the execution
instructions in .windsurf/workflows/core/execute-task.md to persist that status
in the task-list file after execution: mark the task completed on success and
retain or set it pending when unfinished.
| # /execute-task <number> | ||
|
|
||
| ## Purpose | ||
|
|
||
| Execute exactly one task from a task list. | ||
|
|
||
| ## Steps | ||
|
|
||
| 1. Read the spec at `docs/specs/<feature-name>.md`. | ||
| 2. Read the task list at `docs/specs/<feature-name>-tasks.md`. | ||
| 3. Identify the requested task number. | ||
| 4. Analyze the files involved. |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Make task selection feature-specific.
Task numbers are not globally unique across feature task lists.
.windsurf/workflows/core/execute-task.md#L5-L16: accept<feature-name>and<number>.docs/specs/README.md#L26-L27: document the feature-specific command..windsurf/workflows/core/execute-tasks.md#L5-L18: pass the feature name to each delegated task.
📍 Affects 3 files
.windsurf/workflows/core/execute-task.md#L5-L16(this comment)docs/specs/README.md#L26-L27.windsurf/workflows/core/execute-tasks.md#L5-L18
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.windsurf/workflows/core/execute-task.md around lines 5 - 16, Make task
selection feature-specific: in .windsurf/workflows/core/execute-task.md lines
5-16, accept both <feature-name> and <number> and use the feature name when
reading the corresponding spec and task list; in docs/specs/README.md lines
26-27, document the feature-specific command syntax; in
.windsurf/workflows/core/execute-tasks.md lines 5-18, pass the feature name
through to every delegated task invocation.
| - **FR6** O VJV deve ser calculado como: | ||
| `VJV = FIPE + ajusteConservação - descontoIdade ± ajusteQuilometragem` |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
Normalize the VJV percentage contract across the specification and utilities.
The current contract mixes monetary values with percentage coefficients and uses inconsistent signs for the age adjustment.
- docs/specs/ibav-mvp.md#L87-L88: define the multiplication by FIPE and state whether adjustments are signed.
- docs/specs/ibav-mvp-tasks.md#L49-L52: document the same sign convention as the implementation.
- shared/utils/depreciation.ts#L1-L3: return the documented sign and update the dependent test.
📍 Affects 3 files
docs/specs/ibav-mvp.md#L87-L88(this comment)docs/specs/ibav-mvp-tasks.md#L49-L52shared/utils/depreciation.ts#L1-L3
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/specs/ibav-mvp.md` around lines 87 - 88, Normalize the VJV percentage
contract across docs/specs/ibav-mvp.md lines 87-88 and
docs/specs/ibav-mvp-tasks.md lines 49-52 by defining adjustments as percentage
coefficients multiplied by FIPE and documenting the consistent age-adjustment
sign used by the implementation. Update the depreciation utility in
shared/utils/depreciation.ts lines 1-3 to return that documented sign, and
update its dependent test expectation accordingly.
| - **FR7** O IVB deve ser calculado como pontuação de 0 a 1000: | ||
| - base: 1000 | ||
| - idade: `-15` pontos/ano | ||
| - quilometragem acima: `-10` a cada 10.000 km | ||
| - conservação: `+30/0/-30/-80` |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
Reconcilie a fórmula do IVB com o valor de aceitação.
Para o exemplo de 2022 em 2026, a idade é 4, o excesso de quilometragem é 30.000 km e a conservação excelente vale +30. A fórmula escrita produz 1000 - 60 - 30 + 30 = 940, não 842. A mesma fórmula também permite 1030 pontos para um veículo novo em estado excelente. Defina os termos ausentes e aplique um limite explícito de 0 a 1000 antes de implementar calculateIvb.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/specs/ibav-mvp.md` around lines 89 - 93, Atualize o FR7 e a
implementação de calculateIvb para definir explicitamente os termos ausentes da
fórmula, incluindo a referência usada para calcular o excesso de quilometragem,
e reconciliar o cálculo com o valor de aceitação 842 para o veículo de 2022 em
2026. Após aplicar idade, quilometragem e conservação, limite explicitamente o
resultado ao intervalo de 0 a 1000, impedindo valores acima de 1000 ou abaixo de
0.
| - idade: `-15` pontos/ano | ||
| - quilometragem acima: `-10` a cada 10.000 km | ||
| - conservação: `+30/0/-30/-80` | ||
| - **FR8** O resultado deve exibir classificação IVB (Excelente, Muito Bom, Bom, Regular, Atenção). |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
Defina as faixas da classificação IVB.
A especificação lista os rótulos, mas não define intervalos nem regras para os limites. Sem essas faixas, calculateIvb não pode produzir uma classificação determinística para todos os resultados.
🧰 Tools
🪛 LanguageTool
[style] ~94-~94: “Muito Bom” é uma expressão prolixa. É preferível dizer “ótimo”.
Context: ...ve exibir classificação IVB (Excelente, Muito Bom, Bom, Regular, Atenção). - FR9 O co...
(PT_WORDINESS_REPLACE_MUITO_BOM)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/specs/ibav-mvp.md` at line 94, Atualize o requisito FR8 em conjunto com
calculateIvb para definir faixas numéricas explícitas para cada classificação
IVB e regras claras para valores nos limites, cobrindo todo o intervalo de
resultados de forma determinística.
| - **Unitários** em `test/utils/` com os cenários do `docs/docs.md`: | ||
| - `vjv.test.ts` — exemplo FIPE 80.000, 2022, 90.000 km, Excelente → R$ 74.800 | ||
| - `ivb.test.ts` — mesmo exemplo → 842 pontos |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Fixe o ano de referência dos exemplos.
Os valores de 74.800 e 842 dependem do ano atual. calculateAge usa new Date().getFullYear() por padrão; em 2027, o veículo de 2022 terá idade 5. Declare que os exemplos usam currentYear = 2026 e injete esse valor nos testes de VJV e IVB.
Also applies to: 184-185
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/specs/ibav-mvp.md` around lines 167 - 169, Atualize os exemplos de VJV e
IVB em `docs/specs/ibav-mvp.md` para declarar `currentYear = 2026` e injete esse
valor nos testes `vjv.test.ts` e `ivb.test.ts`, garantindo que os resultados de
R$ 74.800 e 842 permaneçam determinísticos.
| default: | ||
| return 0; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Rejeite condições inválidas em vez de tratá-las como bom.
O default retorna 0, o mesmo ajuste de bom. Quando um valor de query param ou formulário chega em runtime, uma condição inválida produz uma avaliação aparentemente válida. Valide a entrada antes da chamada ou lance um erro explícito.
Correção sugerida
default:
- return 0;
+ throw new RangeError(`Invalid vehicle condition: ${condition}`);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| default: | |
| return 0; | |
| default: | |
| throw new RangeError(`Invalid vehicle condition: ${condition}`); |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@shared/utils/condition.ts` around lines 13 - 14, Altere o branch default da
função de avaliação de condições para rejeitar valores inválidos, em vez de
retornar 0 como o ajuste de “bom”. Valide a entrada antes da chamada ou lance um
erro explícito no default, preservando os resultados existentes para condições
válidas.
Cria formulário principal para avaliação de veículos. Implementa lógica para cálculo de pontos e label do IBAV. Adiciona testes unitários para a funcionalidade de avaliação.
# Conflicts: # shared/utils/depreciation.ts
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (1)
.prettierignore (1)
71-72: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDo not exclude the entire
.githubdirectory from formatting checks without a replacement validation step.
package.json:31-32runs Prettier across the repository. This exclusion removes all GitHub Actions and repository configuration files fromformat:check. Ignore only specific incompatible files, or add a separate validation step for.githubfiles.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.prettierignore around lines 71 - 72, Update the .prettierignore entry for .github so the entire directory is not excluded from repository-wide format:check. Either remove the broad exclusion and ignore only incompatible files, or add a separate formatting validation step covering .github while preserving validation of the remaining repository.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/app.vue`:
- Around line 90-92: Update the USelect bound to form.condition in the app
template to pass conditionOptions through the items prop instead of options,
then add a behavioral test that selects a condition and verifies form.condition
updates without stubbing USelect.
- Around line 8-10: Update the currentYear initialization in app.vue to use
SSR-safe useState so the server-rendered year remains stable during hydration,
then pass that shared state value to both the VJV and IVB calculation functions
instead of recalculating the year independently.
In `@docs/specs/ibav-mvp.md`:
- Around line 135-142: Add the text language identifier to the opening fenced
block in the app directory tree documentation, preserving the existing tree
content and closing fence.
In `@shared/utils/vehicle-query.ts`:
- Around line 10-28: Update the query parsing logic around the fipe, year, and
km conversions to use complete-string Number() parsing and reject non-finite
values. Preserve FIPE as a finite numeric value, while requiring year and
mileage to also be finite integers; do not populate parsed fields for Infinity
or partial strings such as 2022abc. Add tests covering Infinity and partial
numeric inputs.
---
Nitpick comments:
In @.prettierignore:
- Around line 71-72: Update the .prettierignore entry for .github so the entire
directory is not excluded from repository-wide format:check. Either remove the
broad exclusion and ignore only incompatible files, or add a separate formatting
validation step covering .github while preserving validation of the remaining
repository.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 1a6953d8-bcdc-4aa1-a6f0-a38f85a69359
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (23)
.prettierignoreCONTRIBUTING.mdGOVERNANCE.mdREADME.mdSECURITY.mdapp/app.vuedocs/docs.mddocs/specs/ibav-mvp-tasks.mddocs/specs/ibav-mvp.mdnuxt.config.tspackage.jsonrenovate.jsonserver/api/hello.tsshared/utils/capitalize.tsshared/utils/depreciation.tsshared/utils/ivb.tsshared/utils/vehicle-query.tsshared/utils/vjv.tstest/app.test.tstest/utils/ivb.test.tstest/utils/vehicle-query.test.tstest/utils/vjv.test.tsvitest.config.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- shared/utils/depreciation.ts
- docs/specs/ibav-mvp-tasks.md
| <div> | ||
| <label for="condition" class="block text-sm font-medium">Conservação</label> | ||
| <USelect id="condition" v-model="form.condition" :options="conditionOptions" /> |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- app/app.vue ---'
sed -n '1,180p' app/app.vue
printf '%s\n' '--- package manifests ---'
find . -maxdepth 2 -type f \( -name 'package.json' -o -name 'package-lock.json' -o -name 'pnpm-lock.yaml' -o -name 'yarn.lock' \) -print
printf '%s\n' '--- USelect references and conditionOptions ---'
rg -n -C 4 'conditionOptions|<USelect|USelect' --glob '!node_modules' .Repository: 4sllan/IBAV
Length of output: 5993
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- package.json ---'
cat package.json
printf '%s\n' '--- Nuxt UI lockfile entries ---'
rg -n -C 3 '(^|/)`@nuxt/ui`|nuxt/ui|version: 4\.' pnpm-lock.yaml | head -120
printf '%s\n' '--- repository tests ---'
sed -n '1,140p' test/app.test.ts
printf '%s\n' '--- Nuxt UI Select v4 source/API references ---'
curl -L --fail --silent --show-error \
https://raw.githubusercontent.com/nuxt/ui/v4/src/runtime/components/Select.vue \
| sed -n '1,220p'Repository: 4sllan/IBAV
Length of output: 16644
🏁 Script executed:
#!/bin/bash
set -eu
tmp=$(mktemp)
trap 'rm -f "$tmp"' EXIT
curl -L --fail --silent --show-error \
https://raw.githubusercontent.com/nuxt/ui/v4/src/runtime/components/Select.vue > "$tmp"
printf '%s\n' '--- item consumption ---'
rg -n -C 5 'props\.items|items\)|items\?' "$tmp"
printf '%s\n' '--- options references ---'
if rg -n '\boptions\b' "$tmp"; then
exit 1
else
echo 'No options identifier in Select.vue'
fi
printf '%s\n' '--- source-level API check ---'
python3 - "$tmp" <<'PY'
import re
import sys
from pathlib import Path
source = Path(sys.argv[1]).read_text()
props_block = re.search(r'export interface SelectProps[\s\S]*?\n}\n', source)
assert props_block, "SelectProps declaration not found"
props = props_block.group(0)
assert re.search(r'\bitems\?\s*:', props), "items is not declared"
assert not re.search(r'\boptions\?\s*:', props), "options is unexpectedly declared"
consumers = re.findall(r'props\.items', source)
assert consumers, "props.items is not consumed"
assert not re.search(r'\bprops\.options\b', source), "props.options is consumed"
print(f"SelectProps declares items: yes")
print(f"SelectProps declares options: no")
print(f"props.items consumer references: {len(consumers)}")
print("props.options consumer references: 0")
PYRepository: 4sllan/IBAV
Length of output: 1237
🏁 Script executed:
#!/bin/bash
set -eu
tmp=$(mktemp)
trap 'rm -f "$tmp"' EXIT
curl -L --fail --silent --show-error \
https://raw.githubusercontent.com/nuxt/ui/v4/src/runtime/components/Select.vue > "$tmp"
printf '%s\n' '--- rendering path ---'
sed -n '215,275p' "$tmp"
printf '%s\n' '--- identifier-specific API check ---'
python3 - "$tmp" <<'PY'
import re
import sys
from pathlib import Path
source = Path(sys.argv[1]).read_text()
props_block = re.search(r'export interface SelectProps[\s\S]*?\n}\n', source)
assert props_block, "SelectProps declaration not found"
props = props_block.group(0)
assert re.search(r'(?m)^\s*items\?\s*:', props), "items is not declared"
assert not re.search(r'(?m)^\s*options\?\s*:', props), "options is unexpectedly declared"
assert re.search(r'\bprops\.items\b', source), "props.items is not consumed"
assert not re.search(r'\bprops\.options\b', source), "props.options is consumed"
print("SelectProps declares items: yes")
print("SelectProps declares options: no")
print(f"props.items references: {len(re.findall(r'\\bprops\\.items\\b', source))}")
print("props.options references: 0")
PYRepository: 4sllan/IBAV
Length of output: 2406
🏁 Script executed:
#!/bin/bash
set -eu
tmp=$(mktemp)
trap 'rm -f "$tmp"' EXIT
curl -L --fail --silent --show-error \
https://raw.githubusercontent.com/nuxt/ui/v4/src/runtime/components/Select.vue > "$tmp"
python3 - "$tmp" <<'PY'
import re
import sys
from pathlib import Path
source = Path(sys.argv[1]).read_text()
props_block = re.search(r'export interface SelectProps[\s\S]*?\n}\n', source)
assert props_block, "SelectProps declaration not found"
props = props_block.group(0)
assert re.search(r'(?m)^\s*items\?\s*:', props), "items is not declared"
assert not re.search(r'(?m)^\s*options\?\s*:', props), "options is unexpectedly declared"
item_refs = re.findall(r'\bprops\.items\b', source)
assert item_refs, "props.items is not consumed"
assert not re.search(r'\bprops\.options\b', source), "props.options is consumed"
print("SelectProps declares items: yes")
print("SelectProps declares options: no")
print("props.items references:", len(item_refs))
print("props.options references: 0")
PYRepository: 4sllan/IBAV
Length of output: 268
Pass the condition choices through items. Nuxt UI 4.10.0 consumes items, not options, so users cannot change form.condition. Replace :options with :items and add a behavioral selection test without stubbing USelect.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@app/app.vue` around lines 90 - 92, Update the USelect bound to form.condition
in the app template to pass conditionOptions through the items prop instead of
options, then add a behavioral test that selects a condition and verifies
form.condition updates without stubbing USelect.
| ``` | ||
| app/ | ||
| ├── components/ | ||
| ├── composables/ | ||
| ├── pages/ | ||
| ├── utils/ | ||
| └── ... | ||
| ``` |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Set a language for the fenced block.
Add text to the opening fence. This resolves the reported MD040 warning.
🧰 Tools
🪛 markdownlint-cli2 (0.23.2)
[warning] 135-135: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/specs/ibav-mvp.md` around lines 135 - 142, Add the text language
identifier to the opening fenced block in the app directory tree documentation,
preserving the existing tree content and closing fence.
Source: Linters/SAST tools
| if (typeof query.fipe === 'string') { | ||
| const value = Number.parseFloat(query.fipe); | ||
| if (!Number.isNaN(value)) { | ||
| parsed.fipeValue = value; | ||
| } | ||
| } | ||
|
|
||
| if (typeof query.year === 'string') { | ||
| const value = Number.parseInt(query.year, 10); | ||
| if (!Number.isNaN(value)) { | ||
| parsed.year = value; | ||
| } | ||
| } | ||
|
|
||
| if (typeof query.km === 'string') { | ||
| const value = Number.parseInt(query.km, 10); | ||
| if (!Number.isNaN(value)) { | ||
| parsed.mileage = value; | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Reject non-finite and partial numeric query values.
parseFloat('Infinity') passes the current check. The form then accepts an infinite FIPE value and renders an invalid monetary result. parseInt also accepts partial values such as 2022abc.
Parse complete numeric strings with Number(). Require finite values. Require integer values for year and km. Add tests for Infinity and partial numeric strings.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@shared/utils/vehicle-query.ts` around lines 10 - 28, Update the query parsing
logic around the fipe, year, and km conversions to use complete-string Number()
parsing and reject non-finite values. Preserve FIPE as a finite numeric value,
while requiring year and mileage to also be finite integers; do not populate
parsed fields for Infinity or partial strings such as 2022abc. Add tests
covering Infinity and partial numeric inputs.
Adiciona novos arquivos TypeScript para lidar com cálculo de condição, depreciação, quilometragem e tipos de avaliação de veículos. Inclui testes unitários abrangentes para as novas utilidades. Cria extensa documentação sobre especificações do MVP e regras de arquitetura e qualidade.
Summary by CodeRabbit
New Features
Documentation
Tests