Repository navigation
Conversation
…rges and integer checks
|
Mutation testing: 219 of 220 changes caught by a test. Each one is a change to the code no test noticed. Not a blocker: real gaps get their own PR. Full report |
This branch has not been deployed
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.
The weekly mutation run listed 127 missed or timed-out mutants in Issue #533. This PR adds tests for the real gaps, rewrites code where a mutant cannot change behavior, and excludes the mutants that only hang.
Closes #533
How each finding is handled
+=→*=intokenize(number start)ai_calculator.rs>→==,>=intokenizeai_calculator.rs==is excluded: the list grows one token at a time, so>and==first fail at the same token.+=→*=intokenize,+=→-=in the parser,||→&&inpower,/=→*=inconvert_baseai_calculator.rs,base_conversion.rs.cargo/mutants.toml: each one only makes a loop run forever (or a power run until the timeout), so a test can only hang.<→<=infloor_divideandmoduloai_calculator.rsnum_integer::Integer::div_floorandmod_floor(Python's//and%) instead of hand-written sign checks.+→-and<→<=inparse_creditlog_limitadmin_reports.rsclamp. New cases:1,25,26and1_a.Value::Nullinoptional_idadmin_commands.rspython_stringalready turns a null into "None".civil_from_days,days_from_civilcharge_history.rs,bcra.rsbot_core::calendarmodule, also used bybot-adapters(it had two more copies). A test compares every day from year -500 to 4980 with chrono.>→>=inestimate_transcription_reserve_credit_unitsai_reserve.rsassaturates, andcredit_units_from_usd_microsalready returnsOverflowfor a value that large.||→&&instrip_leading_contextai_response_cleanup.rs<→<=inparse_date,>→>=inrender_bcrabcra.rs99is 2099 and100stays 100; the title shows a date only when more than half of the variables share it. The sign of the country-risk change usesis_sign_negative, because it is never 0 there.>→>=,||→&&inraw_componentsandallocate_componentscharge_history.rsallocate_componentsdrops them, and a new test checks it.<→<=inrender_chat_memberschat_members.rs-and<→<=inevaluate_creditless,==→!=inplan_config_callbackconfig_callbacks.rs&&→||inevaluate_compactioncompaction_policy.rs||→&&intransliterate_remaining_scriptscommand_normalization.rs\n), so theñarm was not needed. New test: all 128 ASCII characters stay unchanged.||→&&inutf16_slicelinks.rs||→&&inreadable_numberoutput_format.rs1234.and1234.5a.link_mode_textarms and return value,<→<=increditless_textconfig_command.rs(Locale::En, "Mayorista")and"Tarjeta"inrender_dollar_ratesdollar.rs<→==,>,<=inrender_electionspolymarket.rsexplicit_slug_requests,merge_asset,merge_assets,missing_usable_tokens,retain_requested_slugs,stock_fallback_querymarket_prices.rsformat_signal_caption_for_period_with_candles,candle_change_for_span,format_percentage,has_usable_chart, delete arm("expired", Locale::En)incallback_texttoken_signals.rsathdirectly (is_usable_chart_candleignores a price that is not positive). The span change returns a value only for a positive close. The English "expired" arm is gone: the default text is the same. New tests cover the ATH age in days, history far from the live price, a zero supply, a zero close, rounding near zero, and exactly 5 candles.>→>=inpayer_order, delete-inevaluate_pre_checkouttelegram_payments.rsu64. The amount check compares anOption, so a missing amount never matches./→%intruncate_texttelegram_actions.rs||→&&and>→>=inparse_conversion_amountprice_queries.rs>→>=inparse_conversion_amountis excluded: the last dot and the last comma are never at the same index.>→>=inpositive_floatandpositive_integerprovider_runtime_policy.rs"0"are not positive.<→<=inbest_ask,>→>=inbest_bid,/→*inevaluate_rulorulo.rs>→>=inrender_task_pagetask_commands.rs+=→*=inromanize_japanesecommand_normalization.rs>→>=inrender_bcra(one date)bcra.rsAll changes
Cargo.toml,crates/bot-core/Cargo.toml:num-integer0.1.47 as a direct dependency. It was already inCargo.lockthroughnum-bigint.osv-scannerfinds no advisory for it.crates/bot-core/src/calendar.rs: new module with the onlydays_from_civilandcivil_from_days.crates/bot-core/src/bcra.rs,charge_history.rs,crates/bot-adapters/src/bcra.rs,crates/bot-adapters/src/weather.rs: usecalendarinstead of their own copies.crates/bot-core/src/ai_calculator.rs: floor division and modulo throughnum-integer; one step less intokenize; a 200-token test.crates/bot-core/src/admin_reports.rs,admin_commands.rs,ai_reserve.rs,ai_response_cleanup.rs: remove checks that cannot change the result; new limit cases..cargo/mutants.toml: exclusions for the equivalent and hanging mutants, each with its reason.crates/bot-core/src/command_normalization.rs,config_callbacks.rs,links.rs,telegram_payments.rs,token_signals.rs: the small rewrites in the table above.chat_members.rs,compaction_policy.rs,config_callbacks.rs,config_command.rs,dollar.rs,market_prices.rs,output_format.rs,polymarket.rs,price_queries.rs,provider_runtime_policy.rs,rulo.rs,task_commands.rs,telegram_actions.rs,token_signals.rsandbcra.rs.Done when
cargo clippy -D warningsandcargo test -p bot-core(736 pass) on 6cc06a1.scripts/check-container.shpasses on 6cc06a1 (the full suite with its ffmpeg and PostgreSQL), with coverage.Review
Pending.