The archive importer still says which telephone numbers other accounts hold, with no allowance #890

Closed
opened 2026-10-10 17:25:15 +00:00 by tiagoagueda · 1 comment
Owner

_restore_phone_numbers (src/postulo/core/importer.py:828-860) calls phone_numbers.taken_elsewhere(number) for every number in an archive, skips the ones another account holds, and says so: Telephone number ending 78 …: already recorded on this instance, not restored.

What exists today

  • Every other door that can answer does another account hold this number? charges the asker's allowance (POSTULO_NUMBER_RATE, 20/h) or, once it is spent, refuses free and held numbers alike: the form (phone_numbers.refusal), the API (api/routers/companies.py) and, since #735, the candidate file's review.
  • The archive import calls taken_elsewhere directly. It is not charged and not refused when the allowance is spent, and it names the last two digits of each number it skipped.
  • An archive is a file the person makes; an account can upload one with any numbers in it as often as the import itself is allowed.

What would change

  • The import asks phone_numbers.ensure_allowance(owner) before each lookup and charges a held answer with collision_noticed, the way the candidate file does (resume/candidate.py, _somebody_elses). Once the allowance is spent a number is skipped with the told about a lot of numbers sentence whether or not it is held.
  • A regression test beside tests/security/test_candidate_file.py's: spend the allowance, import an archive with a free and a held number, same outcome and words.

Decisions

  • Should a number that is skipped for the allowance be reported at all. Recommended: yes, as one line for the whole archive, not one per number, so the person knows to try again later.

Found while fixing #735 (checked against main at 8c3d03570 plus that fix).

`_restore_phone_numbers` (`src/postulo/core/importer.py:828-860`) calls `phone_numbers.taken_elsewhere(number)` for every number in an archive, skips the ones another account holds, and says so: *Telephone number ending 78 …: already recorded on this instance, not restored*. ## What exists today - Every other door that can answer *does another account hold this number?* charges the asker's allowance (`POSTULO_NUMBER_RATE`, 20/h) or, once it is spent, refuses free and held numbers alike: the form (`phone_numbers.refusal`), the API (`api/routers/companies.py`) and, since #735, the candidate file's review. - The archive import calls `taken_elsewhere` directly. It is not charged and not refused when the allowance is spent, and it names the last two digits of each number it skipped. - An archive is a file the person makes; an account can upload one with any numbers in it as often as the import itself is allowed. ## What would change - The import asks `phone_numbers.ensure_allowance(owner)` before each lookup and charges a held answer with `collision_noticed`, the way the candidate file does (`resume/candidate.py`, `_somebody_elses`). Once the allowance is spent a number is skipped with the *told about a lot of numbers* sentence whether or not it is held. - A regression test beside `tests/security/test_candidate_file.py`'s: spend the allowance, import an archive with a free and a held number, same outcome and words. ## Decisions - **Should a number that is skipped for the allowance be reported at all.** Recommended: yes, as one line for the whole archive, not one per number, so the person knows to try again later. Found while fixing #735 (checked against `main` at `8c3d03570` plus that fix).
tiagoagueda added this to the 0.6.0 milestone 2026-10-10 17:25:15 +00:00
Author
Owner

Fixed in e9f8a59e4 on main.

Fixed in e9f8a59e4 on main.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Postulo/postulo#890
No description provided.