This repository contains a standalone, Mac-local server for incremental code coverage from physical iOS devices. It accepts LLVM artifacts from registered Builds and user-initiated .profraw uploads, analyzes every Build independently, and conservatively accumulates source-region coverage over the current Build's immutable Git diff.
The source tree does not store runtime data. For the initial setup, configure the runtime data location and prepare the project registry:
cp config/server.example.json config/server.json
# Edit config/server.json and set runtime_root to an absolute data directory.
mkdir -p <runtime_root>/config
cp config/projects.example.json <runtime_root>/config/projects.json
./start_coverage_server.shconfig/server.json is machine-local configuration and is ignored by Git. If runtime_root is empty, missing, or not an absolute path, the server stops with a configuration error before creating tokens, a database, or logs. The repository's projects.example.json contains fictional projects only; the real project registry must exist only at <runtime_root>/config/projects.json.
All mutable data lives under that runtime root:
config/projects.json
state/gitlab_api_token
state/operator_token
state/run_upload_token
instance/coverage.sqlite3
data/
analysis/
logs/server.log
Missing operator and Run tokens are generated automatically with 0600 permissions. The GitLab token must be provisioned separately by the operator; if it is absent, only MR URL-based Cycle creation is unavailable.
Open http://127.0.0.1:8765/cycles/ in a browser. See docs/api.md for the HTTP protocol, docs/daily_workflow.md for the daily workflow, and docs/runtime_deployment.md and docs/project_registry.md for deployment configuration.
Install the optional Chrome extension to view line-level coverage directly on GitLab Merge Request diff pages. The extension uses the local server's read-only endpoint to validate the MR diff identity and retrieve the coverage report. The server's Cycle, Build, Run, background analysis, and built-in report features work without the extension.
- Repository: IOSCoverageGitLabExtension
- Download: v0.2.1 Release
The four analysis compatibility entry points require an explicit --runtime-root and accept only immutable identities such as Cycle, Build, and Run IDs. They do not accept repository or artifact paths:
python3 analyze_cycle_latest.py --runtime-root /absolute/runtime --cycle-id <cycle-id>When the server is running, a Run upload asynchronously triggers the same orchestrator; the CLI does not need to be invoked manually.
The production server applies one safe cleanup before it begins serving, then repeats cleanup every 24 hours from that process start. Restarting the server starts a fresh 24-hour timer. Cleanup waits for an active analysis to finish and briefly serializes Cycle/Build/Run writes; health, report, and other read-only HTTP requests remain available. Shutdown cancels cleanup only while it is still waiting for those barriers; once deletion begins, shutdown waits for its quarantine operation to finish. Background Cycle orchestration runs in a dedicated process group so coordinated shutdown can terminate a stuck LLVM/Git execution within a bounded grace period. The analysis execution inherits the runtime process-lock lease, so a crash or forced parent exit cannot let another server or offline cleanup acquire the runtime while analysis remains alive.
An operator can request online cleanup without stopping the server:
curl -X POST http://127.0.0.1:8765/api/v1/maintenance/cleanup \
-H 'Authorization: Bearer <operator-token>'The standalone CLI remains available for a read-only audit. Its destructive --apply mode is the offline fallback and still requires the server to be stopped:
python3 cleanup_runtime_data.py
python3 cleanup_runtime_data.py --applySee docs/runtime_data_lifecycle.md for retained evidence, deletion rules, and safety boundaries.
PYTHONPYCACHEPREFIX=/private/tmp/ios-coverage-tests-pycache \
python3 -m unittest discover -s tests -t . -vStart codebase navigation at knowledge/README.md. The server's Python package is named ioscoverage.
Run this command before committing or publishing:
python3 scripts/check_public_repository.pyThe checker scans tracked files and untracked files that are not excluded by .gitignore. It rejects internal project identifiers, local user directories, runtime artifacts, and common plaintext credential patterns. It reports only relative file paths and safe finding categories, never suspected credential contents. Real projects.json files, tokens, SQLite databases, profiles, logs, and analysis results are deployment data and must not enter the source repository.
This project is licensed under the Apache License 2.0.