Skip to content

fix(profile): expose volume_size_gb on Profile model#84

Merged
max-tet merged 1 commit into
mainfrom
fix/profile-volume-size-gb
May 16, 2026
Merged

fix(profile): expose volume_size_gb on Profile model#84
max-tet merged 1 commit into
mainfrom
fix/profile-volume-size-gb

Conversation

@ClaydeCode
Copy link
Copy Markdown
Contributor

Summary

  • Add volume_size_gb: int | None to the Profile model and propagate it from ShardBase in Profile.from_shard.
  • Extend tests/test_profile.py with a case asserting the field round-trips through GET /protected/management/profile.

Why this matters

This is a prerequisite for web-terminal#20 (Subscription card on the Settings page). The Trial-state "Subscribe — €X/month" button label needs volume_size_gb to apply the pricing formula from landing-page/src/components/Pricing.astro (disk price per GB × volume size). Without this field, the web terminal can only render a placeholder for the price, producing a degraded UX during the initial billing rollout. ShardBase already carries the field, so this is purely a model-surface fix on the shard side.

Recommended reading order

  1. shard_core/data_model/profile.py — the model + from_shard change.
  2. tests/conftest.pymock_shard gains volume_size_gb=30 so the propagation has something to assert against.
  3. tests/test_profile.py — new test_profile_includes_volume_size_gb.

Test plan

  • test_profile still passes (existing model-equality assertion).
  • test_profile_includes_subscription still passes.
  • test_profile_includes_volume_size_gb — new: asserts Profile.volume_size_gb == mock_shard.volume_size_gb == 30.
  • test_signed_call (uses Profile.from_shard) still passes.
  • just cleanup (ruff + black on shard_core and tests) clean.
  • Manual: after merging, web-terminal#20 reads $store.state.profile.volume_size_gb and renders the Subscribe price label.

Notes

  • from_shard uses getattr(shard, "volume_size_gb", None) for safety against runtime subclasses, mirroring the existing subscription field.
  • No DB migration needed — Profile is stored as JSON via set_value in kv_store, and the field defaults to None.

🤖 Generated with Claude Code

Prerequisite for web-terminal#20 (Subscription card pricing display).
The Subscribe button label needs disk size to compute the monthly price
via the pricing formula in landing-page/Pricing.astro. Without this,
the trial-state CTA can only show a placeholder.

ShardBase already carries volume_size_gb; Profile.from_shard now
propagates it (via getattr for safety against subclassed shard models).

Follows up on PR#83 / issue#77 subscription work.
@max-tet max-tet merged commit 66ecfcf into main May 16, 2026
6 checks passed
@max-tet max-tet deleted the fix/profile-volume-size-gb branch May 16, 2026 19:08
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