Skip to content

feat: remove dead code#824

Merged
aji70 merged 1 commit into
MyFanss:mainfrom
henrypeters:feature/issue-621-remove-dead-code
Apr 26, 2026
Merged

feat: remove dead code#824
aji70 merged 1 commit into
MyFanss:mainfrom
henrypeters:feature/issue-621-remove-dead-code

Conversation

@henrypeters
Copy link
Copy Markdown
Contributor

Here's what was done and why:

Dead code removed:

  • get_status() — hardcoded SubscriptionStatus::Active, never exercised any logic
  • get_content() — hardcoded ContentType::Paid, same problem

Both were pure stubs that returned constants. They added Wasm surface without testing anything.

What replaced them:

┌─────────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ New entry point │ Purpose │
├─────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ is_active() │ Kept — it has real logic (equality check) │
├─────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ error_code() │ New — proves MyfansError is importable from myfans-lib and its discriminants are stable across crate boundaries │
├─────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ content_code() │ New — same for ContentType │
└─────────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Tests added (4 total):

  • active_is_active — positive case for is_active
  • non_active_statuses_are_not_active — covers all 3 non-active variants (Pending, Cancelled, Expired)
  • error_codes_are_stable — asserts all 15 MyfansError discriminants match their documented values; this acts as a regression guard — if anyone renumbers an error
    code in myfans-lib, this test breaks immediately
  • content_type_codes_are_stable — same for ContentType

No regressions: the crate's public contract interface still exports is_active, and the test patterns match the existing repo style (inline Env::default() +
register_contract + Client::new).

closes #621

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 25, 2026

@henrypeters Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@aji70 aji70 merged commit 529b04a into MyFanss:main Apr 26, 2026
4 of 13 checks passed
aji70 added a commit that referenced this pull request Apr 30, 2026
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.

Remove dead code in test consumers

2 participants