Repository navigation
Optimize: settings file keys address what the server's keys name - #2437
Conversation
Every format flattens the file into key -> value entries and an op edits the characters of the value it names, so the rest of the file keeps its bytes. XML children are keyed by name/Name/id/Id/key/Key, unkeyed siblings are counted per tag, a key without @attr is the text, the one non-keying attribute or the value attribute; missing elements are added keyed like the file's own. INI keys are Section.key with the last repeat written; JSON is edited in place and falls back to structured text; structured text has block paths and name#2 repeats. An op that cannot be written is skipped instead of failing the step. A start that never showed the game window is no result, not a crash of the pending step, unless it repeats. A rung refused as a repeat is listed in ladder.skipped so it is not offered again.
|
Caution Review failedThe pull request is closed. Walkthrough
Merge Risk:
|
…ards from the next answer - An engine_file lever's path_alternatives are tried in order after its path; the first that leads to an existing file is written. - A settings file that is not there is not a failure: its ops count as skipped, and a rung whose files are all missing goes into the tried list as file_missing (outcome no_op with apply.missing_files). - The Unreal project name (from <Project>-Win64-Shipping.exe) goes out as engine_meta.project. - A helped or no-change card still waiting takes its choices from the next-rung answer at exit: exhausted shows the end card, no_rule or not_settings drops "Keep going" (kept or undone only). A card already on screen is updated in place.
…r at exit, external power The next-rung game block carries epic_namespace and epic_app_name for Epic games and amazon_sku for Amazon games, null when the library row does not have them. A long session in which the device throttled asks the exit dry-run even when the local rules say it ran fine or this rules build was already asked; the first card follows the server's answer, and without one the local decision stands. Sessions carry on_external_power, read from the run's charging state at start and exit.
Description
Optimize settings files: the writer now addresses each key in the same notation the server's keys use, and edits only the value's characters. Also two judging and ladder fixes found on a device.
Settings file writer (
ConfigFormats.kt)\r) stay as they were. XML and JSON are no longer re-serialized.tag[v]by the first ofname,Name,id,Id,key,Keyit carries. Before, onlyNamecounted, so a selector keyed byidmissed and a new element the game ignores was appended. Unkeyed siblings are counted per tag (tag,tag[1], ...), sotag[N]is no longer read asName="N". A key without@attris the element's text, else its one non-keying attribute, else itsvalueattribute. Before, it always wrote the text. Values are read and written as they are in the file, and malformed files no longer fail to parse.Section.key, so a section whose name contains a dot is found. Repeated keys: the last occurrence is read and written. A key with an empty section is not added above the first header of a file that has no keys there.Block.name). A name that repeats isname#2from its second occurrence (it was counted from zero).bindlines,-flag valuepairs,"key" "value",Name(value)andsetalines are covered. Unkeyed lines and flags without a value are never written. A key that is not a full path matches the only entry whose path ends with it.applyVerifiednow also checks that no other key changed and none appeared.Judging: a start without the game window (
OptimizeJudge.kt,OptimizeController.kt)not_comparablewithjudge_reasonno_window, and the step stays pending and is tried again on the next launch.judge_reasonno_window) only on the second such start in a row with the step applied, and only when the game's latest session without a step on trial did show its window. If starts fail without the step too, the step is not blamed; after three such starts it is judged not comparable.Ladder: rungs the app refuses (
OptimizeLocalState.kt,OptimizeController.kt)skippedlist (rung id, version, reasonrepeat) and sent asladder.skippedwith the next request, which is asked for right away. Before, the refusal was not sent, so the same rung could be offered again on every launch and nothing was applied.Where a settings file is, and when it is not there (
OptimizeApplier.kt,OptimizeModels.kt,EngineHint.kt)engine_filelever may carrypath_alternatives: other places the same file can be. The first ofpathand the alternatives that leads to an existing file is written.file_missing(the outcome isno_opwithapply.missing_files), and the next rung is asked for in the same launch.<Project>-Win64-Shipping.exeand its folder) is sent asengine_meta.project.After-cards follow the next answer (
OptimizeController.kt,OptimizeRules.kt,OptimizeCardDialog.kt)exhaustedturns it into the end card (keep or undo all);no_ruleornot_settingsdrops "Keep going" (helped: keep or undo; no change: stop here). A card already on screen is updated in place. Existing strings only.Store ids, the exit question for throttled sessions, external power (
OptimizeIdentity.kt,OptimizeServer.kt,OptimizeModels.kt)gameblock carries the store's other ids next tostore_id:epic_namespaceandepic_app_namefor Epic games (from the Epic library row),amazon_skufor Amazon games. Each is null when the row does not have it; other stores send none of them. Amazon'sstore_idwas already its product id.show_card, the local decision stands as before. The user's own holds still come first.on_external_power(true when the device was on external power at the session's start or exit, null when neither was read) in the metrics, outcomebefore/afterand the stored run.Tests: OptimizeFileAddressingTest covers path alternatives, missing files and the after-card choices; EngineHintTest the Unreal project name. Tests: ConfigFormatsTest has a test per addressing rule, all on small synthetic files. OptimizeJudgeTest covers the no-window starts. OptimizeStateTest covers skipped rungs and step numbers across phases. OptimizeOfferTest covers the store ids per store; OptimizeServerTest runs a hot session at its target (660 s at 59.5 fps under a 60 cap, hot most of the session) through the local verdict to the exit question and the card, and the external power field.
Recording
The helped and no-change cards lose "Keep going" when the server has nothing next; no new screens. Not recorded yet.
Type of Change
Checklist
#code-changes, I have discussed this change there and it has been green-lighted. If I do not have access, I have still provided clear context in this PR. If I skip both, I accept that this change may face delays in review, may not be reviewed at all, or may be closed.CONTRIBUTING.md.Summary by cubic
Settings file ops now address keys exactly as the server names them, so each edit replaces only that value's characters and keeps comments, quoting, attribute order, indentation, and line endings intact. Also fixes judging of starts that never reach the game window, stops repeated ladder rungs from being offered again, finds settings files at alternate paths, and sends store ids and throttled-session verdicts to the server.
Settings file editing and server exchange
name/Name/id/Id/key/Key, unkeyed siblings counted per tag; INI keys areSection.keywith the last repeat written.name#2repeats,bind, flags, andName(value). Missing elements are added keyed like the file's own, andapplyVerifiedconfirms no other key changed.path_alternativesare tried in order; a missing file's ops count as skipped, and a rung with all its files missing goes into the tried list asfile_missing.<Project>-Win64-Shipping.exe, is sent asengine_meta.project; Epic games addepic_namespaceandepic_app_name, and Amazon gamesamazon_sku, to the next-runggameblock.on_external_power.Judging and ladder
not_comparablewithno_windowand stays pending; it counts as a crash only when it repeats while the game's last unstepped session showed the window.skippedlist and sent with the next request, so it is not offered again.no_ruleornot_settingsdrops "Keep going", and an already-shown card updates in place.Written for commit 0b31ed8. Summary will update on new commits.
Summary by CodeRabbit