Skip to content

French social security numbers - corsican codes#2373

Open
dancergraham wants to merge 9 commits into
joke2k:masterfrom
dancergraham:copilot/update-corsica-prefecture-names
Open

French social security numbers - corsican codes#2373
dancergraham wants to merge 9 commits into
joke2k:masterfrom
dancergraham:copilot/update-corsica-prefecture-names

Conversation

@dancergraham

@dancergraham dancergraham commented May 8, 2026

Copy link
Copy Markdown
Contributor

What does this change

Adds corsican department codes to the list of possible values for the creation of French social security numbers

What was wrong

The current implementation ommits the possibility of corsican department codes - the only ones which include letters (A or B). This may (correctly) break the code of some users of faker if they currently wrongly assume that French Social Security numbers are all digits.

How this fixes it

Adds the missing codes and updates the checksum calculation.

Fixes #2372

AI Assistance Disclosure (REQUIRED)

  • No AI tools were used in preparing this PR.
  • If AI tools were used, I have disclosed which ones, and fully reviewed and verified their output.

I used GPT5.4 via GitHub Copilot, giving it specific and detailed instructions on what changes to make - I have fully reviewed, verified and simplified the output.

Checklist

  • I have read the documentation about CONTRIBUTING
  • I have read the documentation about Coding style
  • I have run separately opened a PR to pin mypy and fix the linting and then run make lint

Copilot AI and others added 3 commits May 6, 2026 11:29
Agent-Logs-Url: https://github.com/dancergraham/faker/sessions/c37c463b-b410-460b-9b66-8da985992016

Co-authored-by: dancergraham <32717635+dancergraham@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dancergraham/faker/sessions/c37c463b-b410-460b-9b66-8da985992016

Co-authored-by: dancergraham <32717635+dancergraham@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 8, 2026 20:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds support for Corsican French SSN (NIR) department codes (2A / 2B) in the fr_FR SSN provider, including the required checksum normalization, and updates tests to accept alphanumeric SSNs.

Changes:

  • Extend fr_FR SSN generation to allow Corsican department codes (2A, 2B).
  • Update checksum calculation to normalize 2A -> 19 and 2B -> 18 before mod-97.
  • Strengthen fr_FR SSN tests to validate the new format and deterministic Corsica generation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
faker/providers/ssn/fr_FR/__init__.py Adds 2A/2B departments and updates checksum computation to handle letters.
tests/providers/test_ssn.py Updates SSN regex expectations and adds targeted tests for Corsican codes and checksum.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/providers/test_ssn.py
Comment thread faker/providers/ssn/fr_FR/__init__.py Outdated
Comment thread faker/providers/ssn/fr_FR/__init__.py Outdated
dancergraham and others added 2 commits May 8, 2026 22:31
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Removed redundant test case for SSN generation.
@dancergraham dancergraham changed the title Copilot/update corsica prefecture names French social security numbers - corsican codes May 14, 2026
@dancergraham

Copy link
Copy Markdown
Contributor Author

Hi @fcurella anything I can do to make this PR easier to check / approve / reject ? This fixes a genuine hole in the current implementation.

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.

Missing edge case for French social security numbers

3 participants