test(backup): assert selected folder in retention parent lookup

Open Beginner friendly
#1,358 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@EtanHey is already working on this.

Since Nov 4, 2026.

  • #1631 by @EtanHey — open

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
95/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Active
Tech stack
google-cloud, python
Domain
backend, testing

Research direction

Update tests/test_backup_machine_identity.py in test_opt_in_retention_sees_prior_ids_without_creating_or_moving_folders by asserting that files.get is called once with fileId="stable", fields="parents", and supportsAllDrives=True. Read the retention mock and existing assertions first, then run this focused synthetic test; it is done when the correct lookup passes and a wrong folder ID, fields value, or shared-drive flag fails without making Drive or database calls.

Written by the indexing model from the issue text.

Description

The retention test's mock returns {"parents": ["backups"]} for every files.get call. The test verifies the retained/trash results, but does not assert which folder was queried or the requested fields. A future regression in those arguments could therefore escape this test.

ACCEPTED-AND-ROWED — test hardening only, under the lead's explicit two-round ruling for PR #1347. Origin: CodeRabbit inline 4304929792, review 5560578479 on exact head 5ec264671950ff308a0b80c9db222588adb85f97, base main 7ea3c9f46766005b6fee809c80b18996cf44c446.

The current production implementation already calls service.files().get(fileId=folder_id, fields="parents", supportsAllDrives=True) at backup_daily.py:1125. The production caller passes the upload folder via selected_folder_id at line 1829, which the pruner passes into that helper at lines 1573–1574. No current production lookup defect was found.

In test_opt_in_retention_sees_prior_ids_without_creating_or_moving_folders, add:

service.files.return_value.get.assert_called_once_with(
    fileId="stable", fields="parents", supportsAllDrives=True
)

Preserve all existing removed-file/update/create/delete assertions. Scope is this small test assertion only; no production, fixture, timeout, cache, guard or retention-policy changes. The fixture and current assertions are at test_backup_machine_identity.py:92,121–131.

Acceptance for the future follow-up: the focused synthetic test passes against the correct lookup, and a wrong folder ID/fields/shared-drive flag would fail the new assertion. Use existing isolated test guards; no real Drive/database calls. This disposition task deliberately makes no code edit or new test run and retains the frozen PR head.

— bl-stability-lead-w4 (worker) · codex/gpt-6.1-sol

Dominant language
Python
Stars
9
Forks
7
Avg merge
4h 6m
Merged PRs (30d)
461

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from EtanHey/brainlayer

All issues in EtanHey/brainlayer

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.