Skip to content

feat(core): Adiciona funcionalidades e documentação de valuation - #6

Open
4sllan wants to merge 8 commits into
masterfrom
feat/funding
Open

feat(core): Adiciona funcionalidades e documentação de valuation#6
4sllan wants to merge 8 commits into
masterfrom
feat/funding

Conversation

@4sllan

@4sllan 4sllan commented Aug 11, 2026

Copy link
Copy Markdown
Owner

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

    • Added a vehicle valuation interface with FIPE value, year, mileage, and condition inputs.
    • Added VJV and IVB calculations with valuation adjustments and Portuguese classifications.
    • Added validation, Brazilian currency formatting, conditional results, and URL query-parameter synchronization.
  • Documentation

    • Added architecture, quality, product-planning, specification, task-execution, testing, and release guidance.
  • Tests

    • Added automated coverage for valuation calculations, input parsing, query synchronization, and the valuation interface.

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.
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d6f9413e-a08b-4358-8dde-535a5caa63b7

📥 Commits

Reviewing files that changed from the base of the PR and between a046a50 and d26f1e7.

📒 Files selected for processing (1)
  • app/app.vue
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/app.vue

📝 Walkthrough

Walkthrough

Added IBAV project rules, Windsurf workflows, MVP specifications, valuation types, calculation utilities, query synchronization, a Nuxt valuation interface, and Vitest coverage.

Changes

IBAV MVP

Layer / File(s) Summary
Project rules and validation
.windsurf/rules/*, .prettierignore
Added Nuxt, TypeScript, project, quality, formatting, and sequential-execution rules.
Planning and task workflows
.windsurf/workflows/*, docs/specs/README.md
Added workflows for analysis, planning, specification creation, task generation, execution, validation, testing, review, and release preparation.
MVP specification and implementation plan
docs/specs/ibav-mvp.md, docs/specs/ibav-mvp-tasks.md
Defined valuation formulas, data flow, interfaces, acceptance criteria, risks, and ordered implementation tasks.
Valuation engine
shared/types/valuation.ts, shared/utils/*, test/utils/*
Added valuation types and calculations for vehicle age, depreciation, mileage, condition, VJV, and IVB. Added unit tests.
Valuation interface and query synchronization
app/app.vue, shared/utils/vehicle-query.ts, test/app.test.ts, test/utils/vehicle-query.test.ts
Replaced the default Nuxt page with a vehicle valuation form. Added validation, result rendering, query loading, URL updates, and component tests.
Supporting configuration and documentation
nuxt.config.ts, vitest.config.ts, package.json, docs/docs.md, README.md, CONTRIBUTING.md, GOVERNANCE.md, SECURITY.md, server/api/hello.ts, shared/utils/capitalize.ts, renovate.json
Enabled Nuxt UI, added Vitest coverage support and the #shared alias, and applied documentation and formatting updates.

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
Loading

Possibly related PRs

  • 4sllan/IBAV#1: Shares formatting, package, and Vitest configuration changes.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed O título resume corretamente as principais mudanças: novas funcionalidades de valuation e documentação associada.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/funding

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 12

🧹 Nitpick comments (3)
.windsurf/rules/architecture.md (1)

73-76: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Include shared/utils/ in the utility-location rule.

This PR places shared valuation utilities in shared/utils/, but this rule permits only app/utils/ and utils/. Align the rule with the existing shared/ 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 win

Handle 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 win

Restrinja ivbLabel às classificações suportadas.

A especificação define um conjunto finito de rótulos, mas string permite qualquer valor. Exporte um tipo como IvbLabel e use-o em ValuationResult e no retorno de 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 `@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

📥 Commits

Reviewing files that changed from the base of the PR and between 7c710f9 and c941608.

📒 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.md
  • docs/specs/README.md
  • docs/specs/ibav-mvp-tasks.md
  • docs/specs/ibav-mvp.md
  • shared/types/valuation.ts
  • shared/utils/condition.ts
  • shared/utils/depreciation.ts
  • shared/utils/mileage.ts
  • shared/utils/vehicle.ts
  • test/utils/condition.test.ts
  • test/utils/depreciation.test.ts
  • test/utils/mileage.test.ts
  • test/utils/vehicle.test.ts

Comment on lines +5 to +19
# /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`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 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.

Comment on lines +21 to +67
## 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`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ 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 initial Draft status and an explicit approval transition.
  • .windsurf/workflows/core/create-tasks.md#L13-L24: require Approved before 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.

Comment on lines +15 to +24
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`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ 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.

Comment on lines +26 to +51
## Task template

```markdown
# Tasks

## Task 1 — <name>

### Goal

### Files

### Implementation

### Tests

### Validation

### Acceptance Criteria

- [ ] ...

---

## Task 2 — <name>

...

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ 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.

Comment on lines +5 to +16
# /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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ 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.

Comment thread docs/specs/ibav-mvp.md
Comment on lines +87 to +88
- **FR6** O VJV deve ser calculado como:
`VJV = FIPE + ajusteConservação - descontoIdade ± ajusteQuilometragem`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ 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-L52
  • shared/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.

Comment thread docs/specs/ibav-mvp.md
Comment on lines +89 to +93
- **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`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 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.

Comment thread docs/specs/ibav-mvp.md
- 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).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ 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.

Comment thread docs/specs/ibav-mvp.md
Comment on lines +167 to +169
- **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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 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.

Comment thread shared/utils/condition.ts
Comment on lines +13 to +14
default:
return 0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 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.

Suggested change
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.

aslan.gama added 5 commits August 11, 2026 12:55
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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (1)
.prettierignore (1)

71-72: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Do not exclude the entire .github directory from formatting checks without a replacement validation step.

package.json:31-32 runs Prettier across the repository. This exclusion removes all GitHub Actions and repository configuration files from format:check. Ignore only specific incompatible files, or add a separate validation step for .github files.

🤖 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

📥 Commits

Reviewing files that changed from the base of the PR and between c941608 and a046a50.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (23)
  • .prettierignore
  • CONTRIBUTING.md
  • GOVERNANCE.md
  • README.md
  • SECURITY.md
  • app/app.vue
  • docs/docs.md
  • docs/specs/ibav-mvp-tasks.md
  • docs/specs/ibav-mvp.md
  • nuxt.config.ts
  • package.json
  • renovate.json
  • server/api/hello.ts
  • shared/utils/capitalize.ts
  • shared/utils/depreciation.ts
  • shared/utils/ivb.ts
  • shared/utils/vehicle-query.ts
  • shared/utils/vjv.ts
  • test/app.test.ts
  • test/utils/ivb.test.ts
  • test/utils/vehicle-query.test.ts
  • test/utils/vjv.test.ts
  • vitest.config.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • shared/utils/depreciation.ts
  • docs/specs/ibav-mvp-tasks.md

Comment thread app/app.vue Outdated
Comment thread app/app.vue
Comment on lines +90 to +92
<div>
<label for="condition" class="block text-sm font-medium">Conservação</label>
<USelect id="condition" v-model="form.condition" :options="conditionOptions" />

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 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")
PY

Repository: 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")
PY

Repository: 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")
PY

Repository: 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.

Comment thread docs/specs/ibav-mvp.md
Comment on lines +135 to +142
```
app/
├── components/
├── composables/
├── pages/
├── utils/
└── ...
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 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

Comment on lines +10 to +28
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;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant