Skip to content

Development

Sam MG Harish edited this page Sep 29, 2026 · 5 revisions

Development

Local setup

git clone https://github.com/sam-mg/lu77U-MobileSec.git
cd lu77U-MobileSec
python -m venv .venv && source .venv/bin/activate
pip install -e ".[claude]"
python -m lu77U_MobileSec -V        # or: lu77U-MobileSec -V

python -m lu77U_MobileSec and the console script both land in cli.main:main.

Test APKs live in etc/APKs/ (DIVA is the usual target, since it has a wide spread of deliberate flaws). Design notes and diagrams are in etc/Documents/.

Layering

The dependency direction is one-way:

cli  →  web  →  services  →  engine (detection, analyzers, dynamic_analysis, report_generator)
                              ↑
                          ai, config, utils

AnalysisService is the only place the full pipeline is sequenced. Engine modules take a verbose flag and optional progress and is_cancelled callbacks, and never import anything from web/. Keeping that direction is what allowed the terminal UI to be replaced by a web UI without touching the engine.

Three conventions worth preserving:

  • verbose_print(msg, verbose) everywhere, rather than a logger. A sink registered at app startup routes those lines to the right scan's WebSocket using a contextvar, so call sites need no plumbing. Any code running on its own thread must start from contextvars.copy_context() or its log lines vanish.
  • ScanCancelled is re-raised through every intermediate except Exception. Best-effort error handling must not swallow cancellation.
  • Best-effort enhancements return None and log, rather than raising. The code graph, call graph, checkpointing, dynamic verification and report generation all follow this: a failure degrades the scan instead of failing it.
  • Nothing in web/checkpoint.py may raise into a scan. A bad checkpoint means "start over", never "fail".
  • Scoring arithmetic lives only in utils/scoring.py. Three copies once existed and disagreed.

Extension points

Adding an AI provider

  1. Subclass BaseAIProvider in ai/. Implement analyze, list_models, validate_credentials, and default_model. Override supports_vision if the model accepts images.
  2. analyze must return {"response": str} or {"error": str} and must not raise for provider-side failures.
  3. Map the schema argument onto the provider's structured-output mechanism. Where the API needs an object at the top level, wrap the array under vulnerabilities, as the OpenAI and Claude providers do.
  4. Register the class in PROVIDER_CLASSES (ai/provider_factory.py), add the name to user_settings.PROVIDERS, a config block in DEFAULT_SETTINGS, a display name and default model in ai/registry.py, and a branch in tools_checker/ollama_checker.check_ai_provider_configured if readiness differs from "has an API key".
  5. Keep credentials out of URLs. Anything in a request URL reappears in httpx exception text, which is logged and returned.

Adding a framework detector

  1. Subclass BaseFrameworkDetector in framework_detector/, implement detect(input_path) returning {"framework", "confidence", "indicators"} or None.
  2. Append an instance to the list in HybridFrameworkDetector.__init__.
  3. For a pure file-signature detector, add entries to TECH_DETECTION_MAP in config/constants.py instead; the zip-entry detector picks them up with no new class.
  4. Decide whether the framework gets deep analysis. If it does, see "Adding a framework analyzer" below; if not, it just needs to not be in analyzers/registry.py, and belongs in AnalysisService.UNSUPPORTED_FRAMEWORKS for the verbose-log wording.

Adding a framework analyzer

This is the bigger version of the above: giving a detected-but-currently-unsupported framework the same static-analysis depth the five supported ones already get. Follow the shape they share:

  1. Profile. Add a SourceProfile in analyzers/agent/profiles.py: the source extensions, noise fragments (vendor/framework paths to filter), generated-file stems, and what file (if any) should stand in as the agent's first-turn orientation context.
  2. Decompiler/extractor wrapper. A module under decompiler/ following blutter_runner.py's shape: resolve the tool path fresh from user_settings on every call (so a Settings change takes effect without a restart), run it as an argv list (never shell=True), and judge success by output artifacts rather than return code.
  3. Settings + readiness. A <tool>_path key in user_settings.DEFAULT_SETTINGS with a getter/setter pair, a tools_checker/<tool>_checker.py mirroring jadx_checker.py, and a <tool>_configured entry in tools_checker/analysis_checker.get_analysis_status(), but not folded into ready_for_analysis unless the framework should be able to block every other scan on the machine (JADX is the only tool that currently does). Add the field to SettingsUpdate, settings_service.get_settings/update_settings, and the frontend's AnalysisStatus/Settings types plus a PathField in Settings.tsx.
  4. Code graph. A build_<framework>_graph(source_root, verbose) -> Optional[CodeGraph] function reusing the existing CodeNode/CodeGraph containers from analyzers/agent/code_graph.py unmodified; only how nodes get built differs. Return None on any parse failure or when nothing is recoverable; the agent loop falls back to the flat file tree automatically.
  5. Analyzer class. Subclass BaseAnalyzer (analyzers/base.py): implement preflight() (checks the tool is configured) and analyze() (decompile/extract, build the graph, call self.run_agent(source_root, code_graph), then self.enrich_vulnerabilities(vulnerabilities, source_root)). Override framework_label, profile, and source_prefixes() if the model might cite paths under a subdirectory the way JADX's sources/resources split does.
  6. Prompt + skill. Add a <framework>_agent_system prompt id to config/prompts.py (PROMPT_IDS, _AGENT_SYSTEM_BY_PROFILE, labels, help, default text) and a bundled skill file, registered in skills_loader.CORE_SKILLS under the profile's key. For the prompt's SCORING SEVERITY block, call the shared _cvss_scoring(av, scope, cia_and_example) helper rather than writing the six CVSS bullets out again: the AC/PR/UI bullets are identical across every framework prompt and are supplied by the helper itself; only the attack-vector example, scope question, and closing worked example need to be framework-specific.
  7. Scanners. Add the profile key to analyzers/sast/runner._BY_PROFILE. manifest and secrets work for any framework; the rest need decompiled Java. Omitting the key falls back to those two rather than to nothing.
  8. Register it. One line in analyzers/registry.py's _REGISTRY mapping the detected framework name(s) to a lazy-import factory for the new class, and remove the name from AnalysisService.UNSUPPORTED_FRAMEWORKS if it is listed there.

tests/test_registry.py::TestEveryProfileIsFullyWired enforces steps 1 and 6 together: every analyzer's profile key must resolve to a real agent prompt over 500 characters and a core skill whose file exists. It exists because a half-wired framework silently falls back to the Java/Kotlin prompt and looks like it works.

Nothing in AnalysisService, the agent loop, the region fan-out, validation, or code-context enrichment needs to change. That is the point of the shared BaseAnalyzer/SourceProfile machinery. See Static analysis for how the existing frameworks' versions of steps 2-6 work, as worked examples; Xamarin is the most recent and the closest to a template.

Adding an agent tool

  1. Add the method to AgentTools (phase 1) or VerifyTools (phase 2). Resolve any path through the existing sandbox helper; do not build paths from model input by hand.
  2. Add the action name to the relevant NEXT_ACTION_SCHEMA enum and describe its arguments in the schema.
  3. Add a dispatch branch in the loop, plus _describe_request / _describe_response entries so the transcript reads sensibly. Decide whether results are cacheable: in phase 2, read-only calls belong in _dedup_key; side-effecting ones must not be cached. A tool that navigates the call graph goes through AgentTools._method_or_error so an unresolvable name returns a usable error instead of an exception.
  4. Document the action in every framework's system prompt this loop drives. config/prompts.py help text warns users not to remove action names from an override, so both must stay in step.

Adding a resumable stage

web/checkpoint.py records pipeline stages in order (STAGES = ("decompiled", "sast_done", "agents_done")). To make a new stage resumable:

  1. Append its name to STAGES, after the stages it depends on.
  2. cp.mark("<stage>", **facts) when the stage finishes, with whatever is cheap to store and expensive to recompute.
  3. cp.reached("<stage>") / cp.get(key) at the top of the stage, to skip it and reuse those facts.
  4. Emit a progress message saying the stage was reused, so the log distinguishes a resumed scan from a fast one.

Per-region agent state is separate (agent-<region>.json), one file per worker, so region threads write with no shared lock. Region keys must stay stable across runs, and partition_graph is deterministic for exactly this reason, down to the node-key tiebreak in _seed_rank.

Adding a skill

Drop a markdown file into lu77U_MobileSec/skills/ to bundle it, or upload it through Settings to install it into <config dir>/skills/ for the current user. Either way it is keyed by filename stem, and a user file shadows a bundled one of the same name. Four ways to have it loaded:

Route Where
Core skill for a framework skills_loader.CORE_SKILLS
Region guidance for a sink family An AttackSurface.skills tuple in analyzers/agent/surfaces.py, resolved by guidance_for_families
A keyword rule as the agent works _contextual_skills in analyzers/agent/agent_loop.py
Always _ALWAYS_LOADED in analyzers/agent/agent_loop.py, and the report turn

tests/test_skills.py asserts that every bundled skill is reachable by at least one of those and that every name referenced resolves to a real file. Both checks exist because load_skills silently drops names it cannot resolve, so a typo costs the agent its guidance with no error anywhere. Add the new skill's stem to the OWN tuple in that file as well — the content rules (no third-party attribution, no external repository link, no iOS material) are parametrized over OWN, so a skill left out of it ships unchecked.

Write skills rather than importing them. If you take material from another project it needs a source and licence header in the file plus a NOTICE at the repository root. test_skills.py currently asserts that no bundled skill or shipped source carries an attribution, that none points at an external repository, and that no NOTICE exists. Adding one is a deliberate decision that has to update those tests too.

Skills are prompt text, so keep them short and specific. Everything loaded is re-sent on every turn of the loop.

Frontend

See Web UI for structure and the known build gap. The build output goes to lu77U_MobileSec/web/static, which is what MANIFEST.in ships; the frontend source is pruned from the distribution.

Testing

pip install -e ".[dev]"
python -m pytest            # the suite on its own
./scripts/preflight.sh      # the suite plus the commenting standard plus CodeQL plus a clean-install check, i.e. what the push gate runs

tests/ covers the parts where a silent regression would be expensive and the behaviour is checkable without a device or a model. A feature or fix is not finished until something would fail if it regressed, and a new rule or check needs tests for the rule itself.

Repository standard

File Covers
test_comment_style.py Each rule of the commenting standard pinned against a crafted file, so a rule that stops firing is caught rather than silently passing everything; plus the shipped package and the checker itself passing, vendored trees being skipped, and the exit codes and JSON output the hook and CI read

Engine core

File Covers
test_cvss.py Base scores against FIRST's published vectors, severity bands, prefix and metric-order tolerance, an unparseable vector meaning "no score" rather than zero
test_utils.py Verbose-log redaction, URL and truncation helpers
test_metadata.py Name, version, description, author and homepage matching pyproject.toml everywhere (including the rendered report HTML and /api/version), and that skills/ and rules/ are declared as package data
test_web_paths.py Static-file resolution against traversal and symlinks, scan-id validation, upload filename sanitising
test_scan_logs.py Per-scan log persistence: complete when verbose, and nothing written when not

Agent engine

File Covers
test_agent_parsing.py Thinking-token stripping (including the lone </think> case), balanced-object extraction, report coercion, salvage of malformed findings
test_agent_loop.py Turn budget, the opt-in max_steps cap forcing a final report, cancellation interrupting a never-reporting model, and the add_finding accumulator surviving an empty forced report
test_agent_budget.py The step and wall-clock ceilings, throttle credit back to the deadline, and the stop_reason a region reports when it stops
test_agent_tools.py The phase-1 sandbox, the paged reader and its continuation, search filtering, source inventory
test_profiles.py AgentTools under each SourceProfile: noise filtering, generated-file exclusion, orientation-file resolution; the Java/Kotlin default reproducing pre-refactor behaviour exactly
test_fanout.py Region partitioning and the four threading hazards: per-thread context copies, one progress event per region inside the band, a child ScanCancelled reaching the parent, collision-free provider log paths, a failing region not costing the others
test_sast_first.py SAST running before the agent and its output becoming the per-region worklist: lead construction, ranking, routing and rendering
test_source_resolution.py resolve_source_path against a tree of same-basename twins: refusing rather than guessing, and using the claimed construct to disambiguate
test_agent_failure_paths.py Failure paths across the agent engine: a failing checkpoint or malformed resume state logging rather than losing the region, an androguard class with no access flags surviving the code graph, the shared vendor-prefix/sink-family tables staying identity-equal across modules with no import cycle, a BaseException in a fan-out worker still escaping, and SQL-provenance/vendor-tagging/manifest-read failures degrading to a log line

Code graphs and decompilers

File Covers
test_apk_payload.py Bundle discovery, Hermes magic-byte sniffing, native-library extraction, Cordova assets/www extraction including zip-slip refusal
test_code_graph_prefetch.py analyze_apk_for_code_graph as a separable half, so androguard can run on its own thread while JADX decompiles
test_code_graph_js_bridge.py @JavascriptInterface flagging in the Java/Kotlin graph, without androguard or a real APK
test_flutter_graph.py Per-asm-file nodes, sink/role detection, object-pool secret recovery, None on nothing recoverable
test_rn_graph.py Both JS shapes: module directory (vendor filtering, refs, sinks) and single-file Hermes output (function splitting, safe fallback)
test_cordova_graph.py DOM-XSS/bridge/network sinks, runtime + vendor noise filtering, <script src>/require refs, secrets, entry-page role, None on noise only
test_xamarin.py XALZ LZ4 round-trips including an overlapping match, AssemblyStore parsing and its refusal of implausible headers, MAUI's blob-disguised-as-.so, UTF-16 string mining, the C# graph
test_external_runners.py The Blutter/hermes-decomp/react-native-decompiler wrappers: exact argv, artifact-based success, every failure mode returning None rather than raising
test_registry.py Framework name → analyzer dispatch, the shared BaseAnalyzer contract across all five, preflight() degrading cleanly, and that every profile is fully wired to a prompt and a core skill

Scanners, validation and chains

File Covers
test_sast_extractors.py Every deterministic scanner against real files: manifest tri-state export rules, the WebView taint and SQL regexes that once failed silently, secret classification and downgrades, SDK fingerprinting, one scanner raising costing only its own findings
test_patterns.py The shared secret/endpoint table: specific-before-generic ordering, per-pattern severity, the endpoint classifier
test_validation.py The gates, the weak-class table against the titles the extractors actually emit, that nothing is ever removed, that the judge can only weaken a finding, chain matching and confirmation, and the HTML/JSON rendering of both
test_chain_determinism.py Deterministic chain pairings, candidate ranking by severity, and rejection logging
test_chain_annotation.py Cross-referencing findings with no model: chain-table pairings kept as related_findings, same-file grouping, and never as a severity claim
test_skills.py Every bundled skill resolving, being reachable by at least one route, carrying no third-party attribution, external repository link or iOS material, no NOTICE file being needed, and the chain table using no code the catalogue does not define

Providers and reporting

File Covers
test_provider_resilience.py What a scan does when the provider stops answering: error classification, the circuit opening once, and no repeated rediscovery of a dead quota
test_provider_limits.py num_predict bounding runaway generation, thinking-token accounting, and the concurrency gate
test_credentials_pool.py Multiple keys per provider: storage, rotation on a fatal error, index removal, reveal, none of it touching the real keychain
test_report_integrity.py Report fields that were silently wrong: pass-through and arithmetic checks over the exporter and serializer
test_metadata_parity.py Agent and SAST findings carrying the same metadata (a CWE on both, a CVSS vector on both), so no consumer filter silently loses half the scan
test_parsing_and_detection_fixes.py Parser and detector defects that lost or mislabelled information with no exception and no log line
test_analysis_service.py Phase 2 orchestration: runtime findings merging, the session running without static findings, progress remapping, failures degrading rather than raising
test_verify_tools.py The phase-2 adb allowlist: prefix stripping, package scoping, traversal and unknown-verb refusals
test_provider_config_paths.py Provider and config edge cases: Ollama with no retries configured returning an error instead of hanging, a keychain delete failure warning while a PasswordDeleteError stays silent, the one-time fallback warning printing once, a configured output directory being used and an empty one falling back to the default, and a custom endpoint's model listing falling back to the configured model on failure
test_web_dynamic_failure_paths.py Web server and dynamic-analysis failure paths: killing an orphaned mitmdump process, the firewall helper script's permissions, a failed startup reconciliation or checkpoint write logging rather than being lost, one failing dashboard log subscriber not costing the others, a failed frida-server stop surfacing in both the log and the result, and KeyboardInterrupt/SystemExit in the analysis thread re-raising instead of being recorded as an ordinary error
test_detector_and_report_fixes.py The comprehensive PDF generator failing to import raising a clear error instead of crashing in its own fallback, a multi-DEX app's class list no longer duplicated once per DEX file, Kony and Unity directory detection actually finding a project, and every public name validation.taxonomy exports staying importable
test_cordova_dvhma.py, test_flutter_dvfa.py End-to-end against real vulnerable-app APKs (below). Both skip when the APK isn't present

Device work, provider calls, keychain access, and JADX/Blutter/hermes-decomp/react-native-decompiler/ilspycmd are all stubbed; nothing in the suite touches the network, a device, an external tool binary, a live quota, the OS keychain, or the user's settings file. Anything involving a real device, model, or external tool still needs a manual scan:

lu77U-MobileSec -V        # scan etc/APKs/DIVA.apk and read the verbose log

Real vulnerable-app fixtures

test_cordova_dvhma.py and test_flutter_dvfa.py run against real deliberately-vulnerable apps cloned under etc/vulnerable-apps/ (gitignored, so present locally but not in CI; the tests skip when the APK is absent). tests/fixtures.py locates them.

  • Cordova, DVHMA (logicalhacking/DVHMA): ships prebuilt Cordova APKs under releases/; used directly, no build.
  • Flutter, DVFA (Schmiemandev/dvfa): a release APK is downloaded from the repo's GitHub Releases to flutter-dvfa-schmieman/build/app/outputs/flutter-apk/app-release.apk. Building from source instead needs the Flutter SDK, JDK 21 (Gradle does not run on JDK 26), and a valid Android NDK, then flutter build apk --release. The AOT libapp.so Blutter needs exists only in a release/profile build, never a debug one.

Release

.github/workflows/python-publish.yml runs on a published GitHub release: it builds an sdist and wheel with python -m build, checks them with twine check, and publishes to PyPI through trusted publishing (id-token: write, environment pypi). No manual upload step.

Before tagging:

  1. Bump version in pyproject.toml. That is the only place to edit; see Project identity.
  2. Run python -m pytest.
  3. Rebuild the frontend with ./scripts/build_frontend.sh if the UI changed, and commit web/static/, since that is what ships. The script also syncs package.json's version from pyproject.toml.

Project identity

Name, version, description, author and homepage live in pyproject.toml and nowhere else. _metadata.py resolves them once at import:

  • From the checkout's pyproject.toml when one sits directly above the package. An editable install's recorded metadata goes stale the moment the version is bumped, so the file on disk wins.
  • Otherwise from the installed distribution's metadata, which is the only source available inside a wheel. The distribution is located through packages_distributions() rather than by naming it, so even the lookup carries no literal.

Everything downstream imports from there:

Consumer Uses
lu77U_MobileSec.__version__, __title__, __author__, __email__ All five values
config/settings.py (APP_NAME, APP_VERSION, …, SOCIAL_LINKS) All five values
config/paths.py Name, for the config, cache and default output directories
config/credentials.py Name, as the keyring service
web/store.py Name, as the scan-folder prefix
web/app.py, web/server.py, web/routes/system.py, cli/parser.py Name and version
dynamic_analysis/frida_manager.py, mitmproxy_manager.py Name, for the cache directory, User-Agent and firewall prompt
report_generator/*, utils/output_manager.py Name, version and homepage in report titles, footers, page furniture and filenames
frontend/vite.config.js Reads pyproject.toml at build time and injects __APP_NAME__, __APP_VERSION__, __APP_HOMEPAGE__, plus %APP_NAME% in index.html

Renaming the project or changing its URL is therefore a one-line edit. Note that the name is also the keyring service and the config-directory name, so a rename orphans previously stored keys and settings.

tests/test_metadata.py asserts each of those consumers still matches pyproject.toml, including the rendered HTML report.

Repository conventions

Every .py file in lu77U_MobileSec/, tests/ and scripts/ follows one commenting standard, and it is enforced mechanically rather than in review. CONTRIBUTING.md is the contributor-facing statement of it and CLAUDE.md is the same rules written for AI assistants; both are authoritative, this section is the summary.

  • Line 1 is exactly #!/usr/bin/env python3, and the module docstring is the next statement on line 2.
  • Zero # comments past line 1 — not # noqa, not # pragma: no cover, not a banner. Everything goes in a triple-double-quoted docstring; the single-quoted form is rejected.
  • Every module, class, function and method is documented, including nested functions and ones defined under an if or a try.
  • Docstrings are sectioned from a fixed vocabulary (Purpose, Parameters, Returns, Raises, Side effects, Security considerations, Implementation notes, and the rest). A Purpose: is always required; anything returning or yielding a value needs Returns:.
  • One line per section. A section body is a single line however long it runs — not hard-wrapped, not split into paragraphs. The exceptions are Parameters:/Raises:/Attributes:, which take one entry per line, and Usage:/Examples:, which keep their line breaks because they hold runnable commands.
  • Every parameter is documented and nothing that is not a parameter. The self/cls exemption is narrow: the leading positional argument only, on a method defined directly in a class body only, and never on a @staticmethod. A parameter that merely happens to be named cls — which parametrized tests over analyzer classes have — still needs documenting.
  • Files end with exactly one newline terminator. No trailing blank line, and do not strip the terminator either.
  • Never put a credential in a docstring, and never leave a second bare string literal under one: only the first is the docstring, so a second renders as a duplicated block that no other rule looks at.

Comments still explain why, not what. Several non-obvious decisions (daemon threads, the Frida 16.x pin, tail-truncating the transcript, the lone </think> case) are documented at the site that depends on them; keep that habit when changing them. Module and class docstrings carry the design rationale, and this wiki summarizes it rather than replacing it.

A docstring describing parameters a function does not have is worse than no docstring, and the checker rejects it.

Contributions: fork, branch, run ./scripts/preflight.sh, open a pull request. Issues and security reports both go to the GitHub issue tracker.

The push gate

Four checks run before a push is allowed, and all four must pass:

python scripts/check_comment_style.py    # the commenting standard, over 220 files
python -m pytest                         # the whole suite
./scripts/codeql_scan.sh                 # CodeQL, every finding-producing suite, zero tolerance
./scripts/verify_install.sh              # a fresh venv, pip install -e ., -v and -V both actually work
./scripts/preflight.sh                   # runs all four

scripts/check_comment_style.py is stdlib-only and self-hosting — it satisfies the standard it enforces, which a test asserts. It reports one violation per rule with a file, a symbol and a rule name; --json gives a machine-readable form for editor integration.

scripts/codeql_scan.sh builds a fresh CodeQL database for Python, JavaScript and the GitHub Actions workflows from a clean copy of the tracked (and untracked-but-not-gitignored) tree, then runs security-and-quality, security-experimental and code-quality-extended for the two code languages and actions-all for the workflows — every suite CodeQL ships that produces actual findings rather than metrics or model-generator output, which is why the LGTM-family suites are deliberately left out (see the script's own header for exactly why). Any result fails the gate. The CodeQL CLI and its query packs are close to 2GB, so the script installs its own copy on first run into ~/.codeql-lu77u and CodeQL's default pack cache ~/.codeql/packages, both outside the repo and both persisted across runs; CI caches the same two paths with actions/cache so it isn't redownloaded on every job. There is deliberately no suppression mechanism — CodeQL's usual inline lgtm[rule-id] comment would itself be a # comment, which rule 3 bans, so a finding is fixed or the code is restructured, and nothing is ever dropped from the suites, even where its stock form cannot be satisfied by application code. js/untrusted-data-to-external-api-more-sources is the one case here: its own documentation calls it a manual-audit query with no code-level sanitizer, and direct testing against this repo's real validation (a TypeScript type guard on a fetched array, extracting only primitive fields into a new object, a JSON round trip) confirmed none of it clears the taint, because the query's Sanitizer extension point has zero implementations in the shipped library. The documentation's own recommended fix is to extend its safe-API classes rather than sanitize application code, so scripts/codeql/lu77u-js-models/ is a small local query pack that does exactly that: a real, narrow model addition marking exactly the two packages this codebase's fetch-into-hook pattern hits (react, react-router-dom) as not being external security boundaries for this concern, since fetch() is the actual external call and is already covered as a source everywhere else. scripts/codeql/javascript-suite.qls runs that re-modelled copy under the exact same rule id in place of the stock one, so the check still runs against every file and would still catch a real external-API sink — a database driver, a shell, a raw HTTP client — and so do its heuristic siblings, which real validation in this codebase already satisfies unmodified.

scripts/verify_install.sh is the slowest gate by a wide margin, because it deliberately reuses nothing: a brand-new venv, pip install -e . from cold pulling every dependency straight from PyPI, then the two flags a first-time user would try. -v/--version has to print the exact version pyproject.toml declares, catching packaging metadata that drifted from the source of truth. -V/--verbose starts the real web dashboard and — unlike almost every other CLI's -v — never exits on its own, since -v is version and -V is verbose here, a deliberate, documented inversion of the usual Unix convention (see cli/parser.py); the script starts it with the real, undocumented --port/--no-browser flags meant for exactly this kind of embedding, watches for a clean startup with no traceback, then stops it.

Enable the hook once per clone:

./scripts/install_hooks.sh    # sets core.hooksPath to .githooks

The hook lives at .githooks/pre-push and is versioned rather than kept in .git/hooks, so one config setting points every clone at it. git push --no-verify bypasses it, which is exactly why .github/workflows/ci.yml runs the identical four scripts — a bypassed push fails there instead.

Two rules of engagement when a check fails:

  • Never weaken a rule or a test to make it pass. Fix the code.
  • When the checker and the code disagree, work out which is actually wrong before changing either. The checker has been wrong before: it once exempted every argument named cls rather than only a method's receiver, which reported correct docstrings as documenting a non-parameter.

Clone this wiki locally