Feat/module interface standardization#455
Merged
Xhristin3 merged 2 commits intoApr 28, 2026
Merged
Conversation
- Add docs/MODULE_INTERFACE_STANDARDS.md defining 8 rules: module-level doc comment, manager-struct pattern, section comments, #[must_use] on pure getters, error handling, auth pattern, compliance table, and a minimal example module - Refactor reputation.rs: free functions -> ReputationManager struct, add module doc, section comments (Mutations/Queries/Internal), #[must_use] on get_reputation - Add module doc, Mutations/Queries section comments, and #[must_use] on all 3 getters in score.rs - Add module doc, standardize section comments (Initialization/Mutations/Admin/Queries), and #[must_use] on all 5 getters in rewards.rs - Update all 4 reputation call sites in lib.rs from free functions to ReputationManager::* methods
|
@Mrchinedum 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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixed #369
feat: implement module interface standardization
Module interfaces were inconsistent across the codebase. Some modules
used free functions (reputation.rs), others used manager structs
(audit.rs, performance.rs) with no shared convention for doc comments,
section grouping, or return-value annotations. This change defines the
standard and brings all affected modules into compliance.
Changes
docs/MODULE_INTERFACE_STANDARDS.md (new)
no free functions
required sections: Initialization, Mutations, Admin, Queries
getters return T or Option
state-changing function; #[cfg(not(test))] guards only where
the test harness cannot provide auth
contracts/teachlink/src/reputation.rs
rate_contribution, get_reputation) with ReputationManager struct
but now explicitly grouped)
contracts/teachlink/src/score.rs
contracts/teachlink/src/rewards.rs
style comments with standard // ===== Section ===== style:
Initialization (initialize_rewards)
Mutations (fund_reward_pool, issue_reward, claim_rewards)
Admin (set_reward_rate, update_rewards_admin)
Queries (get_user_rewards, get_reward_pool_balance,
get_total_rewards_issued, get_reward_rate,
get_rewards_admin)
contracts/teachlink/src/lib.rs
manager-struct style:
reputation::update_participation -> ReputationManager::update_participation
reputation::update_course_progress -> ReputationManager::update_course_progress
reputation::rate_contribution -> ReputationManager::rate_contribution
reputation::get_reputation -> ReputationManager::get_reputation
Acceptance criteria met
✓ Interface standards defined — docs/MODULE_INTERFACE_STANDARDS.md
✓ Non-compliant modules refactored — reputation.rs (struct), score.rs
(doc + sections), rewards.rs (doc + sections)
✓ Interface documentation added — module-level //! doc on all three
modules; standards doc with compliance table
✓ Examples created — minimal ExampleManager in standards doc;
reputation.rs, score.rs, and rewards.rs serve as living reference
implementations