Skip to content

refactor: decouple legacy boolean privacy storage from PrivacyLevel (#317) - #323

Merged
MaryammAli merged 2 commits into
BlockDash-Studios:mainfrom
temiport25:feat/decouple-privacy-storage
Jul 21, 2026
Merged

refactor: decouple legacy boolean privacy storage from PrivacyLevel (#317)#323
MaryammAli merged 2 commits into
BlockDash-Studios:mainfrom
temiport25:feat/decouple-privacy-storage

Conversation

@temiport25

Copy link
Copy Markdown
Contributor

Summary

Decouples legacy boolean privacy_enabled storage helpers from the new numeric PrivacyLevel storage paths so both APIs can evolve independently.

Changes

  • legacy_privacy.rs (new) — backward-compatible boolean helpers: key construction, fallback reads from typed → legacy keys, cleanup of legacy keys on write
  • privacy.rs — refactored to own the PrivacyLevel (numeric) API, per-account history, and a new migrate_boolean_to_level() conversion function that maps false → 0, true → 1 and cleans up both boolean storage keys
  • storage.rs — privacy-level functions removed (now in privacy.rs)
  • lib.rs — updated imports to use privacy:: for level functions
  • storage_test.rs — updated imports
  • DocsUPGRADE_SAFETY_GATE_QUICK_REFERENCE.md and storage.rs module docs updated

Migration

During a rolling upgrade, call privacy::migrate_boolean_to_level(env, account) for each account with a legacy boolean flag. Both storage paths coexist until migration completes.

Tests

All 330 existing tests pass. New tests added:

  • legacy_privacy::tests — 6 tests for boolean key fallback, precedence, cleanup
  • privacy::tests — 7 tests for level CRUD, history, and boolean→level migration

Closes #317

temiport25 and others added 2 commits July 20, 2026 16:51
…lockDash-Studios#317)

Separate legacy boolean privacy storage helpers from new PrivacyLevel
storage paths for cleaner maintenance and independent evolution.

- Create legacy_privacy.rs with backward-compatible boolean helpers
  (key construction, fallback reads, typed key cleanup)
- Refactor privacy.rs to own PrivacyLevel (numeric) API, history,
  and a migrate_boolean_to_level() conversion function
- Remove privacy-level functions from storage.rs (moved to privacy.rs)
- Add migration tests for boolean-to-level conversion
- Update storage.rs and UPGRADE_SAFETY_GATE_QUICK_REFERENCE.md docs

@MaryammAli MaryammAli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM
nice implementation of the issue

@MaryammAli
MaryammAli merged commit 902e02d into BlockDash-Studios:main Jul 21, 2026
2 checks passed
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.

decouple legacy boolean privacy storage from new privacy level storage paths

2 participants