Repository navigation
fix(gain): suggest repair for missing tracking tables - #5300
remote-controlled-man wants to merge 2 commits into
Conversation
TechWizard9999
left a comment
There was a problem hiding this comment.
Thanks for this. The root cause in #3685 is right: warn_if_missing_table was only wired into the write paths, so a dropped table made rtk gain fail with a bare no such table error. Wrapping the report reads with inspect_err keeps the error and the exit status, and on a real build rtk gain, --history, --format json and -p with commands dropped now print the hint once and exit 1.
Two things before merge. Both are test gaps: a mutation survives the suite.
- The
--by-layer --format jsonhint is untested (src/analytics/gain.rs:111). It is the first read inattribution_jsonwhen only--by-layeris set, so removing that wrap brings back the bare error forrtk gain --by-layer --format jsonwithengine_attributiondropped, and every test still passes. The loop ingain_explains_missing_attribution_data_in_each_reportcovers--by-layeras text and--by-method --format jsononly. Fix: add&["--by-layer", "--format", "json"]to it. - The kept fallback is unpinned. The description says optional reads keep their fallback. On this head,
rtk gainwithengine_attributiondropped is silent and exits 0, becauseprint_efficiency_ledger(gain.rs:1224) still usesunwrap_or_default(). Making that read print the hint (it then prints it three times) passes every test. Fix: one row withengine_attributiondropped asserting that plainrtk gainsucceeds with noRun \rtk init`` on stderr.
Smaller, optional (not every suggestion needs acting on):
-
15 of the wraps can never fire, because an earlier wrapped read of the same table always fails first:
:323,:346,:366,:395(after:290);:461,:474(after:458);:1146,:1640,:1647,:1654(after:763);:1706,:1722,:1727,:1732(after:1698);:1709(after:1703).
Plain
?there is enough. Each of them is a mutation no test can kill. For the same reason, the--history/--daily/--weekly/--monthlyrows in the first loop all stop at the summary read (:763). -
missing_tracking_tables_keep_telemetry_reads_silentand its fixture (telemetry.rs:898-942) pass with every production line of this PR reverted, since no telemetry code changed. Dropping them saves the subprocess re-run and 46 lines.
cc @KuSh
Fixes #3685
Summary
rtk initrecovery hint when a fatal tracking query in a staticgainreport fails because a table is missing, preserving the SQLite error and exit status.Test plan
cargo fmt --all --checkandcargo fmt --manifest-path proxy/Cargo.toml --all --check.cargo clippy --workspace --all-targets.cargo test --all: 5905 passed, 0 failed, 9 ignored. The telemetry subprocess fixture is explicitly executed by its passing parent test.engine_attributionmissing,rtk gain --by-layer --format jsonexits 1 with exactly one repair hint and plainrtk gainsucceeds without the hint.