Skip to content

Completed Milestones - archive

Milestones of the releases before 11.0, moved out of completed_milestones.md on 20-10-2026 to keep that file short. Newest first.

Post-10.12 development — October 2026 (shipped in 10.13)

  • [x] Release 10.13 review fixes (from /code-review medium on PR #55 and the release verifactu-compliance-auditor run): (1) Añadir nuevas prendas checked for paid garments only at search time while the number stayed editable: retyping an already-sent ticket after searching an unpaid one would add a paid garment to it and - since this release - submit invoice <n> again; a duplicate rejection would then have rewritten the sent rows to ERROR, wiping their CSV / payload / Huella (auditor: blocking). Now the save is refused unless the number is the one searched, the paid check is repeated at save, and updateTicketVerifactuFields never rewrites a row already ENVIADA / ANULADA / RECTIFICADA. (2) The AEAT export filtered dates row by row before grouping, so a legacy invoice paid over several days appeared in two periods with partial amounts; it now filters on the event's earliest fecha_pago / latest fecha_anulacion (HAVING), the latter by date rather than text. (3) A ticket with several cancelled payment events merged into one regularisation kept whichever row's payment date came first, so the period ticket count depended on row order; it keeps the latest. (4) When the reception-date retry of a cancellation also failed, the first (real) rejection was lost; the dialog now shows both. Also kEarliestFechaPago reuses kFechaPagoIso, and three doc drifts were fixed (AddGarment submit path, Req. 1 insert paths, NETWORK_ERROR at save stays PENDIENTE). Each fix has a test that fails without it. Smaller findings were filed in the "Verifactu review follow-ups" tracker row.
  • [x] Añadir nuevas prendas: a garment added as paid is submitted to AEAT at once: the open item asked whether a paid garment added with AddGarment could collide with an invoice already registered under seq 0. It cannot: AddGarment refuses any ticket that already has a paid garment, so such a garment is always the ticket's first payment event (seq 0, InvoiceID = ticket number, its payment date), exactly what the startup recovery would submit. The real gap was timing: nothing submitted it when saved; it sat PENDIENTE until the next startup's recovery dialog and an operator's "Reintentar". Now AddGarment emits paidGarmentSaved after inserting a paid row and MainWindow submits it through verifactuSubmitInvoice like a paid ticket on save; the reply is applied by the usual handler and an unanswered submission stays PENDIENTE for the recovery. Test: test_e2e_app::test_addGarmentPaid_submittedAtOnce (one Create with the ticket number, today's date and the garment's total; row ENVIADA in seq 0; the unpaid garment untouched); it fails without the connection. Files: src/add_garment/add_garment.{h,cpp}, src/app/mainwindow.cpp, tests/test_e2e_app.cpp, docs/modules/add_garment.md.
  • [x] AEAT's cancellation record is stored and exported: the /Cancel reply carries AEAT's own cancellation record in Return.Xml (parsed into VerifactuResult::rawXml like a /Create reply), but it was thrown away, so the Hacienda export could only show a cancellation as a date on the original invoice. New column ingresos.verifactu_cancel_xml (added by migrateDatabase, hidden in Listado and Recogida); markInvoiceSeqCancelled takes the reply's XML and stores it on the cancelled event's paid rows (a later call without one never erases it). Exportar registros AEAT now writes a <Registro> in the period an invoice was issued and, for a cancellation, an <Anulacion invoiceId fechaPago fechaAnulacion> in the period it was made with that record inlined (sinPayload="1" for cancellations made before this change); the original invoice is no longer repeated in the cancellation's period. (The envelope element is Anulacion, not RegistroAnulacion, because AEAT's own payload root has that name.) A substituted invoice gets no <Anulacion>: its rectificativa is a <Registro> of its own. Tests: test_markInvoiceSeqCancelled_stampsTheCancelledEvent (stored, never erased), test_cancelInvoice_markedAnulada (the dialog stores the reply), test_aeatExport_oneRegistroPerPaymentEvent (issue vs cancellation periods); the dialog test fails if the XML is not passed.
  • [x] Anular factura sends each invoice's own date: CancelInvoiceDialog sent every payment event's cancellation with InvoiceDate = the ticket's earliest reception date, but AEAT keys an invoice on (emisor, InvoiceID, FechaExpedicion) and every submission path issues it under the payment date (fecha_pago). For a ticket paid at pickup on a later day (the usual case) or any partial-payment event <n>-<seq>, the cancellation named a date AEAT never registered, and would probably have been rejected as not existing. Found by the compliance review of the AEAT export fix. Now each event's date comes from verifactuEventFor (the same rule as retry and query) and is shown in a new "Fecha factura" column; an event without a readable payment date is refused locally with a pointer to "Consultar en AEAT". Following the compliance review: the earliest payment date is now taken by date, not as dd-MM-yyyy text (MIN over the text put 05-03 before 28-01), in verifactuEventFor, the startup recovery and the AEAT export alike; this matters for pre-10.9 seq-0 invoices paid garment by garment on different days, which AEAT registered under the first payment. And because 8.0-10.8 resubmissions used the reception date, a rejected cancellation of a seq-0 invoice is retried once with the reception date (only one invoice can have that InvoiceID, so it cannot reach another). Tests: test_cancelInvoice_markedAnulada (ticket received 20 days ago, paid 10 days ago and partly paid again today: each Cancel's InvoiceID and date, both events ANULADA), test_cancelInvoice_olderDataDates (earliest date, the reception-date retry, the local refusal), test_verifactuEventFor (date vs text order); each fails with the old behaviour. The review also raised an unconfirmed AddGarment / seq-0 question, filed as an open item. Files: src/app/cancelinvoicedialog.{h,cpp}, src/sql_lite/sql_lite.cpp, tests/test_e2e_app.cpp, tests/test_sql_lite.cpp.
  • [x] Exportar registros AEAT: one record per invoice (payment event): found by the dead-code pass. The Hacienda export (Verifactu Req. 7, Art. 14.1 RD 1007/2023) wrote one <Registro> per garment row, so a multi-garment invoice repeated its XML payload once per garment. It used the bare n_recibo, so the partial-payment invoices <n>-<seq> could not be told apart, filtered by reception date instead of the date the invoice was issued under, and wrote one garment's amount. Now sql_lite::aeatExportRecords returns one record per paid (n_recibo, verifactu_invoice_seq) event with a stored payload (any estado: AEAT keeps cancelled and rectified invoices), filtered by fecha_pago, with the literal InvoiceID, the event total, CSV and estado. The XML writer moved out of the menu slot into src/app/aeatexport.{h,cpp} (writeAeatExportXml). The <Registro> attributes are now nRecibo, invoiceId, fechaPago, importe, csv, estado, plus fechaAnulacion, rectifica / tipoRectificacion and sinPayload when they apply. Following the compliance review, the export also includes invoices known only by their CSV (recovered with "Consultar en AEAT", which stores no payload) and invoices from an earlier period cancelled inside the range, never merges two submissions sharing a seq (grouped by CSV too), and reports a failed query or write instead of producing an empty file. The review also found that Anular factura sends the reception date rather than the invoice's payment date, and that the cancel reply's XML is not stored; both filed as open items. Tests: test_sql_lite::test_aeatExportRecords_onePerPaymentEvent (grouping, totals, legacy id, CSV-only invoice, cancellation in the period, rectificativa link, unpaid / unconfirmed / out-of-range rows excluded, inclusive range) and test_e2e_app::test_aeatExport_oneRegistroPerPaymentEvent (records + writer as the menu runs them; the document parses, each payload appears once). Both fail with the old per-row grouping, without the CSV-only case, and without the cancellation-date case; the unit test also fails with the reception-date filter.
  • [x] Dead-code cleanup pass; dead-code report and guidelines-audit doc retired: ran the dead-code-finder agent over src/ and removed what production never reaches. Removed: Recogida's per-garment payment writes (updateDb PAY_YES / PAY_NO, unreachable because pb_payment is never enabled; payments only go through PayDialog) with hasPendingSubmit and the then test-only sql_lite::updateTicketPayment / ticketVerifactuEstado and their tests; PayDialog::onSelectionChanged (never connected); VerifactuInvoice getters with no caller and the never-set buyer fields (their BuyerID JSON branch could not fire; isValid still refuses any type other than F2 / R1-R5, same message); VerifactuTaxItem's unused TaxType and never-set description; VerifactuResult::isError and the never-read rawResponse; EscPosBuilder::raw; the date-range filter of MySortFilterProxyModel (never wired); the write side of FilterWidget's two properties; RecogPrendas::columnClickedCell and RectifyInvoiceDialog::m_loadedCSV (written, never read). VerifactuManager::getValidationUrl / getLastError and BackupManager::backupDirectory became private (internal callers only). Fixed on the way: RecogPrendas::rowClickedCell was uninitialised and could be read before any row was clicked (now -1); a comment in verifactutypes.h sat above the wrong declaration. Kept on purpose and now listed in the agent's exclusions: the test hooks (setEndpointOverride, setOpenGeneratedReports, loadFrom, setBackupEnabled, the DPAPI wrappers, EscPosBuilder::columns). Payloads for the invoices the app issues (F2, R1-R5) are unchanged; checked by the verifactu-compliance-auditor. The pass also found that Exportar registros AEAT is not grouped by payment event; that is a real bug, filed as an open tracker item rather than folded into the cleanup. docs/dead_code_report.md is gone (all its items are resolved; the agent now reports to the main agent and no snapshot is kept). Likewise docs/coding_guidelines_audit.md moved into the skill as .claude/skills/coding-guidelines/audit.md: the grep checklist, the severity tiers and the accepted Tier 2 / Tier 3 exceptions (without line numbers); the dated findings snapshot was dropped, since open items live in the tracker. The guidelines-auditor agent, the release skill, INDEX, README, ai_agent_instructions and the MkDocs nav point to the new place.
  • [x] E2E coverage: Recogida late-reply adoption and the AEAT comparison dialog: these two screens were checked only by the smoke test's real-AEAT blocks, which were dropped when the smoke test stopped contacting AEAT. Their logic was already covered; Recogida's own wiring was not: taking over PayDialog's in-flight request, chaining a duplicate rejection into the AEAT query, the comparison dialog and its Actualizar rules, and which Verifactu buttons each row offers. test_e2e_app gains three scenarios on the real RecogPrendas with the fake server. (1) Pay-all → Cobrar with a Create reply delayed 7 s: PayDialog gives up at 5 s leaving PENDIENTE, then the late reply makes the row ENVIADA with its CSV and the status bar offers the factura with QR. (2) An ERROR row → Reintentar answered "duplicado" → automatic query → comparison dialog (match, AEAT's CSV, Actualizar enabled) → adopt → ENVIADA with AEAT's CSV. (3) Consultar en AEAT when nothing may be adopted (not found, different amount, already ENVIADA = informational), plus the button rules (Reintentar only on ERROR, neither on an unpaid row). New tests/support/modaldriver.h operates dialogs opened with exec() (one-shot match + action per dialog); stable object names were added to the Verifactu and comparison dialogs in recog_prendas.cpp, with no behaviour change. Four mutations were each caught (no takeover of the request, no query after a duplicate, Actualizar enabled on any found record, Consultar on unpaid rows). The suite now takes about 15 s. The smoke test's "not covered" note and the tracker row are gone.
  • [x] Smoke test rewritten: shorter, and it never contacts AEAT: the old checklist sent smoke tickets to the real IreneSolutions endpoint with whatever service key was configured. TEST_ENDPOINT and PROD_ENDPOINT are the same URL, so with the shop's key they landed in the shop's own AEAT records. That happened in the blocks marked registers at AEAT and, silently, in any paid save or Cobrar made while online. Their numbers would also collide with real tickets the shop issues later, because the copied DB's next number is the real one. Now the setup backs up the settings, empties ingresos / gastos in the backup copy, and points the settings at the copy with an empty verifactu.service_key, so every submit / cancel / rectify / QR / query path is skipped locally. The first launch must show "No se pudo inicializar Verifactu", or the run stops. A log check (no Submitting invoice / Server response, etc.) repeats at the end, and the settings are restored afterwards. Seeds are five integer-numbered tickets plus one gasto, chosen so the Q3 / Q4 2026 reports have known figures, a regularisation included. Everything the e2e bench and unit suites check by themselves was dropped: migrations, saves, voids, cancel / rectify guards, recovery listing, offline PENDIENTE, accounting totals. What is left is start-up on a real schema, wiring, printing, PDF rendering, the Listado lock, backup, language and installer: 5 blocks and 25 checks instead of 7 blocks and 48. test_e2e_app gained test_cancelAndRectify_offeredOnlyForSentInvoices (Anular disabled on PENDIENTE, unpaid tickets refused) to replace two manual rows. The dropped real-AEAT screens (Recogida late-reply adoption, the comparison dialog) became an open tracker item. The release skill and the production-switch row now say the smoke test never contacts AEAT. Files: docs/testing/smoke_test.md, tests/test_e2e_app.cpp, docs/testing/e2e.md, docs/testing/README.md, .claude/skills/release/SKILL.md, docs/progress_tracker.md.
  • [x] Application-level test bench, phase 2: MainWindow, the app dialogs, Imprimir and Contabilidad at screen level: phase 1 covered PayDialog and the Verifactu client; the app's own windows were compiled into the executable and could only be checked by hand. src/app/ now builds a laideal_app static library (MainWindow + Cancel / Rectify / Void / Pending dialogs) and laideal.exe is just main.cpp + resources linking it (same exe path, installer and CI unchanged). New suite tests/test_e2e_app.cpp (nine scenarios, ~6 s, every CI run) drives the windows as an operator would and asserts on the DB, on the requests the fake AEAT received and on the pop-ups: MainWindow save of an unpaid and a paid ticket (incl. the 3 s print-after-submit wait and the reqId correlation) and the no-client refusal; Anular prendas; Anular factura and its closed-quarter refusal; Rectificar por sustitución with the before-payment and closed-quarter date refusals; the startup Envíos pendientes recovery and its retry; an Imprimir reprint of one payment event (paid rows of that seq only, QR requested under its InvoiceID and payment date, none once ANULADA); and Contabilidad Trimestral generate + lock + revert writing the PDF. Each scenario was proven against a mutated build. Test seams added: Contabilidad::setOpenGeneratedReports(false) (skips opening the PDF viewer), stable object names on the dialog widgets, ModalAutoCloser answers Yes/No confirmations with Yes, the fake server's GetQrCode returns a real image, and a shared tests/support/e2efixture.h. Same safety rules as phase 1: local fake server only (the suite refuses to start otherwise), throwaway DB and settings. This absorbs the two parked Backlog "Test coverage" rows (MainWindow async-AEAT wiring, Imprimir seq filter / QR gating), and retires smoke-test checks A5–A7, B1 and G10. See docs/testing/e2e.md.
  • [x] Testing documentation moved to docs/testing/: requested before phase 2 of the test bench, so test knowledge sits in one organised place instead of a long section of architecture.md. It now has four pages. README.md covers the three layers (unit suites, end-to-end bench, manual smoke test), running locally and in CI (JUnit results, the step-summary script), the conventions (real libs, pure cores, throwaway state only, application type, prove each test can fail, 120 s timeouts, the UAC naming rule), the patterns table, adding a suite and the CI toolchain. unit_suites.md has every suite in an index table and then grouped by module, refreshed for this cycle's tests: listings, regularisations, migrations, ticket counts, language and IVA. e2e.md has the bench's safety rules, FakeVerifactuServer / ModalAutoCloser usage, the scenario table, how to add a scenario and the phase 2 plan. smoke_test.md was moved from docs/ with git mv. architecture.md keeps a short Testing section that links there. All live references were updated: the test-engineer agent, the /tackle-issue and /release skills, ai_agent_instructions.md, INDEX.md, docs/README.md, the tracker, .gitignore. The MkDocs site gains a Testing section, plus the previously unlisted Completed milestones page. docs.yml needed no change, since it already triggers on docs/** and mkdocs.yml, and the site was built locally with no new warnings.
  • [x] Application-level test bench, phase 1: fake Verifactu server + end-to-end payment / AEAT scenarios: the unit suites tested logic and sql_lite in isolation, while the flows across objects were covered only by the manual smoke test: payment -> AEAT submission -> reply -> estado/QR -> reconciliation -> Contabilidad. The user chose these design points. Seam: the in-process VerifactuConfig::setEndpointOverride(baseUrl) redirects every endpoint (Create / Cancel / GetFilteredList / GetQrCode). Only code linked into a test can call it, so no setting, environment variable or registry value can divert real invoices. It also matters because TESTING and PRODUCTION are the same hard-coded URL, so there is no real sandbox. tests/support/FakeVerifactuServer is a minimal HTTP/1.1 server on 127.0.0.1 (random port). It records every request (endpoint + JSON) and answers with a queued scripted reply or a default "accepted" reply (CSV, ValidationUrl, Huella XML, a real PNG QR). Replies can be delayed or dropped, and the builders follow the captured fixtures in test_verifactu_response. tests/support/ModalAutoCloser closes and records any QMessageBox (user choice: auto-dismiss and record), so a pop-up never blocks the run headless. test_e2e_verifactu (runs on every CI run, offscreen, about 9 s) drives the real PayDialog as Cobrar does, with the real client and network stack, against a seeded throwaway DB and a throwaway settings file with printing off. It never touches the real database, the user's settings or the AEAT, and refuses to start unless the endpoint is local. Six scenarios: accepted; two payment events as invoices n and n-1; no reply within 5 s -> PENDIENTE -> retry answered "already exists" -> the queried CSV is adopted (ENVIADA); AEAT rejection -> ERROR; a payment into a closed quarter is refused, nothing sent; paid Q1 -> Q1 closed -> cancelled in Q2 -> Q1 unchanged, Q2 regularised, the remainder charged as n-1. The last scenario immediately found a real bug in 10.12's ticket count, fixed in its own commit just below. Phase 2 (move MainWindow + the app dialogs into a static lib and add screen-level scenarios) stays Open in the tracker. Files: src/verifactu/verifactuconfig.{h,cpp}, tests/support/{fakeverifactuserver.h,fakeverifactuserver.cpp,modalautocloser.h}, tests/test_e2e_verifactu.cpp, tests/CMakeLists.txt, docs.
  • [x] Contabilidad ticket count: only a same-period cancellation offsets a ticket (bug found by the new e2e test bench): 10.12's netTicketCount netted a ticket's income against every regularisation of the period, regardless of which payment was being cancelled. A ticket with a new sale in Q2 (its remaining garment charged as <n>-1) and the cancellation of its Q1 payment in Q2 netted below zero in Q2, so it was not counted even though Q2 had a real sale. The first end-to-end scenario written for the test bench (paid Q1 -> Q1 closed -> cancelled at AEAT in Q2 -> remainder charged in Q2) caught it. netTicketCount now takes the period and lets a regularisation offset only when the cancelled payment's fecha_pago lies in that same period; figuresFromDetails passes the report period through, and yearTicketCount(details, year) the calendar year. The user's rule is unchanged: paid and cancelled in the same period is not counted, and paid in Q1 / cancelled in Q2 is counted in Q1. Amounts were never affected, only the "Número de tickets" figure. Tests: test_netTicketCount gains the Q1-payment / Q2-sale case, and existing fixtures carry the payment date. Files: src/contabilidad/{contabilidad.h,contabilidad.cpp}, tests/test_contabilidad.cpp, docs/modules/contabilidad.md.

Post-10.11 development — October 2026 (shipped in 10.12)

  • [x] 10.12 release gate: fixes from the PR review and the compliance gate: a medium /code-review of the commits after the pre-release audit, and the new verifactu-compliance-auditor release gate, confirmed the closed-quarter fix and found the following, all fixed before merging. Rectify: the red "AEAT accepted but the local RECTIFICADA mark failed" message was immediately overwritten by the green success text. applyRectificationResult now returns whether the local mark succeeded, and the success text is shown only when it did (both reviewers flagged this). Cancel: after a failed local write the event is shown ANULADA, so its button cannot send a second cancellation to AEAT. A quarter closed while the request was in flight moves the stamped date to today. The new message uses tr(), like its neighbours. The event list groups only pagado = 'SI' rows, like verifactuEventFor, so a part-paid seq-0 invoice no longer shows as SIN COBRAR with its Anular button disabled. Marks: markInvoiceSeqCancelled / markTicketRectified return false when they match no paid row, instead of reporting a silent success. Data repair: a migrateDatabase step returns to SIN COBRAR the unpaid garments that pre-10.12 cancellations had marked ANULADA, leaving local voids alone. A gate re-check showed that unpaid RECTIFICADA rows are not provably safe to re-open: before dc87a5e a substitution could have been submitted with their amounts included. They are only logged for manual review. The same re-check made a failed UPDATE of the new rectificativa row count as a failed local write too. Without it the release note's "they can still be charged" would not hold for existing data; the note now says so in both languages. Ticket count: only a positive net counts, so a by-differences credit note is not a ticket, while a comma-flagged real sale still is. yearTicketCount now reuses netTicketCount. Dismissed with reasons: the "last payment includes cancelled seqs" case is unreachable, because the rectify dialog refuses multi-seq tickets and accepts only ENVIADA ones; the CI regex's r? is intentional, to stop at the legacy r7.1-style headers. Tests: marks fail on no paid row, unpaid-remainder repair (incl. a local void left alone), credit note and comma-only ticket counts. An existing fixture got realistic amounts, because a zero-amount ticket correctly no longer counts. Verified non-vacuous. Files: src/app/{cancelinvoicedialog.cpp,rectifyinvoicedialog.h,rectifyinvoicedialog.cpp}, src/sql_lite/{sql_lite.h,sql_lite.cpp}, src/contabilidad/contabilidad.cpp, tests/{test_sql_lite.cpp,test_contabilidad.cpp}, releases_notes*.txt, docs.
  • [x] Release notes published in both languages; release skill reuses the review skills and agents: the GitHub release body, which is also what the in-app updater shows the shop before installing, was the English X.Y section only. The ci.yml release job now publishes a bilingual body: ## Español (the releases_notes_es.txt section) then ## English. A shared Get-Section helper fails the release if either section is missing or empty. The /release skill's local fallback and the README's mirror do the same, and the extraction was checked locally against 10.11. A review of the /release skill against the other skills found gaps, now filled. It now runs /update-docs instead of "mentally", and sends smoke-test findings through /debugging. It adds a Verifactu / accounting gate in step 5: the verifactu-compliance-auditor subagent on the release diff whenever it touches invoices, numbering, the ingresos schema or Contabilidad. That is the check that caught the closed-quarter path this cycle. It offers the guidelines-auditor subagent after a large cycle, and points at /update-skills when the skill drifts from the README. Files: .github/workflows/ci.yml, .claude/skills/release/SKILL.md, README.md.
  • [x] Pre-release review: smaller fixes and the manual checks for this cycle: the remaining findings of the 10.10..HEAD review. The void-date migration now also covers old voids that a later substitution relabelled RECTIFICADA. Regularisations include same-period cancellations, so the report wording changed from "de periodos anteriores / trimestre ya cerrado" to "Anulaciones / rectificaciones del periodo" and the annex text explains it. The Mensual "cerrada" label uses quarterIsClosed, so an empty month inside a closed quarter no longer reads open. A NULL IVA rate shows ?, never -1, in the comma-amount branch of the gastos annex. The live language switch moved into SettingsDialog::accept(), so the first-run Configuración in main.cpp applies it too, not only MainWindow's. The detail collectors size their per-bucket index by bucketCount instead of a fixed [4]. A stale Recogida comment was fixed. docs/smoke_test.md gains Block G with the manual checks this cycle's changes need (Anulación search and columns, migration, the Contabilidad lock box, gastos-only quarter, the annex PDF, regularisation across quarters and within one, the unpaid remainder after a cancellation, the cancel/rectify guards, IVA field removed, live language switch, both installer languages), and the suite count is corrected to 15. Tests: test_detailRegularizaciones updated to the new heading, plus the NULL-rate ? case and a relabelled-RECTIFICADA void in the migration test. Files: src/sql_lite/sql_lite.cpp, src/contabilidad/contabilidad.cpp, src/appsettings/settingsdialog.cpp, src/app/mainwindow.cpp, src/recog_prendas/recog_prendas.cpp, tests/test_contabilidad.cpp, docs/smoke_test.md, docs/modules/contabilidad.md.
  • [x] Pre-release review of everything since 10.10: accounting and Verifactu correctness fixes: a high-effort code review plus a verifactu-compliance-auditor pass over 10.10..HEAD found issues in this cycle's own work, none of it shipped yet. (1) A closed quarter could still change. Cancelling a payment event at AEAT, or a substitution rectification, marked every row of the ticket with that seq, including unpaid garments that share seq 0, as ANULADA / RECTIFICADA with a fecha_anulacion. Paying one of them in a later quarter made it income there and a regularisation subtracted from the cancellation quarter, even if that quarter was already filed. Separately, and older than 10.10, such a payment was never submitted to AEAT. By user decision, markInvoiceSeqCancelled / markTicketRectified now touch only pagado = 'SI' rows, the ones the invoice covered. That matches how verifactuEventFor already defines a payment event, and unpaid garments stay SIN COBRAR and chargeable as their own invoice. (2) The ticket count included cancelled tickets. The new Contabilidad::netTicketCount counts a ticket in a period only if its income there is not fully offset by a same-period regularisation (user decision). yearTicketCount nets over the year the same way. (3) A rectificativa could be back-dated before the original payment, into an earlier open quarter that never counted it. RectifyInvoiceDialog now refuses a date before the new tested sql_lite::ticketLastPaymentDate(), on top of the closed-quarter check. (4) Failed local writes were reported as success: both dialogs now check the mark functions' result and say in red that AEAT accepted but the local update failed. (5) Midnight race: the cancellation stamps the date the closed-quarter guard checked (m_pendingCancelDate), not the AEAT reply time. Verifactu doc drift flagged by the auditor fixed too. Tests: unpaid garments untouched by cancel/rectify, ticketLastPaymentDate, netTicketCount (same-period, partial, other-period) and yearTicketCount netting. Verified non-vacuous. While reverting for that check, an over-broad sed also hit verifactuEventFor's identical pagado = 'SI' scoping, and its test caught it, which confirms the new scoping matches the existing event definition. Files: src/sql_lite/{sql_lite.h,sql_lite.cpp}, src/contabilidad/{contabilidad.h,contabilidad.cpp}, src/app/{cancelinvoicedialog.h,cancelinvoicedialog.cpp,rectifyinvoicedialog.cpp}, tests/{test_sql_lite.cpp,test_contabilidad.cpp}, docs.
  • [x] Application language setting: live switch, installer default, release notes in Spanish and English: requested before the next release, keeping the scope to the setting. The full app translation stays an Open item. The app.language setting and its Idioma combo already existed, but only applied Qt's standard-dialog translations at startup, so a change needed a restart, and the release notes were English-only. New AppLanguage module (src/appsettings/applanguage.{h,cpp}): applyQtTranslations() installs or removes the bundled qtbase_es.qm live. It is called at startup and again when Configuración is accepted, so no restart is needed; the tooltip now says so, and says the rest of the app is still Spanish. Release notes: the new releases_notes_es.txt is a full Spanish translation of the history, with the same 40 version headers. Ayuda → Notas de la versión opens the file for the configured language (releaseNotesResource()), with the dialog title and button in that language too. Installer: each Inno Setup language now shows its own notes on the information page (per-language InfoBeforeFile) and records HKCU\Software\La Ideal\Language. On first run, when the settings have no language yet, applyDefaults() takes that choice (initialLanguage(installerChoice()), unknown or absent means es), so an existing user's setting is never overridden by a reinstall or update. Encoding: both notes files are now UTF-8 with BOM, because Inno Setup reads a BOM-less .txt as ANSI. The English file already contained accents ("Configuración", "Envíos"), which the installer was showing garbled. The viewer strips the BOM. Release process: ci.yml refuses to publish without the Spanish X.Y section; the /release skill and README require both files. Tests (test_appsettings): initialLanguage (en / es / empty / unknown), releaseNotesResource, and a parity test that both files list the same versions in order, verified non-vacuous by renaming a Spanish header. The installer script was compiled locally with ISCC against a dummy payload. The live translator swap is integration-only, because it needs the app's resource bundle. Files: src/appsettings/{applanguage.h,applanguage.cpp,appsettings.h,appsettings.cpp,settingsdialog.cpp,CMakeLists.txt}, src/app/{main.cpp,mainwindow.cpp}, resources/laideal.qrc, releases_notes.txt, releases_notes_es.txt, releases/laideal.iss, .github/workflows/ci.yml, tests/{test_appsettings.cpp,CMakeLists.txt}, README.md, /release skill, docs.
  • [x] Ingresos grids: the four dates side by side, an Anulación search, and green "NO" for every ANULADA row: follow-up to fecha_anulacion recording every cancellation. Columns: fecha_anulacion is appended last in the table by migrateDatabase, so the new tableview free function placeIngresosDateColumns(QHeaderView*) moves it visually right after Recepción / Pago / Recogida in both the Recogida de Prendas grid (where it is now visible, headed "Anulación") and Listado → ingresos. Only the visual order changes, so every INGRESOS_COL_* logical index the code reads is untouched; it is re-applied after each search and is idempotent. Search: the Recogida date filter gains a fourth option, Anulación (fecha_anulacion), which lists garments voided in place and AEAT-cancelled / rectified ones on their cancellation date. Its Importe total is 0, since all of them are excluded from totals. Colour: TextColorDelegate::classify now also renders green any row whose verifactu_estado is ANULADA, read from the sibling column, so a cancelled garment's NO / estado no longer reads as a debt, whether or not it carries a payment date. Tests (test_textcolordelegate, now QTEST_MAIN offscreen): the ANULADA colour rule, and the header placement on a real QTableView (positions 2–5, importe after, idempotent). Both verified non-vacuous. Files: src/tableview/{textcolordelegate.h,textcolordelegate.cpp,ingresoscolumns.h,ingresoscolumns.cpp,CMakeLists.txt}, src/recog_prendas/{recog_prendas.cpp,recog_prendas.ui}, src/listado/listado.cpp, tests/{test_textcolordelegate.cpp,CMakeLists.txt}, docs.
  • [x] fecha_anulacion records every cancellation; voided garments no longer carry a payment or pickup date: requested to complete the new column, and it supersedes the earlier "voided garments keep the void date in fecha_pago, by design" decision below. Anular prendas: voidGarmentRow now writes the void date to fecha_anulacion and leaves fecha_pago / fecha_recogida empty, because a voided garment was never paid nor collected. pagado stays NO and estado Anulado / ANULADA are unchanged. A one-off, idempotent migrateDatabase backfill moves the stamped date of existing voids (estado Anulado, pagado != 'SI', ANULADA) into fecha_anulacion and empties both fields; AEAT-cancelled paid rows are not touched. AEAT cancellation / substitution rectification: by user decision, markInvoiceSeqCancelled / markTicketRectified now record fecha_anulacion on every row they mark, not only on rows of an already-closed quarter, still without overwriting an existing date. The Contabilidad rule becomes uniform: a paid row stays income in its payment period and is subtracted in the period of its fecha_anulacion. Within the same period the two net out, matching the old result. The one visible change is a sale cancelled in a later quarter while its own quarter was still open: it now shows +original / −cancellation quarter instead of silently leaving the original quarter. Pre-10.12 cancellations without a date stay excluded as before. Voided garments are unpaid, so they are never income nor a regularisation. Tests: void writes only fecha_anulacion; cancel/rectify stamp open and closed rows alike; regularisation across quarters, within a quarter, and voids never appearing; migration moves the date once and leaves AEAT rows alone; markTicketPickedUp expectation updated to the empty pickup date. All verified non-vacuous by restoring the old rules. Files: src/sql_lite/{sql_lite.h,sql_lite.cpp}, tests/test_sql_lite.cpp, docs (contabilidad.md, sql_lite.md, architecture.md, mainwindow.md, recog_prendas.md, Verifactu docs).
  • [x] Closed quarters no longer change after an AEAT cancellation or rectification; the change is counted where it happens: neither CancelInvoiceDialog nor RectifyInvoiceDialog respected the accounting lock. Cancelling at AEAT, or substituting via a rectificativa, a garment from an already-closed quarter set ANULADA / RECTIFICADA, the garment silently dropped out of its original quarter, and regenerating that filed quarter gave different figures. The rectificativa row itself was inserted unlocked (edit_lock = 0) and could be dated inside a closed month. Following the user's choice ("count where it happens", the usual fiscal treatment), a new ingresos.fecha_anulacion column (migrateDatabase, INGRESOS_COL_FECHA_ANULACION = 26, hidden in Recogida) is stamped only on rows whose quarter is already closed: the cancellation date, or the rectificativa's date. The DB writes moved out of both dialogs into the tested seams sql_lite::markInvoiceSeqCancelled / markTicketRectified, with the same seq/ticket scoping, still only after AEAT success, and never overwriting an existing date. kIngresosIncomeWhere keeps a stamped row as income in its closed quarter, so the filed report is reproducible. The new regularizationsBetweenDates (and QuarterlyDetails::regularizations) lists it in the period of fecha_anulacion, where figuresFromDetails subtracts it (PeriodFigures::ingRegularizacion). The Ingresos table then shows period income, the regularisation and the net total, and the annex adds an "Anulaciones y rectificaciones de periodos anteriores" table with negative amounts. Rows from open quarters behave as before, and pre-existing cancellations are untouched. Guards, the first two raised by the verifactu-compliance-auditor review: the rectificativa date must be in an open quarter, and a cancellation is refused while today's quarter is closed. Both use the new sql_lite::quarterIsClosed, which checks the whole quarter across ingresos and gastos, because the month-level readLockForMonthAndYear reads a row-less month (e.g. August) as open. Tests: markInvoiceSeqCancelled stamps only closed rows of the right seq; markTicketRectified uses the rectification date; a Q1-closed ticket cancelled in Q2 stays in Q1 income and is a Q2 regularisation (incl. annual bucketing); quarterIsClosed covers a row-less month and gastos-only; no overwrite; figuresFromDetails nets regularisations; the regularisation table renders. All verified non-vacuous. Files: src/sql_lite/{sql_lite.h,sql_lite.cpp,ingresos_schema.h}, src/app/{cancelinvoicedialog.cpp,rectifyinvoicedialog.cpp}, src/recog_prendas/recog_prendas.cpp, src/contabilidad/{contabilidad.h,contabilidad.cpp}, tests/{test_sql_lite.cpp,test_contabilidad.cpp}, docs (contabilidad.md, sql_lite.md, architecture.md, Verifactu README + requirements).
  • [x] Contabilidad figures now come from the detail rows (single source of truth), closing the annex reconciliation gaps: the Contabilidad summary used to be computed by separate SQL helpers (totalPriceBetweenDates, countOperationsBetweenDates, plus the grouped annualAccountingByQuarter for the annual report), while the 10.11 detail annex listed rows through other queries. Four gaps followed, all fixed. (c) Every mode now fetches the period's detail rows once (incomeTicketsBetweenDates / expensesBetweenDates; annual annualDetailsByQuarter, one scan per table bucketed by quarter), and the new pure static Contabilidad::figuresFromDetails() derives the PeriodFigures from those same rows. A summary can no longer disagree with its detail, and Mensual/Trimestral drop from 6 + 2 queries to 2. (a) A comma-decimal importe is now flagged rather than silently read as 0 or 10. The collectors count it (IncomeTicketDetail::invalidAmounts, ExpenseDetail::invalidAmount) and never sum it; the detail marks the ticket * or the gasto ** with a note; and generateContabilidad() raises the clean-up-tool error dialog once per report. (d) Because every mode reads the same collectors, the annual report treats comma amounts exactly like the quarterly one; previously its SQL SUM() handled them differently and without the dialog. (b) Each detail table ends with a note that per-line base/IVA are rounded to cents while the totals are unrounded. The annual consolidated ticket count is now Contabilidad::yearTicketCount(), a distinct n_recibo over the year's buckets, replacing the short-lived ingTicketsYear field. Removed as dead code: totalPriceBetweenDates, countOperationsBetweenDates, annualAccountingByQuarter / QuarterlyAccountingTotals, and Contabilidad::getTotalIncome / computeFigures, which had no other callers. Their tests were rewritten against the listings, plus new figuresFromDetails, yearTicketCount, flagging and rendering tests, verified non-vacuous by breaking the sin-IVA bucket and the comma skip. Files: src/sql_lite/{sql_lite.h,sql_lite.cpp}, src/contabilidad/{contabilidad.h,contabilidad.cpp}, tests/{test_sql_lite.cpp,test_contabilidad.cpp}, docs (contabilidad.md, sql_lite.md, architecture.md, INDEX.md, Verifactu docs, /debugging skill).
  • [x] IVA on ingresos is a fixed 21 %, no longer a setting: Contabilidad derived the ingresos base/IVA split from AppSettings::ivaRate() read from the settings JSON at report time. A rate change would therefore have silently altered every regenerated past report, along with every ticket, factura and AEAT submission made afterwards. The user decided the ingresos rate will not change from 21 %, so it is now the internal constant AppSettings::kIngresosIvaRate, exposed as the static AppSettings::ivaRate() so no call site had to change (Contabilidad, PayDialog, Recogida retry, MainWindow, Imprimir, RectifyInvoiceDialog, TicketRenderer data). The "Tipo de IVA (%)" field was removed from Configuración → General, setIvaRate is gone, and applyDefaults() no longer writes a default taxes.iva_rate. For backwards compatibility an existing key in a user's JSON is left untouched (older app versions still read it) but ignored. Gastos keep their per-invoice iva column. Test test_ivaRateIsFixedAndIgnoresJson checks a JSON value of 10 is ignored. Files: src/appsettings/{appsettings.h,appsettings.cpp,settingsdialog.h,settingsdialog.cpp}, tests/test_appsettings.cpp, docs.
  • [x] Annual report: the consolidated ticket count no longer double-counts: "Número de tickets" in the Resumen anual consolidado was the sum of the four per-quarter COUNT(DISTINCT n_recibo), so a ticket whose garments were paid in two quarters counted twice for the year. The amounts were correct; only the count was inflated. annualAccountingByQuarter now also returns ingTicketsYear, a year-level distinct count under the shared kIngresosIncomeWhere predicate, and the consolidated summary uses it. The per-quarter sections keep their own counts, where the ticket correctly appears in each. Test test_annualTicketCountIsDistinctOverYear checks it equals countOperationsBetweenDates over the year. Files: src/sql_lite/{sql_lite.h,sql_lite.cpp}, src/contabilidad/contabilidad.cpp, tests/test_sql_lite.cpp, docs.
  • [x] Contabilidad: a quarter with only gastos can now be closed and reverted: the quarterly flow read its lock state from ingresos alone. A quarter without any ingresos row (readLockForQuarter = 2) stopped at "No hay registros de ingresos" and neither generated the report nor locked, even with gastos to declare; revert had the same blind spot. It now reads both tables and merges them in the pure static Contabilidad::combinedLockState(ingresosLock, gastosLock): no data only when both are empty, locked if either is, else open. updateLock() already locked and unlocked both tables by month, so closing and reverting a gastos-only quarter work unchanged. The Mensual and Anual "Contabilidad cerrada / no cerrada" labels use the same merge, and the empty-period message now says "ni de gastos". Test test_combinedLockState. Files: src/contabilidad/contabilidad.{h,cpp}, tests/test_contabilidad.cpp, docs/modules/contabilidad.md.
  • [x] Contabilidad: "Bloquear datos" is offered only where it works: the checkbox stayed enabled in Mensual and Anual mode, but only the Trimestral branch of on_bb_ok_cancel_accepted calls updateLock(), so ticking it there did nothing. Closing stays a quarterly action, matching modelo 303 (user decision). The checkbox is now enabled only for Trimestral and never while reverting, through the pure static Contabilidad::lockOptionAvailable(mode, reverting). Switching mode unticks it, so a choice made in Trimestral cannot carry over unseen. Test test_lockOptionOnlyForTrimestral. Files: src/contabilidad/contabilidad.{h,cpp}, tests/test_contabilidad.cpp, docs/modules/contabilidad.md.
  • [x] Voided garments keep the void date in fecha_pago, by design: the 10.11 release review had suggested recording the void date only in fecha_recogida. The user decided to keep stamping both: a voided garment carrying a fecha_pago with pagado = 'NO' and estado Anulado reads unambiguously as "closed, never paid" throughout the app. The side effects are already handled. Every total skips ANULADA rows (garmentExcludedFromTotals, kIngresosIncomeWhere), so a Pago-date search lists a voided garment on its void date without adding it. The month lock covers it harmlessly, because readLockForMonthAndYear / readLockForQuarter use MAX(edit_lock) and a voided row cannot mask a locked sibling. Closed without a code change.
  • [x] Completed milestones split out of the progress tracker: docs/progress_tracker.md had grown to ~440 lines, mostly history. It now holds only Current Status, Blocking, Open Non-Blocking and Backlog (~55 lines). All finished work, including the Archive, moved verbatim to the new docs/completed_milestones.md, which carries its own rules: newest first, ### Post-<X.Y> development sections keyed on the latest release, a (shipped in X.Y) suffix at release time, never delete. The skills (/update-docs, /tackle-issue, /release, /debugging, /update-skills), CLAUDE.md, docs/ai_agent_instructions.md, docs/INDEX.md, docs/README.md, the root README.md and the docs that pointed at "Completed Milestones" now point at the new file. /update-docs lowers the tracker size limit to 150 lines. /release no longer asks for a "previous release" pointer in Current Status, which contradicted the single-release rule.

Post-10.10 development — October 2026 (shipped in 10.11)

  • [x] CI built with the wrong compiler, which hung test_settingsdialog and put the release installer at risk: the 10.11 release CI stalled indefinitely at suite 7 (settingsdialog) on every commit that contained it, while it passed locally in under a second. Diagnosis, through a throwaway feature/ branch: a first guess (QPrinterInfo blocking without a print spooler) was stubbed and disproved. Running the exe directly on the runner showed it never started: exit 0xC0000139 STATUS_ENTRYPOINT_NOT_FOUND. Under ctest that loader failure shows as a modal "Entry Point Not Found" dialog that nobody can close, hence the hang. The import table explained it: install-qt-action installs the Qt 6.4.3 win64_mingw DLLs, which are built with MinGW 11.2 (MSVCRT), but not the toolchain itself. CMake therefore picked the runner's preinstalled C:\mingw64, a newer UCRT GCC, and those binaries load Qt's older bundled libstdc++. Most suites happened to use only symbols present in both; settingsdialog.obj pulled one that is not. The release job ships an exe built the same way, so this was a latent risk for the published installer, not just a test problem. Fix: Qt's own tools_mingw1120 is no longer on the Qt online repo, so both CI jobs install MinGW GCC 11.2.0 posix-seh MSVCRT from Chocolatey (mingw 11.2.0.07112021, winlibs) and pass it to CMake explicitly. The release job also puts it on PATH, so windeployqt deploys the matching runtime. A new Check runtime of built executables step fails the build if any exe imports the UCRT api-ms-win-crt-* DLLs. The printer stub was reverted because it was not the cause. Kept as hardening: a 120 s CTest TIMEOUT on every suite (CI also passes --timeout 120) and timeout-minutes: 45 on the build job, so a future hang fails instead of holding a runner for the 6 h default. Files: .github/workflows/ci.yml, tests/CMakeLists.txt, docs.
  • [x] opencode configuration removed: the project no longer uses opencode, so opencode.json (its command wrappers pointing at the skills) and .opencode/agents/dead-code-finder.md (a copy of the Claude subagent) were deleted. A sweep found no other live reference; the remaining mentions in this tracker are historical entries. Claude Code's .claude/skills/ and .claude/agents/ are the single source for AI-agent workflows.
  • [x] Configuración → Verifactu: show/hide toggle for the service key: the ServiceKey field was masked with no way to reveal it, so the user could not check what had been typed or pasted. A checkable Mostrar / Ocultar QToolButton now sits beside the field and switches the QLineEdit echo mode between Password and Normal. It changes the display only: the text, the save path and the DPAPI-at-rest storage are unchanged. A button was chosen over an eye-icon QAction because the project ships no eye icon and a text-only trailing action would render blank. Hidden by default comes free: both callers (MainWindow, and the first-run prompt in main.cpp) build the dialog on the stack for each open. New suite test_settingsdialog (15 suites now) drives the real dialog offscreen, pointing AppSettings at a throwaway file through the existing loadFrom seam and never accepting the dialog, so the real ~/.laideal_settings.json is untouched. It checks masked by default, reveal without changing the text, hide again, and masked on reopen. Verified non-vacuous by stubbing out the toggle's setEchoMode. Files: src/appsettings/settingsdialog.cpp, tests/{test_settingsdialog.cpp,CMakeLists.txt}, docs.
  • [x] Contabilidad reports end with a detail annex of the tickets and gastos behind each summary: requested so the user can audit or debug exactly what each figure is made of. Every period (trimestral, mensual, and each quarter of the annual report, placed after the consolidated summary) now ends with Detalle de ingresos: one line per paid ticket with nº recibo, fecha de pago, cliente, garment count, base, IVA and importe. It is followed by Detalle de gastos: fecha, nº factura, empresa, servicio, IVA %, base, cuota and importe. Each table ends with a total row. Reconciliation by construction: the issue warned against duplicating the WHERE, so the period predicates were lifted into shared constants in sql_lite.cpp (kIngresosIncomeWhere, kGastosPeriodWhere). The existing totalPriceBetweenDates / countOperationsBetweenDates and the new incomeTicketsBetweenDates / expensesBetweenDates all use them, as does the grouped annualAccountingByQuarter, which previously kept its own copy. A detail table therefore cannot list a row its summary excluded. totalPriceBetweenDates now accumulates and returns double instead of float, so a large quarter's total row cannot differ by a cent from the summary. The verifactu-compliance-auditor review confirmed the shared predicate is identical to the previous inline SQL and flagged both of these points. Release-review follow-ups (10.11): a gastos row with a NULL or non-standard IVA (e.g. 4 %) was listed and totalled in the detail but summed in no summary column. Such rows are now marked *, kept out of the detail total, and explained in a note under the table. ExpenseDetail::iva is -1 for NULL, so NULL is not mistaken for sin IVA. The annual annex no longer runs 8 per-quarter scans: sql_lite::annualDetailsByQuarter fetches the year once per table and buckets rows by quarter through the same collectors as the period listings. It is asserted equal to the four per-quarter calls, including a ticket paid across two quarters. The reconciliation tests now hold the double totals in double. All three were verified non-vacuous. Ingresos lines aggregate garment rows by n_recibo, so the line count equals "Número de tickets". The annual summary still comes from the grouped annualAccountingByQuarter, which test_annualAccountingByQuarter already pins to the per-period helpers. Rendering is in the pure statics Contabilidad::createHtmlDetailIngresos / createHtmlDetailGastos, with HTML-escaped client and company names and borderless zebra tables for multi-page output. contabilidad now links sql_lite PUBLIC because its header exposes the row types. Tests: test_sql_lite asserts both listings reconcile with the total and count helpers, including ANULADA, RECTIFICADA, voided-in-place and half-open-end rows. test_contabilidad covers the renderers. Both were verified non-vacuous by breaking the listing filter and the gastos base split. The PDF layout itself is not machine-checked; review a generated report in the app. Files: src/sql_lite/{sql_lite.h,sql_lite.cpp}, src/contabilidad/{contabilidad.h,contabilidad.cpp,CMakeLists.txt}, tests/{test_sql_lite.cpp,test_contabilidad.cpp,CMakeLists.txt}, docs.
  • [x] Recogida de Prendas Importe total no longer counts voided garments: reported from the shop. A search by Pago date for 07-08-2026 added ticket 31045 to the total although it had been voided. Root cause: voidGarmentRow (local void via Anular prendas) keeps pagado = 'NO' but stamps fecha_pago with the void date, so a voided garment matches a Pago-date search, and the total loop in on_pb_search_clicked summed importe over every proxy row. The first fix followed the issue text and counted only paid rows. The 10.11 release review then caught that this applies to every search mode: an unpaid ticket searched by number showed 0.00 instead of the amount owed, and a Recepción search lost the day's intake. The final rule, chosen by the user, skips only rows excluded from every total, via the pure sql_lite::garmentExcludedFromTotals: verifactu_estado ANULADA (voided in place or cancelled at AEAT) or RECTIFICADA (superseded). Unpaid rows count again. The excluded states now live in one list, kTotalsExcludedEstados, which builds both this C++ check and the kIngresosIncomeWhere SQL, so the panel and Contabilidad cannot drift apart. The listing still shows voided rows, which is useful for auditing. Test test_garmentExcludedFromTotals was verified non-vacuous. Files: src/sql_lite/{sql_lite.h,sql_lite.cpp}, src/recog_prendas/recog_prendas.cpp, tests/test_sql_lite.cpp, docs.
  • [x] New AI components adapted from addyosmani/agent-skills, gaps only: reviewed the 4 agents and 25 skills there and adopted only what this mature repo lacked. Generic duplicates were skipped: code-reviewer, security-auditor and code-simplification are covered by the built-in /code-review, /security-review and /simplify; planning, docs and git-workflow skills are covered by /tackle-issue, /update-docs and /release; the web-only ones (Core Web Vitals, browser DevTools, frontend UI) don't apply. Each new piece is rewritten for Qt/C++/CTest and points at existing docs rather than copying them. test-engineer subagent (adapted from theirs): finds the coverage gap and writes Qt Test cases using the four seam patterns from architecture.md §Testing. It must prove every new test fails against the bug, which is the repo's recurring "verified non-vacuous" practice, and it reports a needed seam extraction instead of refactoring production code on its own. It preloads /coding-guidelines. /debugging skill (adapted from debugging-and-error-recovery): reproduce from the shop report, ~/.laideal.log, a copy of the live DB (never the DB itself) or the captured AEAT response; localize by layer with a symptom table drawn from past fixes; reduce, fix the cause, guard, verify. verifactu-compliance-auditor subagent (project-specific, read-only, proactive): checks a diff against the ten requirements in verifactu-requirements.md, the one review a generic reviewer cannot do. guidelines-auditor subagent: runs the existing coding_guidelines_audit.md method and returns tiered findings plus a delta, mirroring how dead-code-finder feeds its report. /tackle-issue now routes bugs through /debugging, may delegate coverage to test-engineer, and runs the compliance auditor on Verifactu-sensitive diffs; the existing steps are unchanged. Files: .claude/agents/{test-engineer,verifactu-compliance-auditor,guidelines-auditor}.md, .claude/skills/{debugging,tackle-issue,update-skills}/SKILL.md, CLAUDE.md, docs/{ai_agent_instructions,INDEX,coding_guidelines_audit}.md.
  • [x] AI-agent layout migrated from .claude/commands/ to .claude/skills/: the five workflows (coding-guidelines, release, tackle-issue, update-docs, update-skills) moved (git mv, history kept) to .claude/skills/<name>/SKILL.md, the layout Claude Code now documents as standard (commands still work but are the legacy form). The real gain is the new YAML frontmatter, not the move. Legacy commands were already offered to the model, but with no description the model only saw the H1 title ("Code Development Guidelines"), so auto-triggering was weak. Each skill now has a trigger-first description. Invocation control: /release sets disable-model-invocation: true (it merges to master, pushes a tag and publishes, so it must never fire on its own); /coding-guidelines sets paths: src/**, tests/**, **/CMakeLists.txt so it auto-activates only when code is touched; the rest stay user + auto. /tackle-issue and /release gained an argument-hint. /update-skills was rewritten for the new format: skill vs subagent, frontmatter fields, invocation flags, and agent frontmatter, with links to the official docs. Also fixed /tackle-issue's self-contradicting "200-char cap" (the rule is 300). dead-code-finder was already in the correct .claude/agents/ layout and is unchanged. References updated in CLAUDE.md, docs/ai_agent_instructions.md (plus /review → /code-review), docs/INDEX.md (plus a broken relative agent link), docs/coding_guidelines_audit.md and opencode.json. Adopting more agents and skills (e.g. adapting addyosmani/agent-skills' code-reviewer, test-engineer, security-auditor to Qt/C++) is left as a separate follow-up. Files: .claude/skills/*/SKILL.md, CLAUDE.md, opencode.json, docs.

Post-10.9 development — September 2026 (shipped in 10.10)

  • [x] AEAT reconciliation picks the accepted record, not the first one (ticket 31121): reported from the shop — "Actualizar con los datos de AEAT" stayed greyed out on an invoice that was demonstrably registered (the operator validated it by hand in the AEAT sede). Root cause found in a captured log: the vendor stores every submission ATTEMPT, not one record per invoice. The query for 31121 returned Count: 5 — four duplicate-rejections (ErrorCode 9999, CSV: null, ValidationUrl: null, one per retry the operator had made) plus the original acceptance from 08-09 carrying StatusResponse "Correcto", CSV "A-…" and the AEAT ValidationUrl. The accepted record was the last element, and the parser took Items[0], so it read a failure: no CSV → hasUsableCsv() false → the adopt button disabled. Fixed by scanning for the accepted record (CSV present, no ErrorCode, not IsRejected) and falling back to the first only so the dialog can still show what came back; VerifactuRemoteRecord gains recordCount, and the dialog now explains when several attempts were returned and distinguishes "datos no coinciden" from "ningún registro fue aceptado". Note the earlier single-record fixture could not have caught this — it took a real retried ticket to expose it. Regression test built from the captured 5-record shape (redacted), verified non-vacuous by restoring Items[0] and watching it fail. Files: src/verifactu/{verifactutypes.h,verifacturesponse.cpp}, src/recog_prendas/recog_prendas.cpp, tests/test_verifactu_response.cpp, docs.
  • [x] Reprinted recibos now show IMPORTE PAGADO for a paid ticket: reported from the shop after 10.9. The 10.9 fix covered PayDialog's AEAT-timeout fallback, but the reprint path from Recogida de Prendas is different code and hardcoded the marker off at three buildTicket(..., /*addPayedInfo=*/false) call sites in Imprimir, so a fully-paid ticket reprinted from the pickup panel never showed the payment. Fixed for the two recibo sites; the third (the multi-event loop) and the single-seq factura branch stay false deliberately — a factura implies payment and omits the marker on every path, including MainWindow::printFra. The rule is all garments paid, not any: a reprinted recibo shows the whole ticket total, so "any paid" would mark a partially-paid ticket as settled in full. Extracted as the tested seam sql_lite::ticketAllGarmentsPaid() (strict pagado='SI', so a blank never reads as paid, plus a COUNT > 0 guard so an empty result cannot print the marker on nothing) rather than reading Imprimir's live model inline — which also keeps it out of the integration-only bucket its sibling checkAnyItemPaid() sits in. Verified non-vacuous by restoring the hardcoded false and watching the behaviour revert. Files: src/sql_lite/{sql_lite.h,sql_lite.cpp}, src/imprimir/imprimir.cpp, tests/test_sql_lite.cpp, docs.
  • [x] Reception date made display-only in Recogida de Prendas: the sibling of the payment-date fix shipped in 10.9. de_date_recep had no dateChanged/editingFinished handler either, so edits to it were silently discarded for the clicked row — but unlike the payment date it was not inert: its one remaining reader is SEPARATE_GARM, which copies it onto the split-off row. So typing a date changed nothing visible, then silently applied to a garment split off afterwards. Now setReadOnly(true) with no spin buttons and a tooltip, which is also the correct semantic (a split-off garment belongs to the same ticket and arrived the same day) and closes a subtler hazard: fecha_recepcion is what the Verifactu startup-recovery floor gates on (sql_lite::pendingVerifactuEvents), so a hand-typed value could shift a row in or out of the recovery window. Pure UI wiring, not unit-testable; the DB-level consequences are already covered (insertGarmentRow persists what it is handed, pendingVerifactuEvents pins the floor behaviour). Files: src/recog_prendas/recog_prendas.cpp, docs/modules/recog_prendas.md.
  • [x] Progress tracker archived down to a readable active section: the file had grown to 419 lines against a 250 soft limit. Everything from the pre-8.0 feature/add_mdiago_verifactu build-out downwards was moved below the Archive header (nothing deleted, per the tracker rules), cutting Completed Milestones from 343 to 126 lines. Because that block already sat immediately above the Archive header, the move is a two-line diff — the header simply relocated above it.

Post-10.8 development — September 2026 (shipped in 10.9)

  • [x] Manual smoke test formalised as docs/smoke_test.md, and the three bugs it caught: the automated suite proves the pure and DB-level logic but structurally cannot reach the real network, the real printer, the migration running on a real database, or Qt signal/slot wiring with no testable seam. A full manual pass against a copy of the live DB (19 501 rows) found three defects, all fixed: (1) PendingSubmitsDialog persisted a literal 'Error' instead of the canonical ERROR; verifactuEstadoFromString() compared exactly, so those rows decoded as un-submitted and silently lost their "Reintentar envío a AEAT" button (it tests == VerifactuEstado::Error), and the QR-blocking check in Imprimir was defeated too. Fixed at the writer (bind verifactuEstadoToString), normalised for existing rows in migrateDatabase via UPPER(), and the reader is now case-insensitive as a safety net — the stored value had to be corrected because the SQL filters elsewhere compare case-sensitively. (2) "Consultar en AEAT" was gated to unsettled rows only, which blocked the one way to verify what AEAT holds for a registered invoice; it is now offered on any paid row (the query is read-only) while the adopt button is disabled where there is nothing to adopt. (3) The Recogida de Prendas payment-date field was inert — nothing ever wrote it back, its only writer being the unreachable PAY_YES path — so operator edits were silently discarded; made display-only, since fecha_pago is part of the AEAT invoice identity and editing it after submission would make a retry register a second invoice and stop reconciliation matching. The checklist is now a release gate (/release step 1). Files: docs/smoke_test.md (new), src/app/pendingsubmitsdialog.cpp, src/sql_lite/sql_lite.cpp, src/verifactu/verifactutypes.h, src/recog_prendas/recog_prendas.{h,cpp}, tests/{test_verifactu_models,test_sql_lite}.cpp.
  • [x] Migration verified to move zero money, on real data: income per quarter compared against a genuine pre-migration backups/ snapshot came out identical to the cent (2026 Q1 8 470.24, Q2 14 777.65, all-time 219 745.98), while PENDIENTE 349 → 30 and SIN COBRAR 0 → 319 — 349 = 30 + 319, and ANULADA/ENVIADA/ERROR/the 18 678 legacy NULL rows all unchanged. This is the empirical backing for scoping the backfill to the literal 'PENDIENTE': had blanks been normalised too, that would have been an 18 678-row rewrite altering what prints on invoices. Note a copy of the live DB taken after the new build has run is not a valid baseline (it is already migrated) — the backups/ snapshots are.
  • [x] GetFilteredList confirmed working against the live service, and the parser pinned to the real schema: a captured reply proved the endpoint answers, the envelope is Items, and — decisively — that the InvoiceID filter is applied server-side (Count: 1 for a specific id, not the whole table). Every first-choice field name guessed while blind turned out correct (InvoiceID, InvoiceDate as ISO-8601 with a time component, TotalAmount, CSV, StatusResponse, ValidationUrl). The speculative fallbacks were then removed: once the shape is known they are a liability, because the same record also carries ExternKey and Created, which are not the InvoiceID and not the invoice date, and a wrong-field match is worse than no match. The real payload also revealed IsRejected and ErrorCode, now required to be clear before a CSV may be adopted — a record AEAT rejected can still come back from a query. Fixtures captured from live traffic are committed redacted (NIF, company name, user e-mail, CSV) because the repository is public. Files: src/verifactu/{verifactutypes.h,verifacturesponse.cpp}, tests/test_verifactu_response.cpp.
  • [x] Reconcile an "already exists" rejection against AEAT's own record (GetFilteredList): the remaining half of the offline/slow-AEAT problem. Once AEAT has registered an invoice whose reply we lost, no retry can ever succeed — it can only answer "ya existe" — so the row was stuck at ERROR with the operator's only recourse being the AEAT sede by hand. This supersedes the assessment recorded in the 8.x "operator-surfaced recovery dialog" milestone below, which rejected auto-reconcile on the grounds that the Irene Solutions Kivu API had "no confirmed idempotent lookup-by-InvoiceID endpoint". That turned out to be wrong: the vendor's own REST client exposes <base>/GetFilteredList (confirmed against mdiago/VeriFactu's Net/Rest/ApiClient.cs + Config/Settings.cs, same base URL we already use), and our rest_api.md had documented the matching FilterSet/Filter objects all along — naming InvoiceID as a valid FieldName — under "Not implemented (reserved for future)". What is unknown, and how it is contained: the vendor does not publish the response schema (its own client parses it into an untyped ExpandoObject) and there is no sample response anywhere reachable. Since flipping a row to ENVIADA asserts a regulatory fact, the design never trusts the parse alone: parseVerifactuQueryResponse() probes several plausible envelopes (Return/Records/List/bare array) and field spellings, and crucially distinguishes "AEAT does not have it" from "we could not read the answer" — a failed query or an unparseable body yields parsed=false, never a confident absence. verifactuRemoteMatches() then requires the InvoiceID, the date and the amount to agree to the cent, treating a missing date or a zero amount as missing evidence rather than agreement. Only then, and only with a non-empty CSV, is the write offered — and it is always the operator who confirms it, in a dialog showing AEAT's record beside ours with the raw payload one click away. The raw JSON is also always logged, so the first real reply is what lets the candidate field names be narrowed to the truth. The write is sql_lite::reconcileVerifactuFromAeat(db, nRecibo, seq, csv, url): sets ENVIADA + CSV + validation URL + timestamp, clears the error, scoped to the event's paid rows, and refuses an empty CSV or a row already ENVIADA/ANULADA/RECTIFICADA (re-stamping those would revive a deliberately superseded invoice). Triggers: a "Consultar en AEAT" button in the Verifactu detail dialog for any unsettled row, and an automatic query when a submission is rejected as duplicate — detected by verifactuErrorIsDuplicate(), matched on wording (Spanish + English stems) because no stable code is published. Read-only against AEAT: queryInvoiceAsync answers on its own queryFinished signal so it can never be mistaken for a submission reply. Tests: test_verifactu_response gains the parser (envelope + alternative spellings + ISO dates + comma decimals + nested detail), the absent-vs-unreadable distinction, the duplicate-wording detector and the full match gate; test_sql_lite gains the reconcile write and its four refusals. The match gate was verified non-vacuous by weakening it and watching the test go red. Caveat: the parser fixtures are hypothetical shapes, not captured traffic — they pin the parser's behaviour, not the real schema, which stays unconfirmed until the first live query. The dialog wiring itself is untested UI. 14 suites green. Files: src/verifactu/{verifactutypes.h,verifacturesponse.h,verifacturesponse.cpp,verifactumanager.h,verifactumanager.cpp,verifactuintegration.h,verifactuintegration.cpp}, src/sql_lite/{sql_lite.h,sql_lite.cpp}, src/recog_prendas/{recog_prendas.h,recog_prendas.cpp}, tests/{test_verifactu_response,test_sql_lite}.cpp, docs.
  • [x] Offline / slow-AEAT handling: four defects behind the "ticket sin Pagado ni QR, y al día siguiente dice que ya existe" field report: traced from the customer report. Root trigger is that both UI waits are shorter than the network layer's own timeout — VerifactuManager sets a 10 s transfer timeout while MainWindow waits 3 s and PayDialog 5 s — so a merely slow AEAT (not just a dropped line) routinely leaves the UI having given up on a request that is still perfectly alive. Four independent fixes, each committed separately:
  • The QR-less recibo now says IMPORTE PAGADO. PayDialog::printPartialFactura hardcoded addPayedInfo=false, but it is only ever reached after persistPayment marked the rows pagado='SI' — so on an AEAT timeout the customer got a ticket showing neither the payment nor a QR (the QR is absent by design: isRecibo = qrCode.isNull(), and recibos never carry one). Now passes ui_impr->isRecibo, i.e. the marker appears exactly on the recibo fallback; facturas keep omitting it as every other print path does. New test_escpos::test_renderPaidMarker pins the renderer contract both ways.
  • A transport failure is no longer recorded as a definitive ERROR. PayDialog already treated NETWORK_ERROR/PENDING as an unknown outcome, but MainWindow and the RecogPrendas retry passed any non-success straight through to Error. New pure verifactuEstadoForResult(status) (SUCCESS→Enviada, ERROR→Error, everything else→NotSubmitted) is now used inside updateTicketVerifactuFields, fixing every caller at once. An unknown outcome also keeps its InvoiceID so a retry reuses the identity AEAT may already hold. This was the main engine of the report: an ERROR row offers a "Reintentar" that, when AEAT did register the invoice, can only ever answer "already exists".
  • The RecogPrendas retry is seq-aware. It submitted the bare n_recibo with SUM(importe) over the whole ticket on the reception date — so retrying a partial payment sent the wrong amount under an InvoiceID belonging to a different event, on a date AEAT never keyed it on (a third route to "already exists", and one that could have registered a wrong amount if it did not collide). New tested seam sql_lite::verifactuEventFor(db, nRecibo, seq) returns that event's own paid total and original fecha_pago; retryVerifactuSubmit(ticketNum, seq) uses it and refuses to submit when no paid event exists. RecogPrendas::m_pendingSubmits becomes reqId → {ticketNum, seq} so the reply patches the right rows.
  • A late AEAT reply is no longer discarded. PayDialog is stack-allocated by RecogPrendas and dies with exec(), and its timeout cleared m_pendingReqId — so a reply arriving at, say, 7 s hit requestId != m_pendingReqId and was dropped, including a SUCCESS carrying the CSV. That guaranteed a falsely-PENDIENTE row whose next-day recovery retry was doomed. The dialog now emits submitAdopted(reqId, ticketNum, seq) before closing and RecogPrendas adopts the request, so the existing handler applies the reply. On a late success both PayDialog and MainWindow now tell the operator the factura with QR can be printed rather than silently reporting a CSV for a ticket the customer already left with. Wait policy deliberately unchanged (3 s / 5 s): with (4) in place a longer wait buys only the chance of printing the QR on the first pass, at the cost of freezing the counter for up to 10 s on every sale when AEAT is slow. The late-confirmation message covers the same need without the hang. Raising the waits to match the 10 s transport timeout remains an option if the shop would rather wait than reprint. Not unit-tested: (4) is Qt signal/slot + dialog-lifetime wiring, and (1)'s call-site wiring; a harness would need a fake VerifactuIntegration that emits requestFinished on demand plus headless-constructible RecogPrendas/PayDialog. The DB-level consequences of both are covered (updateTicketVerifactuFields tests). 14 suites green. Files: src/verifactu/verifactutypes.h, src/sql_lite/{sql_lite.h,sql_lite.cpp}, src/recog_prendas/{pay_dialog.h,pay_dialog.cpp,recog_prendas.h,recog_prendas.cpp}, src/app/{mainwindow.h,mainwindow.cpp}, tests/{test_escpos,test_verifactu_models,test_sql_lite}.cpp, docs.
  • [x] A ticket's first partial payment no longer stamps the unpaid remainder with the AEAT result: found while auditing the SIN COBRAR split for regressions (the split itself was clean; this turned out to be a pre-existing bug going back to the 8.5 partial-payment feature). nextVerifactuInvoiceSeq computes COALESCE(MAX(verifactu_invoice_seq), -1) + 1 over rows where pagado = 'SI', so for a ticket with no paid rows yet that set is empty and the first payment event gets seq 0 — which the still-unpaid siblings also carry (already pinned by test_nextVerifactuInvoiceSeq). PayDialog::persistPayment correctly scopes the payment itself to the selected hashes, but the AEAT write-backs then ran WHERE n_recibo = ? AND verifactu_invoice_seq = ?, which also matched the unpaid remainder: those garments were stamped ENVIADA + CSV + an InvoiceID for an invoice that never covered them (or ERROR/PENDIENTE on a failure/timeout). Quarterly income was never affected — every accounting query gates on pagado = 'SI' first — but the mislabelled rows became non-voidable in "Anular prendas" (garmentIsLocallyVoidable requires an unsubmitted estado) and fed a spurious CSV into the print path's hasCsv check. Fixed by adding AND pagado = 'SI' to both write-backs (sql_lite::updateTicketVerifactuFields and PayDialog::markPendingVerifactu). That predicate was chosen over scoping to the paid hashes because it also covers the two retry paths (RecogPrendas::retryVerifactuSubmit and the PendingSubmitsDialog recovery retry) which share the same seq-0 exposure but have no hash list; it is correct for all four callers, since an AEAT result can only ever belong to a paid row. nextVerifactuInvoiceSeq was deliberately left alone — starting the first event at seq 1 would change the AEAT InvoiceID of a ticket's first payment from the bare <n_recibo> to <n_recibo>-1, a submission-identity change with no upside once the write-backs are scoped. updateTicketVerifactuFields had no test coverage at all, which is how this survived; two now pin it (success and AEAT-error), both verified to fail without the guard. test_sql_lite gains an include path to src/verifactu (header-only VerifactuResult, no lib link). 14 suites green. Files: src/sql_lite/sql_lite.cpp, src/recog_prendas/pay_dialog.cpp, tests/test_sql_lite.cpp, tests/CMakeLists.txt, docs.
  • [x] VerifactuEstado split into Unpaid ("SIN COBRAR") and NotSubmitted ("PENDIENTE"): closes the Open Non-Blocking entry of the same name, the residual from issue #43. verifactu_estado now says which of the two situations a row is in instead of leaving it to be inferred from pagado/fecha_pago: SIN COBRAR = unpaid, no invoice to send; PENDIENTE = paid and due at AEAT (submitted and awaiting a reply, or not yet sent). Writers pick per row — MainWindow::saveTicket and AddGarment::saveFactura both branch on row.pagado; PayDialog and the rectificativa placeholder keep writing PENDIENTE because both are paid by construction. The load-bearing risk is on the read side: paying a garment does not rewrite verifactu_estado, so a row is still SIN COBRAR at the exact moment RecogPrendas decides whether to submit it — a gate testing == NotSubmitted alone would have silently stopped paid garments from reaching AEAT (a compliance failure far worse than the cosmetic bug #43). Both such gates now go through the new pure helper verifactuEstadoIsUnsubmitted() (true for Unpaid, NotSubmitted, and legacy blank): sql_lite::garmentIsLocallyVoidable (keeps "Anular prendas" working on the new state) and the RecogPrendas PAY_YES submit trigger. Other read sites needed no change — they compare against ENVIADA exactly, or block only on ANULADA/RECTIFICADA/ERROR, and the accounting filters (!= 'ANULADA' AND != 'RECTIFICADA') pass SIN COBRAR through exactly as they did PENDIENTE. Migration: a one-time idempotent backfill in migrateDatabase re-labels unpaid 'PENDIENTE' rows as 'SIN COBRAR'. It is scoped to the literal 'PENDIENTE' and deliberately leaves NULL/'' alone — those are legacy split-off garments, and Imprimir's event-list query plus CancelInvoiceDialog detect them via verifactu_estado != '', so making them non-empty would have added a spurious event group to printed invoices. pendingVerifactuEvents keeps its #43 payment gate as belt-and-braces (the estado filter now excludes SIN COBRAR on its own, but the gate still covers those untouched legacy blanks). Tests: test_verifactu_models::test_estadoIsUnsubmitted pins the "every other gate treats the two alike" contract, test_estadoRoundTrip covers the new value, test_sql_lite::test_migrateDatabase_backfillsUnpaidAsSinCobrar pins both migration boundaries (a paid pending row survives; a blank row stays blank) plus idempotency, test_pendingVerifactuEvents_excludesSinCobrar and an extra garmentIsLocallyVoidable case cover the readers. 14 suites green. Files: src/verifactu/verifactutypes.h, src/sql_lite/{sql_lite.h,sql_lite.cpp}, src/app/mainwindow.cpp, src/add_garment/add_garment.cpp, src/recog_prendas/recog_prendas.cpp, src/app/voidgarmentsdialog.h, tests/{test_verifactu_models,test_sql_lite}.cpp, docs.
  • [x] CI: bump Node 20 actions to v5: GitHub Actions was force-running actions/checkout@v4, actions/upload-artifact@v4 and actions/download-artifact@v4 on Node 24 and warning that Node 20 is deprecated; the shim will eventually be removed and break the build + release pipeline. A first pass to @v5 only half-fixed it — CI still warned, because upload-artifact@v5 and download-artifact@v5/v6 are themselves Node 20; only checkout@v5, upload-artifact@v6+ and download-artifact@v7+ run on Node 24 (verified by reading runs.using in each major's action.yml). Final state: checkout@v5, upload-artifact@v7, download-artifact@v8 in ci.yml and checkout@v5 in docs.yml. Upload/download were taken to the current matched pair — v7 and v8 are the two halves of the same direct-upload feature — and the three inputs actually used (name, path, if-no-files-found) are unchanged. setup-python@v5 / upload-pages-artifact@v3 / deploy-pages@v4 were left alone: not flagged, and out of scope for a warning fix. Verification gap: download-artifact runs only in the tag-gated release job, so a develop push exercises the upload side only. If v8 ever misbehaved the release job would fail at the download step, which happens before packaging and publishing, so a broken artifact cannot reach the GitHub release. Files: .github/workflows/ci.yml, .github/workflows/docs.yml.

Post-10.7 development — September 2026 (shipped in 10.8)

  • [x] "Envíos Verifactu pendientes" no longer lists unpaid tickets (issue #43): reported from the shop — on startup the recovery dialog showed every ticket at verifactu_estado='PENDIENTE', none of them paid, so none of them ever due for AEAT submission. Traced the save path: MainWindow::saveTicket stamps every garment row PENDIENTE (VerifactuEstado::NotSubmitted) regardless of pagado, while the actual submission is gated on if (isPaid) in on_bb_save_reset_clicked — an unpaid ticket is correctly never sent, but its rows sit at PENDIENTE until collection and payment in PayDialog. The dialog's feed, sql_lite::pendingVerifactuEvents, filtered only on estado + the reception-date floor, with no payment gate, so the normal steady state of the shop (garments in store awaiting collection) read as unreconciled in-flight AEAT submissions. The string "PENDIENTE" conflates "not due to be sent" with "sent, reply lost"; only onRetryClicked distinguished them, one step too late (it refuses a row with no fecha_pago). Why now: the default recovery floor is 2026-09-01, so from 1 September every newly-entered ticket cleared the floor and the dialog began filling up. Fixed by adding AND pagado = 'SI' AND fecha_pago IS NOT NULL AND fecha_pago != '' to the query — fecha_pago is the real gate (it is what a retry must re-submit under), pagado is the weaker literal-string check kept alongside it. Verified no recoverable event is lost: every writer that leaves a genuinely pending row sets both columns — save-time paid ticket (fecha_pago = fecha_recepcion), PayDialog partial pay (seq>0), and the RectifyInvoiceDialog placeholder (pagado='SI'). New test_sql_lite::test_pendingVerifactuEvents_excludesUnpaid mirrors the corner case both ways (same n_recibo: unpaid save-time event excluded, paid partial-pay event still surfaced) plus a pagado='SI' row with no fecha_pago; confirmed it fails without the gate. 14 suites green. Files: src/sql_lite/sql_lite.cpp, tests/test_sql_lite.cpp, docs.

Post-10.6 development — July 2026 (shipped in 10.7)

  • [x] Anular prendas: stamp the cancellation date, and keep observations editable on a voided row: two in-shop follow-ups to the "Anular prendas" tool. (1) sql_lite::voidGarmentRow now also writes fecha_pago and fecha_recogida with the current date (dd-MM-yyyy), so the DB records when a garment was anulada — previously both stayed empty and the cancellation had no timestamp anywhere. Accounting is unaffected: the row keeps pagado='NO' and gets verifactu_estado='ANULADA', and every accounting query filters on pagado='SI' plus a not-ANULADA estado, so a stamped fecha_pago can never leak into a quarter total. (2) In Recogida de Prendas, the observaciones field is no longer read-only for an Anulado row: updateRowClickedToFields() leaves le_obsv writable and updateDb()'s Anulado early-return now exempts the OBSV op, so staff can record why the garment was voided or add later notes. All other edit paths (pay / pickup / split / re-price) stay locked. Tests updated: test_voidGarmentRow_setsAnuladoAndScopesByHash asserts both dates equal today, and test_markTicketPickedUp_excludesAnulado now asserts a "Recoger todo" does not overwrite the voided row's cancellation date. 14 suites green. Files: src/sql_lite/{sql_lite.h,sql_lite.cpp}, src/recog_prendas/recog_prendas.cpp, tests/test_sql_lite.cpp, docs.
  • Hardening prompted by the above (accounting-lock read made order-independent): because a voided garment now carries edit_lock 0 and a stamped fecha_pago, it becomes a matching row in the month-lock lookup sql_lite::readLockForMonthAndYear (which keys on fecha_pago LIKE '%-MM-yyyy'). That function previously took the first matching row's edit_lock, so a voided (unlocked) row sorting ahead of a genuinely locked sibling could make an already-locked month read as open and let a write through. Changed the query to SELECT COALESCE(MAX(edit_lock), 0) so the month reads locked if any row is locked, regardless of order; an empty month still returns 0 (callers only branch on == 1 / == 0, and Facturas relies on empty → 0 to allow an expense in a fresh month). readLockForQuarter already used the COUNT(*), COALESCE(MAX(edit_lock),0) shape, so this only aligns the month variant. test_readLockForMonthAndYear extended with an unlocked-row-inserted-first case that returns 1 (would have returned 0 under the old read). Files: src/sql_lite/sql_lite.cpp, tests/test_sql_lite.cpp, docs.

Post-10.5 development — July 2026 (shipped in 10.6)

  • [x] Status API watchdog recalibration (warning was suppressed on lid-open): after the shop reinstalled APD6 (which fixed the BiOpenMonPrinter hang), the diagnostic showed every call fast, but lid-open prints still showed no warning. Cause: the watchdog timeout (4 s) was below the offline BiDirectIOEx send time, so a normal offline send tripped the watchdog first -> it returned status.valid=false, suppressed the warning, and latched the API off for the session. Key finding from the field logs: the DLL's ERR_ACCESS (-80) path on an open cover / no paper returns after its own internal ~5 s and ignores our BiDirectIOEx timeout parameter (lowering it 5000 -> 2500 ms did not speed up the -80 case). So the fix is to size the watchdog well above that: set it to 10 s (was 4 s, briefly 6 s which left only ~0.3 s margin over the real ~5.5 s offline send and would still occasionally false-trip). A genuine hang is indefinite, so 10 s cleanly separates "normal offline" from "hung". Confirmed on the shop TM-T20III: lid-open now shows the warning and queues via RAW, normal prints are unaffected. Root cause of the whole saga (BiOpenMonPrinter hang) was a printer firmware update that reset the interface config; reinstalling the APD6 Status API package restored it. Files: src/printing/statusapiprinter.cpp, src/imprimir/imprimir.cpp, docs.
  • [x] Status API diagnostic button ("Probar Status API") to pinpoint the firmware-induced hang: to find which Bi* call the printer firmware update made block, added StatusApiPrinter::runDiagnosticsBounded(queue, timeoutMs) - it opens the printer and calls each Status API function in sequence (BiOpenMonPrinter -> BiGetStatus -> BiGetType -> BiDirectIOEx a real-time DLE EOT 1 status request that does not print -> BiCloseMonPrinter), logging [diag] a line before and after each call with elapsed ms, and returns a report. It runs behind the same watchdog thread, so a hang cannot freeze the UI: the culprit shows as the last -> line with no result after it, and the report ends with a "BLOQUEO" note. A "Probar Status API (diagnóstico)..." button in SettingsDialog (General tab, beside the Status API checkbox) runs it and shows the report (also in the log). src/appsettings now links printing for StatusApiPrinter; the DLE EOT request is safe (real-time status, no paper used). Not unit-tested (Win32 DLL / UI). 14 suites green. Next: run it on the shop TM-T20III and read which call stalls. Files: src/printing/{statusapiprinter.h,statusapiprinter.cpp}, src/appsettings/{settingsdialog.cpp,CMakeLists.txt}, docs.
  • [x] Status API watchdog: a hung Epson DLL can no longer freeze the app: after a printer firmware update on the shop TM-T20III, enabling the Status API froze the app on every print - one of the synchronous Bi* DLL calls (BiOpenMonPrinter/BiGetStatus/BiDirectIOEx) now blocks indefinitely on that printer, and it ran on the UI thread. Since the DLL is third-party and out of our control, wrapped it in a watchdog: new StatusApiPrinter::sendAndReadStatusBounded(..., timeoutMs) runs the DLL calls on a detached worker thread and waits at most 4 s (std::thread + condition_variable; not std::async, whose future destructor would re-block). On timeout the UI thread abandons the worker (its shared_ptr result slot keeps it memory-safe), falls back to RAW, and latches the API off for the rest of the process so only one print pays the 4 s, not every one. Imprimir::printTicket now calls the bounded variant. Net effect: the optional Status API can never freeze the POS again - worst case is one 4 s delay then silent RAW. Not unit-tested (threading/DLL/UI wiring, no pure logic); 14 suites still green. Workaround already in the field: the shop turned the setting off to unblock. Files: src/printing/{statusapiprinter.h,statusapiprinter.cpp}, src/imprimir/imprimir.cpp, docs.
  • [x] Status API cover-open detection: read-before-send + isFatal split + send-failure warning (hardware-driven): iterated on the shop TM-T20III to make the optional Epson Status API actually warn on an open cover. (1) Reordered StatusApiPrinter::sendAndReadStatus to the APD6 manual's flow - BiOpenMonPrinter -> BiGetStatus (read first) -> BiDirectIOEx (send) - since the send returns ERR_ACCESS (-80) while the cover is open, so a send-first design never read status. (2) New PrinterStatus::isFatal() splits faults: fatal (cutter/mechanical/unrecoverable) -> warn and do NOT print; recoverable (cover/paper) -> warn but fall through to RAW so the spooler queues the job. (3) Hardware finding: this unit reports an open cover as ASB_NO_RESPONSE (raw ASB 0x1), not ASB_COVER_OPEN (0x20) - BiGetStatus succeeds but decodes to "ready", and the send fails -80. So a specific "Tapa abierta" isn't obtainable here; Imprimir::printTicket now warns generically ("comprueba tapa / papel / conexión") whenever the API send is refused and we reached a valid status, and still queues via RAW. A missing DLL leaves status invalid -> stays silent (RAW only). Kept a gated qDebug of the raw ASB word in StatusApiPrinter (only logs when nonzero / read error) to identify the offline cause in the field. New test_escpos::test_printerStatus_fatalVsRecoverable (pure decode/classification). The printTicket warning wiring is UI-coupled, not unit-tested. 14 suites green. Validated on the shop TM-T20III (APD6 Status API installed): the warning dialog appears for lid-open, no-paper and printer-off, and the ticket still queues via RAW and prints once the printer is fixed. Hardware quirk recorded: this unit reports printer-off as raw ASB 0x1 (ASB_NO_RESPONSE) and both lid-open and no-paper as 0x4 (and the value is not even stable per condition), so a specific "Tapa abierta" / "Sin papel" is not obtainable here - the send-failure-keyed generic warning is the right design. This closes the former "Validate the ESC/POS Status API on hardware" open issue. Files: src/printing/{printerstatus.h,printerstatus.cpp,statusapiprinter.cpp}, src/imprimir/imprimir.cpp, tests/test_escpos.cpp, docs.
  • [x] Test coverage: Imprimir InvoiceID selection extracted to a pure seam: the "which InvoiceID to print" rule in Imprimir::displayInvoiceId() was a first-non-empty scan over the ticket rows' verifactu_invoice_id column with a bare-n_recibo fallback, trapped behind Imprimir's QSqlQueryModel/QLineEdit members and so untested. Extracted the pure decision into sql_lite::verifactuDisplayInvoiceId(const QStringList &invoiceIds, const QString &fallback) (sibling of the existing verifactuInvoiceId format seam); displayInvoiceId() now just gathers the column and delegates. New test_sql_lite::test_verifactuDisplayInvoiceId locks the invariant that matters - it picks the first NON-EMPTY literal (not row 0, which can be an unpaid row of a multi-event ticket with an empty id) and falls back to the bare n_recibo for all-empty legacy (8.0-8.4) rows. The remaining getTicketInfo seq WHERE filter and resolveQrCode QR gating stay parked as integration-only (see Backlog). 14 suites green. Files: src/sql_lite/{sql_lite.h,sql_lite.cpp}, src/imprimir/imprimir.cpp, tests/test_sql_lite.cpp, docs.
  • [x] RecogPrendas: integer-only quantity (follow-up to the pre-payment editing feature): the review of the 10.5 feature noted that le_qty accepted a decimal like 2,5, which toInt() would store as cantidad 2 while the importe recompute used 2.5 - a divergence. Fixed at the source: initialSettings() installs a QIntValidator(1, 9999) on le_qty so a non-integer count can't be typed, and Qt suppresses editingFinished while the field is not Acceptable, so the existing newQty < 1 guard in the QTY case is now belt-and-suspenders. Files: src/recog_prendas/recog_prendas.cpp, docs.

Post-10.2 development — July 2026

  • [x] RecogPrendas: edit quantity / service / importe before payment: the garment-pickup panel now lets staff correct a garment's quantity, service and amount while it is still unpaid, instead of only observations/size. le_qty and le_price became editable and the read-only le_servic line edit was replaced by a cb_servic QComboBox offering the two services the app prices (Limp. / Plan.). Editing quantity (QTY op) or changing the service (SERVICE op) re-prices the row automatically via sql_lite::garmentImporte (importe = qty * unitPrice * size, unit price from readGarmentPrice); le_price (PRICE op) is a manual comma-normalised override applied last. All four widgets are gated by priceEditable = !isAnulado && !isPaid && !editLock in updateRowClickedToFields (a paid row was already submitted to AEAT), and every updateDb case re-checks !editLock && pagado=="NO" as defense-in-depth. The combo writes on activated(int) (user interaction only) so loading a row never fires a spurious write, and a legacy servicio not in the list maps to findText()==-1 -> blank rather than a wrong value. New DB seam sql_lite::updateGarmentServiceAndImporte (servicio + importe) with test_sql_lite::test_updateGarmentServiceAndImporte; QTY reuses the existing updateGarmentQtyAndImporte seam and PRICE reuses updateTicketSizeAndPrice. Files: src/recog_prendas/{recog_prendas.ui,recog_prendas.h,recog_prendas.cpp}, src/sql_lite/{sql_lite.h,sql_lite.cpp}, tests/test_sql_lite.cpp, docs.
  • [x] Auto-update fixed for a hardened-%TEMP% machine: per-user install + non-elevated launch with TMP/TEMP redirect: a shop report that the in-app update "only works when the app is run as administrator" turned into a three-layer investigation on the actual machine. (Layer 1) The installer targeted C:\Program Files\La Ideal (admin), so it was manifested requireAdministrator; QProcess::startDetached/CreateProcess cannot elevate, so launching it from a non-elevated app failed with ERROR_ELEVATION_REQUIRED. A first attempt (released as 10.3, then retracted) switched the launch to ShellExecuteW("runas") to raise the UAC prompt. (Layer 2) On-machine testing showed 10.3 still failed - the downloaded installer in %TEMP% could not be executed at all (not by the app, not by Explorer: "Windows cannot access the specified device, path, or file... permissions"). Its inherited %TEMP% ACL was Administrators:(F) + Everyone:(R,W,DC) with no execute for the normal user - a hardened Temp (the "AV/Controlled-Folder blocks executing from %TEMP%" the README warns about). Under UAC the Administrators SID is deny-only, so a non-elevated process fell to Everyone = no execute; the same file in %LOCALAPPDATA%\<app>\updates gets <user>:(F) (execute allowed). (Layer 3) Even after downloading to that executable folder, Inno Setup's own loader extracts its bootstrap into %TEMP% and runs it there, so an elevated installer hit "Unable to execute file in the temporary directory. Error 5". A direct test proved UAC elevation resets the environment (an elevated child saw the default hardened %TEMP%, not a TMP/TEMP we had set) - so redirecting Inno's temp only works if the installer runs non-elevated. Final fix (10.4): (a) releases/laideal.iss sets PrivilegesRequired=lowest -> per-user install to %LOCALAPPDATA%\Programs\La Ideal, no elevation, no UAC; (b) Updater::downloadInstaller saves to QStandardPaths::AppLocalDataLocation + "/updates" (execute-allowed) instead of %TEMP%, clearing stale installers; (c) UpdaterDialog::onDownloadFinished sets TMP/TEMP to that folder via qputenv and launches with QProcess::startDetached (non-elevated, so the redirect is inherited) - the 10.3 ShellExecute("runas") and shell32 link were reverted. Validated on the hardened machine: a minimal PrivilegesRequired=lowest Inno installer, run non-elevated with TMP/TEMP redirected, installed per-user with exit code 0 and no Error 5. Note: every build up to 10.3 has the broken (Temp/admin) updater, so 10.4 must be installed manually once; auto-update works from 10.4 onward. The old C:\Program Files\La Ideal install should be uninstalled once (data is safe - the DB path lives in settings). Not unit-tested: environment-dependent download path + process launch + installer packaging, no pure logic; compareVersions stays covered. Files: releases/laideal.iss, src/updater/{updater.cpp,updaterdialog.cpp,CMakeLists.txt}, docs.

Post-10.1 development — June 2026

  • [x] Dev-experience: self-healing VSCode Debug + Rectify INSERT clarity comment: (1) the F5 build task (.vscode/tasks.json) now dependsOn "CMake: configure (Debug)", so a fresh clone or a wiped build-debug/ self-configures instead of failing with no exe - CMake no-ops an already-valid cache, so it costs nothing on repeat runs; the README Debug section was trimmed accordingly (the manual one-time-configure step is no longer needed, troubleshooting kept). (2) Added a one-line comment at the RectifyInvoiceDialog INSERT INTO ingresos explaining it deliberately bypasses sql_lite::insertGarmentRow because a rectificativa row writes the full verifactu_* column set the IngresoGarmentRow seam does not carry - so a future reader does not "fix" it into the seam. Files: .vscode/tasks.json, README.md, src/app/rectifyinvoicedialog.cpp.
  • [x] Global UI language setting (Español/English) via a bundled Qt translator: replaces per-widget Spanish button hacks with one global QTranslator, so every Qt standard dialog (the Yes/No -> Sí/No confirmations, Aceptar/Cancelar, QColorDialog, etc.) follows a single configurable language. New AppSettings::language()/setLanguage() (app.language, default "es"; persisted in applyDefaults) + a Idioma combo in SettingsDialog -> General (note: applies on next launch). main.cpp installs the translator at startup: English is Qt's source language (no translator), Spanish loads qtbase_es. The .qm is bundled as a Qt resource (resources/i18n/qtbase_es.qm, prefix /i18n, loaded via :/i18n/qtbase_es.qm) because the release runs windeployqt with --no-translations - Qt's translations dir is absent on the shop PC, so shipping it in the exe is the only reliable path. As required for the global setting to actually take effect, removed the one existing per-widget override: VoidGarmentsDialog reverted from manually-built "Sí"/"No" buttons back to a standard QMessageBox::question(Yes|No) that the translator localizes. (Domain toggle text like pb_payment "SI"/"NO" and pb_estado "Recogido"/"En tienda" is data, not language, and was left untouched; bespoke buttons such as PayDialog "Cobrar"/"Cancelar" are app strings, not Qt standard buttons, so the translator does not touch them.) Not unit-tested: startup/UI wiring; the language getter/default is covered indirectly by the AppSettings suite pattern. Files: src/appsettings/{appsettings.h,appsettings.cpp,settingsdialog.h,settingsdialog.cpp}, src/app/{main.cpp,voidgarmentsdialog.cpp}, resources/{laideal.qrc,i18n/qtbase_es.qm}, README.md, docs.
  • [x] AddGarment refuses to append garments to a paid ticket (follow-up to #41): closes the latent "paid-but-unsubmitted" gap - AddGarment::saveFactura never submits to AEAT, so a garment added to an already-paid (already-submitted) ticket and marked paid would sit paid-but-unsubmitted. Rather than wire a submit into that path, adding is now blocked at search time for any ticket that already has a paid garment: new pure-ish seam sql_lite::ticketHasPaidGarment(db, nRecibo) (EXISTS a pagado='SI' row); AddGarment::on_pb_search_pressed shows "el recibo ya está pagado (enviado a la AEAT); usa un recibo nuevo" and leaves ticketFound=false so save is blocked. Only unpaid (not-yet-submitted) receipts can be altered locally by appending garments - consistent with the VoidGarmentsDialog rule for removing them. New test_sql_lite::test_ticketHasPaidGarment (unpaid ticket -> false, any paid row -> true, unknown ticket -> false). Files: src/sql_lite/{sql_lite.h,sql_lite.cpp}, src/add_garment/add_garment.cpp, tests/test_sql_lite.cpp, docs.
  • [x] Log analysis + message refinement (issue #42): analysed a customer log (~43k lines, 75 sessions, May 27 - Jul 1) for misleading traces and warnings. Two code fixes plus a findings triage. (1) MainWindow::saveTicket garment count: the header logged rows: <table_ticket->rowCount()> (always 9, the fixed number of empty input slots) which read as "9 garments saved" even when only 1-2 were filled; the per-row line logged the raw table slot index. Now it counts garments actually inserted (savedGarments), logs saved garment <k> sequentially per insert and a - N garment(s) saved summary at the end. Also corrected the stale comment claiming rows may be written "empty if Verifactu not configured" (saveTicket always writes PENDIENTE). (2) BackupManager::performBackup Qt warning: QSqlDatabasePrivate::removeDatabase: connection 'laideal_backup_verify' is still in use fired on every backup (21x in the log) because removeDatabase() was called while the block's QSqlDatabase/QSqlQuery were still in scope. Restructured Step 2 (verify) - and Step 1 (snapshot) for consistency, it had the same latent bug on its error path - to do the DB work in an inner block that captures a success flag, then removeDatabase() after the handles go out of scope (the pattern Step 1's success path already used). Findings triaged as non-actionable (documented for the record): the ~50 Verifactu submit failed/network error/timeout warnings are legitimate AEAT rejections of data, not code bugs (pre-2024 InvoiceDate on a bulk historical re-submission, duplicate-InvoiceID "ya existe" dedup rejections, an HTTP 429 rate-limit, connection timeouts); the single QProcess: Destroyed while process ("cscript") is still running is a legacy artifact from the pre-10.0 Excel/.vbs print pipeline that was removed in 10.0 (current code only uses QProcess::startDetached for the updater); and readMaxNMinYearInColumnFromTable - database path not configured (2x at startup) is the intended dbNotConfigured guard when a report screen is opened before the DB is configured. Not unit-tested: both fixes are logging / Qt-connection-scoping with no pure logic to assert, and a performBackup happy-path test is impractical because its success path calls AppSettings::instance()->save() (writes the real ~/.laideal_settings.json) - a future test would need an AppSettings injection seam. 14 suites still green. Files: src/app/mainwindow.cpp, src/backup/backup_manager.cpp, docs.
  • [x] AddGarment now books added garments PENDIENTE (issue #41): diagnosed from a customer log (saveTicket: ticket "30877" followed by AddGarment::saveFactura: INSERT INTO ingresos ticket= "30877" for a "Manta"). Root cause: AddGarment::saveFactura ("Herramientas -> Añadir nuevas prendas") built its own inline INSERT that omitted the verifactu_estado column, so a garment added to an existing ticket was written with NULL/empty estado while MainWindow::saveTicket rows get PENDIENTE — the estado column read blank for those garments. Fixed by routing the insert through the existing tested sql_lite::insertGarmentRow(IngresoGarmentRow) seam (same one saveTicket and the SEPARATE_GARM split use) with verifactuEstado = verifactuEstadoToString(VerifactuEstado::NotSubmitted) ("PENDIENTE"), which also dedups the duplicated INSERT SQL. Safe by construction: the pending-submit recovery query (sql_lite::pendingVerifactuEvents) already treats empty/NULL and PENDIENTE identically (verifactu_estado IS NULL OR = '' OR = 'PENDIENTE') and refuses to retry rows with no fecha_pago, so stamping PENDIENTE changes only the displayed/consistent estado, not the AEAT submission behaviour (no new duplicate-InvoiceID risk). New test_sql_lite::test_insertGarmentRow_addGarmentShapePending anchors the regression (an added, unpaid garment persists PENDIENTE). The AddGarment slot itself stays UI-coupled; the meaningful contract (insertGarmentRow persists the estado it is handed) is unit-tested. 14 suites green. Files: src/add_garment/add_garment.cpp, tests/test_sql_lite.cpp, docs.
  • [x] Void unpaid, not-delivered garments (issue #40) — new VoidGarmentsDialog + Anulado estado + green-pagado colouring: a local counterpart to CancelInvoiceDialog for erroneous receipts / change-of-mind on garments not yet delivered. The key insight that shaped the design: AEAT submission only happens when a ticket is paid (save-if-paid in MainWindow::on_bb_save_reset_clicked, or at payment via PayDialog) — an unpaid garment stays verifactu_estado = PENDIENTE and was never sent to AEAT, so voiding it is a pure local DB change with no AEAT anulación (that path is CancelInvoiceDialog, for paid/ENVIADA rows). New menu action Herramientas → Anular prendas (recibo erróneo)... opens src/app/voidgarmentsdialog.{h,cpp}: search a ticket by number, see its garments in a table with per-garment checkboxes, and void the selected ones. Only rows that pass the new pure guard sql_lite::garmentIsLocallyVoidable(pagado, verifactuEstado) (unpaid and never-submitted) are selectable; paid/ENVIADA rows show "Pagado/enviado - usar Anular Factura" and already-voided rows show "Anulado". Voiding runs the new DB seam sql_lite::voidGarmentRow(db, nRecibo, hash) = UPDATE ingresos SET estado='Anulado', verifactu_estado='ANULADA' scoped by (n_recibo, hash) (pagado deliberately left as NO — the row is closed, not collected). The new estado value lives as INGRESOS_ESTADO_ANULADO in ingresos_schema.h. For the colouring requirement, TextColorDelegate gained a pure static classify(cellText, rowEstado) and now reads the row's sibling estado column: a row whose estado is Anulado renders green everywhere (via INGRESOS_COL_ESTADO), so a voided receipt's NO pagado no longer reads as an outstanding debt — satisfying "cambiar color del pagado a verde aunque siga siendo que NO". Accounting is unaffected: an anulado row is unpaid (pagado='NO') so it was already excluded from the pagado='SI' paid totals, and verifactu_estado='ANULADA' keeps it out of the Verifactu-based figures. New tests: test_sql_lite covers garmentIsLocallyVoidable (paid/sent variants) and voidGarmentRow (sets Anulado/ANULADA, leaves pagado, scopes by hash); new suite tests/test_textcolordelegate.cpp covers classify incl. the Anulado-green rule. 14 suites green. Files: src/app/voidgarmentsdialog.{h,cpp} (new), src/app/{mainwindow.ui,mainwindow.h,mainwindow.cpp,CMakeLists.txt}, src/sql_lite/{sql_lite.h,sql_lite.cpp,ingresos_schema.h}, src/tableview/textcolordelegate.{h,cpp}, tests/{test_sql_lite.cpp,test_textcolordelegate.cpp,CMakeLists.txt}, docs.
  • Follow-up: an Anulado row is now immutable and excluded from payment, prints and accounting everywhere. After the initial dialog landed, in-shop testing found the RecogPrendas pb_state button could still flip a voided garment back to "En tienda". Fixed by treating an Anulado row as read-only across every edit path: (1) RecogPrendas::updateRowClickedToFields disables pb_state / pb_pay_all / pb_pku_all / pb_separ_garm and makes le_obsv / le_size / le_price read-only for an Anulado row (and the redundant re-enable block in selectSourceRow was removed so updateRowClickedToFields is the single source of truth); (2) RecogPrendas::updateDb early-returns on an Anulado row as defense-in-depth so no write path can revive it; (3) Recoger todo now goes through the new seam sql_lite::markTicketPickedUp(db, nRecibo, fechaRecogida) whose UPDATE ... SET estado='Recogido' carries AND estado != 'Anulado', so a bulk pickup never revives a voided garment; (4) PayDialog::loadTicket skips Anulado rows so a voided (unpaid) garment can never enter the payable set and be submitted to AEAT; (5) Imprimir::getTicketInfo excludes estado='Anulado' on both the recibo and factura queries so a voided garment never prints. Contabilidad needs no change: every accounting query already requires pagado='SI' (an Anulado row is pagado='NO') and also excludes verifactu_estado='ANULADA' — doubly excluded — and the payment guards guarantee an Anulado row can never become pagado='SI'. New test_sql_lite::test_markTicketPickedUp_excludesAnulado seeds a voided + a normal row and asserts the bulk pickup marks only the normal one Recogido. Files: src/recog_prendas/{recog_prendas.cpp,pay_dialog.cpp}, src/imprimir/imprimir.cpp, src/sql_lite/{sql_lite.h,sql_lite.cpp}, tests/test_sql_lite.cpp, docs.
  • [x] Documentation site (MkDocs Material → GitHub Pages): the docs/ tree is now published as a searchable static site. New mkdocs.yml (Material theme, light/dark palette toggle, search, the full docs/ tree as nav) renders the existing Markdown as-is; a validation: block classifies the many cross-repo links (to src/ sources and root files like releases_notes.txt, .claude/…) as warnings, not errors, so a plain non-strict mkdocs build stays green. A minimal root pyproject.toml hosts the build tooling as a docs optional-dependency group (pip install ".[docs]" → mkdocs-material); it ships no Python package (py-modules = []). New .github/workflows/docs.yml uses the official Pages flow (upload-pages-artifact + deploy-pages, pages: write + id-token: write, concurrency: pages non-cancelling): the build job runs on push and PR (the PR run is the pre-merge publication test), the deploy job runs only on master push and then verifies publication by polling the deployed page_url until HTTP 200. Requires the repo's Pages source set to "GitHub Actions" (done). .gitignore ignores site/ / _site/. Verified locally: build exits 0 with the expected cross-repo link warnings. Files: mkdocs.yml, pyproject.toml, .github/workflows/docs.yml, .gitignore, docs.

Post-10.0 development — June 2026

  • [x] Thermal ticket layout polish from shop feedback (Uds. gap, condiciones pitch, QR spacing): three readability tweaks to the printed recibo/factura after the 10.0 in-shop printouts. (1) The garment table's quantity column abutted the name column (Uds.Prendas with no gap because the 4-char header filled the 4-col field) — EscPosBuilder::garmentRow default qtyWidth widened 4→6 so Uds. (and short quantities) clear the Prendas column; the name column drops from 35→33 cols @80mm, still ample. (2) The "Condiciones generales" legal block was already the smallest built-in font (Font B) but still read like body text, so its line pitch was tightened via two new pure builder methods lineSpacing(int dots) (ESC 3 n, set to 24) / defaultLineSpacing() (ESC 2, restored after the block) — the glyphs can't shrink below Font B, but the denser pitch makes it read as fine print. (3) The Verifactu QR had too much whitespace above it — the extra feed(1) before the raster was removed (the payment marker above and the AEAT pixmap's own quiet zone already separate it). New test_escpos case asserts the ESC 3 24 / ESC 2 bytes and the widened qty column; the test_ticket_preview ESC-interpreter learned to skip ESC 2 / ESC 3 n (the latter is 3 bytes — the old 2-byte default skip would have leaked the pitch byte into the text); committed preview_*.png regenerated. 13 suites green. Files: src/printing/{escposbuilder,ticketrenderer}.{h,cpp}, tests/{test_escpos,test_ticket_preview}.cpp, docs/modules/printer/preview_*.png, docs.

Post-9.3 development — June 2026

  • [x] Optional ESC/POS Status API layer (dossier Phase 4) — paper-out / cover-open / cutter status: behind the new print.use_status_api setting (off by default), Imprimir::printTicket routes the same ESC/POS bytes through Epson's Status API instead of the RAW spooler and reads the device status back. Two new src/printing/ seams: PrinterStatus (pure — fromAsb(quint32) decodes the Epson ASB 32-bit status word into named flags paperEnd/paperNearEnd/coverOpen/cutterError/mechanicalError/unrecoverableError/offline/drawerOpen, with hasError()/hasWarning() and a Spanish summary()), and StatusApiPrinter::sendAndReadStatus (Win32 — loads EPSStmApi.dll dynamically via LoadLibrary/GetProcAddress so there is no build-time Epson-SDK dependency, then BiOpenMonPrinter(2,queue) → BiDirectIOEx send → BiGetStatus → BiCloseMonPrinter; a stub off Windows). The transport returns false without sending when the DLL/API is unavailable or the queue can't be opened, so printTicket falls back to the RAW ThermalPrinter::send path — enabling the flag never stops printing. On a real problem after a successful send it shows a QMessageBox::warning(status.summary()) ("Sin papel", "Tapa abierta", "Papel casi agotado", …). Settings getter AppSettings::useStatusApi() + a SettingsDialog → General checkbox. Not hardware-validated: the ASB_* bit values and the EPSStmApi.dll call path must be confirmed on the shop's TM-T20III with the APD/Status API installed (like Phase 0 for the RAW path). Six PrinterStatus decode cases added to tests/test_escpos.cpp (OK/near-end/end/cover/cutter/offline + error-ranks-before-warning + default-invalid); 13 suites green. Files: src/printing/{printerstatus,statusapiprinter}.{h,cpp} + CMakeLists.txt, src/imprimir/imprimir.cpp, src/appsettings/appsettings.{h,cpp} + settingsdialog.{h,cpp}, tests/test_escpos.cpp, docs.
  • [x] Removed the vendored QXlsx/ library (dossier Phase 5 cleanup): the Excel→ESC/POS migration left imprimir no longer linking QXlsx, and the vendored tree + root add_subdirectory(QXlsx) were kept for one release as an easy rollback until the printer was validated on hardware. With the TM-T20III validation done (previous milestone), the 906 KB tree was deleted and the CMake wiring removed. Verified first that nothing under src/ includes any xlsx header or names QXlsx:: — only docs and the dead-code-finder agent note referenced it. Dropped the "Excel library" rows from the file map (ai_agent_instructions), the source-tree diagram + Third-Party Dependencies table (architecture), and the file/build tables (INDEX); marked dossier Phase 5 done in printer/README.md + 05_implementation_plan.md. No test change — pure build-graph cleanup, proven by the build still linking laideal.exe. Files: root CMakeLists.txt, QXlsx/ (deleted), docs.
  • [x] Direct ESC/POS printing validated on hardware + ticket-preview test + CI/release consolidation: follow-ons to the Excel→ESC/POS migration below. (1) The printer was confirmed on the shop's physical Epson TM-T20III — recibo and factura print correctly (Spanish accents via PC858, partial cut, Verifactu QR, 80 mm width), closing the dossier Phase 0 hardware-validation item. (2) New tests/test_ticket_preview renders a sample recibo + factura from the real TicketRenderer ESC/POS output back into a PNG simulation of the thermal paper + an ASCII mock (asserts the layout blocks; QTEST_MAIN with the native QPA platform on Windows so system fonts render real glyphs, offscreen elsewhere); a committed PNG pair lives in docs/modules/printer/ (embedded in the dossier README), and Render-TestSummary.ps1 appends the ASCII receipt to the run summary because GitHub strips inline images (PNG/SVG, data:/inline) from job summaries — an SVG render was tried and dropped (its generic monospace misaligned the right-justified values + vertical rhythm; the grid-drawn PNG aligns). (3) CI consolidated into one workflow: ci.yml now also triggers on feature/** branches, and the standalone release.yml was folded into ci.yml as a tag-gated release job (needs: build, if: startsWith(github.ref,'refs/tags/')) that reuses the build job's exe artifact instead of recompiling, then windeployqt/zip/InnoSetup/publishes — release.yml deleted. Files: tests/{test_ticket_preview.cpp,CMakeLists.txt}, docs/modules/printer/preview_*.png, .github/workflows/ci.yml, .github/scripts/Render-TestSummary.ps1, root README.md, .claude/commands/release.md, docs.
  • [x] Excel ticket printing replaced by direct ESC/POS over the Windows RAW spooler: receipts/facturas no longer go through QXlsx → .xlsx → a generated .vbs → cscript → Excel COM (which required Excel installed and licensed on the shop PC, launched a process per print, was brittle — a left-over EXCEL.EXE/dialog/macro prompt could hang the 60 s wait — and gave no print/error feedback). New src/printing/ static lib with three seams from the research dossier (docs/modules/printer/): EscPosBuilder (pure: chainable ESC/POS byte builder + a PC858 transcode for Spanish accents/€ + dots/char-width column math), TicketRenderer (pure: a plain TicketData → the same header/identity/garment-table/totals/QR/policy/timestamp content and ordering as before, laid out to the printer's real column width; the factura IVA split reproduces the legacy rounding — IVA derived from the rounded base string — so base+IVA still reconstruct the total), and ThermalPrinter (the only host-specific piece: OpenPrinter/StartDocPrinter datatype RAW/WritePrinter via winspool, default-printer fallback, a human-readable GetLastError/FormatMessage string surfaced in a QMessageBox; a failing stub off Windows keeps the builder/renderer cross-platform). Imprimir::createTicketExcel→buildTicket (fills m_ticketBytes) and printTicket→ThermalPrinter::send; the public two-step call shape (build copy → print → build next copy → print) is preserved, so all six call sites (mainwindow save + print menu, PayDialog Cobrar, RecogPrendas reprint, the multi-seq chooser) keep working with a one-word rename. The Verifactu QR is rastered from the exact AEAT pixmap (GS v 0, qr.scaled(192).toImage()) rather than re-encoded, so the printed QR stays byte-exact with what AEAT registered; resolveQrCode() (async /GetQrCode, 5 s wait, estado/CSV gating) is unchanged. New settings print.printer_name (empty = Windows default printer) and print.paper_width_mm (58/80, default 80 → 576/420 dots) editable in SettingsDialog → General (printer combo from QPrinterInfo::availablePrinterNames()); the obsolete ticketExcelPath/ticketPrintScriptPath helpers were removed. imprimir no longer links QXlsx — but the vendored QXlsx/ tree was left in place for one release (decoupled, unused) for an easy rollback before the printer is validated on the shop PC; its removal is a new Open Non-Blocking item. New tests/test_escpos.cpp (12th suite, links the light printing lib, QTEST_GUILESS_MAIN) asserts the exact control bytes (init/align/bold/font/size/cut), the PC858 transcode incl. unmapped→?, the column math (576→48/64, 420→35/46), and the recibo/factura render fragments incl. the 121→100+21 IVA split and that a QR is rastered. Not hardware-validated in CI (dossier Phase 0): the real printer-queue name, the PC858 code page for accents, and the loaded paper width must be confirmed on the shop's TM-T20III. Files: src/printing/* (new lib), src/imprimir/imprimir.{h,cpp} + CMakeLists.txt, src/appsettings/appsettings.{h,cpp} + settingsdialog.{h,cpp} + CMakeLists.txt, src/app/mainwindow.cpp, src/recog_prendas/{pay_dialog,recog_prendas}.cpp, root CMakeLists.txt, tests/{test_escpos.cpp,CMakeLists.txt}, docs (architecture, INDEX, README, ai_agent_instructions, modules/{imprimir,printing}.md, modules/printer/).
  • [x] Test coverage: MainWindow saveTicket INSERT + verifactuSubmitInvoice base math onto existing seams: the save-side equivalent of the RecogPrendas updateDb extraction. MainWindow::saveTicket built its ingresos INSERT inline from the ticket-table widgets (22 bound columns) — trapped in the app exe, untestable. It now delegates to the existing sql_lite::insertGarmentRow seam, which gained a verifactuEstado field (the single verifactu_* column the two callers differ on): a RecogPrendas split-off row passes "" (legacy/NotSubmitted, unchanged), saveTicket passes "PENDIENTE" via verifactuEstadoToString(NotSubmitted) so the async AEAT submit can later patch the row. The slot keeps reading its widgets (combo cells, payment toggle, optional size/obsv items) and just fills the struct. Separately, verifactuSubmitInvoice's inline tax-base split total / (1 + iva/100) now routes through the already-tested pure Facturas::taxBaseFromGross(gross, rate) (its InvoiceID already goes through the tested verifactuInvoiceId), so the method's whole pure surface is covered by existing suites. New test_sql_lite case asserts the saveTicket shape (PENDIENTE estado, payment booked on the reception date, empty pickup date). The async/UI residual (submitSimplifiedInvoiceAsync + m_pendingSubmits correlation, onVerifactuRequestFinished status text, the QEventLoop/QTimer print-after-submit wiring) stays a narrowed Open Non-Blocking item — exe-bound, needs a QTest-GUI harness. Minor behaviour note: insertGarmentRow now writes verifactu_estado for every caller (split rows previously left it NULL, now "" — both read as NotSubmitted, so no functional change). Files: src/sql_lite/sql_lite.{h,cpp}, src/app/mainwindow.cpp, tests/test_sql_lite.cpp, docs.
  • [x] Test coverage: AppSettings JSON getters via a loadFrom(path) injection seam: the secret-at-rest dpapi* helpers were already covered, but the getters that read the singleton's JSON (contabilidadPath/listadosPrendasPath/listadosGastosPath = reportsRoot + a hardcoded subdir, ivaRate, and the encryptSecretsAtRest() legacy-plaintext migration) couldn't be asserted without touching the real ~/.laideal_settings.json. New public seam AppSettings::loadFrom(const QString &path) points m_filePath at an arbitrary file, drops the constructor defaults (m_data = {}) and runs the real load() pipeline (parse → migrateLegacyKeys → encryptSecretsAtRest → applyDefaults, rewriting the file if a plaintext secret was encrypted) — not used in production. New test_appsettings cases write a throwaway JSON in a QTemporaryDir, loadFrom it, and assert: the three derived report paths resolve under the configured root; ivaRate reads taxes.iva_rate and falls back to the 21.0 default when the block is absent; a plaintext service_key is encrypted at rest on load (the getter still returns plaintext, the on-disk value carries the DPAPI marker on Windows and round-trips via dpapiDecrypt on every platform); and an already-encrypted key is left byte-for-byte unchanged (no double-wrap). Files: src/appsettings/appsettings.{h,cpp}, tests/test_appsettings.cpp, docs.
  • [x] Test coverage: RecogPrendas updateDb DB-write seams extracted + tested: the per-operation SQL in RecogPrendas::updateDb (PAY_YES/PAY_NO, PKU_YES/PKU_NO, OBSV, SIZE_AND_PRICE, SEPARATE_GARM) was inline widget-reading code trapped in the app, untestable. Each write is now a pure sql_lite free function keyed by (n_recibo, hash) — updateTicketPayment, updateTicketPickup, updateTicketObservations, updateTicketSizeAndPrice, updateGarmentQtyAndImporte, and insertGarmentRow(IngresoGarmentRow) for the split-off row (which deliberately leaves the verifactu_* columns at their empty defaults so a split row reads as legacy/NotSubmitted — re-submitting it would duplicate the ticket's AEAT InvoiceID); the PAY_YES pay-all dedup's estado read-back is the new ticketVerifactuEstado. updateDb keeps all the business rules (edit_lock guard, blocked-quarter check, the Verifactu-submit decision) and now just reads its widgets and delegates — behaviour unchanged. New test_sql_lite cases seed multi-row tickets and assert each write lands and is scoped by hash (siblings untouched), the split row persists every field with empty verifactu_estado, and ticketVerifactuEstado returns the first row's estado / empty for an unknown ticket. The MainWindow saveTicket/verifactuSubmitInvoice + async-AEAT + dialog-wiring half stays a narrowed Open Non-Blocking item (needs a QTest-GUI harness + an app-logic lib split). Files: src/sql_lite/sql_lite.{h,cpp}, src/recog_prendas/recog_prendas.cpp, tests/test_sql_lite.cpp, docs.

Post-9.2 development — June 2026

  • [x] Annual Contabilidad report: 24 per-quarter scans → 2 grouped queries: the annual PDF called computeFigures for all 4 quarters, each running 4 totalPriceBetweenDates + 2 countOperationsBetweenDates full-table substr() scans (~24 scans). New DB seam sql_lite::annualAccountingByQuarter(db, year) runs one grouped query per table over the whole year, bucketed by quarter (quarter = (month + 2) / 3): ingresos SUM(importe) + COUNT(DISTINCT n_recibo) under the exact pagado='SI' + ANULADA/RECTIFICADA + half-open date filters; gastos SUM(importe) bucketed by quarter×iva (10/21/0) plus a per-quarter row count over every rate (matching the existing gastos count). It returns a QuarterlyAccountingTotals (per-quarter raw importes/counts, index 0 = Q1). The IVA base/cuota derivation was extracted from computeFigures into the pure static Contabilidad::figuresFromTotals(...), now shared by both the per-period path (trimestral/mensual, unchanged) and the annual path (one prefetched QuarterlyAccountingTotals), so the figures are identical. Verification (the reason this was deferred): test_sql_lite::test_annualAccountingByQuarter seeds a multi-quarter DB and asserts the grouped result equals, quarter by quarter, the per-quarter totalPriceBetweenDates/countOperationsBetweenDates it replaces — the tax math is provably unchanged. Caveat: the grouped path sums importe in SQL, so it does not raise the comma-decimal corruption dialog the per-row helpers do; the trimestral/mensual reports still call those helpers and keep that guard (and they are run regularly to lock quarters, so corruption still surfaces). The 4 per-quarter readLockForQuarter reads stay (cheap, separate concern). Files: src/sql_lite/sql_lite.{h,cpp}, src/contabilidad/contabilidad.{h,cpp}, tests/test_sql_lite.cpp, docs.
  • [x] Seq-aware startup recovery of partial-pay (seq>0) Verifactu timeouts: the PendingSubmitsDialog startup recovery now reconciles timed-out PayDialog partial-payment events, not only save-time / full-ticket submissions. The pending-events query is extracted into the testable seam sql_lite::pendingVerifactuEvents(db, floorIso) — it drops the old AND verifactu_invoice_seq = 0 filter and groups by (n_recibo, verifactu_invoice_seq), so each event surfaces as its own {n_recibo, seq, fechaPago, cliente, importe} row with that event's own SUM(importe). The recovered event re-submits under its fecha_pago (the original AEAT submission date — date is part of the invoice identity, so reusing reception date would register a second invoice and defeat the duplicate-InvoiceID guard); the recovery floor still gates on fecha_recepcion. Seq is threaded through the async retry path: PendingSubmitsDialog::Entry and the retryRequested signal gain seq; the recovery row shows the <n>-<seq> InvoiceID via verifactuInvoiceId; onMarkErrorClicked now scopes its UPDATE by seq so marking one event Error never clobbers a sibling event of the same ticket. MainWindow::verifactuSubmitInvoice gains seq=0 and submits verifactuInvoiceId(ticketNum, seq) (so a recovered event re-submits under the same ID it stored); m_pendingSubmits becomes reqId → {ticketNum, seq} and onVerifactuRequestFinished patches via updateTicketVerifactuFields(db, ticketNum, result, seq). This changes what is re-submitted to AEAT for seq>0 events — intended; it is the fix. The slow-but-already-registered case is still covered by the duplicate-InvoiceID rejection warning. New test_sql_lite::test_pendingVerifactuEvents seeds save-time (multi-row), partial-pay (seq>0) and ENVIADA/before-floor rows and asserts the grouping, per-event sums and ordering. Files: src/sql_lite/sql_lite.{h,cpp}, src/app/pendingsubmitsdialog.{h,cpp}, src/app/mainwindow.{h,cpp}, tests/test_sql_lite.cpp, docs.

Post-9.1 development — June 2026

  • [x] PayDialog "Cobrar" now auto-prints a single factura: PayDialog::printPartialFactura printed two copies (customer + business: createTicketExcel(true) → printTicket() → createTicketExcel(false) → printTicket()). At the operator's request it now prints only the single customer copy after Cobrar; a second copy is available via the RecogPrendas reprint button (pb_print). Files: src/recog_prendas/pay_dialog.cpp, docs/modules/recog_prendas.md.
  • [x] ReportHtml::formatEuro now groups thousands consistently: the test_reporthtml suite had surfaced that QLocale(Spanish,Spain).toString(value,'f',2) grouped inconsistently — no separator for 1234.56 ("1234,56") but a single misplaced one for 1000000.0 ("1000.000,00"). Replaced the QLocale call with manual grouping: round to cents, group the integer part in threes with ., join with , and two zero-padded decimals, handling the sign. Now 1234.56 → "1.234,56 €", 1000000 → "1.000.000,00 €", 999.99 → "999,99 €", -1234.5 → "-1.234,50 €". The test was updated to assert the grouped output. Affects every euro figure in the Contabilidad + Listados PDFs (a display improvement). Files: src/reporthtml/reporthtml.h/.cpp, tests/test_reporthtml.cpp, docs.
  • [x] Test coverage: MainWindow removeSpecialChar extracted + tested: the last quick pure-helper win on the MainWindow/RecogPrendas surface. The accent/special-char stripper used for client-name matching couldn't be unit-tested because MainWindow is compiled into the app executable, not a library; its logic moved verbatim into sql_lite::removeSpecialChars (NFD → narrow to Latin-1 so combining marks become ? → drop every ?; case preserved) and the member now delegates, so checkClientData behaviour is unchanged. New cases in test_sql_lite. The remaining RecogPrendas/MainWindow surface (DB writes + async AEAT + UI wiring) is integration-level and stays a narrowed Open Non-Blocking item needing a seeded-DB + QTest-GUI harness. Files: src/sql_lite/sql_lite.h/.cpp, src/app/mainwindow.cpp, tests/test_sql_lite.cpp, docs.
  • [x] Verifactu InvoiceID reconstruction deduped into sql_lite::verifactuInvoiceId (+ a seq-0 submit/persist fix): the seq==0 ? n_recibo : "<n>-<seq>" rule was rebuilt in 5 places. Lifted into the single pure helper sql_lite::verifactuInvoiceId(nRecibo, seq) and routed all callers through it. Four were behaviour-preserving dedups (updateTicketVerifactuFields, CancelInvoiceDialog reconstruction, Imprimir::labelFor, PayDialog::markPendingVerifactu). The fifth, PayDialog::onCobrarClicked, was the one site that built the InvoiceID always dashed ("<n>-<seq>" even for seq 0): a first Cobrar on an unpaid-saved ticket (seq 0) submitted "<n>-0" to AEAT while updateTicketVerifactuFields persisted bare "<n>" — a latent submit/persist mismatch that misaligned the reprint QR / cancel for that case. Routing it through the helper makes the submitted InvoiceID match what is stored (bare "<n>" for seq 0). This is a Verifactu AEAT-submission behaviour change (only for the seq-0 partial-pay case; both forms are valid unique InvoiceIDs, and the new one aligns submit with persist). Unit-tested in test_sql_lite::test_verifactuInvoiceId. Files: src/sql_lite/sql_lite.h/.cpp, src/recog_prendas/pay_dialog.cpp, src/app/cancelinvoicedialog.cpp, src/imprimir/imprimir.cpp, tests/test_sql_lite.cpp, docs.
  • [x] Test coverage: GenListado pure helpers: extracted the model/ui-independent logic from two ui-reading slots into pure statics — GenListado::filenameSuffix(agrupar, tipoGastos, allYears, selectedYear) (the gastos-PDF filename suffix: agrupado_<agrupar>_<tipo>_<year|todos_los_años>, lower-cased, spaces→underscores) and GenListado::shouldPrintGastoRow(allYears, selectedYear, rowYear, onlyClosed, rowClosed) (the year + accounting-type row filter); the check_years_invoice_type_for_row/add_suffix_to_filename members now read the widgets/model and delegate. New tests/test_genlistado.cpp covers both. The gastos/prendas HTML row builders (heavy model iteration + ui) were left uncovered. Files: src/listado/genlistado.h/.cpp, tests/test_genlistado.cpp, tests/CMakeLists.txt, docs.
  • [x] Test coverage: MySortFilterProxyModel sort comparators: extended test_mysortfilterproxymodel with lessThan cases driven via sort() + row-order assertions on a QStandardItemModel with table_name set — an ingresos date column sorts chronologically (dd-MM-yyyy parsed, not lexicographically: 15-12-2025 < 31-01-2026 < 02-02-2026), an importe column sorts numerically (9 < 50 < 100, not as strings), and a non-special column falls back to locale string compare. No production change. Files: tests/test_mysortfilterproxymodel.cpp, docs.
  • [x] Test coverage: Facturas IVA split: extracted the base/cuota math that was inline in Facturas::on_le_importe_textEdited into pure statics Facturas::taxBaseFromGross(gross, rate) = gross/(1+rate/100) and taxAmountFromGross(gross, rate) = gross*(1 - 1/(1+rate/100)); the slot now calls them (parse switched toFloat→toDouble, output still 2 decimals so behaviour is preserved). New tests/test_facturas.cpp covers the 21/10/0 % rates and that base+cuota reconstructs the gross. Files: src/facturas/facturas.h/.cpp, tests/test_facturas.cpp, tests/CMakeLists.txt, docs.
  • [x] Test coverage: AppSettings DPAPI secret-at-rest: exposed the file-local encryptSecret/decryptSecret/isEncrypted helpers as public static delegators (AppSettings::dpapiEncrypt/dpapiDecrypt/dpapiIsEncrypted, distinct names so they don't clash with the unqualified internals the getters/setters keep calling) so the security-relevant crypto is testable without the settings file. New tests/test_appsettings.cpp asserts the dpapi:v1: marker, the encrypt→decrypt round-trip (on Windows the value is real ciphertext carrying the marker; the round-trip holds cross-platform since non-Windows is a passthrough), the legacy-plaintext passthrough, and empty→empty. The settings-file getters (derived paths / ivaRate / encryptSecretsAtRest migration) were deferred — they read the singleton JSON and need an injection seam (re-filed as a narrower Open Non-Blocking item). Files: src/appsettings/appsettings.h/.cpp, tests/test_appsettings.cpp, tests/CMakeLists.txt, docs.
  • [x] Test coverage: Verifactu model classes (config / tax item / invoice / estado): new tests/test_verifactu_models.cpp (links verifactu, all pure) covers VerifactuConfig (default TESTING env, the service-key→NIF→name validation order, and the prewww2-vs-www2 getValidationUrl / getQrUrl per environment); VerifactuTaxItem (operationTypeToString for S1/S2/N1/N2/E1, toJson keys, negative-rate isValid); VerifactuInvoice (isRectificationInvoiceType, rectificationTypeToString S/I, calculateTotals = Σbase+Σtax, toJson keys incl. F1/F2/R1 InvoiceType and the rectificativa RectificationType/base/amount block, and the validation rules incl. F2 needing no buyer but F1 requiring one); and the verifactuEstadoToString/verifactuEstadoFromString round-trip (PENDIENTE/empty/unknown → NotSubmitted). 8 suites pass. Files: tests/test_verifactu_models.cpp, tests/CMakeLists.txt, docs.
  • [x] Test coverage: reporthtml + updater pure helpers: closes the first "grow test coverage" sub-item. New tests/test_reporthtml.cpp covers ReportHtml::formatEuro (Spanish comma decimals + euro suffix), tableOpen (grid vs borderless) and documentClose (footer / closing tags); new tests/test_updater.cpp (built as exe test_versioncompare) covers Updater::compareVersions (numeric major-then-minor, leading-v normalisation, 9.10 > 9.2) and currentVersion. Two issues surfaced and handled: (1) formatEuro does not group thousands the way its doc claimed (re-filed as an Open Non-Blocking note; the test asserts the real small-value behaviour + structure rather than the quirky grouping, and the doc comment was corrected); (2) the test executable could not originally be named test_updater - Windows' UAC installer-detection heuristic flags any exe whose name contains update/setup/install as requiring elevation and CTest failed with BAD_COMMAND, so the target was renamed to test_versioncompare (noted in tests/CMakeLists.txt). 7 suites pass. Files: tests/test_reporthtml.cpp, tests/test_updater.cpp, tests/CMakeLists.txt, src/reporthtml/reporthtml.h (doc), docs.
  • [x] Test coverage grown into BackupManager retention + Contabilidad period math (two more testability seams): continues the "grow test coverage" item. (1) BackupManager::pruneOldBackups() mixed the retention decision with filesystem I/O (entryInfoList + QFile::remove); the decision is split into the pure static BackupManager::backupsToPrune(fileNames, now) (sorts chronologically, keeps every copy < 30 days, then the earliest per calendar month up to 4 years, drops the rest, ignores non-schema names), and pruneOldBackups() now just lists the dir, calls it, and removes the returned names. New tests/test_backup_manager.cpp drives the policy with synthetic filenames + a fixed now (recent kept, monthly dup dropped, >4y dropped, junk ignored) - no filesystem needed. (2) Contabilidad::periodRange() read the mode/quarter/year off the widgets; the date math is split into the pure static Contabilidad::periodRangeFor(mode, unit, year, &start, &endExclusive) (the member now just reads the ui and delegates), and tests/test_contabilidad.cpp asserts the half-open quarter/month ranges incl. the Q4/December year-boundary roll-over. Both suites run under QTEST_GUILESS_MAIN. The Imprimir invoice-id target stays deferred (heaviest lib to link). All 5 suites pass. Files: src/backup/backup_manager.{h,cpp}, src/contabilidad/contabilidad.{h,cpp}, tests/test_backup_manager.cpp, tests/test_contabilidad.cpp, tests/CMakeLists.txt, docs.
  • [x] Test coverage extended to the Verifactu response parser and the garment price math (with the seams to make them testable): closes the named half of the "extend test coverage" item. (1) VerifactuManager::processResponse() was a private method, untestable without a live VerifactuManager; its body (pure: JSON reply -> VerifactuResult, incl. the <...:Huella> SHA-256 extraction and base64 QR decode) is lifted verbatim into a free function parseVerifactuResponse() + decodeVerifactuImageBase64() in new src/verifactu/verifacturesponse.{h,cpp}; the manager's two call sites now call the free function and the private method + decodeImageFromBase64 member are gone. New tests/test_verifactu_response.cpp (8 cases) covers invalid JSON, ResultCode error + ResultMessage/Return.ErrorDescription precedence, an invoice-level Return.ErrorCode under ResultCode 0, the success path (CSV / ValidationUrl / Huella upper-cased, and that HuellaPrevia is not mistaken for Huella), and the GetQrCode base64->QPixmap decode (uses QTEST_MAIN under QT_QPA_PLATFORM=offscreen since QPixmap needs a QGuiApplication). (2) The duplicated setGarmentPrice price math in MainWindow and AddGarment (comma-decimal-normalised quantity x unit price x non-zero size factor, clamp >= 0) is extracted into the pure sql_lite::garmentImporte(); both dialogs now call it (also collapses the duplicate and removes the latent MainWindow "empty cell on negative" quirk - it now shows 0.00 like AddGarment). Six garmentImporte cases added to test_sql_lite (incl. the comma-decimal regression and the size factor). All 3 suites pass; the foldable CI report now lists a third suite. Files: src/verifactu/verifacturesponse.{h,cpp}, src/verifactu/verifactumanager.{h,cpp}, src/verifactu/CMakeLists.txt, src/sql_lite/sql_lite.{h,cpp}, src/app/mainwindow.cpp, src/add_garment/add_garment.cpp, tests/test_verifactu_response.cpp, tests/test_sql_lite.cpp, tests/CMakeLists.txt, docs.
  • [x] Test suite: Qt Test + CTest foundation, wired into CI and the release gate: closes (the bulk of) the long-standing "Unit and integration tests" Open Non-Blocking item. New top-level tests/ (enable_testing() + add_subdirectory(tests), Test added to the root find_package) with two Qt Test executables registered via add_test, both QTEST_GUILESS_MAIN so they run headless on CI. test_sql_lite spins up a throwaway SQLite DB in a QTemporaryDir, creates the ingresos/gastos/clientes schema and exercises the free functions against it: genHash16 shape/uniqueness, readMaxValueInColumnFromTable, totalPriceBetweenDates (ingresos ANULADA/RECTIFICADA + pagado='SI' + half-open [start,end) filters; gastos IVA-rate filter), countOperationsBetweenDates (distinct n_recibo), readLockForMonthAndYear, readLockForQuarter (incl. the 9.1 first-month-only regression guard), nextVerifactuInvoiceSeq, readClientPhones. test_mysortfilterproxymodel covers removeDiacritics and accent-insensitive filterAcceptsRow. Fixtures stay on success paths + dot-decimal importes so the QMessageBox error paths never fire under the guiless main. CI (ci.yml) replaced its placeholder with ctest --output-on-failure; release.yml runs ctest between Build and Stage as a hard gate (a failing test aborts the publish); the /release skill (step 3) and README document the local ctest gate. Surfaced a doc bug: the test showed readLockForMonthAndYear returns 0 (not 2) for an empty month — a valid-but-empty SELECT hits q.first() ? ... : 0, so it conflates "no data" with "open" (harmless: its only caller checks ==1). Corrected the function's sql_lite.md row; the distinct-2-for-no-data behavior lives only in the new readLockForQuarter. Remaining originally-listed targets (processResponse, setGarmentPrice) re-filed as a narrowed Open Non-Blocking follow-up — each needs a production change (test seam + AEAT fixtures / pure-function extraction). Files: CMakeLists.txt, tests/CMakeLists.txt, tests/test_sql_lite.cpp, tests/test_mysortfilterproxymodel.cpp, .github/workflows/{ci,release}.yml, .claude/commands/release.md, README.md, docs/{architecture,INDEX,modules/sql_lite}.md.

Post-9.0 bug fixes — June 2026

  • [x] Startup backup moved off the GUI thread + single-query client phone lookup: two of the three perf findings from the 9.0 review. (1) BackupManager::performBackup() (VACUUM INTO + PRAGMA integrity_check, seconds on a large DB) ran on the GUI thread ~3 s after launch and froze the UI for its duration; it now runs on a QThread::create worker (safe — it uses its own dedicated DB connections and touches no GUI), with the Result marshalled back to the main thread via QMetaObject::invokeMethod(this, …, Qt::QueuedConnection) for the success status-bar / failure message-box. (2) RecogPrendas::updateRowClickedToFields looked up tel_fijo and movil with two separate selectFromWhereLike calls (two DB open/close + two SELECTs) on every row click; new sql_lite::readClientPhones(db, client) returns both in one SELECT tel_fijo, movil … WHERE nombre = :n. The third finding (annual Contabilidad report's ~24 full-table scans) was deliberately deferred — see Open Non-Blocking — because it rewrites the quarterly tax aggregation and needs verification against real data. Files: src/app/mainwindow.cpp, src/sql_lite/sql_lite.h/.cpp, src/recog_prendas/recog_prendas.cpp, docs/modules/sql_lite.md, docs/architecture.md.
  • [x] PayDialog AEAT timeout now records PENDIENTE, not Error (and recovery is scoped so it can't mis-resubmit): when the 5 s bounded wait expired, PayDialog::persistPayment ran a NETWORK_ERROR result through updateTicketVerifactuFields, which wrote verifactu_estado = Error. A slow-but-accepted AEAT submission was therefore recorded as a failure, and PendingSubmitsDialog (which only re-surfaces NULL/empty/PENDIENTE) never offered to reconcile it, so a later manual retry risked an AEAT 8003 duplicate. Now a NETWORK_ERROR/PENDING outcome (timeout or transport failure — an unknown, not a definitive rejection) is persisted as PENDIENTE via the new PayDialog::markPendingVerifactu(seq), which keeps the <n_recibo>-<seq> InvoiceID and leaves CSV/XML empty; a genuine AEAT ERROR reply still writes Error. Because PendingSubmitsDialog re-submits a whole ticket as a bare n_recibo (it is seq-unaware), its query was scoped with AND verifactu_invoice_seq = 0 so a partial-pay (seq>0) PENDIENTE row is never auto-retried with the wrong amount/InvoiceID — full seq-aware recovery is filed as a new Open Non-Blocking item. Income totals are unaffected (PENDIENTE, like Error, is still counted). Files: src/recog_prendas/pay_dialog.h/.cpp, src/app/pendingsubmitsdialog.cpp, docs/modules/verifactu/README.md.
  • [x] Reprinted factura QR now uses the submitted payment date (fecha_pago), not fecha_recepcion: Imprimir::resolveQrCode() rebuilt the QR's FechaExpedicion from row 0's fecha_recepcion. For a partial payment (PayDialog submits to AEAT with fecha_pago) or a late pickup payment (retry submits with the payment date), payment day ≠ reception day, so a reprint produced a QR whose date — and thus the AEAT cotejo URL — did not match the registered invoice. Now reads the first paid row's fecha_pago, which equals the date submitted to AEAT on every path: PayDialog/retry submit the payment date, and save-time submissions store fecha_pago = fecha_recepcion (mainwindow binds :fecha_pago to de_date_recep), so the common counter-sale case is unchanged. Scans for the first non-empty fecha_pago because row 0 can be an unpaid garment in the legacy unfiltered reprint path. Files: src/imprimir/imprimir.cpp. (Note: the QR is regenerated via the AEAT GetQrCode service rather than rendered from a stored URL because there is no local QR encoder; storing/rendering the cotejo URL locally remains a possible future simplification.)
  • [x] Trimestral accounting lock now reads the whole quarter, not just its last month: Contabilidad::on_bb_ok_cancel_accepted() decided whether a quarter was already done/locked by calling readLockForMonthAndYear(db, "ingresos", sb_trim*3, year) — i.e. only the quarter's third month. A quarter with income in its first month(s) but nothing paid in the last month read back as "no data" (status 2), hit the default branch ("no hay registros"), and updateLock() was never invoked, so the quarter stayed editable after the operator closed contabilidad — AEAT-reported income could then be altered. New sql_lite::readLockForQuarter(db, table, quarter, year) does one pass over the quarter's three months (substr(dateCol,4,2) IN (m1,m2,m3) AND substr(dateCol,7,4)=year): COUNT(*)=0 → 2 (no data), else MAX(edit_lock) → 1 locked / 0 open. Used both for the lock decision and for the Annual report's per-quarter "Contabilidad cerrada/no cerrada" label (which had the same last-month-only bug). As part of the change the lock read moved inside the Trimestral branch (it was computed unconditionally at the top, producing a meaningless month=sb_trim*3 up to 36 in Mensual mode) and the dialog's stay-open-on-revert decision now uses an explicit keepDialogOpen flag instead of re-testing the now-scoped editLock. Files: src/sql_lite/sql_lite.h/.cpp, src/contabilidad/contabilidad.cpp, docs/modules/{contabilidad,sql_lite}.md.

Post-8.4 development — May 2026

  • [x] Pickup-all (pb_pku_all) scoped to the clicked ticket (closes the name-search blast-radius bug): RecogPrendas::on_pb_pku_all_clicked() used to loop sqlQueryModel->rowCount() and fire updateDb(PKU_YES) per source row. On a name search the model holds the whole ingresos table (SELECT *), so the loop marked every ticket in the DB as Recogido — the same blast-radius pattern that was fixed for pay-all in 8.5 via PayDialog. Now reads the clicked row's n_recibo (isCellClicked guard) and runs a single prepared UPDATE ingresos SET fecha_recogida = :fr, estado = 'Recogido' WHERE n_recibo = :n bounded to that one ticket, then refreshes via on_pb_search_clicked(). Pickup never carried the Verifactu duplicate-InvoiceID consequence (no AEAT submission), which is why it was non-blocking. Shipped in commit 9f8d217; this entry reconciles the tracker (the item had a dangling "tracked in Open Non-Blocking" reference but the fix had already landed). Files: src/recog_prendas/recog_prendas.cpp, docs/modules/recog_prendas.md.
  • [x] db handle privatised + constructor-injected across all dialogs (extends the Contabilidad #9 fix): following the Contabilidad cleanup, the same anti-encapsulation pattern (QSqlDatabase db; as a public member assigned after construction, e.g. ui_x->db = db;) was removed from every other dialog opened from MainWindow. db is now a private member set through the constructor (explicit Foo(const QSqlDatabase &database, QWidget *parent = nullptr)), so callers write new Foo(db, this) instead of new Foo(this) + a separate ->db = db. Classes converted: Imprimir, Listado, RecogPrendas, Facturas, AddGarment, GenListado, InsertNewItem, PayDialog, CancelInvoiceDialog, RectifyInvoiceDialog. All nested instantiations updated too (RecogPrendas→PayDialog/Imprimir, PayDialog→Imprimir, Listado→InsertNewItem/GenListado). Verified safe: every constructor-invoked setupUi()/initialSettings()/buildUi() is db-free (db is only touched in event handlers), so injecting the handle earlier is behaviour-preserving; and there were no external reads of another object's db (every prior occurrence was a db = db assignment), so privatising breaks nothing. In each header db was placed after the ui member so the constructor init-list order matches declaration order (no -Wreorder). MainWindow::db stays public — it is the owner that creates the connection. The other public flags/pointers flagged in audit item #9 (qrCode, isRecibo, revertirOn, m_verifactu, …) were left as-is — out of scope. Release build links clean (30/30). Files touched: headers + cpps of all ten classes above, src/app/mainwindow.cpp, src/listado/listado.cpp, src/recog_prendas/recog_prendas.cpp, src/recog_prendas/pay_dialog.cpp; docs docs/modules/{imprimir,add_garment,recog_prendas,facturas,listado}.md, docs/coding_guidelines_audit.md (item #9 marked resolved for db).
  • [x] Contabilidad / sql_lite review fixes (re-verified todo.bak findings): an earlier opencode review of contabilidad had logged 10 issues; re-checking against the post-rewrite code, two were already resolved (the malformed <th<'> HTML — the table builders now go through ReportHtml::tableOpen(); and the missing revertirOn guard for Mensual/Anual — resetAllContents() now forces cb_config to Trimestral and disables it in revert mode, so the unguarded branch is unreachable). The rest were fixed: (#1 SQL injection / guideline) totalPriceBetweenDates, countOperationsBetweenDates, readLockForMonthAndYear and the lock-update helper now use prepare() + bindValue() named params instead of + string concatenation (table/column names stay interpolated — still validated against "ingresos"/"gastos" — since SQL can't bind identifiers). (#2 misnamed) updateLockInIngresos → updateLockForMonth: the name no longer hides that it UPDATEs both ingresos and gastos. (#3 leak + modality) Contabilidad changed from QMainWindow to QDialog (the .ui lost its centralwidget wrapper) and now sets WA_DeleteOnClose, so the non-modal new Contabilidad(...) + show() instances self-delete instead of leaking until MainWindow dies. (#6 dead code) removed the three no-op ui->sb_trim->minimum() calls. (#7 readability) static_cast<int>(!revertirOn) replaced with a named const int lockValue = revertirOn ? 0 : 1. (#8 hardcoded 2019) the year-selector lower bound now comes from readMaxNMinYearInColumnFromTable(db, false, "fecha_pago", "ingresos") (falls back to the current year when there is no data). (#9 public db) the db handle is now a private member injected via the constructor (Contabilidad(const QSqlDatabase &, QWidget *)) instead of a public field assigned after construction. (#10 text-coupled constants) the C_MENSUAL/C_TRIMESTRAL/C_ANUAL #defines (compared against combobox text) replaced by a ConfigMode { Mensual=0, Trimestral=1, Anual=2 } enum compared via currentMode() (the combobox index), so renaming an item can't silently break the logic. Release build links clean. Files touched: src/contabilidad/contabilidad.h/.cpp/.ui, src/sql_lite/sql_lite.h/.cpp, src/app/mainwindow.cpp, src/recog_prendas/pay_dialog.cpp (comment), docs/modules/contabilidad.md, docs/modules/sql_lite.md, docs/architecture.md, .claude/commands/coding-guidelines.md (stale C_TRIMESTRAL example).
  • [x] Dead-code cleanup in src/verifactu/ (19 unused methods removed): closes the Open Non-Blocking entry. Removed VerifactuConfig::getEmitterCompanyName(), getSystemDeveloper(), and the companyName/developer parameters from setEmitterData/setSystemData (the members were never read outside their own setters); thinned VerifactuTaxItem by 6 accessors (setTaxType, setOperationType, setDescription, getTaxType, getTaxRate, getOperationType); thinned VerifactuInvoice by 12 items (setBuyerNIF/Name, setTotalAmount, setTotalTaxAmount, getInvoiceType, getDescription, getBuyerNIF/Name, getTotalTaxAmount, clearTaxItems, the member operationTypeToString overload, taxTypeToString). All dead as of the async refactor that removed createAndSubmitInvoice — codebase is self-contained with no external linkers. Updated call sites: verifactuintegration.cpp, mainwindow.cpp. Snapshot refreshed via the dead-code-finder subagent. Files touched: src/verifactu/verifactuconfig.h/.cpp, src/verifactu/verifactutaxitem.h, src/verifactu/verifactuinvoice.h/.cpp, src/verifactu/verifactuintegration.cpp, src/app/mainwindow.cpp, docs/dead_code_report.md, docs/progress_tracker.md.
  • [x] Verifactu ServiceKey encrypted at rest (Windows DPAPI, per-user): closes the "ServiceKey stored in plaintext JSON" Open Non-Blocking entry. The AEAT API credential was kept as plaintext under verifactu.service_key in ~/.laideal_settings.json. Now AppSettings::setVerifactuServiceKey() encrypts via Windows DPAPI CryptProtectData (scoped to the current Windows user, CRYPTPROTECT_UI_FORBIDDEN so no prompt) and stores dpapi:v1:<base64>; verifactuServiceKey() transparently CryptUnprotectDatas on read, so every caller (VerifactuIntegration, SettingsDialog) still sees plaintext and nothing else changed. Chosen over a master password (the shop runs unattended at the counter) and over an app-embedded key (not real security). Migration: encryptSecretsAtRest() runs in load() (both the new-file and existing-file branches) and re-encrypts any value lacking the dpapi:v1: marker — covering both legacy plaintext already in the JSON and a key just imported from ~/.verifactu_key; the existing-file branch then save()s immediately so the plaintext does not linger on disk. Fallbacks (key never lost): CryptProtectData failure stores plaintext rather than dropping the key; CryptUnprotectData failure (file copied to another Windows user/machine — DPAPI is user+machine bound) returns empty so "Probar conexión" fails clearly and the operator re-enters it. Non-Windows builds (none shipped) compile via a passthrough. Logs were already redacted (verifactumanager.cpp). Tradeoff documented: the encrypted key is not portable across Windows accounts/machines and must be re-entered after a reinstall or migration. Files touched: src/appsettings/appsettings.h/.cpp, src/appsettings/CMakeLists.txt (link crypt32 on Windows). Docs: docs/architecture.md (AppSettings + Known Issues), docs/INDEX.md (glossary).
  • [x] Size-dependent garment price fixed for comma-decimal input (m² cortinas): closes the "Price calculation for size-dependent garments (cortinas) may be incorrect" Open Non-Blocking entry. Root cause: both MainWindow::setGarmentPrice and AddGarment::setGarmentPrice parsed the user-entered size (and quantity) with QString::toFloat(), which is C-locale only (dot decimal), while every storage site normalises with .replace(",",".") before binding :size / :importe. So a Spanish-entered size like 2,6 parsed as 0.0 and the size factor was silently dropped: in MainWindow the importe fell back to quantity × unitPrice (too low), and in AddGarment (which multiplies unconditionally when the field is non-empty, no != 0 guard) it became 0.0 × price = 0,00 — yet the size was stored correctly as 2.6, so the saved/printed importe did not match the entered size. Fix: normalise both inputs with .trimmed().replace(",", ".") before toFloat() at both price-calc sites (mirroring the existing save-time convention), and switch the size test to a parsed sizeValue != 0.0f so non-numeric input no longer multiplies. No schema change. The DB unit price itself is out of scope (kept clean by the existing Herramientas comma-cleanup tool / updateComasInDecimalData). Files touched: src/app/mainwindow.cpp (setGarmentPrice), src/add_garment/add_garment.cpp (setGarmentPrice). Docs: docs/modules/add_garment.md (price-calc note).
  • [x] Investigated & discarded "clients missing from Listado but present in MainWindow combobox": no reproducible mechanism remains, so the entry was removed from Open Non-Blocking Issues (to be reopened only if observed again). The combobox is populated solely from clientes.nombre via readColumnFromTable (mainwindow.cpp:216, SELECT nombre FROM clientes) and Listado (tableName == "clientes") shows the same clientes table via QSqlTableModel. Listado::populateTable() drains fetchMore for every non-ingresos table (while (model->canFetchMore()) model->fetchMore()), which deterministically loads all clientes rows — this replaced an older flaky "scroll the view to the bottom until rowCount stops growing" hack (commit b39cda7 "fix ingresos table view"). The 256-row QSqlTableModel lazy batch was the only plausible original cause (same family as the RecogPrendas name-search 256-row bug) and it is now force-drained. The issue's "encoding differences" hypothesis is refuted: both paths read clientes.nombre through the same QSQLITE driver (SELECT nombre … vs SELECT * …), so a row cannot decode into one result set and disappear from the other; the default (empty) MySortFilterProxyModel filter hides nothing. No code change. Files touched: docs only (docs/progress_tracker.md, docs/architecture.md).
  • [x] Report visualisation: shared professional A4 style + IVA settlement / net result / counts / annual consolidated: closes the "Improve report visualisation" Open Non-Blocking entry for the two A4 PDF surfaces (the thermal-ticket half stays open, re-scoped, since imprimir.cpp is a 58 mm Excel/cscript path where the A4 redesign does not apply). Shared styling, no drift: the three report generators (Contabilidad::generate*, GenListado::generate_html_prendas_table, generate_html_gastos_table) each hand-rolled their own <!DOCTYPE>…<style>…<body> + business header, with an undefined text-small CSS class, a hardcoded "Granada", and malformed tags (<th<'>, <td colspan='6',>). Lifted the common scaffolding into a new tiny static lib src/reporthtml/ (ReportHtml::documentOpen(title, subtitle) / documentClose() / formatEuro(value)): one "clean professional" stylesheet (Arial, slate #2c3e50 headings, soft #b6bec7 grid, grey #e8ecf0 header row, #f6f7f9 zebra, bold accent total rows), a business header band (name / address / city / NIF from verifactuNif() / phone, issue date right-aligned) and a generation-timestamp footer. Everything stays table- and inline-style based because QTextDocument renders only a subset of HTML/CSS (no flexbox). Currency now prints with Spanish grouping via QLocale(Spanish, Spain) — 1.234,56 € instead of 1234.56 €. New contabilidad figures (all computed from existing data, no schema change): a per-period Liquidación de IVA block — IVA repercutido (ingresos) − IVA soportado (gastos) = Resultado IVA, labelled "a ingresar"/"a compensar" by sign (the modelo-303 figure previously computed by hand); Resultado del periodo = base ingresos − base gastos (beneficio/pérdida); the explicit period range (Periodo: dd-MM-yyyy a dd-MM-yyyy) and operation counts (distinct paid tickets for ingresos, invoice rows for gastos) via a new countOperationsBetweenDates() in sql_lite that mirrors the estado/date filters of totalPriceBetweenDates; and, for the annual report, a Resumen anual consolidado that sums the four quarters. Refactors that fell out: the four-way quarter/month date switch duplicated inside getTotalIncome is now a single periodRange() helper reused by the counts and the period subtitle; the figures are computed once into a PeriodFigures struct (with resultadoIva() / resultadoPeriodo() / accumulate() helpers) and shared by the ingresos table, gastos table and summary, replacing the old per-table recomputation and the dead createHtmlHeader() / createHtmlTables(). The listados keep their columns but adopt the shared header/footer/stylesheet, right-aligned euro cells, and the malformed group-total colspan rows are fixed. Files touched: src/reporthtml/ (new: reporthtml.h/.cpp, CMakeLists.txt), CMakeLists.txt (add_subdirectory), src/sql_lite/sql_lite.h/.cpp (countOperationsBetweenDates), src/contabilidad/contabilidad.h/.cpp (+ CMakeLists.txt link), src/listado/genlistado.cpp (+ CMakeLists.txt link). Docs: docs/modules/contabilidad.md, docs/INDEX.md, docs/architecture.md.
  • [x] Tag-triggered release workflow — release.ps1 pipeline reproduced in CI and fully automated: new .github/workflows/release.yml (runs on push of an X.Y tag) reproduces every step of releases\release.ps1 on a windows-latest runner — validate tag == CMakeLists.txt version, install Qt 6.4.3 MinGW + Ninja + Inno Setup, configure/build (CMake + Ninja, Release), stage laideal.exe, windeployqt, zip into X.Y.zip, compile the Inno Setup installer (laideal_setup_X.Y.exe), extract this version's releases_notes.txt section, and publish a GitHub Release with both artifacts attached + the section as the release body. So cutting a release is now just git tag X.Y && git push origin X.Y — no local release.ps1 run or manual gh release create needed (release.ps1 stays as the offline/local fallback). Toolchain parity, no separate pin: jurplel/install-qt-action@v4 with arch: win64_mingw runs aqt install-qt … --autodesktop, which auto-downloads MinGW-w64 11.2.0 (the exact toolchain release.ps1 pins at C:\Qt\Tools\mingw1120_64) and puts it on PATH, so the build and windeployqt use the same compiler runtime DLLs the libraries were built against — confirmed in the run log (Finished installation of MinGW-w64-x86_64-11.2.0-…-runtime.7z). An initial attempt to pin it explicitly with tools: 'tools_mingw1120' failed (aqt: not a valid tool name) and was redundant, so it was removed. Hardening added over the plain script translation (caught during a max-effort review of the new file): (1) the windeployqt step now asserts the runtime DLLs were actually deployed (libgcc_s_seh-1.dll, libstdc++-6.dll, libwinpthread-1.dll, Qt6Core.dll, platforms\qwindows.dll) — ci.yml only builds the bare exe and never runs windeployqt, so this is the only place that guards the packaging step from shipping an installer that crashes on launch on a clean machine; (2) Test-Path existence checks after build (exe) and after Inno (installer), mirroring release.ps1; (3) the release-notes extraction now throws when releases_notes.txt has no section for the tag, or the section is empty, instead of silently publishing a release with a blank body that the in-app updater would then show users; (4) the publish step is idempotent — if a release already exists for the tag (re-run after a transient failure, or a moved tag) it is deleted first (the git tag is kept) so gh release create always succeeds. The tag glob '[0-9]+.[0-9]+' is valid GitHub filter syntax (+ = one-or-more), the bare X.Y tag (no v/r prefix) matches Updater::currentVersion() / tag_name, and the laideal_setup_X.Y.exe asset name matches the updater's kInstallerAssetPrefix — so the auto-published release is consumable by the in-app updater unchanged. Validated end-to-end via a throwaway 0.1 tag (on a temp commit bumping CMakeLists.txt/notes to 0.1, never merged): the full pipeline ran green in 3m38s and published 0.1.zip (22 MB) + laideal_setup_0.1.exe (17.6 MB) with the correct notes body; 0.1 chosen because the updater is downgrade-safe (0.1 ≤ 8.4 → no update offered) so no user was affected during the brief window it was /releases/latest. Test release + tag deleted afterwards, restoring 8.4 as Latest. Files touched: .github/workflows/release.yml. Docs: root README.md (Development workflow step 6 + Release procedure now lead with the tag-push automation, release.ps1 documented as the local fallback), docs/INDEX.md (CI/CD workflow files), docs/ai_agent_instructions.md (release-pipeline note).
  • [x] GitHub Actions CI/CD pipeline: new .github/workflows/ci.yml — Windows runner that builds on every push/PR (Qt 6.4.3 MinGW via jurplel/install-qt-action + CMake + Ninja), with a test placeholder and artifact upload of laideal.exe on push branches. Closes the Open Non-Blocking entry. Files touched: .github/workflows/ci.yml.
  • [x] RecogPrendas landline phone (tel_fijo): visualization of the home phone added to the dialog from clientes table alognside client name.
  • [x] CancelInvoiceDialog per-seq cancellation: closes the Open Non-Blocking entry of the same name and removes the 8.5 partial-pay guard that previously blocked the dialog whenever any row of the searched ticket carried verifactu_invoice_seq > 0. The dialog now lists every (n_recibo, verifactu_invoice_seq) AEAT submission as one row in a QTableWidget (InvoiceID, importe, estado, CSV, per-row "Anular" button). Single-event legacy tickets render the same uniform table with one row (seq=0) and behave identically to before. AEAT side: each cancel sends the literal verifactu_invoice_id stored at submit time — when that column is empty (8.0-8.4 rows or pre-Phase-G PayDialog events) the dialog reconstructs the same string AEAT would have under (seq=0 → bare n_recibo, seq>0 → <n>-<seq>). Local side: the post-success UPDATE is now scoped WHERE n_recibo=:n AND verifactu_invoice_seq=:seq, so the other payment events of the same ticket stay ENVIADA. Only events whose verifactu_estado=ENVIADA are cancellable; ANULADA / RECTIFICADA / ERROR / PENDIENTE rows show the button greyed out. Single in-flight cancellation is enforced — the dialog disables all action buttons while a request is pending and re-enables them on reply. The header (cliente + fecha_recepcion) is rendered once above the table since it is invariant per ticket. No schema change. Public surface of the dialog (db + m_verifactu + exec()) is unchanged; MainWindow::on_actionAnular_factura_verifactu_triggered keeps working as-is. Files touched: src/app/cancelinvoicedialog.h/.cpp.
  • [x] RecogPrendas "Recoger todo" blast-radius bug closed: closes the Open Non-Blocking entry of the same name. The legacy on_pb_pku_all_clicked iterated sqlQueryModel->rowCount() source rows and called updateDb(PKU_YES) per row. On a name-search (SELECT * FROM ingresos) the source model held the entire table, so pressing "Recoger todo" marked every ticket in the database estado=Recogido + fecha_recogida=today — same blast-radius pattern that was fixed for pay_all in 8.5 via PayDialog. Closed here with the same scope strategy but a much smaller change since pickup has no per-garment choice / AEAT submit / print: read the clicked row's n_recibo from the source model (no proxy mapping needed — rowClickedCell is already a source row thanks to the 8.4 coord-space fix) and run one UPDATE ingresos SET fecha_recogida=:fr, estado='Recogido' WHERE n_recibo=:n then re-fire the search to refresh the view. No new dialog, no schema change. fecha_recogida is bound from ui->de_date_pickup->date() to match the legacy semantics where the operator could pick a different pickup date in the form. Files touched: src/recog_prendas/recog_prendas.cpp.
  • [x] hash column: UUID-based generator + maintenance action regenerates legacy duplicates instead of just listing them: closes the Open Non-Blocking entry "Manual hash column — review necessity, fix duplicates". Why the dialog was reporting "wrong" duplicates: the legacy SELECT n_recibo, COUNT(*) FROM ingresos GROUP BY hash HAVING COUNT(*) > 1 returned ONE arbitrary n_recibo per duplicate group, so when ticket 21484 shared a hash with ticket 17510 the operator saw 21484 listed but checking 21484's own rows showed unique hashes within that ticket — the collision was cross-ticket, not within-ticket; ticket numbers appearing twice in the list (21484, 21484) just meant that ticket participated in two distinct collision groups. The collisions themselves are legacy data from the older rand()-era genHash16(). The hash IS still required: it is the per-row addressing key used by PayDialog::persistPayment (WHERE n_recibo=:n AND hash=:h) and seven RecogPrendas operations (Entregar / Separar / Pagar / etc.), plus every INSERT site, so dropping it in favour of SQLite's rowid would be a wider refactor than this task warranted. Changes: (1) genHash16() now returns QUuid::createUuid().toString(QUuid::Id128).left(16) — 16 hex chars from a cryptographic UUID, ~2^64 entropy, no realistic birthday-collision and no manual retry loop; (2) on_actionCrear_hash_en_ingresos_triggered() rewritten as three phases — A fills hash IS NULL OR hash = '' rows keyed by rowid (not the legacy all-fields equality, which mass-stamped identical garment rows with one hash); B detects every collision group GROUP BY hash HAVING COUNT(*) > 1, keeps the first row's hash (ordered by rowid), regenerates the rest via UPDATE ... WHERE rowid = :rid; C defensive re-check, surfaces remaining groups in a warning if Phase B didn't converge. Dialog now reports actionable counts: filled / collision groups / rows regenerated, instead of the opaque ticket list. Idempotent — a clean DB returns 0 / 0 / 0. The action is kept as an operator escape hatch even though the schema is now self-healing. Files touched: src/sql_lite/sql_lite.cpp (genHash16 body + swap <QRandomGenerator> for <QUuid>), src/app/mainwindow.cpp (on_actionCrear_hash_en_ingresos_triggered rewrite).
  • [x] Pending Verifactu submissions across app restarts: operator-surfaced recovery dialog: closes the Open Non-Blocking entry of the same name. Until now MainWindow::m_pendingSubmits (reqId → ticketNum) lived only in RAM, so an app close or crash mid-submission left the row at verifactu_estado='PENDIENTE' with no recovery path — and a naive auto-resubmit risks AEAT duplicate-InvoiceID if the original POST had actually reached AEAT before the reply was lost. Resolution path picked: operator-surfaced recovery rather than auto-reconcile (the alternative, auto-reconcile via lookup, was rejected because the Irene Solutions Kivu API has no confirmed idempotent lookup-by-InvoiceID endpoint that returns the AEAT-side CSV). New module src/app/pendingsubmitsdialog.{h,cpp} — a modal QDialog opened from MainWindow's startup via QTimer::singleShot(4000) so it lands after the updater + backup prompts have settled. loadPending() SELECTs distinct n_recibo with at least one row whose verifactu_estado is NULL/empty/PENDIENTE, aggregates fecha_recepcion / cliente / SUM(importe) per ticket, and returns false (so the dialog never opens) when there is nothing pending. Two gates protect against surfacing pre-Verifactu legacy tickets: (1) operator toggle verifactu.pending_recovery_enabled (default true) — when off, loadPending() returns false unconditionally; (2) floor date verifactu.pending_recovery_floor_date (ISO yyyy-MM-dd, default 2026-09-01 matching the planned PROD cutover) — added to the SQL as substr(fecha_recepcion,7,4)||'-'||substr(fecha_recepcion,4,2)||'-'||substr(fecha_recepcion,1,2) >= :floor since the DB stores dd-MM-yyyy and the substr-rebuild gives a lexicographically-comparable ISO key. Both settings are user-configurable in the Verifactu tab of SettingsDialog (QCheckBox + QDateEdit with dd-MM-yyyy display, calendar popup, persisted as ISO in ~/.laideal_settings.json). Each row shows three per-row buttons: Reintentar emits retryRequested(ticketNum, date, total) → MainWindow::verifactuSubmitInvoice(...) which already registers the new reqId in m_pendingSubmits so onVerifactuRequestFinished patches the row when AEAT replies; Marcar como error runs a single UPDATE setting verifactu_estado='Error' + verifactu_error='Pendiente sin reconciliar tras cierre - revisar en sede AEAT' (no AEAT call, no duplicate-InvoiceID risk); Posponer just drops the row from the table — verifactu_estado stays PENDIENTE and the dialog will resurface it on the next launch. Files touched: src/app/pendingsubmitsdialog.h/.cpp (new), src/app/CMakeLists.txt (add to executable sources), src/app/mainwindow.cpp (#include + deferred-launch hook + retryRequested connect → verifactuSubmitInvoice), src/appsettings/appsettings.h/.cpp (two new accessors + defaults), src/appsettings/settingsdialog.h/.cpp (two new controls under the Verifactu tab). Docs: docs/architecture.md (new module box under MainWindow's children), docs/INDEX.md (new file entries).
  • [x] Drop the legacy VerifactuConfig INI cache: closes the Open Non-Blocking entry of the same name. Pre-8.5 builds wrote a QSettings INI copy of NIF/name/serviceKey/environment to <AppDataLocation>/verifactu_config.ini on every Verifactu submit, but VerifactuIntegration::loadEmitterConfiguration() always overwrote the in-memory state from ~/.laideal_settings.json (AppSettings) at startup, so the INI was never read back. The file was therefore a stale plaintext copy of the same credentials already kept in the JSON — a credential-footprint smell with no functional purpose. Changes: VerifactuConfig is now a pure in-memory holder. Dropped save(), load(), the m_settings member, the <QSettings> include, and the configPath constructor parameter. Constructor performs a one-time delete of the legacy INI at <AppDataLocation>/verifactu_config.ini if it exists, so existing installs are cleaned up the next time the app starts (idempotent — once gone, the file-exists check no-ops). VerifactuManager ctor signature loses its configPath arg; the sole caller in VerifactuIntegration::initialize() updated. The lingering m_manager->getConfig()->save(); call in loadEmitterConfiguration() is gone since there is no more persistent target. Net: zero credential bytes written by Verifactu code outside of ~/.laideal_settings.json. Side-benefit: removes the VerifactuConfig::load() row called out as dead in the open "Dead-code cleanup in src/verifactu/" tracker entry. Files touched: src/verifactu/verifactuconfig.h/.cpp, src/verifactu/verifactumanager.h/.cpp, src/verifactu/verifactuintegration.cpp. Docs: this entry; docs/modules/verifactu/README.md Internal note removed.
  • [x] Coding-guidelines Tier 1: split verifactuinvoice.h into one-class-per-header: closes the last open Tier-1 item from the 2026-05-26 audit. VerifactuTaxItem and VerifactuInvoice previously shared src/verifactu/verifactuinvoice.h / .cpp. New verifactutaxitem.h and verifactutaxitem.cpp carry only the VerifactuTaxItem class; verifactuinvoice.h now declares just VerifactuInvoice and #includes the new header at the top so existing transitive consumers (verifactumanager.{h,cpp}, verifactuintegration.{h,cpp}, mainwindow.cpp, rectifyinvoicedialog.cpp, pay_dialog.cpp, sql_lite.cpp) keep working without edits. verifactuinvoice.cpp likewise slimmed to VerifactuInvoice-only implementation; the #include <cmath> and the tax-item-specific qDebug include moved to the new verifactutaxitem.cpp. src/verifactu/CMakeLists.txt adds the two new files to PROJECT_SOURCES (alphabetical order: taxitem before invoice, mirroring header dependency). No public API change, no behaviour change. Same one-class-per-header direction as the 8.4 split of verifactutypes.h out of verifactumanager.h. Files touched: src/verifactu/verifactutaxitem.h/.cpp (new), src/verifactu/verifactuinvoice.h/.cpp (slimmed), src/verifactu/CMakeLists.txt.
  • [x] Verifactu Req. 5: close per-user trazabilidad (Art. 8.1) by stating the monoperador scope in the declaración responsable: removes the only remaining PARTIAL row from docs/modules/verifactu/verifactu-requirements.md (Req. 5) and the matching entry from Open Non-Blocking Issues. The issue text offered two closures — full per-operator-stamping (new operador TEXT column on ingresos, login prompt at startup, stamp on each write) vs. single-operator declaration — and we picked the second because La Ideal is run by a single clerk and the regulator accepts "implicit identification by Windows session" when the scope is documented. Added a new paragraph to the Acerca de Verifactu... dialog body in mainwindow.cpp declaring (a) the system is used in a monoperador installation, (b) the single operator is identified implicitly by the Windows session, (c) under that scope Art. 8.1 is satisfied, and (d) incorporating a second clerk requires enabling per-event identification first — so the operator is aware that hiring re-opens the requirement. verifactu-requirements.md §5 flipped PARTIAL → COVERED with the new wording; §8 cross-references the monoperador clause; the audit table at the bottom now shows all ten requirements COVERED. No schema change, no UI prompt, no new module. Files touched: src/app/mainwindow.cpp (HTML body of the declaración), docs/modules/verifactu/verifactu-requirements.md.
  • [x] Verifactu Req. 4: automated SQLite backup + 4-year retention + in-app manual trigger: closes the Open Non-Blocking entry "Verifactu Req. 4 — automated SQLite backup + 4-year retention (Art. 8.2.c RD 1007/2023)" and flips that requirement from PARTIAL to COVERED in docs/modules/verifactu/verifactu-requirements.md. New module src/backup/backup_manager.{h,cpp} exposes BackupManager::performBackup() (synchronous), needsBackup(minIntervalSeconds=24*3600), and pruneOldBackups(). The snapshot uses SQLite VACUUM INTO 'target' on a dedicated connection (laideal_backup_snapshot), which produces a transactionally-consistent point-in-time copy without taking exclusive access on the live DB — so the operator's current session is not interrupted. Each snapshot is then re-opened read-only on a second dedicated connection (laideal_backup_verify) and PRAGMA integrity_check must return ok before the file is counted toward the retention window; a corrupt copy is deleted on the spot. Filenames follow laideal_yyyy-MM-dd_HHmmss.db (same .db extension as the live DB so the operator manages a uniform set of files) and sort lexicographically by time, which keeps the pruner trivial. Backups live in a backups/ subdir next to the live DB — derived from QFileInfo(dbPath()).absolutePath() + "/backups" — so the operator manages one location and the snapshots stay isolated from the live file. Retention policy: keep every backup from the last 30 days, then one per calendar month for 4 years, then delete (matches the tax prescription period in Ley 58/2003 LGT). AppSettings gains backup.enabled (default true) and backup.last_time (ISO timestamp persisted after each success); the directory is not a separate setting — it follows dbPath(). MainWindow instantiates m_backupManager in the constructor; if needsBackup() is true it schedules performBackup() via QTimer::singleShot(3000) so the snapshot runs after the first paint and doesn't delay the UI. The auto path is silent on success (status-bar 8 s message) and shows a QMessageBox::warning only on failure — since the regulatory requirement is durable storage, a failed snapshot is worth surfacing. Herramientas → Hacer copia de seguridad ahora... is a new QAction in the menubar (actionHacer_copia_de_seguridad) that runs the same performBackup() under a WaitCursor and reports the resulting path + size in a QMessageBox so the operator can grab the file for offsite copies. No installer / Task Scheduler changes were needed: the shop opens the app daily, so an in-app daily backup covers the prescription window equivalently, and the manual trigger handles ad-hoc offsite workflows. Files touched: src/backup/backup_manager.h/.cpp (new), src/backup/CMakeLists.txt (new), CMakeLists.txt (add_subdirectory), src/app/CMakeLists.txt (link backup), src/appsettings/appsettings.h/.cpp (new backup keys + default opt-in), src/app/mainwindow.h/.cpp (include + member + startup hook + slot), src/app/mainwindow.ui (Herramientas menu entry + action). Docs: docs/architecture.md (new module box), docs/INDEX.md (new files), docs/modules/backup.md (new module reference), docs/modules/verifactu/verifactu-requirements.md (Req. 4 → COVERED).
  • [x] Partial-payment dialog (PayDialog) — operator picks a subset of garments and Verifactu submits one invoice per payment event: closes the long-standing tracker entry "Per-payment Verifactu InvoiceID seq (restore per-garment payment)" and the 8.5 Blocking Issue for "Pagar todo on name search marks every ticket paid". v8.0 disabled per-garment payment as a workaround for AEAT duplicate-InvoiceID rejection; v8.5 restores it with the proper mechanism. Schema: migrateDatabase() adds verifactu_invoice_seq INTEGER DEFAULT 0 to ingresos. Constant INGRESOS_COL_VERIFACTU_INVOICE_SEQ = 24 in ingresos_schema.h. Legacy rows (8.0-8.4) keep seq=0, matching the bare-InvoiceID convention they were submitted under. sql_lite helpers: nextVerifactuInvoiceSeq(db, ticketNum) returns MAX(verifactu_invoice_seq)+1 across rows of that ticket that have a non-empty verifactu_estado (so it skips never-submitted rows), and updateTicketVerifactuFieldsForSeq(db, ticketNum, seq, result) patches AEAT metadata scoped by (n_recibo, seq) instead of n_recibo alone. Imprimir gains an optional int invoiceSeq = -1 member; when >=0, getTicketInfo() filters WHERE n_recibo=? AND verifactu_invoice_seq=?, the factura header prints Nº: <n_recibo>-<seq>, and the reprint QR path uses the same seq'd InvoiceID for generateQRAsync — so printed receipt and AEAT-side invoice are always aligned. PayDialog (src/recog_prendas/pay_dialog.{h,cpp}) is a modal QDialog opened from RecogPrendas::pb_pay_all with the clicked ticket pre-loaded: every unpaid row of that n_recibo appears as a QTableWidget line with a per-row checkbox pre-checked. Live "Total seleccionado (N prendas)" label updates as boxes are unticked. "Cobrar" reads nextVerifactuInvoiceSeq, builds InvoiceID = "<n_recibo>-<seq>", fires submitSimplifiedInvoiceAsync with a 5 s bounded wait via QEventLoop + QTimer::singleShot, UPDATEs the chosen rows pagado='SI', fecha_pago=:date, verifactu_invoice_seq=:seq, calls updateTicketVerifactuFieldsForSeq for the AEAT metadata on the matched rows, and prints the partial factura via Imprimir with invoiceSeq set so only the paid subset is on the print. AEAT-not-configured and 5 s-timeout paths still persist the payment locally and print a paid recibo (no QR). RecogPrendas on_pb_pay_all_clicked was rewritten: instead of looping sqlQueryModel->rowCount() source rows and pressing on_pb_payment_toggled(true) per row (the v8.5 blocking bug: on name-search the source model held the full table, so the loop marked every ticket in the DB paid), it now takes the clicked row's n_recibo, opens PayDialog, waits for it to close, and re-runs the search. pb_print was updated to read the clicked row's verifactu_invoice_seq and forward it to Imprimir via printFactura(ticketNum, askSecondCopy, invoiceSeq) so a reprint covers exactly that payment event's rows. CancelInvoiceDialog gets a guard: if the queried ticket has any row with verifactu_invoice_seq > 0, the dialog blocks the cancel and tells the operator to use the AEAT sede electrónica — its current UPDATE WHERE n_recibo = X would mark every payment event's rows ANULADA in one shot and lose the per-seq alignment, so full per-seq cancellation is deferred to 8.6 (filed in Open Non-Blocking Issues). pku_all left unchanged - same blast-radius pattern but no Verifactu corruption pressure, also filed in Open Non-Blocking. Files touched: src/sql_lite/sql_lite.h/.cpp, src/sql_lite/ingresos_schema.h, src/imprimir/imprimir.h/.cpp, src/recog_prendas/pay_dialog.h/.cpp (new), src/recog_prendas/CMakeLists.txt, src/recog_prendas/recog_prendas.h/.cpp, src/listado/listado.cpp (hide the new column), src/app/cancelinvoicedialog.cpp. Six commits in sequence (Phase A→F): f8ebbce, b964c60, 6430528, da0cef7, 7a64e2c, plus this docs commit.

8.4 release — May 2026

  • [x] Split verifactutypes.h out of verifactumanager.h: the previous milestone moved updateTicketVerifactuFields() into sql_lite.cpp and added #include "../verifactu/verifactumanager.h" to bring in VerifactuResult + VerifactuEstado + the helpers. That header transitively pulls <QNetworkAccessManager> (because it declares the REST client), so the sql_lite static lib - which links only Core / Gui / Sql, not Network - failed to compile (fatal error: QNetworkAccessManager: No such file or directory). Lifted the lightweight types (the VerifactuEstado enum, verifactuEstadoToString/FromString, the VerifactuResult POD) into a new verifactu/verifactutypes.h that depends only on <QString> + <QPixmap>. verifactumanager.h now includes that header instead of carrying the types; sql_lite.cpp includes the small header so it never sees Network. Same one-class-per-header direction as the open Tier-1 task for verifactuinvoice.h. Files touched: src/verifactu/verifactutypes.h (new), src/verifactu/verifactumanager.h, src/verifactu/CMakeLists.txt, src/sql_lite/sql_lite.cpp.
  • [x] RecogPrendas: fix latent proxy/source row-coord bug under header sort + set table_name so date / importe sort correctly: recog_prendas.ui already had sortingEnabled=true on the table view and on_pb_search_clicked already called sortByColumn(0, DescendingOrder), so header-click sorting was nominally working - but two flaws made it silently wrong. (1) Coordinate-space bug: on_tableView_clicked(const QModelIndex &index) received a proxy-space index from the view, stored index.row() as rowClickedCell, and the rest of the class then consumed that value as a source-model row via sqlQueryModel->index(rowClickedCell, ...). Whenever the desc-by-n_recibo default sort actually reordered rows (i.e. searches that span multiple tickets - typically name search), every click that wasn't on the first visible row hit the wrong DB record - so pb_state (Entregar) could mark the wrong ticket as picked up, pb_separ_garm could split the wrong garment, etc. Same-ticket searches were immune because all rows share the same n_recibo so the sort was a no-op. Factored row storage into a new private helper selectSourceRow(int sourceRow, int sourceCol); on_tableView_clicked now maps via proxyModel->mapToSource(index) before delegating. The pay-all / pku-all loops, which previously fake-called on_tableView_clicked with raw sqlQueryModel->index(row, 0) source indices (an existing layering oddity that happened to work because of the bug above), now call selectSourceRow(row, 0) directly - same outcome, less magic. (2) table_name was never set on the proxy: MySortFilterProxyModel::lessThan() keys on table_name ("ingresos" / "gastos" / "prendas") to pick the date or numeric comparator; Listado sets it but RecogPrendas never did, so clicking a date column header sorted lexicographically ("31-01-2026" < "02-02-2026" reverses by day, not chronology) and importe sorted as strings ("100" < "9"). Added proxyModel->table_name = "ingresos"; right after the proxy is constructed. Defensive: MySortFilterProxyModel *proxyModel was an uninitialised pointer member; changed to = nullptr so the proxyModel ? mapToSource : index guard in the click handler is safe before the first search. The sortByColumn(0, ...) call now uses INGRESOS_COL_N_RECIBO instead of a bare literal. Files touched: src/recog_prendas/recog_prendas.h/.cpp.
  • [x] Consolidate ingresos column-index constants into sql_lite/ingresos_schema.h: three parallel macro sets indexed the same 24 columns of ingresos: INGRESOS_IDX_* in mysortfilterproxymodel.h (used by mysortfilterproxymodel.cpp, mainwindow.cpp, listado.cpp — half-Spanish names ID/IMPORTE/PAYED/CANTIDAD/PRENDA/SERVICIO/OBSV), TABLE_* in imprimir.h (used by imprimir.cpp, add_garment.cpp — English-ish names TICKET/PRICE/IS_PAYED/QUANTITY/GARMENT/SERVICE/OBSERV), and a near-duplicate TABLE_* in recog_prendas.h (with TIMESTAMP instead of TS and a comment leaning on imprimir.h for TABLE_HASH). The previous Verifactu milestones in the tracker explicitly note new columns being added to all three blocks for each schema change — exactly the drift hazard that produced the v8.0 verifactu_xml/verifactu_hash silent-drop bug. Lifted into a single canonical set in a new tiny header sql_lite/ingresos_schema.h (no QtSql dep, so light consumers like tableview can include it without picking up the SQL link): INGRESOS_COL_<UPPER_DB_COLUMN_NAME> (INGRESOS_COL_N_RECIBO=0 ... INGRESOS_COL_VERIFACTU_RECTIFICATION_TYPE=23). sql_lite.h re-includes it so existing SQL consumers keep working transparently. The name = uppercase SQL column avoids the English-vs-Spanish bikeshed (DB names are what they are) and makes a grep for any column hit both the schema and the C++ constant. All ~80 call sites renamed (mainwindow.cpp, listado.cpp, mysortfilterproxymodel.cpp, imprimir.cpp, recog_prendas.cpp, add_garment.cpp). Headers (mysortfilterproxymodel.h, imprimir.h, recog_prendas.h) gain a one-line breadcrumb pointing at sql_lite.h so future readers know where the constants live. TABLE_TICKET_* in mainwindow.h was not touched — those index the in-memory QTableWidget used for ticket entry, a distinct concept from the ingresos DB row layout. The mechanical rename was driven by a regex script with \b boundaries so TABLE_TICKET_QNTY etc. were correctly skipped. Docs updated: docs/modules/imprimir.md, docs/modules/recog_prendas.md (column-index tables rewritten to point at INGRESOS_COL_*). Files touched: src/sql_lite/sql_lite.h, src/tableview/mysortfilterproxymodel.h, src/imprimir/imprimir.h, src/recog_prendas/recog_prendas.h, src/app/mainwindow.cpp, src/listado/listado.cpp, src/tableview/mysortfilterproxymodel.cpp, src/imprimir/imprimir.cpp, src/recog_prendas/recog_prendas.cpp, src/add_garment/add_garment.cpp, docs/modules/imprimir.md, docs/modules/recog_prendas.md.
  • [x] Consolidate updateTicketVerifactuFields() into sql_lite: MainWindow::updateTicketVerifactuFields() and RecogPrendas::updateTicketVerifactuFields() were byte-identical (same UPDATE on ingresos, same bindings, same logging shape) — exactly the drift hazard flagged in the previous milestone where the RecogPrendas copy missed the xml/hash columns for weeks. Lifted into a single free function updateTicketVerifactuFields(QSqlDatabase &db, const QString &ticketNum, const VerifactuResult &result) in sql_lite.h/.cpp, alongside the other ingresos-touching helpers (updateLockInIngresos, insertNewItemToTable, etc.). Both call sites now invoke the free function with their member db. sql_lite.h forward-declares VerifactuResult so consumers do not need to include verifactumanager.h transitively; the implementation includes it. The rectifyinvoicedialog helper applyRectificationResult() was intentionally not folded in — its WHERE clause has the extra AND verifactu_rectifies_n_recibo = :orig guard and a different success-state mapping, so it is a sibling helper, not a duplicate. docs/architecture.md data-flow box updated to point at sql_lite::updateTicketVerifactuFields. Files touched: src/sql_lite/sql_lite.h/.cpp, src/app/mainwindow.h/.cpp, src/recog_prendas/recog_prendas.h/.cpp, docs/architecture.md.
  • [x] Save-time print: bounded 3 s wait for AEAT so the factura carries the QR when possible, otherwise degrade to a paid recibo: previously the isPaid branch of on_bb_save_reset_clicked always called printFra() immediately after firing the async verifactuSubmitInvoice(), so the printed factura simplificada always went out without QR / CSV - the AEAT reply was still in flight and the DB row was still PENDIENTE. The Verifactu legend gated on verifactu_estado = ENVIADA (line 415 of imprimir.cpp) was likewise never printed at save time. New flow: verifactuSubmitInvoice now returns the reqId (was void); the save handler opens a local QEventLoop with a 3 s QTimer::singleShot timeout and listens on VerifactuIntegration::requestFinished filtered by that reqId. The existing onVerifactuRequestFinished slot fires first (FIFO connect order) and UPDATEs the row to ENVIADA / ERROR + CSV / Huella before the local lambda runs, so by the time the lambda quits the loop the DB is consistent. If the reply arrived AND result.isSuccess() && !result.qrCode.isNull(), we call the new printFra(const QPixmap &qrCode = QPixmap()) overload - it forwards the pixmap into Imprimir::qrCode so resolveQrCode() short-circuits on its if (!qrCode.isNull()) return qrCode early-out, skipping a second generateQRAsync round-trip. Otherwise (timeout, success-without-QR, or error) we call printRecibo(), which - because the ticket is paid - already stamps "Importe pagado" on the customer copy via createTicketExcel(true, ui->pb_payment->isChecked()). The async submit is still alive in m_pendingSubmits and onVerifactuRequestFinished will eventually patch the row even if it missed the 3 s window; the customer can reprint a Verifactu-complete copy via RecogPrendas at pickup time once ENVIADA lands. Picked 3 s because the median Irene Solutions round-trip from local logs is around 1-2 s; longer waits start to feel laggy at the counter. Files touched: src/app/mainwindow.h/.cpp - new +#include <QEventLoop>, verifactuSubmitInvoice signature change (void → QString), printFra gains a default QPixmap parameter, save handler rewritten with the bounded wait. docs/architecture.md Data Flow updated.

Post-8.2 development — May 2026

  • [x] Ayuda → Notas de la versión: in-app version history viewer: complements the updater dialog (which only shows the new version's body during an upgrade) by letting the user browse the full history of what shipped at any time, offline. releases_notes.txt is now bundled into the exe as a Qt resource (resources/laideal.qrc, alias :/docs/releases_notes.txt) — the same file Inno Setup already shows at install time (InfoBeforeFile=..\releases_notes.txt) and that gh release create --notes-file reuses for the GitHub release body, so all three surfaces are guaranteed to stay in sync without any deploy-time copy step. New menu entry in Ayuda between "Buscar actualizaciones..." and the separator. Handler opens a small modal QDialog with a read-only QTextEdit in the system fixed font (so the tab-indented release notes layout is preserved), sized 680×560, with cursor anchored at the top so the newest release is what the user sees first. No network involved — the dialog works on offline machines. Files touched: resources/laideal.qrc (new /docs prefix), src/app/mainwindow.ui (new actionNotas_de_la_version + menu wiring), src/app/mainwindow.h/.cpp (new slot, +4 includes).
  • [x] In-app updater (Ayuda → Buscar actualizaciones + startup check): end-user upgrade no longer requires manually downloading the installer from GitHub and uninstalling the prior version. New src/updater/ module with two classes: Updater (async QNetworkAccessManager client against https://api.github.com/repos/germanbravolopez/laideal/releases/latest, compares the returned tag_name to the compile-time PROJECT_VERSION macro via the same target_compile_definitions(... PROJECT_VERSION="${PROJECT_VERSION}") trick the Verifactu module already uses, picks the laideal_setup_X.Y.exe asset out of assets[], and emits updateAvailable / noUpdateAvailable / checkFailed) and UpdaterDialog (shows current vs. new version plus the GitHub release body, on "Actualizar ahora" collapses to a progress bar, downloads the .exe to %TEMP% via the same Updater, then QProcess::startDetached(installer, {}); qApp->quit(); so Inno Setup can replace the running files). The dialog is modal but the network is fully async so the UI never blocks. MainWindow ctor instantiates one Updater, wires the three signals, and — gated on AppSettings::checkUpdatesOnStartup() (default true) — fires checkForUpdates(silentOnNoUpdate=true) via QTimer::singleShot(1500, ...) so the main window is fully shown first. Menu action Ayuda → Buscar actualizaciones... uses silentOnNoUpdate=false so the user always sees an outcome. AppSettings gained checkUpdatesOnStartup() / setCheckUpdatesOnStartup(bool) reading/writing updater.check_on_startup in ~/.laideal_settings.json, and SettingsDialog's General tab gained a "Buscar actualizaciones al iniciar la aplicación" checkbox. Inno Setup (releases/laideal.iss) declares CloseApplications=yes, RestartApplications=yes, CloseApplicationsFilter=*.exe so a running app is auto-closed and relaunched (the updater's own qApp->quit() usually wins the race; the Inno flags are the safety net). The repo was made public so unauthenticated GitHub API calls resolve /releases/latest (private repos return 404). Files touched: src/updater/ (new dir, 5 files: CMakeLists.txt, updater.h/.cpp, updaterdialog.h/.cpp), CMakeLists.txt (add_subdirectory), src/app/CMakeLists.txt (link updater), src/app/mainwindow.h/.cpp (new fields + slots + startup-check timer), src/app/mainwindow.ui (Ayuda menu entry + new QAction), src/appsettings/appsettings.h/.cpp (new key + default seeding in applyDefaults), src/appsettings/settingsdialog.h/.cpp (checkbox on General tab), releases/laideal.iss (3 new keys). Limits: only checks releases/latest (no pre-release / multi-version paths); the GitHub release body is shown verbatim as plain text (no markdown rendering); if the installer fails to launch (QProcess::startDetached returns false) the dialog surfaces the local path so the user can run it by hand; download timeout uses Qt's default (no explicit deadline). Known UX caveat: an in-place upgrade keeps the user's ~/.laideal_settings.json, ~/.laideal.log and the SQLite database (all under %USERPROFILE%, outside Inno's {app} scope) — no migration risk for end-user data.
  • [x] Repo switched from private to public (gh repo edit --visibility public): required for the in-app updater above — the GitHub Releases REST API returns 404 to anonymous callers on private repos, so the updater could not see /releases/latest. Pre-flight grep confirmed no NIF / ServiceKey / .env / .key / .cfg files were ever committed; the "secret"-looking matches in the tree were source-code variable names and dialog labels, never literal values. The Verifactu ServiceKey lives only in ~/.laideal_settings.json on the customer machine.

Post-8.0 maintenance — May 2026

  • [x] RecogPrendas "Pagar todo" now auto-prints the factura and offers a second copy; print no longer closes the window: previously the operator had to click "Pagar todo" (which marks every row of the ticket as paid and fires the async Verifactu submission), then separately click the print button to send the factura to the thermal printer. The print button also unconditionally closed the RecogPrendas window, which made it awkward to print a second copy for the establishment - the operator had to reopen RecogPrendas, search the ticket again and reprint. New flow: at the end of on_pb_pay_all_clicked(), the ticket number is captured before resetAllContents() clears le_nr_ticket (when no row was originally clicked the loop leaves it on the last paid row), and the factura is generated + sent to the printer via a new private helper printFactura(ticketNum, askSecondCopy). When askSecondCopy=true, the helper then opens a QMessageBox::question "¿Imprimir una segunda copia de la factura?" (Yes / No, defaulting to No) and re-runs printTicket() on the same Excel file if the operator picks Yes. After the print returns, resetAllContents() clears the form so the operator can move on to the next client without reopening the window. on_pb_print_clicked() is refactored to call the same helper with askSecondCopy=false and then resetAllContents() (replacing the previous this->close(), so the standalone print button no longer dismisses the window either). Both copies use the same Excel parameters (createTicketExcel(copyForClient=false, addPayedInfo=false)) so the output is identical - "second copy" just reprints the same file rather than rendering a different variant. The AppSettings::enablePrinting() guard wraps both the first print and the second-copy dialog, so testing-mode runs still generate the Excel but skip the printer and the dialog. Caveat: when "Pagar todo" is pressed on a multi-ticket search (e.g. name search returning all of a client's tickets), only the last paid ticket gets printed - separate printFactura calls per n_recibo would be needed to cover that, deferred until the multi-ticket case is actually exercised. A qDebug was added at the top of printFactura showing ticket and askSecondCopy so the operator can confirm the flow ran via ~/.laideal.log. Files touched: src/recog_prendas/recog_prendas.h/.cpp.
  • [x] RecogPrendas name search silently dropped tickets past row 256 (no log was registered because the function had no entry-time qDebug): the name-search branch did db.open() / SELECT * FROM ingresos / setQuery() / db.close() and then, ~30 lines later in the common post-search section, ran while (sqlQueryModel->canFetchMore()) sqlQueryModel->fetchMore(); to drain the rest. But QSqlQueryModel lazy-fetches in 256-row batches and fetchMore() needs the underlying SQLite statement handle to still be valid, which db.close() had already invalidated. So canFetchMore() returned false immediately and the proxy filter only ever saw the first 256 rows of ingresos - any client whose receipts landed past that point would have some tickets in the result and some silently missing, regardless of whether the search term was a partial or complete name. Fix: pulled the fetchMore() loop inside the name branch, ordered as setQuery -> fetchMore-until-done -> db.close(), and dropped the now-redundant common loop. Added three qDebug lines so the search is now visible in ~/.laideal.log: (1) at function entry, showing the input and the date-mode combobox value; (2) after the SELECT, showing how many source rows were loaded and the normalized filter; (3) at the end, showing proxyMatched / sourceLoaded. The same db.close() pattern exists in the phone / ticket / date branches but doesn't trigger the bug there because each of those returns a small result set (single client, single ticket, single day) that fits in one 256-row batch. Files touched: src/recog_prendas/recog_prendas.cpp.
  • [x] Streamlined release pipeline: one PowerShell command builds + deploys + installs: the previous flow required opening the Qt Creator IDE, building Release manually, closing Qt Creator, opening a special "Qt command prompt" shortcut (cmd.exe /K C:\Qt\6.4.3\mingw_64\bin\qtenv2.bat) with admin rights, and running deploy_laideal_run_in_qt_cmd.bat which chained three other batch scripts (zip_folder.bat, find_replace.bat, create_installer.bat). The deploy script searched for Qt Creator's specific shadow-build folder (build-laideal-Desktop_Qt_*_MinGW_64_bit-Release), so the README's cmake -B build instructions actually produced an exe in a folder the deploy script could not find - a hidden disconnect that broke the documented build path. Replaced by a single releases\release.ps1 <version> invocation (with releases\release.bat <version> as a thin cmd.exe wrapper) that: (1) prepends Qt + MinGW to PATH itself so the Qt cmd shortcut is no longer required, (2) cross-checks the supplied version against project(laideal VERSION X.Y ...) in CMakeLists.txt and aborts on mismatch, (3) refuses to overwrite an existing zip/installer/staging dir, (4) configures CMake (Release, MinGW Makefiles) into build-release/, (5) builds with -j, (6) stages the exe into releases\<version>\ and runs windeployqt --release --no-translations --no-system-d3d-compiler, (7) zips into releases\old_releases\<version>.zip via .NET System.IO.Compression.FileSystem, (8) compiles the Inno Setup installer via ISCC.exe /DMyAppVersion=<version> laideal.iss, (9) deletes the staging dir. The laideal.iss template was rewritten to use ISCC preprocessor #define MyAppVersion (with #ifndef guard so it still compiles standalone with a 0.0 default), and all paths inside it switched from absolute to relative-to-iss (..\License.txt, ..\releases_notes.txt, ..\icon\lavadora.ico, setup_outputs, {#MyAppVersion}\*) so the installer recipe is portable to any clone of the repo, not just this developer's machine. The four obsolete batch scripts were deleted (deploy_laideal_run_in_qt_cmd.bat, zip_folder.bat, find_replace.bat, create_installer.bat) - the brittle find_replace.bat sed-replace of "1.0" in the iss is now redundant since ISCC handles substitution natively. .gitignore updated: dropped the now-unused laideal_upd.iss entry, added build-release alongside build. README's "Build" section now shows the explicit -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release flags (so a fresh CMake configure picks the right toolchain even on machines with Visual Studio installed), and the "Release procedure" collapsed from 12 manual steps to 5 (bump version + commit, run script, tag, push, gh release). Files touched: releases/release.ps1 (new), releases/release.bat (new), releases/laideal.iss (rewritten), .gitignore, README.md; deleted releases/deploy_laideal_run_in_qt_cmd.bat, releases/zip_folder.bat, releases/find_replace.bat, releases/create_installer.bat.

Archive (Entries older than 6 months / no longer actionable)

Pre-8.0 development history. The feature/add_mdiago_verifactu entries below are the original Verifactu build-out, all shipped in 8.0; moved here from Completed Milestones on 2026-09-14 to keep the active section readable.

Pre-release bug fixes — May 2026 (feature/add_mdiago_verifactu)

  • [x] Code-review fixes for v8.0 release (twelve findings from the branch review): (1) ServiceKey log leak [release-blocker]: VerifactuManager::submitInvoiceAsync was dumping the full /Create JSON payload - including ServiceKey - to ~/.laideal.log on every paid ticket save and every "Probar conexion". Now redacted to [redacted, N chars] before logging. Other request-emitting paths (cancel / QR / testConnection) were already safe (they log endpoint URLs only). (2) Listado allowed inline edit of ingresos via QSqlTableModel::OnFieldChange - including verifactu_csv/verifactu_estado/importe/etc. - which contradicts Verifactu Req. 1 (Art. 8.1 RD 1007/2023). Added setEditTriggers(NoEditTriggers) on the ingresos table view; all changes must now flow through RecogPrendas / Cancel / Rectify which keep AEAT and the accounting lock in sync. (3) insertNewItemToTable built SQL with raw quote concatenation of user values - a client named O'Brien would have crashed, and a hostile input could have injected DDL. Replaced with q.prepare("... VALUES (?, ?, ...)") + positional addBindValue so values are bound by the driver, never interpolated. (4) AppSettings::save() was non-atomic: a crash mid-write produced a zero-byte JSON and the next launch saw "first run" (DB path lost, Verifactu credentials lost). Now writes to <path>.tmp first, flushes, then QFile::rename over the target - previous file survives a crash. (5) Operator-precedence ambiguity in MySortFilterProxyModel::lessThan: the &&/|| chain happened to parse correctly but triggered -Wparentheses and was fragile to refactors. Each table && col clause is now its own paren group. (6) RectifyInvoiceDialog n_recibo race: max(n_recibo)+1 was allocated at submit time and INSERTed only on AEAT reply, leaving a seconds-long window where a regular saveTicket could re-use the same number. Now eagerly INSERTs a PENDIENTE placeholder row at submit time (same pattern as MainWindow::saveTicket); applyRectificationResult patches it to ENVIADA/ERROR on reply. (7) Huella regex was too permissive: <[^>]*Huella[^>]*> would also have matched a hypothetical <HuellaPrevia>. Tightened to <(?:\w+:)?Huella(?:\s[^>]*)?> so only the exact element (with optional namespace prefix) matches. (8) Imprimir::resolveQrCode checked only row-0 CSV: a ticket with mixed row states (e.g. some PENDIENTE / RECTIFICADA / ANULADA / ERROR) could still print a QR claiming AEAT validity. Now aggregates across all rows: emits a QR only when at least one row has a CSV AND no row is in a state that contradicts the claim. (9) Annotated the magic 10 in filterAcceptsRow - it caps the search to user-facing columns so the hidden verifactu_* metadata never bleeds into the visible filter. (10) testConnection reply now held via QPointer: defensive against the dialog being closed mid-loop. (11) Documented the intentional NULL verifactu_* columns in the SEPARATE_GARM INSERT (split rows must not re-submit to AEAT - would trigger duplicate-InvoiceID). (12) Tier-1 coding-guidelines cleanups: last SIGNAL/SLOT macro converted to pointer syntax in tableview.cpp; Spanish locals estado/cliente/fecha/estado renamed to state/client/date/verifactuState in cancelinvoicedialog.cpp, imprimir.cpp, recog_prendas.cpp; add_sufix_to_filename typo fixed to add_suffix_to_filename in genlistado.h/.cpp. The remaining Tier-1 item - splitting verifactuinvoice.h into two headers - stays in Open Non-Blocking Issues. Files touched: src/verifactu/verifactumanager.h/.cpp, src/verifactu/verifactuintegration.cpp, src/listado/listado.cpp, src/sql_lite/sql_lite.cpp, src/appsettings/appsettings.cpp, src/tableview/mysortfilterproxymodel.cpp, src/tableview/tableview.cpp, src/app/rectifyinvoicedialog.h/.cpp, src/app/cancelinvoicedialog.cpp, src/imprimir/imprimir.cpp, src/recog_prendas/recog_prendas.cpp, src/listado/genlistado.h/.cpp.
  • [x] App icon now embedded in the executable + bundled as a Qt resource: the desktop shortcut produced by the Inno Setup installer was inheriting a blank icon from laideal.exe because the Windows resource file only carried VS_VERSION_INFO — no IDI_ICON1 ICON directive. Added IDI_ICON1 ICON DISCARDABLE "@CMAKE_SOURCE_DIR@/icon/lavadora.ico" to resources/laideal.rc.in so windres compiles the icon into the exe; the desktop shortcut, Explorer thumbnail, Alt-Tab and taskbar now all pick it up automatically without the .iss needing an IconFilename:. Added a new resources/laideal.qrc that ships the same .ico as a Qt resource (alias :/icons/laideal.ico), wired into src/app/CMakeLists.txt's add_executable() so AUTORCC compiles it in. main.cpp now loads the icon from the resource (QIcon(":/icons/laideal.ico")) instead of from a user-configured filesystem path, so the title bar/taskbar work deterministically regardless of install location. Dropped the now-obsolete app.icon_path setting from AppSettings (iconPath() / setIconPath() removed), the corresponding row from SettingsDialog's General tab, and the post-accept icon re-apply block in MainWindow::mainwindowInitialSettings(). migrateLegacyKeys() strips the orphaned app.icon_path key from existing ~/.laideal_settings.json files on first load. Closes the "Bundle icon with installer" non-blocking item. Files touched: resources/laideal.rc.in, resources/laideal.qrc (new), src/app/CMakeLists.txt, src/app/main.cpp, src/app/mainwindow.cpp, src/appsettings/appsettings.h/.cpp, src/appsettings/settingsdialog.h/.cpp.
  • [x] Verifactu — Factura rectificativa UI (R1-R5) (Req. 1; Art. 8.2.a RD 1007/2023): new RectifyInvoiceDialog (modelled on CancelInvoiceDialog) under Herramientas → Rectificar factura Verifactu.... Operator searches by n_recibo, picks one of R1-R5 (R1 default - error fundado en derecho), picks Por diferencias (I) or Por sustitución (S), enters either the corrected total (S) or the signed delta (I) including IVA, and submits asynchronously via the new VerifactuIntegration::submitRectificationAsync(). The submission builds an F2-style invoice (La Ideal only issues simplified) with InvoiceType = R1..R5, RectificationType = S|I, and - for S - RectificationTaxBase/RectificationTaxAmount carrying the original values being replaced. New columns verifactu_rectifies_n_recibo (TEXT, link to original) and verifactu_rectification_type (TEXT, "S"/"I") added via migrateDatabase(). A new VerifactuEstado::Rectificada ("RECTIFICADA") marks the original rows when the rectificativa is submitted in substitution mode; totalPriceBetweenDates() now excludes RECTIFICADA the same way it excludes ANULADA, so the books reflect the corrected total without double-counting. For differences (I) the original rows stay ENVIADA and the delta row alone reconciles accounting. The new rectificativa row gets the next available n_recibo, pagado = SI, estado = "Rectificativa", prenda = "Rectificativa de ticket <orig>", and full Verifactu metadata (csv/xml/hash/url) from the AEAT reply. AEAT XML export (Herramientas → Exportar registros AEAT (XML)...) broadened to include ANY row with non-empty verifactu_xml regardless of estado (ENVIADA/ANULADA/RECTIFICADA) - all were sent to AEAT and Hacienda has them on record. Negative VerifactuTaxItem::taxBase is now accepted (was previously rejected by isValid()) because a downward-correction rectificativa por diferencias is a legitimate use case. VerifactuInvoice::RECTIFICATION enum value renamed to RECTIFICATION_R1 and joined by RECTIFICATION_R2..R5; new RectificationType (BY_DIFFERENCES / BY_SUBSTITUTION) and isRectificationInvoiceType() helper. isValid() no longer demands a buyer NIF on rectificativas of simplified invoices. Files touched: src/verifactu/verifactuinvoice.h/.cpp, src/verifactu/verifactumanager.h, src/verifactu/verifactuintegration.h/.cpp, src/sql_lite/sql_lite.cpp, src/app/rectifyinvoicedialog.h/.cpp (new), src/app/mainwindow.h/.cpp, src/app/mainwindow.ui, src/app/CMakeLists.txt, src/imprimir/imprimir.h, src/recog_prendas/recog_prendas.h/.cpp, src/tableview/mysortfilterproxymodel.h. Audit table in docs/modules/verifactu/verifactu-requirements.md updated to COVERED.
  • [x] DB interactions: comprehensive qDebug/qWarning logging: audit of every q.prepare / q.exec call site under src/. Every WRITE (INSERT / UPDATE / DELETE / ALTER) now has both (a) a qDebug() at the start of the operation showing the action and the key identifiers (ticket / hash / client / table / column / etc.) and (b) a qWarning() on exec() failure carrying q.lastError().text(). One real bug found and fixed alongside: CancelInvoiceDialog::onVerifactuRequestFinished() at the AEAT-cancel-confirmed branch called q.exec() on the UPDATE ingresos SET verifactu_estado = ANULADA statement without checking the return value — a silent failure would have left the row showing ENVIADA in the UI while the user had been told the cancellation was confirmed. SELECTs were not blanket-logged (each is read with q.first() / q.next() / q.isSelect() which already surface errors at the result-reading step; blanket-logging them would just be noise). Files touched: src/sql_lite/sql_lite.cpp (5 helpers), src/recog_prendas/recog_prendas.cpp (updateDb() start), src/app/cancelinvoicedialog.cpp (the silent UPDATE), src/app/mainwindow.cpp (per-row save log), src/facturas/facturas.cpp (saveFactura), src/add_garment/add_garment.cpp (saveFactura).
  • [x] Printed ticket columns too wide for printer — verified on the physical thermal printer: column widths reduced from (5, 21, 8) = 34 units to (4, 20, 7.5) = 31.5 units in Imprimir::createTicketExcel(), and excel.setPageMargins(0.2, 0.1, 0.1, 0.4) added (left/right/top/bottom in inches; the asymmetric margins were tuned empirically against the actual thermal printer output by the user — top tighter than bottom, left slightly larger than right). The page-margin call uses the new Worksheet::setPageMargins API patched into the vendored QXlsx (see "QXlsx — page-margin support" milestone). Ticket now prints on a single page with no horizontal split. Files touched: src/imprimir/imprimir.cpp.
  • [x] Verifactu — fix verifactu_xml / verifactu_hash never being persisted from the pay-at-pickup path: when the AEAT submission came from the RecogPrendas → Pagar todo flow (not the save-at-creation flow in MainWindow), the duplicate RecogPrendas::updateTicketVerifactuFields() had not been updated alongside MainWindow::updateTicketVerifactuFields() during the xml/hash work, so its prepared UPDATE statement was missing the verifactu_xml = :xml and verifactu_hash = :hash columns. Added both columns to the prepared statement and the corresponding bindValue() calls (with empty strings on the error branch, matching the MainWindow shape). Also added a qDebug() line at the top of both updateTicketVerifactuFields() implementations that logs ticket, estado, csv, hash, xml_len, error — so any future regression of this kind is visible in ~/.laideal.log rather than silent. Worth flagging the underlying issue: the two implementations are near-duplicates and drift like this is the predictable outcome — a future refactor should fold them into a free function in sql_lite.h taking db, ticketNum and a VerifactuResult so there is one source of truth. Files touched: src/app/mainwindow.cpp, src/recog_prendas/recog_prendas.cpp.
  • [x] Verifactu — persist chained hash from AEAT response (Req. 3; Art. 12 RD 1007/2023): the SHA-256 chained hash returned by AEAT/Irene as <sum1:Huella>...</sum1:Huella> inside Return.Xml is now captured into a new VerifactuResult::rawHash field by VerifactuManager::processResponse() (regex tolerant of any namespace prefix; normalised to upper-case hex) and persisted to a new verifactu_hash TEXT column on ingresos (added in migrateDatabase()). INSERT in saveTicket() writes empty; updateTicketVerifactuFields() writes the real value on Enviada or clears it on failure - same async path as csv/url/xml. Column constants TABLE_VERIFACTU_HASH = 21 (imprimir.h, recog_prendas.h) and INGRESOS_IDX_VERIFACTU_HASH = 21 (mysortfilterproxymodel.h); column hidden in RecogPrendas::tableView and Listado ingresos view. (Identifiers use the English term hash/rawHash per /coding-guidelines; the regulatory Spanish term "Huella" appears only in code comments and the XPath-style regex matching the AEAT XML element name.) Strengthens local tamper-detection independently of the AEAT side - the hash chains to the previous record's, so any silent edit/insert in ingresos is detectable by recomputing and comparing. Files touched: src/sql_lite/sql_lite.cpp, src/verifactu/verifactumanager.h/.cpp, src/app/mainwindow.cpp, src/imprimir/imprimir.h, src/recog_prendas/recog_prendas.h/.cpp, src/listado/listado.cpp, src/tableview/mysortfilterproxymodel.h. Audit table in docs/modules/verifactu/verifactu-requirements.md updated to COVERED.
  • [x] AppSettings — fewer user-facing paths: collapsed five user-configurable paths into one. (1) print.template_path removed: the Excel ticket file is now always regenerated at the hardcoded ~/.laideal_ticket.xlsx (matches the ~/.laideal.log / ~/.laideal_settings.json convention) — new AppSettings::ticketExcelPath() static helper. (2) print.script_path removed: Imprimir::printTicket() now generates a small VBScript at ~/.laideal_print.vbs with the Excel-COM print logic templated with the current xlsx path, then invokes cscript //nologo //B <path>.vbs directly — no separate .bat to ship, no setting to configure. New AppSettings::ticketPrintScriptPath() static helper. (3) reports.contabilidad_path / reports.listados_prendas_path / reports.listados_gastos_path collapsed into a single reports.root: getters contabilidadPath(), listadosPrendasPath(), listadosGastosPath() now compose <root>/Contabilidad, <root>/Listados/Prendas, <root>/Listados/Gastos respectively — subdirs are hardcoded, mkpath-on-demand is unchanged at the call sites. Setters removed for all three (users only edit the root). Migration: migrateLegacyKeys() runs at JSON load and strips the well-known suffix from any of the three legacy values (Contabilidad, Listados/Prendas, Listados/Gastos) to derive the root; falls back to the parent dir of the contabilidad path; ultimate default is ~/Tintoreria. Obsolete keys are removed via the new removeNested() helper. SettingsDialog's "Rutas de salida" tab now shows one row instead of five, with a grey note listing the hardcoded subfolders. Files touched: src/appsettings/appsettings.h/.cpp, src/appsettings/settingsdialog.h/.cpp, src/imprimir/imprimir.cpp. Existing call sites in contabilidad.cpp / genlistado.cpp are untouched (the composed getters return the same shape they expect). The old resources/print_ticket.bat is no longer referenced by the app; left in the repo as a reference for the in-app VBScript.
  • [x] Verifactu — XML export of ingresos records for Hacienda (Req. 7; Art. 14.1 RD 1007/2023, Orden HAC/1177/2024): the AEAT-style XML returned by Irene Solutions in Return.Xml of every /Create reply is now captured into a new VerifactuResult::rawXml field by VerifactuManager::processResponse() and persisted in a new verifactu_xml TEXT column on ingresos (added in migrateDatabase() so existing DBs auto-migrate). MainWindow::saveTicket() writes an empty placeholder on initial INSERT (estado=PENDIENTE) and updateTicketVerifactuFields() UPDATEs the column with the real XML when AEAT replies (estado=ENVIADA) or clears it on failure. A new menu action Herramientas → Exportar registros AEAT (XML)... opens a small inline dialog (two QDateEdit for the range), then QFileDialog::getSaveFileName for the output path, and writes a single envelope file <RegistrosFacturacionLaIdeal> with attributes fechaDesde / fechaHasta / generadoEl / nif / emisor, containing one <Registro nRecibo=… fechaRecepcion=… importe=… csv=…> child per qualifying row (estado=ENVIADA AND non-empty verifactu_xml AND fecha_recepcion in range). Each row's stored payload is inlined verbatim with its leading <?xml ?> declaration stripped (single regex) so the outer document stays well-formed. Caveat: only tickets submitted after this fix landed have verifactu_xml stored; older Enviada rows are silently skipped (no retroactive AEAT lookup — would need a separate REST endpoint, out of scope). Hidden in RecogPrendas::tableView and Listado to keep the column from blowing up row heights. Files touched: src/sql_lite/sql_lite.cpp, src/verifactu/verifactumanager.h/.cpp, src/app/mainwindow.h/.cpp, src/app/mainwindow.ui, src/imprimir/imprimir.h, src/recog_prendas/recog_prendas.h/.cpp, src/listado/listado.cpp, src/tableview/mysortfilterproxymodel.h. Audit table in docs/modules/verifactu/verifactu-requirements.md updated to COVERED.
  • [x] Verifactu — mandatory verification leyenda next to the QR on printed receipts (Req. 9; Disposición Final Primera RD 1007/2023): Imprimir::createTicketExcel() now writes the centred line Factura verificable en la sede electrónica de la AEAT (font 7, merged A:C, row height 9.6) immediately below the 140×140 QR. Emitted only when the model's row-0 verifactu_estado equals "ENVIADA" (compared via the canonical verifactuEstadoToString(VerifactuEstado::Enviada) helper instead of a bare string literal), so PENDIENTE / ERROR / ANULADA rows never carry the verifiability claim — and save-time prints (which always have estado=PENDIENTE in the new async flow) silently skip it too. The full-sentence form is chosen over the shorter VERI*FACTU mark because the receipt has the vertical room and the long form directs the customer to the AEAT sede explicitly. Files touched: src/imprimir/imprimir.cpp. Audit table in docs/modules/verifactu/verifactu-requirements.md updated to COVERED.
  • [x] QXlsx — page-margin support added (local patch): upstream QXlsx (QtExcel/QXlsx, including the liufeijin fork bundled here) has the six pageMargins fields (PMleft/PMright/PMtop/PMbotton/PMheader/PMfooter) in WorksheetPrivate and serializes the <pageMargins> XML element when all six are non-empty, but exposes no public setter — the only public page method was setStartPage. Added Worksheet::setPageMargins(left, right, top, bottom, header=0.3, footer=0.3) in QXlsx/header/xlsxworksheet.h + QXlsx/source/xlsxworksheet.cpp (following the liufeijin/setStartPage pattern), and a Document::setPageMargins(...) forwarder in QXlsx/header/xlsxdocument.h + QXlsx/source/xlsxdocument.cpp that delegates to the current worksheet. Units are inches (XLSX standard). imprimir.cpp now calls excel.setPageMargins(0.6, 0.6, 0.4, 0.4) right after the column-width setup in createTicketExcel(). Note: the serializer is all-or-nothing — passing only some margins would still drop the whole element, hence the header/footer defaults (0.3″) so a 4-argument call always works. This is the first local modification to QXlsx/ in this project; the AI agent docs previously said "do not modify" — that note has been relaxed to "minimal local patch — see Completed Milestones".
  • [x] Verifactu — declaración responsable visible in the software (Req. 8; Art. 13 RD 1007/2023): new Ayuda menu with Acerca de Verifactu... action opens a QDialog displaying the fixed-text declaración. Producer NIF / name / address are pulled from AppSettings (the bespoke deployment treats the user-business as producer); software name is La Ideal and the version is interpolated from PROJECT_VERSION_MAJOR/MINOR in the generated version.h, so the declaration is automatically per-version as Art. 13 requires. Body cites RD 1007/2023 + Orden HAC/1177/2024 and states VERI*FACTU mode explicitly. Files: src/app/mainwindow.ui (new menu/action), src/app/mainwindow.h/.cpp (slot + dialog). Verifactu compliance audit table updated to COVERED in docs/modules/verifactu/verifactu-requirements.md.
  • [x] Temp debug code removed from MainWindow constructor — early development debug code that printed module state at startup; cleaned up before the v8.0 cut.
  • [x] Verifactu fully async — UI no longer blocks on AEAT: VerifactuManager and VerifactuIntegration rewritten — submitInvoice / cancelInvoice / generateQRCode (sync, QEventLoop-blocking) replaced with submitInvoiceAsync / cancelInvoiceAsync / generateQRAsync that return a QString requestId immediately. Results arrive via a new requestFinished(reqId, VerifactuResult) signal. Each consumer holds a small QHash<reqId, ticketNum> map to correlate.
  • MainWindow save flow: saveTicket() writes rows with verifactu_estado = PENDIENTE immediately. Print branching now diverges by payment state — paid → printFra() only (factura simplificada), unpaid → printRecibo() only (claim ticket, two copies). In both cases verifactuIntegration = nullptr, so save-time prints never carry CSV/QR (AEAT response is still in flight). The async submit is fired for paid tickets, status bar shows "Enviando ticket NNNN a AEAT..." and the form resets. When AEAT replies, onVerifactuRequestFinished() UPDATEs the row(s) and shows "Ticket NNNN enviado (CSV: ...)" or "Error..." in the status bar (no popups). Customer can reprint a Verifactu-complete copy with QR/CSV via RecogPrendas → Imprimir. AppSettings::enablePrinting() is checked inside printRecibo() / printFra() and only guards the actual printTicket() calls — the Excel file is generated even in testing mode for inspection.
  • RecogPrendas pay-all + retry: same async pattern. updateDb(PAY_YES) now consults an in-memory hasPendingSubmit(ticketNum) map in addition to the DB-state check (pay-all iterates per row, async submits don't update DB synchronously, so the old DB-only dedup would double-fire). retryVerifactuSubmit is now fire-and-forget; status bar shows progress.
  • CancelInvoiceDialog: async cancel; dialog stays open with "Enviando anulación..." label until AEAT replies. m_pendingCancelId guards against re-entry.
  • Imprimir reprint: resolveQrCode() keeps a synchronous API (print needs the QR before embedding in Excel) but built on the async core — uses a local QEventLoop + QTimer::singleShot(5000, ...) to bound the wait. On timeout, prints without the QR and logs a warning. The pre-existing DB-CSV short-circuit means save-time prints never hit this path (CSV is still empty).
  • testConnection() stays sync — interactive button with explicit feedback, already bounded by setTransferTimeout(10000).
  • Dead-code cleanup landed alongside: removed submitInvoices (batch, never called), encodeImageToBase64, onNetworkReply slot, m_lastResult member, createAndSubmitInvoice (full invoice, never called), validateEmitterConfiguration (only caller was itself dead), getManager() and getConfigInfo() (no callers) — per docs/dead_code_report.md.
  • [x] Dead-code audit snapshot + agent: docs/dead_code_report.md lists ~20 unused methods (mostly in src/verifactu/ — the module was built with a broader API than MainWindow + RecogPrendas actually use). Snapshot is reproducible via the new .claude/agents/dead-code-finder.md subagent, which knows about Qt auto-connect slots, virtual overrides, and signals so it doesn't false-flag them. Invoke with the Agent tool, subagent_type: "dead-code-finder". Report is informational only — no methods removed in this pass.
  • [x] "Probar conexión" button in SettingsDialog: new button on the Verifactu tab tests the configured endpoint with the current dialog values (no save required). VerifactuManager::testConnection() was previously broken — fired a GET and returned true immediately, ignoring the reply. Rewritten to POST a stub {"ServiceKey": "..."} payload to /Create (GET on the base URL hangs and never returns — only POST to /Create actually responds), use QEventLoop with a 10s setTransferTimeout, and return a VerifactuResult. SUCCESS = any HTTP response (server rejects the stub with 400/401, but that still proves connectivity + auth path); NETWORK_ERROR = no HTTP status (DNS failure, refused, timeout); INVALID_CONFIG = local validation failed. The dialog emits testConnectionRequested(nif, name, key, production); MainWindow builds a transient VerifactuManager, runs the test, and shows the result via QMessageBox — keeps appsettings from depending on verifactu.
  • [x] Em-dash purged from source code: 49 occurrences across 13 .cpp / .h files (comments, log strings, a few user-visible Spanish strings like the Verifactu dialog window title and empty-value placeholders) replaced with ASCII -. Some Windows code pages mangle U+2014 in source files. Coding guidelines updated with a "no non-ASCII punctuation in source" rule (em-dash, en-dash, curly quotes, ellipsis) so future agents don't reintroduce them.
  • [x] Log de depuración dialog opens the log file directly: on_actionMostrar_log_triggered() button relabelled from "Abrir carpeta" to "Abrir archivo"; QDesktopServices::openUrl now points to path instead of QFileInfo(path).absolutePath(). Faster for support — customer can attach the file with one click instead of navigating Explorer.
  • [x] Per-garment payment disabled in RecogPrendas: pb_payment button is no longer re-enabled on row selection — payment can only be marked via "Pagar todo" (pb_pay_all), which submits one Verifactu invoice per ticket. Prevents the duplicate-InvoiceID rejection from AEAT that would occur if the user paid one garment, triggered an F2 with InvoiceID = n_recibo, then later paid another garment for the same ticket. The on_pb_pay_all_clicked() loop calls on_pb_payment_toggled(true) programmatically, which still fires on a disabled button — full-ticket pay flow unchanged. See "Per-payment Verifactu InvoiceID seq" in Open Non-Blocking Issues for the architectural follow-up that would restore per-garment payment.
  • [x] Verifactu conditional on payment: on_bb_save_reset_clicked() now only calls verifactuSubmitInvoice() when pagado == "SI"; unpaid saves produce NotSubmitted state. updateDb(PAY_YES) in recog_prendas.cpp auto-submits if the ticket is still NotSubmitted, using the payment date as invoice date; DB is queried directly so the pay-all loop never double-submits.

Contabilidad dialog improvements — May 2026 (feature/add_mdiago_verifactu)

  • [x] Contextual confirmation dialogs added to on_bb_ok_cancel_accepted (4 cases: lock/revert × already-done/not-done)
  • [x] Fixed syntax bug: QMessageBox::information call had , + "..." as a separate argument instead of string concatenation
  • [x] Fixed double-dialog: removed redundant QMessageBox calls from updateLock() (replaced with qDebug) since on_bb_ok_cancel_accepted now owns those dialogs
  • [x] Fixed wrong comment: checkBox_lock->setDisabled(revertirOn) line had copy-paste "configuration combobox" comment — corrected to "lock checkbox when reverting"

Herramientas menu reorganisation — May 2026 (feature/add_mdiago_verifactu)

  • [x] menuHerramientas reordered: Imprimir, Recogida de prendas, Añadir nuevas prendas, ─, Añadir factura de gastos, Anular factura Verifactu, ─, Generar contabilidad, Revertir contabilidad
  • [x] actionFormulario_facturas renamed to "Añadir factura de gastos"
  • [x] Log de depuración moved from Herramientas to Archivo, below Configuración (before the separator)

VerifactuEstado enum — May 2026 (feature/add_mdiago_verifactu)

  • [x] VerifactuEstado enum class added to verifactumanager.h (NotSubmitted, Enviada, Anulada, Error)
  • [x] verifactuEstadoToString() and verifactuEstadoFromString() inline helpers in the same header
  • [x] All hardcoded "ENVIADA" / "ANULADA" / "ERROR" literals replaced in mainwindow.cpp, cancelinvoicedialog.cpp, recog_prendas.cpp
  • [x] SQL literal 'ANULADA' in cancelinvoicedialog.cpp replaced with parameterized bind
  • [x] NotSubmitted now serializes as "PENDIENTE" instead of empty string — user-visible status in the Verifactu info dialog and Anular factura search. verifactuEstadoFromString() still maps NULL/empty to NotSubmitted for legacy pre-Verifactu rows

Contabilidad bug fixes — May 2026 (feature/add_mdiago_verifactu)

  • [x] Missing } in contabilidad.cpp::on_cb_config_currentTextChanged fixed (syntax error, prevented compilation)
  • [x] totalPriceBetweenDates now excludes verifactu_estado = 'ANULADA' rows from ingresos — cancelled invoices no longer counted as taxable income
  • [x] gastos query changed from BETWEEN (endpoint-inclusive) to >= AND < — eliminates double-counting on quarter boundary dates

Unsuccessful invoice handling — May 2026 (feature/add_mdiago_verifactu)

  • [x] verifactuSubmitInvoice() in MainWindow now shows QMessageBox::warning (Spanish) when submission fails with ERROR or NETWORK_ERROR; INVALID_CONFIG (not configured) remains silent
  • [x] retryVerifactuSubmit(ticketNum, invoiceDate) added to RecogPrendas: sums ticket total from DB, resubmits via submitSimplifiedInvoice, updates all n_recibo rows in ingresos, refreshes table
  • [x] on_pb_verifactu_clicked() extended: shows "Reintentar envío a AEAT" button in the info dialog when estado == "ERROR" and Verifactu is configured

Persistent debug logging — May 2026 (feature/add_mdiago_verifactu)

  • [x] New src/logging/ module: AppLogger static class with install() and logFilePath()
  • [x] qInstallMessageHandler captures all qDebug / qWarning / qCritical output — no changes needed to any existing call site
  • [x] Log format: yyyy-MM-dd HH:mm:ss [DEBUG|WARN|CRIT|FATAL] message; session separator written on each app start
  • [x] Rotation: file renamed to .laideal.log.old when it exceeds 5 MB; thread-safe via QMutex
  • [x] Log file location: ~/.laideal.log (consistent with ~/.laideal_settings.json)
  • [x] Herramientas → Log de depuración… dialog shows full path + "Abrir carpeta" button (opens Explorer)
  • [x] Conditions block (client copy only) rewritten against RD 1453/1987 (BOE-A-1987-26716) and Consumo Responde (Junta de Andalucía)
  • [x] Clause 1 (receipt/identity): receipt required to collect garment; loss does not prevent collection — client identifies themselves
  • [x] Clause 2 (storage — legal fix): storage fees may accrue after 3 months from delivery; custody obligation ends at 6 months (Art. 6 RD 1453/1987 correctly applied to custody, not documentation)
  • [x] Clause 3 (accessories — per-receipt): disclaimer for buttons/ornaments applies only when noted on this specific receipt; removal recommended before delivery
  • [x] Clause 4 (NEW — pre-cleaning advisory, Art. 6 RD 1453/1987): if garment condition implies risk of damage or uncertain outcome, client will be informed before treatment proceeds

RGPD first-layer notice added to client receipt — May 2026 (feature/add_mdiago_verifactu)

  • [x] 4th bullet added to createTicketExcel() conditions block (client copy only): "Sus datos son tratados por [businessName] para gestionar el servicio (RGPD). Derechos arts.15-22: [businessPhone or 'ver cartel en tienda']." Complies with LOPDGDD Art. 11 layered-notice requirement verified live against aepd.es

General conditions omitted from establishment receipt copy — May 2026 (feature/add_mdiago_verifactu)

  • [x] createTicketExcel() conditions block wrapped in if (!isRecibo || copyForClient) — establishment copy now ends at the timestamp; invoice copies (no isRecibo) always show conditions as before

Ingresos Listado: clickable Verifactu URL column — May 2026 (feature/add_mdiago_verifactu)

  • [x] New LinkDelegate added to src/tableview/ — renders non-empty cells as blue underlined text; follows the same initStyleOption pattern as TextColorDelegate
  • [x] INGRESOS_IDX_VERIFACTU_ERROR (18) and INGRESOS_IDX_VERIFACTU_URL_QR (19) constants added to mysortfilterproxymodel.h
  • [x] Listado::populateTable() applies LinkDelegate to the URL QR column and moves it visually before verifactu_error via QHeaderView::moveSection()
  • [x] Listado constructor connects table_listado->clicked to open the URL in the system browser via QDesktopServices::openUrl()

RecogPrendas bug fixes — May 2026 (feature/add_mdiago_verifactu)

  • [x] Buttons (payment, state, pay-all, pku-all, separ-garm, print) no longer grey out after an action — moved setEnabled(true) calls into updateRowClickedToFields() so they fire after every updateDb() cycle, not only on direct row click
  • [x] Print button in RecogPrendas now generates QR code — m_verifactuIntegration added as public member to RecogPrendas; MainWindow passes it at creation; on_pb_print_clicked() forwards it to Imprimir

Ticket header + business phone setting — May 2026 (feature/add_mdiago_verifactu)

  • [x] createTicketExcel() header rewritten: 6-row block (business name at font 22, then company name / NIF / address / city / phone at font 11 bold) sourced entirely from AppSettings — removed dead formatCenterAlign and broken verifactuIntegration call
  • [x] AppSettings::businessPhone() / setBusinessPhone() added — persisted under business.phone in ~/.laideal_settings.json
  • [x] SettingsDialog Business tab gains "Teléfono:" field wired to businessPhone

Verifactu QR on printed ticket — May 2026 (feature/add_mdiago_verifactu)

  • [x] Imprimir gains qrCode (QPixmap) and verifactuIntegration members; resolveQrCode() returns the pre-supplied pixmap if any, otherwise calls /GetQrCode via VerifactuIntegration::generateQR() using ticket number/date/taxBase/taxRate from ingresos
  • [x] Imprimir::createTicketExcel() embeds the QR (scaled 140×140) at the bottom of the receipt using QXlsx::Document::insertImage()
  • [x] Imprimir column constants extended (TABLE_VERIFACTU_CSV … TABLE_VERIFACTU_URL_QR) for the new ingresos columns
  • [x] MainWindow::printRecibo() / printFra() now take const VerifactuResult & and pass result.qrCode to Imprimir (no extra REST call when QR is already in hand)
  • [x] Imprimir → Recibo / Factura / Factura completa reprint actions inject m_verifactuIntegration so the dialog can hit /GetQrCode for tickets without an in-memory pixmap
  • [x] VerifactuIntegration::generateQR() signature fixed: now builds a valid F2 simplified invoice (with tax item) so the /GetQrCode endpoint accepts the request (previous version failed isValid() due to missing TaxItems)
  • [x] imprimir CMake target now links the verifactu library

Invoice cancellation — May 2026 (feature/add_mdiago_verifactu)

  • [x] CancelInvoiceDialog added to src/app/ — search ticket by number, show cliente/fecha/importe/CSV/estado, enable cancel only when estado == "ENVIADA"
  • [x] Herramientas → Anular factura Verifactu… menu action opens the dialog; disabled with warning if Verifactu not configured
  • [x] On AEAT confirmation: updates ingresos rows (verifactu_estado = 'ANULADA', verifactu_timestamp = now, clears verifactu_error)
  • [x] VerifactuManager::cancelInvoice() fixed to include CompanyName in cancel JSON — required by AEAT API
  • [x] AEAT error 3002 "No existe el registro de facturación" diagnosed: TESTING environment purges old records; must cancel a freshly-submitted invoice in the same session

RecogPrendas UX + Listado fixes — May 2026 (feature/add_mdiago_verifactu)

  • [x] showQrToClient() removed from MainWindow — QR dialog after invoice submit was disruptive; Verifactu info is now accessible in RecogPrendas instead
  • [x] pb_verifactu button added to RecogPrendas — enabled only when selected row has verifactu_estado non-empty; opens dialog showing estado, CSV, timestamp, error, and clickable AEAT validation link
  • [x] All action buttons in RecogPrendas (pb_payment, pb_state, pb_pay_all, pb_pku_all, pb_separ_garm, pb_print, pb_verifactu) start disabled; enabled on row selection
  • [x] ingresos Listado view now loads most-recent rows first (ORDER BY n_recibo DESC) so latest tickets are visible without loading the full table
  • [x] Other tables in Listado use model->fetchMore() loop replacing the unreliable scrollbar hack
  • [x] Row height no longer expands on lazy-load: setDefaultSectionSize(rowHeight(0)) locks compact height after initial resizeRowsToContents()
  • [x] Listado window width capped at screen()->availableGeometry().width() — prevents window from expanding off-screen when ingresos has many columns
  • [x] TABLE_VERIFACTU_CSV/TIMESTAMP/ESTADO/ERROR/URL_QR (15–19) added to recog_prendas.h; hash + verifactu columns hidden from table view via setColumnHidden()

Debug mode replaced by AppSettings::enablePrinting() — May 2026 (feature/add_mdiago_verifactu)

  • [x] bool debug member and on_actionModo_debug_triggered slot removed from MainWindow
  • [x] actionModo_debug UI action removed from mainwindow.ui (Archivo menu)
  • [x] AppSettings::enablePrinting() / setEnablePrinting() added — persisted under print.enable in ~/.laideal_settings.json
  • [x] SettingsDialog General tab gains checkbox "Habilitar impresión de tickets y facturas"
  • [x] on_bb_save_reset_clicked() now guards printing with AppSettings::instance()->enablePrinting() instead of !debug

Verifactu DB persistence + response capture — May 2026 (feature/add_mdiago_verifactu)

  • [x] migrateDatabase() added to sql_lite — adds 5 verifactu_* columns to ingresos on startup (idempotent)
  • [x] processResponse() in VerifactuManager now extracts ValidationUrl and QrCode from the /Create response alongside CSV
  • [x] saveTicket() extended to persist verifactu_csv, verifactu_timestamp, verifactu_estado, verifactu_error, verifactu_url_qr for every garment row in the ticket
  • [x] verifactuSubmitInvoice() now returns VerifactuResult; caller in on_bb_save_reset_clicked() passes it to saveTicket()
  • [x] Error and unconfigured states also written to DB (empty estado = not submitted; estado=ERROR stores error description)

Module consolidation + tilde search fix — May 2026 (feature/add_mdiago_verifactu)

  • [x] All src subdirectory names lowercased; root CMakeLists.txt updated to match
  • [x] Five separate CMake libraries (FilterWidget, MySortFilterProxyModel, NumberFormatDelegate, TextColorDelegate, TableView) merged into a single tableview library — source files stay in their own dirs, all exposed via the tableview INTERFACE include path
  • [x] listado library renamed to lowercase, now links tableview as PUBLIC (propagates headers to consumers)
  • [x] recog_prendas and app target_link_libraries updated — no more references to old individual targets
  • [x] MySortFilterProxyModel::removeDiacritics() added — strips Unicode combining marks via NFD decomposition; covers all Spanish accented characters and ñ
  • [x] MySortFilterProxyModel::setNormalizedFilter(text, column) added — OR-combined with existing regex filter inside filterAcceptsRow; column = -1 searches all columns
  • [x] Listado::textFilterChanged now calls setNormalizedFilter so searches without tildes (e.g., "garcia") match names with tildes (e.g., "García")
  • [x] RecogPrendas name search changed from SQL WHERE cliente LIKE (ASCII-only) to full SELECT * FROM ingresos + proxy-model normalized filter on TABLE_CLIENT column
  • [x] RecogPrendas total-price calculation now sums from the proxy model rows (correct for name search filtered set)

Centralised AppSettings + sql_lite refactor — May 2026 (feature/add_mdiago_verifactu)

  • [x] New src/appsettings/ module: AppSettings singleton + SettingsDialog
  • All previously hardcoded paths and values (DB path, icon, report dirs, Excel template, batch script, business identity, IVA rate, Verifactu NIF/name/key/environment) now live in ~/.laideal_settings.json
  • Legacy ~/.laideal_cfg and ~/.verifactu_key files migrated automatically on first run
  • Settings dialog accessible from Archivo → Configuración...; changes applied at runtime (icon, Verifactu) or require restart (DB path)
  • [x] main.cpp — validates DB path before constructing MainWindow; opens SettingsDialog on first run or misconfiguration
  • [x] sql_lite refactored — const QString & params, dbNotConfigured() guard prevents error dialogs when DB path not set, monthStr() helper deduplicates month-padding logic, QRandomGenerator replaces rand() in genHash16()
  • [x] All module CMakeLists.txt updated to link appsettings

First successful Verifactu submission — May 2026 (feature/add_mdiago_verifactu)

  • [x] submitSimplifiedInvoice() added to VerifactuIntegration for F2 (simplified) invoices — no buyer NIF required, correct for laundry retail
  • [x] Fixed CompanyName field name — API requires CompanyName, was incorrectly sent as SellerName
  • [x] Emitter NIF and name moved out of source code to ~/.laideal_cfg (key=value, same location as ~/.verifactu_key)
  • [x] logResponse() added to VerifactuManager — pretty-prints server JSON with QR blob truncated
  • [x] First confirmed AEAT TESTING submission: invoice 24417, CSV A-9VARYQTZTARVU2, StatusResponse: Correcto
  • [x] Confirmed API returns QrCode, ValidationUrl, and QrCodeUrl directly in the submitInvoice response

Documentation expansion — May 2026

  • [x] Created per-module reference docs for all non-Verifactu modules (docs/modules/*.md)
  • mainwindow.md, sql_lite.md, listado.md, recog_prendas.md, facturas.md, contabilidad.md, imprimir.md, add_garment.md
  • [x] Condensed Verifactu docs: README.md (Spanish→English, shorter), RESUMEN_IMPLEMENTACION.md (246→85 lines), removed redundant INDEX.md
  • [x] Updated architecture.md and ai_agent_instructions.md — method names reflect current camelCase identifiers
  • [x] Removed docs/todo/ and docs/development/ references from all docs; deleted hardcoded_paths.png
  • [x] Updated docs/INDEX.md and docs/README.md to register all new module docs

Code quality improvements — May 2026 (feature/add_mdiago_verifactu)

  • [x] Applied coding guidelines to all src/ modules (commit 157c354)
  • Translated Spanish dev comments and debug strings to English
  • Converted SIGNAL/SLOT macro syntax to new-style pointer syntax
  • Fixed SQL injection in add_garment.cpp on_pb_search_pressed (parameterised query)
  • [x] Renamed all user-defined snake_case identifiers to camelCase across all src/ modules (commit 551b920)
  • Methods, members, parameters, local variables, free functions, signals
  • Qt auto-connect slots (on_*) and Qt virtual overrides preserved unchanged
  • Updated call sites in insertnewitem.cpp and genlistado.cpp

Documentation reorganisation — May 2026

  • [x] Moved all .md docs from src/verifactu/ to docs/modules/verifactu/
  • [x] Created docs/README.md (docs folder index)
  • [x] Created docs/modules/verifactu/ with full Verifactu docs
  • [x] Created docs/ai_agent_instructions.md — agent onboarding guide
  • [x] Created docs/architecture.md — full module/DB/flow documentation
  • [x] Created docs/progress_tracker.md — this file
  • [x] Created docs/INDEX.md — project-wide quick-find index
  • [x] Created .claude/commands/update-docs.md and .claude/commands/update-skills.md skills
  • [x] Created .claude/commands/coding-guidelines.md skill (/coding-guidelines)
  • [x] All documentation translated to English

8.0 — Verifactu Support — May 2026 (feature/add_mdiago_verifactu)

  • [x] Created src/verifactu/ module: VerifactuConfig, VerifactuInvoice, VerifactuManager, VerifactuIntegration
  • [x] Added VerifactuIntegration instance to MainWindow (m_verifactuIntegration)
  • [x] verifactuSubmitInvoice() called in ticket save flow
  • [x] showQrToClient() — QR + CSV + validation URL dialog
  • [x] Graceful degradation: shows warning if Verifactu not configured, does not block ticket saving
  • [x] TESTING environment available; production environment ready
  • [x] CMake integration (src/verifactu/CMakeLists.txt + root CMakeLists.txt)
  • [x] initializeVerifactu() in MainWindow constructor

r7.1 — PDF export for listados

  • [x] Print listado de prendas to PDF via actionGenerar_pdf_con_el_listado

r7.0 — Hardcoded path update

  • [x] Updated hardcoded paths for new laptop (still hardcoded, different machine address)

r6.1 — Fix waiting cursor

  • [x] Fixed waiting cursor in listados and other time-consuming operations

r6.0 — Garment management upgrades

  • [x] AddGarment module: add garments to existing tickets
  • [x] Split garments in RecogPrendas
  • [x] hash column added to ingresos for unique row identification
  • [x] RecogPrendas DB updates based on n_recibo + hash (not just row number)

r5.x — Listado & accounting improvements

  • [x] Revert accountings feature (r5.0)
  • [x] Data lock on closed quarters (r5.6)
  • [x] Generic Listado class replacing per-table views (r5.1+)
  • [x] Sort/filter for all table columns
  • [x] New InsertNewItem dialog for adding clients
  • [x] Quarter lock prevents out-of-period data entry (r5.0)

r4.x — Print, UI, and invoice improvements

  • [x] Print support via Excel + batch script (r3.0/r4.x)
  • [x] Debug mode toggle (r4.0)
  • [x] Invoice form: show IVA and base, replace "producto" with description (r4.0)
  • [x] App icon (r4.1)
  • [x] Version metadata in .exe (r5.4)

r1.0–r2.0 — Foundation

  • [x] Initial release with garment/client/receipt/accounting/invoice features
  • [x] SQLite database
  • [x] servicios table for unique services in invoices
  • [x] 2-decimal currency display