Skip to content

Export has_backup_code flag in Superset account dump - #311

Merged
OrangeAndGreen merged 2 commits into
mainfrom
dv/has-backup-code
Oct 8, 2026
Merged

OrangeAndGreen merged 2 commits into
mainfrom
dv/has-backup-code

Conversation

@OrangeAndGreen

Copy link
Copy Markdown
Contributor

Technical Summary

Adds a has_backup_code column to the daily ConnectUser export to Superset. It is True when the user has a backup code (recovery_pin is set and not empty), otherwise False. The aim is to find out why about 1k PersonalID accounts have no backup code.

CSVGenerator reads queryset.values(*fields), so the column comes from a queryset annotation. The new connect_user_dump_queryset() adds it, and upload_connect_users_to_superset now uses that queryset. The value is worked out in the database, so neither the code nor its hash leaves connect-id. The column is added at the end, so the existing columns keep their positions.

Logging and monitoring

None needed. The new column shows up in the Superset account table after the next daily upload.

Safety Assurance

Safety story

This only changes the export: one extra column, and no change to the model or the API. The configuration-session export is unchanged.

  • I am confident that this change will not break current and/or previous versions of CommCare apps

Automated test coverage

  • test_csv_generator_outputs_expected_rows now gives the user a backup code and checks the new column.
  • The new test_csv_generator_exports_has_backup_code covers three cases: code set (True), null (False) and empty string (False). Each case also checks that the hash appears nowhere in the CSV.
  • users/tests/test_tasks.py passes 16 of 16, and the full users suite passes 458.

QA Plan

None needed beyond the tests. After deploy, check that the Superset table has the column.

Deployment

No manual steps. The upload replaces the Superset table each run (already_exists: replace), so the new column appears without a schema change.

  • This PR can be deployed: any required configuration, commands, or other manual steps required before this PR can be deployed are done.

Labels & Review

  • The set of people pinged as reviewers is appropriate for the level of risk of the change

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@OrangeAndGreen OrangeAndGreen self-assigned this Oct 7, 2026
@OrangeAndGreen
OrangeAndGreen marked this pull request as ready for review October 7, 2026 14:54
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 791b6443-bb64-4d48-9df0-e89dcea31814
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@OrangeAndGreen
OrangeAndGreen merged commit 964bef1 into main Oct 8, 2026
7 checks passed
@OrangeAndGreen
OrangeAndGreen deleted the dv/has-backup-code branch October 8, 2026 19:44
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.

2 participants