Skip to content

refactor: remove dead code and tests that cannot fail - #258

Merged
dev-jodee merged 3 commits into
mainfrom
chore/slop-cleanup
Sep 28, 2026
Merged

dev-jodee merged 3 commits into
mainfrom
chore/slop-cleanup

Conversation

@dev-jodee

Copy link
Copy Markdown
Collaborator

Linked issue

None, maintainer cleanup.

What and why

  • Remove unused init helpers (MintInit, TokenInit, AssociatedTokenAccountInit, init_*, check_with_bump), the test-only TryFrom<u32> for SubscriptionsError, the manual From<AccountDiscriminator> for u8, the unused generic T on ProgramAccountInit::init and the unused program_id param on emit_event::process
  • check_accounts_with_program calls check_with_program instead of duplicating it
  • Header layout asserts use offset_of! so they check the real struct layout instead of comparing literals
  • Drop self-referential event_engine tests, 3 redundant check_min_account_size cases and toBeDefined assertions on signatures sendTransaction already guarantees
  • Webapp reuses clusterIdToNetwork from lib/cluster.ts and findSubscriptionAuthorityPda from @solana/subscriptions

No public API, error code, IDL or instruction/account wire format change. Error variants, client exports, Event, DATA_LEN and the v1_to_v2 scaffolding are kept on purpose.

Testing

  • cargo test -p subscriptions-program: 50 passed
  • cargo test -p tests-subscriptions: 284 passed
  • just build-program, just build-test-hook, cargo fmt --check, clippy -D warnings
  • pnpm run lint: regenerated IDL and clients identical to committed
  • Webapp tsc -b and pnpm test (20/20), client tsc --noEmit
  • just test-client against surfpool: 66/66 fork, 1/1 offline

AI disclosure

Check exactly one. See CONTRIBUTING.md.

  • No AI tooling was used beyond editor autocomplete.
  • AI tooling was used. Tool and extent: Claude Code audited the repo for dead code and redundant tests and wrote the changes.

@vercel

vercel Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
solana-subscriptions-program Ready Ready Preview Sep 28, 2026 3:04pm UTC

Request Review

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Compute Unit Report

Instruction Samples CUs Est Cost (Low) [SOL] Est Cost (Med) [SOL] Est Cost (High) [SOL] Δ Avg vs main
cancel_subscription 30 1836 0.000005000 0.000005073 0.000005918
cancel_subscription_now 5 1871 0.000005000 0.000005074 0.000005935
close_subscription_authority 22 1805 0.000005000 0.000005072 0.000005902
create_fixed_delegation 66 3524 0.000005001 0.000005140 0.000006762
create_plan 144 3499 0.000005001 0.000005139 0.000006749
create_recurring_delegation 38 3564 0.000005001 0.000005142 0.000006782
delete_plan 10 362 0.000005000 0.000005014 0.000005181
init_subscription_authority 250 6315 0.000005001 0.000005252 0.000008157
reclaim_excess_rent 6 365 0.000005000 0.000005014 0.000005182
resume_subscription 4 2040 0.000005000 0.000005081 0.000006020
revoke_abandoned_delegation 3 401 0.000005000 0.000005016 0.000005200
revoke_abandoned_subscription 2 2053 0.000005000 0.000005082 0.000006026
revoke_delegation 24 310 0.000005000 0.000005012 0.000005155
revoke_subscription_authority 8 3580 0.000005001 0.000005143 0.000006790
subscribe 53 6643 0.000005001 0.000005265 0.000008321
transfer_fixed 13 5639 0.000005001 0.000005225 0.000007819
transfer_recurring 22 5752 0.000005001 0.000005230 0.000007876
transfer_subscription 15 5993 0.000005001 0.000005239 0.000007996
update_plan 31 2141 0.000005000 0.000005085 0.000006070

🔺 increase · 🔻 decrease · – unchanged · 🆕 new · 🗑 removed (vs main)

Generated: 2026-09-28

@greptile-apps

greptile-apps Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Low risk] Removes unused test code and dead helper functions.

The PR appears safe to merge based on the reviewed changes.

Summary

The PR removes unused program helpers and redundant assertions, consolidates account validation, and adds an ephemeral transfer context so Token-2022 hooks can identify a payment pull’s initiator.

  • Adds matching program, IDL, TypeScript client, documentation, and integration-test support for the transfer context.
  • The previously reported oversized-account test has been restored.

Reviews (4) · Last reviewed commit: "fix: keep local PDA derivation in webapp..."

Comment thread program/src/state/versioning/core.rs
amilz
amilz previously approved these changes Sep 28, 2026
Delete unused token/mint/ATA init helpers, the test-only TryFrom<u32>
for SubscriptionsError, the manual From<AccountDiscriminator> for u8,
the unused generic on ProgramAccountInit::init and the unused
program_id parameter on emit_event. Header layout asserts now use
offset_of! so they check the real layout.

Drop self-referential event_engine tests, redundant
check_min_account_size cases and toBeDefined assertions on signatures
that sendTransaction already guarantees. The webapp reuses
clusterIdToNetwork and findSubscriptionAuthorityPda instead of copies.

No public API, error code, IDL or wire format change.
The client tests import webapp/src/lib/collect-utils.ts directly, and
CI runs them without building @solana/subscriptions, whose exports
point at dist. Importing findSubscriptionAuthorityPda there made both
collect-utils test files fail to resolve the package.

@amilz amilz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Removes dead init helpers/unused generics, reuses check_with_program, header asserts now use offset_of!. No on-chain behavior change. CI green.

@dev-jodee
dev-jodee merged commit 18a2a28 into main Sep 28, 2026
27 checks passed
@dev-jodee
dev-jodee deleted the chore/slop-cleanup branch September 28, 2026 15:15

This branch was previously deployed

1 inactive deployment
Preview — b175d645 Deployed Sep 28, 2026 by vercel[bot]
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