Move the root probes into .sh files, and group the flat package - #312
Merged
Conversation
~700 lines of shell lived inside `"""…"""` blocks with every `$` written
as `${'$'}`. That cost a release: an apostrophe in a comment inside a
single-quoted block ended the quoting, the batched command stopped
parsing, and every forensic section vanished from bug reports until
someone read a bundle closely (#306). Nothing could have caught it —
the only check was a `contains("emit_file …")` assertion, and shellcheck
cannot read Kotlin.
The scripts are now files under `app/src/main/resources/shell/`, verified
to be packaged into the APK, and CI shellchecks them beside the module
scripts. Parameters (paths, framing prefixes, the two feature flags)
arrive as a generated assignment prelude, so the values stay defined once
in Kotlin and the script stays something you can lint and run.
Equivalence was checked by executing the old and new commands and
comparing the section sequences they emit: 48 identical sections for the
root probe, 60 for the debug probe, same order.
- root_snapshot.sh, debug_snapshot.sh, hook_counters.sh, and the shared
package_inventory.sh (now a function the callers invoke)
- shellcheck found what it was brought in for: a dozen unquoted
expansions and a pattern-matching `${FRAC%${FRAC#???}}`. The `eval`-body
quoting rule is suppressed per file with the reason
- tests assert against the prelude and the script's use of a variable
rather than an interpolated literal
Two of the cheap leaves from the flat 96-file package: nothing else in the module reaches into them beyond a handful of entry points, so the move is mechanical and the tree gains two names that say what they hold. - startup/: MainActivity, StartupCoordinator, StartupTrace and the blocking screen. The manifest and scripts/measure-startup.py follow the activity to `.startup.MainActivity` — verified against the built APK, which carries dev/okhsunrog/vpnhide/startup/MainActivity - statistics/: the screen, its cache and the pure counter model No logic touched; the diff is package lines and imports.
The rest of the cheap moves out of the flat package: picker/ (the Hiding tab), diagnostics/ (the check suite and its report), settings/ and debug/. Each holds a feature's screen, its cache and its pure model together, so the tree says what the module is made of instead of listing 96 files. 42 files stay at the root on purpose — the vocabulary both processes and several features share (StorageConfig, ShellUtils, RootSnapshotCache, HookRegistry, DashboardData, the agent bridge). Moving those would be import churn with nothing gained; dashboard/ and agent/ are left alone for the same reason. No logic touched: package lines, imports, and a layout table in AGENTS.md.
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.
Two backlog items, both hygiene, no behaviour change intended.
The shell. ~700 lines of it lived inside Kotlin
"""…"""blocks with every$written as${'$'}. That cost a release: an apostrophe in a comment inside a single-quoted block ended the quoting, the batched command stopped parsing, and every forensic section vanished from bug reports until someone read a bundle closely (#306). Nothing could have caught it — the only check was acontains("emit_file …")assertion, and shellcheck cannot read Kotlin.The scripts are now files under
app/src/main/resources/shell/, and CI shellchecks them beside the module scripts. Parameters (paths, framing prefixes, two feature flags) arrive as a generated assignment prelude, so values stay defined once in Kotlin while the script stays something you can lint and run.${FRAC%${FRAC#???}}; theeval-body quoting rule is suppressed per file with the reasonThe package. 96 files sat flat. Moved the cheap leaves —
picker/,diagnostics/,settings/,debug/,statistics/,startup/— each grouping a feature's screen, cache and pure model. 42 files stay at the root deliberately: the vocabulary several features and both processes share.dashboard/andagent/are left alone, where the import churn stops being worth it.AndroidManifest.xmlandscripts/measure-startup.pyfollow the activity to.startup.MainActivity; verified against the built APK. AGENTS.md gains a layout table.