Skip to content

fix(seo): add canonical link to docs.html#156

Merged
GeiserX merged 4 commits intomainfrom
fix/canonical-docs
May 6, 2026
Merged

fix(seo): add canonical link to docs.html#156
GeiserX merged 4 commits intomainfrom
fix/canonical-docs

Conversation

@GeiserX
Copy link
Copy Markdown
Owner

@GeiserX GeiserX commented May 6, 2026

Summary

  • Add <link rel="canonical"> to docs.html pointing to https://declarenta.com/docs.html
  • Fixes Google Search Console "Duplicada: el usuario no ha indicado ninguna versión canónica" warning

Context

The 3 "Página con redirección" entries are GitHub Pages mirror URLs redirecting to declarenta.com — expected behavior, no fix needed.

Summary by CodeRabbit

  • New Features

    • Added support for importing Revolut XLSX files in multiple formats.
    • Enhanced wash-sale detection to use symbol-based matching when ISIN data is unavailable.
  • Tests

    • Added comprehensive test coverage for Revolut transaction-log parsing and wash-sale edge cases.

GeiserX added 4 commits May 3, 2026 11:35
…ades)

Revolut's Trading Account Statement has two XLSX formats: closed-positions
summary (existing) and transaction log (Date/Ticker/Type/Quantity/Price per
share/Total Amount/Currency/FX Rate). The transaction log is what users
actually get from the Revolut app, and the parser was rejecting it entirely.

- Add transaction-log detection in detectRevolutXlsx (both formats now detected)
- Parse BUY-MARKET, BUY-LIMIT, SELL-MARKET, SELL-LIMIT as individual trades
- Parse "CCY amount" strings (e.g. "EUR 15.61", "USD -217.14")
- Parse ISO 8601 timestamps with ms/μs precision
- Extract CASH TOP-UP / CASH WITHDRAWAL as cashTransactions
- Infer open positions from unmatched buys (enables Modelo 720/D-6)
- Update text-based detect() for transaction-log headers
- 35 new tests (78 total), anonymized fixture from real user file
- Add Math.abs + isFinite guard on transaction-log quantity to prevent
  negative and Infinity propagation
- Cap sell quantity at net position to prevent negative position state
- Tighten hasTxnLogHeaders to require "price per share" column
- Add symbol-based fallback in wash-sale homogeneousKey() for trades
  without ISINs (Revolut, Lightyear, etc.)
- Add Revolut XLSX detection in CLI before eToro
- Add 9 edge case tests (BUY-LIMIT, negative qty, sell overflow,
  Infinity, corrupted XLSX, empty sheet, wash-sale symbol fallback)
Address CodeRabbit nitpick: replace Number with Decimal.js for
netQty, totalCost, and costPerUnit in open-position inference to
prevent floating-point drift per project financial precision rules.
Google Search Console flagged docs.html as "Duplicada: el usuario
no ha indicado ninguna versión canónica". Adding the canonical URL
tells Google this is the authoritative version.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 303f83f5-aa5e-4258-a7b2-1190176b2d06

📥 Commits

Reviewing files that changed from the base of the PR and between 80e584e and 6de593e.

⛔ Files ignored due to path filters (1)
  • tests/fixtures/revolut-txnlog-sample.xlsx is excluded by !**/*.xlsx
📒 Files selected for processing (6)
  • src/cli/index.ts
  • src/engine/wash-sale.ts
  • src/parsers/revolut.ts
  • src/web/docs.html
  • tests/engine/wash-sale.test.ts
  • tests/parsers/revolut.test.ts

📝 Walkthrough

Walkthrough

Adds Revolut transaction-log format XLSX parsing with multi-format detection alongside existing closed-positions support. Enhances wash-sale detection to use symbol-based grouping when ISIN is missing. Adds canonical link to docs page.

Changes

Revolut Multi-Format XLSX Parsing

Layer / File(s) Summary
Data Models & Type Guards
src/parsers/revolut.ts
New transaction-log format constants (TXN_DATE_HEADERS, TXN_TYPE_BUY/SELL, etc.), TxnLogColumns interface, and detection helpers (hasTxnLogHeaders, findTxnLogColumns).
Date & Currency Parsing
src/parsers/revolut.ts
Enhanced parseRevolutDate to handle ISO 8601 timestamps; new parseCcyAmount utility to extract currency and amount from strings like "EUR 15.61".
Core Parser Implementation
src/parsers/revolut.ts
New parseTransactionLog function parses transaction-log XLSX into trades, cash transactions, and open positions via position-accumulation logic. Updated parseRevolutXlsx to detect format and dispatch to appropriate parser (transaction-log vs. closed-positions).
Detection Logic
src/parsers/revolut.ts
Updated detectRevolutXlsx and revolutParser.detect to recognize both closed-positions and transaction-log formats via header introspection.
CLI Integration
src/cli/index.ts
Added Revolut XLSX detection and parsing block in parseAndMerge with broker naming and logging; adjusted detection order to check Revolut before eToro.
Tests
tests/parsers/revolut.test.ts
Comprehensive transaction-log test suite covering detection, date/currency parsing, BUY/SELL trades, cash flows, open positions, edge cases (NaN/Infinity/blanks), and format coexistence with legacy closed-positions.

Wash-Sale Symbol Fallback

Layer / File(s) Summary
Core Logic
src/engine/wash-sale.ts
homogeneousKey now returns assetCategory:symbol (uppercased) when ISIN is absent, enabling wash-sale detection for non-ISIN assets grouped by category and symbol.
Tests
tests/engine/wash-sale.test.ts
Added three tests: empty-ISIN trades block losses via symbol fallback; empty-ISIN trades with mismatched symbols do not match; CRYPTO asset category enforces 1-year window.

Canonical Link

Layer / File(s) Summary
HTML Metadata
src/web/docs.html
Added canonical link tag pointing to https://declarenta.com/docs.html.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • GeiserX/DeclaRenta#111: Implements Revolut XLSX broker parser with parseRevolutXlsx and detectRevolutXlsx functions.
  • GeiserX/DeclaRenta#117: Exports revolutParser and adjusts broker-detection ordering in the parser registry.
  • GeiserX/DeclaRenta#21: Modifies wash-sale lot-keying logic to use assetCategory:symbol fallback when ISIN is missing.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/canonical-docs

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 and usage tips.

@GeiserX GeiserX merged commit 670e39c into main May 6, 2026
2 of 3 checks passed
@GeiserX GeiserX deleted the fix/canonical-docs branch May 6, 2026 06:48
@codecov
Copy link
Copy Markdown

codecov Bot commented May 6, 2026

Codecov Report

❌ Patch coverage is 97.29730% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.62%. Comparing base (d805714) to head (6de593e).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
src/parsers/revolut.ts 97.28% 6 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #156      +/-   ##
==========================================
+ Coverage   97.61%   97.62%   +0.01%     
==========================================
  Files          37       37              
  Lines        7380     7585     +205     
  Branches     1499     1551      +52     
==========================================
+ Hits         7204     7405     +201     
- Misses        175      179       +4     
  Partials        1        1              
Files with missing lines Coverage Δ
src/engine/wash-sale.ts 94.00% <100.00%> (+0.12%) ⬆️
src/parsers/revolut.ts 98.48% <97.28%> (-0.48%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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