Skip to content

feat: tell people and employers apart - #66

Merged
danielededo merged 2 commits into
mainfrom
feat/person
Oct 20, 2026
Merged

danielededo merged 2 commits into
mainfrom
feat/person

Conversation

@danielededo

@danielededo danielededo commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

Implements ADR 0010, included here and now Accepted. Until now the report assumed every payslip belonged to one person with one employer. When it got payslips of two people, or of one person who changed job, it mixed them: identical labels in the month picker, and comparisons between unrelated payslips.

Reading

  • Person: identified by the codice fiscale, using the existing check-character detector in internal/pii.
  • Name: the run of 2–5 words, anywhere on the page and in either order, whose surname and given name encode the code's first six letters. It is shown as given name then surname, for example "Maria Grazia D'Angelo". Names are only displayed, never used to group payslips.
  • Employer code: an eleven-digit fiscal code or VAT number with a valid check digit, taken from the header above the item table. A code on a line saying what it is wins over a code standing alone.
  • Employer name: the phrase ending in a company form ("GO Reply S.r.l.", without the "con Unico Socio" that follows), or else the line under a "Ditta"/"Azienda" label. Only the header is searched, so the bank and the payroll software's footer are not taken.

Report

  • Grouping: one report per person. A payslip without a code joins the only person, or else goes to a group of its own.
  • One person: the name sits at the top.
  • Several people: buttons at the top switch between them, in the web app and in the downloaded file alike. The other people's reports wait in <template>s. The script now runs in an init(signal): on a switch, the person's DOM is replaced and init runs again. Page-level listeners carry an AbortSignal, so they end with the person they were added for.
  • Comparisons: a month is compared only with the previous one of the same person and employer, through insights.Previous, used by both the report and the CLI's compare. Deduplication also keys on person and employer.
  • Several employers: each month names its employer ("dicembre 2024 · GO Reply"). The month picker names it only when a month has two payslips ("Feb 26 · ALFA").

Synthetic payslips

  • synth -person "ROSSI MARIO" -employer "ALFA SRL" prints an invented, check-valid codice fiscale and VAT number.
  • Only the first fifteen characters of a codice fiscale appear in the source, so piiscan stays clean.

Type of change

  • New feature (non-breaking)

Checklist

  • Commits follow the commit convention
  • Tests added or updated for the change
  • All tests and linters pass locally
  • Documentation updated (README, docs/, comments) where behavior changed
  • CHANGELOG.md updated under Unreleased for user-visible changes

Notes for the reviewer

Tests

  • party_test.go:
    • a name with an apostrophe and two given names, read between a code and a date;
    • an employer named under its label, with a code alone on a line;
    • no person without a codice fiscale;
    • the VAT check digit.
  • TestPreviousOfSameEmployer covers the comparison rule.
  • TestPeople covers grouping, display names, the masked code, a payslip without a code, and employer labels.
  • New e2e test: two people in the web app, one of them with two employers in a month. It switches between them and checks that the page's tabs still lead into the report shown.

Checks

  • Extraction compared with main on a set of real payslips kept off the repository: identical apart from the new fields. Person and employer were read correctly on all of them, across four payroll layouts.
  • Locally: gofmt, vet (including wasm), staticcheck, go test -race, piiscan, the web unit tests and the 13 e2e tests in Chromium all pass. WebKit runs in CI.

Each payslip now carries its person, by the codice fiscale and the name
it encodes, and its employer, by its fiscal code or VAT number and its
name (ADR 0010, now accepted).

The report is built per person: one person's name sits at the top, and
payslips of several people make a report each, chosen with buttons at
the top, in the web app and in the downloaded report alike. The page's
script starts again for the person chosen, its listeners on the page
ending with the person they were added for.

A month is compared only with the previous one of the same person and
employer, in the report and in the CLI's compare. When a person has
several employers, each month names its employer, and the month picker
does when a month has two payslips.

The synthetic payslips can print an invented, check-valid fiscal code
and VAT number (synth -person, -employer); only the first fifteen
characters of a code are in the source.
@danielededo
danielededo merged commit c1786d2 into main Oct 20, 2026
3 checks passed
@danielededo
danielededo deleted the feat/person branch October 20, 2026 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant