leakscope 0.2.0rc1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. leakscope-0.2.0rc1/LICENSE +21 -0
  2. leakscope-0.2.0rc1/PKG-INFO +40 -0
  3. leakscope-0.2.0rc1/README.md +149 -0
  4. leakscope-0.2.0rc1/apps/api/PYPI.md +18 -0
  5. leakscope-0.2.0rc1/apps/api/leakscope.egg-info/PKG-INFO +40 -0
  6. leakscope-0.2.0rc1/apps/api/leakscope.egg-info/SOURCES.txt +36 -0
  7. leakscope-0.2.0rc1/apps/api/leakscope.egg-info/dependency_links.txt +1 -0
  8. leakscope-0.2.0rc1/apps/api/leakscope.egg-info/entry_points.txt +2 -0
  9. leakscope-0.2.0rc1/apps/api/leakscope.egg-info/requires.txt +10 -0
  10. leakscope-0.2.0rc1/apps/api/leakscope.egg-info/top_level.txt +1 -0
  11. leakscope-0.2.0rc1/apps/api/leakscope_api/__init__.py +3 -0
  12. leakscope-0.2.0rc1/apps/api/leakscope_api/agent.py +477 -0
  13. leakscope-0.2.0rc1/apps/api/leakscope_api/analysis.py +90 -0
  14. leakscope-0.2.0rc1/apps/api/leakscope_api/app.py +1558 -0
  15. leakscope-0.2.0rc1/apps/api/leakscope_api/capture.py +162 -0
  16. leakscope-0.2.0rc1/apps/api/leakscope_api/cli.py +513 -0
  17. leakscope-0.2.0rc1/apps/api/leakscope_api/config.py +96 -0
  18. leakscope-0.2.0rc1/apps/api/leakscope_api/context_capture.py +51 -0
  19. leakscope-0.2.0rc1/apps/api/leakscope_api/contracts.py +223 -0
  20. leakscope-0.2.0rc1/apps/api/leakscope_api/db.py +61 -0
  21. leakscope-0.2.0rc1/apps/api/leakscope_api/deployment.py +60 -0
  22. leakscope-0.2.0rc1/apps/api/leakscope_api/healthcheck.py +71 -0
  23. leakscope-0.2.0rc1/apps/api/leakscope_api/investigation.py +493 -0
  24. leakscope-0.2.0rc1/apps/api/leakscope_api/limits.py +46 -0
  25. leakscope-0.2.0rc1/apps/api/leakscope_api/migrations/env.py +14 -0
  26. leakscope-0.2.0rc1/apps/api/leakscope_api/migrations/versions/0001_initial.py +17 -0
  27. leakscope-0.2.0rc1/apps/api/leakscope_api/migrations/versions/0002_agent_evidence.py +19 -0
  28. leakscope-0.2.0rc1/apps/api/leakscope_api/migrations/versions/0003_monitoring.py +21 -0
  29. leakscope-0.2.0rc1/apps/api/leakscope_api/models.py +213 -0
  30. leakscope-0.2.0rc1/apps/api/leakscope_api/monitoring.py +633 -0
  31. leakscope-0.2.0rc1/apps/api/leakscope_api/native.py +132 -0
  32. leakscope-0.2.0rc1/apps/api/leakscope_api/readiness.py +236 -0
  33. leakscope-0.2.0rc1/apps/api/leakscope_api/reports.py +123 -0
  34. leakscope-0.2.0rc1/apps/api/leakscope_api/sensor.py +70 -0
  35. leakscope-0.2.0rc1/apps/api/leakscope_api/service.py +644 -0
  36. leakscope-0.2.0rc1/apps/api/leakscope_api/storage.py +106 -0
  37. leakscope-0.2.0rc1/pyproject.toml +67 -0
  38. leakscope-0.2.0rc1/setup.cfg +4 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 PSala
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,40 @@
1
+ Metadata-Version: 2.4
2
+ Name: leakscope
3
+ Version: 0.2.0rc1
4
+ Summary: LeakScope Python collector and CLI; native executables and web assets are installed separately
5
+ License-Expression: MIT
6
+ Project-URL: Repository, https://github.com/polsala/LeakScope
7
+ Project-URL: Documentation, https://github.com/polsala/LeakScope/tree/main/docs
8
+ Requires-Python: >=3.11
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: fastapi==0.143.1
12
+ Requires-Dist: uvicorn==0.34.3
13
+ Requires-Dist: pydantic==2.11.7
14
+ Requires-Dist: sqlalchemy==2.0.41
15
+ Requires-Dist: alembic==1.16.2
16
+ Requires-Dist: zstandard==0.23.0
17
+ Requires-Dist: protobuf==6.33.5
18
+ Requires-Dist: PyYAML==6.0.2
19
+ Requires-Dist: httpx==0.28.1
20
+ Requires-Dist: starlette==1.8.0
21
+ Dynamic: license-file
22
+
23
+ # LeakScope Python component
24
+
25
+ This distribution installs the Python collector, FastAPI backend, CLI and Alembic
26
+ migrations. It requires Python 3.11 or newer. It does **not** bundle the Rust sensor,
27
+ Rust analyzer, web assets or CPython 2.7 compatibility extension, and performs no
28
+ executable downloads during installation.
29
+
30
+ `leakscope --version`, offline capture inspection and database backup work through
31
+ this package. Recording and native allocation analysis require separately installed
32
+ matching `leakscope-sensor` and `leakscope-analyzer` executables on PATH (or the
33
+ explicit LEAKSCOPE_SENSOR_BIN / LEAKSCOPE_ANALYZER_BIN settings). Serving the UI
34
+ requires LEAKSCOPE_WEB_DIST pointing to matching built assets. For the complete
35
+ application, use the verified offline standalone tarball or Debian distribution
36
+ from https://github.com/polsala/LeakScope/releases.
37
+
38
+ Engineering previews do not claim production readiness. Native tracing is opt-in;
39
+ metrics remain available without BPF. Python 2.7 is used only by the separate
40
+ compatibility agent and optional laboratory interpreter.
@@ -0,0 +1,149 @@
1
+ > Phase 5 engineering preview: offline bundled-runtime packages, reliable startup,
2
+ > genuine six-way Python 2 ABI tests and SQLite recovery are available. Production
3
+ > promotion remains blocked pending the documented kernel, performance, deployment,
4
+ > long-duration and security gates. See [installation](docs/installation/release-candidate.md)
5
+ > and [executed evidence](docs/development/phase5-validation.md).
6
+
7
+ # LeakScope
8
+
9
+ Local memory investigations for long-running Linux processes, with a cooperative
10
+ CPython 2.7.18 agent. The interface defaults to Catalan and includes Spanish and English.
11
+
12
+ **0.1.0 is an engineering preview, not a complete Memray replacement or a production-certified release.**
13
+ Observe metrics work without tracing privileges. Optional native profiling now records
14
+ actual malloc/calloc/realloc/free events through Aya, streams LSCAP captures,
15
+ reconstructs allocations, and displays native flamegraphs, call trees and reports.
16
+ The real Python 2.7/kernel/browser path has been exercised. Cooperative operation/function boundaries now correlate native allocations with Python
17
+ context, while a separately instrumented Lab interpreter can record verified executing
18
+ Python allocation lines. Standard Deep evidence remains temporal. Lab remains experimental. See the [evidence matrix](docs/implementation-status.md).
19
+
20
+ ## Start locally
21
+
22
+ Requires Linux x86_64, Python 3.11+ (commands default to 3.12), Rust 1.94.1,
23
+ Node 24.13.0 with Corepack, Clang with its BPF target, a C compiler and network access for the initial setup.
24
+ Python 2 is needed only for the compatibility agent and target fixtures.
25
+
26
+ ```bash
27
+ make setup
28
+ make build
29
+ .venv/bin/leakscope serve --listen 127.0.0.1:7831
30
+ # In a separate terminal, read the generated local credential:
31
+ cat .data/admin.token
32
+ ```
33
+
34
+ Open **http://127.0.0.1:7831** and paste the credential. Run as the same UID as
35
+ the monitored application. Select **Diagnostica un procés**, choose a process,
36
+ configure a bounded capture, add markers, stop, compare its two halves, then
37
+ create an offline HTML or JSON report. Captures contain real measurements.
38
+
39
+ For development, `make dev` starts the sensor, API on 7831 and Vite on 5173.
40
+ For an offline distribution, run `make package` on a connected build host and
41
+ follow [offline installation](docs/installation/offline.md).
42
+
43
+ ## Implemented architecture
44
+
45
+ ```text
46
+ React 19 / TypeScript / TanStack Query
47
+ │ authenticated HTTP + fetch/SSE
48
+ FastAPI / Pydantic / SQLAlchemy / SQLite WAL
49
+ │ private Unix socket / framed Protobuf envelope
50
+ Rust sensor ── procfs + optional Aya uprobes ── same-UID target processes
51
+ │
52
+ └── bounded leases, acknowledged sample queues, explicit loss
53
+
54
+ Application-initialized Python 2 agent ── credential-checked Unix datagrams
55
+ nested operations / C function boundaries / bounded generation-zero GC counts
56
+ optional Lab object blocks + verified allocation-time frames
57
+
58
+ Metrics + actual native events ── streaming Zstandard .lscap + SHA256
59
+ └── Rust lifecycle + native stacks ── flamegraphs / offline reports
60
+ ```
61
+
62
+ `crates/` contains identity, procfs, protocol, capture, analysis, symbol inspection
63
+ and sensor packages. `apps/api` contains the collector and CLI; `apps/web` contains
64
+ the browser UI. `legacy/` contains the genuine Python 2 extension and audited Lab
65
+ patch. `bpf/` contains the C allocation probes embedded in the Aya sensor loader.
66
+ `schemas/`, `tests/`, `packaging/`, `.github/` and `docs/` carry the shared
67
+ contracts, executable validation, installers, CI and operator guidance.
68
+
69
+ ## Native investigations
70
+
71
+ Phase 4 adds [continuous metrics observation and bounded investigations](docs/usage/production-investigation.md),
72
+ [automatic growth detection](docs/usage/automatic-detection.md), physical native
73
+ capture windows, adaptive safety, deterministic findings and repeated-operation
74
+ experiments. Monitoring keeps no allocator probes attached. Separate windows
75
+ never become one exact lifetime trace. Readiness stays fail-closed until independent
76
+ release gates qualify; releases remain engineering previews.
77
+
78
+ Actual local results, scoped readiness and remaining blockers are recorded in
79
+ the [Phase 4 validation report](docs/development/phase4-validation.md).
80
+
81
+ See the [complete native leak tutorial](docs/usage/native-allocation-leak.md).
82
+ A controlled 48-block leak was attributed to its actual C caller with exactly
83
+ 3,145,728 retained bytes and zero loss; the cleanup control retained zero.
84
+ Native binaries are built against glibc 2.31 and load on Ubuntu 20.04/22.04/24.04.
85
+ Kernel attachment is verified on 6.19.14+kali-amd64; the Ubuntu kernel matrix
86
+ and production overhead target remain unqualified. Historical Phase 3 allocation-heavy target CPU costs range +289–633% for Native Light and
87
+ +605–687% for Detailed on shared hardware. Keep metrics-only as default; no
88
+ production CPU target is qualified. See [measured performance](docs/development/production-performance.md).
89
+
90
+ ## Python investigations
91
+
92
+ [Python Memory Leak Investigation](docs/usage/python-memory-investigation.md)
93
+ covers initialization, nested operations, opt-in function profiling, exact Lab
94
+ lines, positive/cleanup fixtures, CLI and reports. Eight controlled retained tuples
95
+ match 9,152 object-block bytes on the verified UCS4 build; cleanup gives zero.
96
+ Python blocks, native allocations, GC counts and RSS are separate overlapping
97
+ domains. See [attribution evidence](docs/architecture/python-attribution.md).
98
+
99
+ ## CLI
100
+
101
+ ```bash
102
+ .venv/bin/leakscope doctor --json
103
+ .venv/bin/leakscope ps --tree
104
+ .venv/bin/leakscope inspect --pid 1234
105
+ .venv/bin/leakscope capture --pid 1234 --duration 30s --output investigation.lscap
106
+ .venv/bin/leakscope capture --pid 1234 --native --duration 30s --output native.lscap
107
+ .venv/bin/leakscope analyze investigation.lscap
108
+ .venv/bin/leakscope report investigation.lscap --output report.html
109
+ .venv/bin/leakscope monitor --pid 1234 --duration 24h --json
110
+ .venv/bin/leakscope watch --pid 1234 --growth-mb 100 --window 30m --json
111
+ .venv/bin/leakscope investigate --pid 1234 --policy native_light --duration 5s --json
112
+ .venv/bin/leakscope findings SESSION_ID --json
113
+ .venv/bin/leakscope performance SESSION_ID --json
114
+ .venv/bin/leakscope report SESSION_ID --output investigation.html
115
+ .venv/bin/leakscope release-readiness --json
116
+ ```
117
+
118
+ The CLI reads `.data/admin.token`, or `LEAKSCOPE_TOKEN`, and uses the same role
119
+ checks as the UI. `analyze`, file `compare` and file `report` work offline.
120
+
121
+ ## Validation
122
+
123
+ ```bash
124
+ make test lint typecheck
125
+ make test-native
126
+ make test-legacy
127
+ make test-integration
128
+ make test-e2e
129
+ ```
130
+
131
+ Test commands that create sockets, processes or browsers require an environment
132
+ that permits those operations. Kernel probe attachment is not part of portable tests.
133
+ See [testing](docs/development/testing.md), [limitations](docs/compatibility/limitations.md)
134
+ and [release gates](docs/quality-gates.md) before using this preview operationally.
135
+
136
+ RSS, native heap blocks, Python arenas, Python blocks and GC object estimates are
137
+ separate domains. **They are never added together. RSS growth alone is not proof of a leak.**
138
+
139
+ ## Automated releases
140
+
141
+ Prepare and review a version with `.venv/bin/python scripts/release.py prepare 0.2.0-rc.1`,
142
+ then push the matching annotated tag. GitHub Actions validates and publishes
143
+ crates.io, the Python component, GHCR and complete standalone/Debian assets using
144
+ the already configured registry tokens and automatic GITHUB_TOKEN. No manual
145
+ first publication, GPG or registry Trusted Publishing is required.
146
+
147
+ [Release quickstart](docs/releasing/quickstart.md) explains the protected environment,
148
+ manual nonpublishing dry run, first prerelease and safe recovery. Prereleases
149
+ remain engineering previews; stable promotion retains all production gates.
@@ -0,0 +1,18 @@
1
+ # LeakScope Python component
2
+
3
+ This distribution installs the Python collector, FastAPI backend, CLI and Alembic
4
+ migrations. It requires Python 3.11 or newer. It does **not** bundle the Rust sensor,
5
+ Rust analyzer, web assets or CPython 2.7 compatibility extension, and performs no
6
+ executable downloads during installation.
7
+
8
+ `leakscope --version`, offline capture inspection and database backup work through
9
+ this package. Recording and native allocation analysis require separately installed
10
+ matching `leakscope-sensor` and `leakscope-analyzer` executables on PATH (or the
11
+ explicit LEAKSCOPE_SENSOR_BIN / LEAKSCOPE_ANALYZER_BIN settings). Serving the UI
12
+ requires LEAKSCOPE_WEB_DIST pointing to matching built assets. For the complete
13
+ application, use the verified offline standalone tarball or Debian distribution
14
+ from https://github.com/polsala/LeakScope/releases.
15
+
16
+ Engineering previews do not claim production readiness. Native tracing is opt-in;
17
+ metrics remain available without BPF. Python 2.7 is used only by the separate
18
+ compatibility agent and optional laboratory interpreter.
@@ -0,0 +1,40 @@
1
+ Metadata-Version: 2.4
2
+ Name: leakscope
3
+ Version: 0.2.0rc1
4
+ Summary: LeakScope Python collector and CLI; native executables and web assets are installed separately
5
+ License-Expression: MIT
6
+ Project-URL: Repository, https://github.com/polsala/LeakScope
7
+ Project-URL: Documentation, https://github.com/polsala/LeakScope/tree/main/docs
8
+ Requires-Python: >=3.11
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: fastapi==0.143.1
12
+ Requires-Dist: uvicorn==0.34.3
13
+ Requires-Dist: pydantic==2.11.7
14
+ Requires-Dist: sqlalchemy==2.0.41
15
+ Requires-Dist: alembic==1.16.2
16
+ Requires-Dist: zstandard==0.23.0
17
+ Requires-Dist: protobuf==6.33.5
18
+ Requires-Dist: PyYAML==6.0.2
19
+ Requires-Dist: httpx==0.28.1
20
+ Requires-Dist: starlette==1.8.0
21
+ Dynamic: license-file
22
+
23
+ # LeakScope Python component
24
+
25
+ This distribution installs the Python collector, FastAPI backend, CLI and Alembic
26
+ migrations. It requires Python 3.11 or newer. It does **not** bundle the Rust sensor,
27
+ Rust analyzer, web assets or CPython 2.7 compatibility extension, and performs no
28
+ executable downloads during installation.
29
+
30
+ `leakscope --version`, offline capture inspection and database backup work through
31
+ this package. Recording and native allocation analysis require separately installed
32
+ matching `leakscope-sensor` and `leakscope-analyzer` executables on PATH (or the
33
+ explicit LEAKSCOPE_SENSOR_BIN / LEAKSCOPE_ANALYZER_BIN settings). Serving the UI
34
+ requires LEAKSCOPE_WEB_DIST pointing to matching built assets. For the complete
35
+ application, use the verified offline standalone tarball or Debian distribution
36
+ from https://github.com/polsala/LeakScope/releases.
37
+
38
+ Engineering previews do not claim production readiness. Native tracing is opt-in;
39
+ metrics remain available without BPF. Python 2.7 is used only by the separate
40
+ compatibility agent and optional laboratory interpreter.
@@ -0,0 +1,36 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ apps/api/PYPI.md
5
+ apps/api/leakscope.egg-info/PKG-INFO
6
+ apps/api/leakscope.egg-info/SOURCES.txt
7
+ apps/api/leakscope.egg-info/dependency_links.txt
8
+ apps/api/leakscope.egg-info/entry_points.txt
9
+ apps/api/leakscope.egg-info/requires.txt
10
+ apps/api/leakscope.egg-info/top_level.txt
11
+ apps/api/leakscope_api/__init__.py
12
+ apps/api/leakscope_api/agent.py
13
+ apps/api/leakscope_api/analysis.py
14
+ apps/api/leakscope_api/app.py
15
+ apps/api/leakscope_api/capture.py
16
+ apps/api/leakscope_api/cli.py
17
+ apps/api/leakscope_api/config.py
18
+ apps/api/leakscope_api/context_capture.py
19
+ apps/api/leakscope_api/contracts.py
20
+ apps/api/leakscope_api/db.py
21
+ apps/api/leakscope_api/deployment.py
22
+ apps/api/leakscope_api/healthcheck.py
23
+ apps/api/leakscope_api/investigation.py
24
+ apps/api/leakscope_api/limits.py
25
+ apps/api/leakscope_api/models.py
26
+ apps/api/leakscope_api/monitoring.py
27
+ apps/api/leakscope_api/native.py
28
+ apps/api/leakscope_api/readiness.py
29
+ apps/api/leakscope_api/reports.py
30
+ apps/api/leakscope_api/sensor.py
31
+ apps/api/leakscope_api/service.py
32
+ apps/api/leakscope_api/storage.py
33
+ apps/api/leakscope_api/migrations/env.py
34
+ apps/api/leakscope_api/migrations/versions/0001_initial.py
35
+ apps/api/leakscope_api/migrations/versions/0002_agent_evidence.py
36
+ apps/api/leakscope_api/migrations/versions/0003_monitoring.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ leakscope = leakscope_api.cli:main
@@ -0,0 +1,10 @@
1
+ fastapi==0.143.1
2
+ uvicorn==0.34.3
3
+ pydantic==2.11.7
4
+ sqlalchemy==2.0.41
5
+ alembic==1.16.2
6
+ zstandard==0.23.0
7
+ protobuf==6.33.5
8
+ PyYAML==6.0.2
9
+ httpx==0.28.1
10
+ starlette==1.8.0
@@ -0,0 +1 @@
1
+ leakscope_api
@@ -0,0 +1,3 @@
1
+ """LeakScope collector and standalone CLI."""
2
+
3
+ __version__ = "0.2.0rc1"