refactor: merge duplicate type definitions across crates#3185
Merged
Conversation
- Move OAuthTokens to librefang-types::oauth (was duplicated in librefang-extensions and librefang-runtime-mcp); both helpers (access_token_zeroizing, default_token_type) preserved. Old call paths kept via pub use re-exports. - Consolidate SessionResetPolicy / SessionResetMode / SessionResetReason on the librefang-types definition (was duplicated in librefang-kernel::session_policy with a parallel ResetMode enum). Kernel keeps the runtime evaluation via a SessionResetPolicyExt trait; the From conversions between the two layers are no longer needed. - Add explicit From<&memory::UsageSummary> / From<&memory::ModelUsage> conversions to the TUI display projections in librefang-cli; the TUI structs stay separate (different field names match the rendered labels) and are now documented as projections.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
2 tasks
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.
Summary
Three pairs of duplicated/near-duplicated types consolidated:
1.
OAuthTokens(was duplicated in extensions + runtime-mcp)crates/librefang-types/src/oauth.rsaccess_token_zeroizing,refresh_token_zeroizing,default_token_type)zeroizeadded as alibrefang-typesdeplibrefang-extensionsandlibrefang-runtime-mcpreplaced withpub usere-exports — 0 call-site renames, 6 import paths kept working transparently2.
SessionResetPolicy(was duplicated in kernel + types)ResetModeenum and policy struct deletedlibrefang-kernel/src/session_policy.rsnow re-exports the canonicallibrefang_types::config::{SessionResetPolicy, SessionResetMode, SessionResetReason}SessionResetPolicyExttrait (should_reset)3.
UsageSummary+ModelUsage(TUI vs memory)model_id/total_callsvsmodel/call_count)From<&memory::UsageSummary>andFrom<&memory::ModelUsage>impls so the conversion is no longer ad-hoclibrefang-memoryadded as alibrefang-clidepTest plan
cargo build --workspace --libcargo clippy --workspace --all-targets -- -D warnings— cleancargo test --workspace --lib— passes (one pre-existing env-leak test inlibrefang-runtime::embedding::testsflakes only whenOPENAI_API_KEYis set in shell; unrelated to this refactor)