tuneio 2.1.0__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.
- tuneio-2.1.0/CHANGELOG.md +55 -0
- tuneio-2.1.0/CONTRIBUTING.md +9 -0
- tuneio-2.1.0/LICENSE +21 -0
- tuneio-2.1.0/MANIFEST.in +10 -0
- tuneio-2.1.0/PKG-INFO +83 -0
- tuneio-2.1.0/README.md +51 -0
- tuneio-2.1.0/README_DEMO.md +123 -0
- tuneio-2.1.0/SECURITY.md +7 -0
- tuneio-2.1.0/docs/TERMINAL_GUIDE.md +118 -0
- tuneio-2.1.0/docs/product/BENCHMARK_CHECKPOINT_SETTLEMENT.md +26 -0
- tuneio-2.1.0/docs/product/CACHE_WAITER_COMPATIBILITY.md +19 -0
- tuneio-2.1.0/docs/product/CLI_PRODUCT_ROADMAP.md +129 -0
- tuneio-2.1.0/docs/product/PHASE_01_SPECIFICATION.md +91 -0
- tuneio-2.1.0/docs/product/PHASE_02_CORE_EXTRACTION.md +72 -0
- tuneio-2.1.0/docs/product/PHASE_03_CLI.md +47 -0
- tuneio-2.1.0/docs/product/PHASE_04_OBSERVATION_PROXY.md +110 -0
- tuneio-2.1.0/docs/product/PHASE_05_STORAGE_REPORTING.md +123 -0
- tuneio-2.1.0/docs/product/PHASE_06_PERFORMANCE_INSIGHTS.md +109 -0
- tuneio-2.1.0/docs/product/PHASE_07_SAFE_CACHING.md +131 -0
- tuneio-2.1.0/docs/product/PHASE_08_ADAPTIVE_TUNING.md +147 -0
- tuneio-2.1.0/docs/product/PHASE_09_DASHBOARD_SCENARIOS.md +181 -0
- tuneio-2.1.0/docs/product/PHASE_10_RELIABILITY_EVIDENCE.md +204 -0
- tuneio-2.1.0/docs/product/PHASE_11_RELEASE_PREPARATION.md +48 -0
- tuneio-2.1.0/docs/product/PHASE_12_TERMINAL_FOUNDATION.md +56 -0
- tuneio-2.1.0/docs/product/PHASE_13_API_DISCOVERY.md +40 -0
- tuneio-2.1.0/docs/product/PHASE_14_BASELINE_ANALYSIS.md +54 -0
- tuneio-2.1.0/docs/product/PHASE_15_17_TERMINAL_BETA.md +48 -0
- tuneio-2.1.0/docs/product/POST_PHASE_11_STABILIZATION.md +25 -0
- tuneio-2.1.0/docs/product/benchmark_checkpoint_validation.json +79 -0
- tuneio-2.1.0/docs/product/cache_waiter_validation.json +73 -0
- tuneio-2.1.0/docs/product/config.schema.json +379 -0
- tuneio-2.1.0/docs/product/phase_01_validation.json +30 -0
- tuneio-2.1.0/docs/product/phase_02_validation.json +44 -0
- tuneio-2.1.0/docs/product/phase_03_validation.json +44 -0
- tuneio-2.1.0/docs/product/phase_04_validation.json +56 -0
- tuneio-2.1.0/docs/product/phase_05_validation.json +77 -0
- tuneio-2.1.0/docs/product/phase_06_validation.json +93 -0
- tuneio-2.1.0/docs/product/phase_07_validation.json +113 -0
- tuneio-2.1.0/docs/product/phase_08_validation.json +108 -0
- tuneio-2.1.0/docs/product/phase_09_validation.json +149 -0
- tuneio-2.1.0/docs/product/phase_10_validation.json +948 -0
- tuneio-2.1.0/docs/product/phase_11_stabilization_validation.json +90 -0
- tuneio-2.1.0/docs/product/phase_11_validation.json +95 -0
- tuneio-2.1.0/docs/product/phase_12_validation.json +185 -0
- tuneio-2.1.0/docs/product/public_content_validation.json +51 -0
- tuneio-2.1.0/docs/product/scenario.schema.json +162 -0
- tuneio-2.1.0/docs/reference/TuneIO_CLI_Product_PRD.md +178 -0
- tuneio-2.1.0/docs/release/DEVELOPER_BETA.md +44 -0
- tuneio-2.1.0/docs/release/PUBLISHING.md +60 -0
- tuneio-2.1.0/docs/release/candidate.json +7 -0
- tuneio-2.1.0/docs/release/review-receipt.example.json +14 -0
- tuneio-2.1.0/docs/release/v2.0.0b2.md +20 -0
- tuneio-2.1.0/examples/adaptive-demo.json +118 -0
- tuneio-2.1.0/examples/autotuner.json +23 -0
- tuneio-2.1.0/examples/cache-demo.json +107 -0
- tuneio-2.1.0/examples/cache-price-update.json +1 -0
- tuneio-2.1.0/examples/cache_upstream.py +6 -0
- tuneio-2.1.0/examples/proxy-demo.json +82 -0
- tuneio-2.1.0/examples/scenarios/invalidation.json +47 -0
- tuneio-2.1.0/examples/scenarios/lifecycle.json +130 -0
- tuneio-2.1.0/examples/scenarios/reads.json +21 -0
- tuneio-2.1.0/pyproject.toml +48 -0
- tuneio-2.1.0/scripts/benchmark.py +135 -0
- tuneio-2.1.0/scripts/measure_startup.py +40 -0
- tuneio-2.1.0/scripts/profile_sql.py +43 -0
- tuneio-2.1.0/scripts/seed_demo.py +17 -0
- tuneio-2.1.0/scripts/smoke_installers.py +99 -0
- tuneio-2.1.0/scripts/smoke_product.py +96 -0
- tuneio-2.1.0/scripts/smoke_wheel.py +45 -0
- tuneio-2.1.0/scripts/start.py +76 -0
- tuneio-2.1.0/scripts/test_socketless.py +48 -0
- tuneio-2.1.0/setup.cfg +4 -0
- tuneio-2.1.0/tests/conftest.py +39 -0
- tuneio-2.1.0/tests/console_dom.cjs +22 -0
- tuneio-2.1.0/tests/product_ui.test.cjs +62 -0
- tuneio-2.1.0/tests/test_adaptive_controller.py +443 -0
- tuneio-2.1.0/tests/test_api.py +249 -0
- tuneio-2.1.0/tests/test_baseline.py +164 -0
- tuneio-2.1.0/tests/test_benchmark_contract.py +33 -0
- tuneio-2.1.0/tests/test_cache.py +89 -0
- tuneio-2.1.0/tests/test_checkpoint_settlement.py +64 -0
- tuneio-2.1.0/tests/test_cli.py +165 -0
- tuneio-2.1.0/tests/test_console.py +258 -0
- tuneio-2.1.0/tests/test_core.py +177 -0
- tuneio-2.1.0/tests/test_developer_workflow.py +107 -0
- tuneio-2.1.0/tests/test_discovery.py +201 -0
- tuneio-2.1.0/tests/test_insights.py +280 -0
- tuneio-2.1.0/tests/test_install_contract.py +60 -0
- tuneio-2.1.0/tests/test_metrics.py +61 -0
- tuneio-2.1.0/tests/test_overhead_regression.py +82 -0
- tuneio-2.1.0/tests/test_policy_revisions.py +56 -0
- tuneio-2.1.0/tests/test_product_config.py +72 -0
- tuneio-2.1.0/tests/test_proxy.py +333 -0
- tuneio-2.1.0/tests/test_public_metadata.py +56 -0
- tuneio-2.1.0/tests/test_qualification.py +319 -0
- tuneio-2.1.0/tests/test_release.py +132 -0
- tuneio-2.1.0/tests/test_reliability.py +80 -0
- tuneio-2.1.0/tests/test_response_cache.py +699 -0
- tuneio-2.1.0/tests/test_scenarios.py +246 -0
- tuneio-2.1.0/tests/test_stabilization.py +51 -0
- tuneio-2.1.0/tests/test_storage.py +487 -0
- tuneio-2.1.0/tests/test_storage_batching.py +51 -0
- tuneio-2.1.0/tests/test_storage_budget_recovery.py +72 -0
- tuneio-2.1.0/tests/test_terminal.py +221 -0
- tuneio-2.1.0/tests/test_terminal_product.py +424 -0
- tuneio-2.1.0/tests/test_tuning.py +182 -0
- tuneio-2.1.0/tests/test_workflow_api.py +56 -0
- tuneio-2.1.0/tests/workflow.test.cjs +117 -0
- tuneio-2.1.0/tuneio/__init__.py +2 -0
- tuneio-2.1.0/tuneio/__main__.py +3 -0
- tuneio-2.1.0/tuneio/_version.py +2 -0
- tuneio-2.1.0/tuneio/artifacts.py +55 -0
- tuneio-2.1.0/tuneio/baseline.py +160 -0
- tuneio-2.1.0/tuneio/benchmarking.py +434 -0
- tuneio-2.1.0/tuneio/cache.py +2 -0
- tuneio-2.1.0/tuneio/cli.py +575 -0
- tuneio-2.1.0/tuneio/comparison.py +106 -0
- tuneio-2.1.0/tuneio/console.py +151 -0
- tuneio-2.1.0/tuneio/core/__init__.py +10 -0
- tuneio-2.1.0/tuneio/core/cache.py +223 -0
- tuneio-2.1.0/tuneio/core/contracts.py +14 -0
- tuneio-2.1.0/tuneio/core/controller.py +90 -0
- tuneio-2.1.0/tuneio/core/engine.py +64 -0
- tuneio-2.1.0/tuneio/core/insights.py +146 -0
- tuneio-2.1.0/tuneio/core/metrics.py +83 -0
- tuneio-2.1.0/tuneio/core/monitoring.py +26 -0
- tuneio-2.1.0/tuneio/dashboard.html +114 -0
- tuneio-2.1.0/tuneio/database.py +64 -0
- tuneio-2.1.0/tuneio/demo.py +51 -0
- tuneio-2.1.0/tuneio/discovery.py +294 -0
- tuneio-2.1.0/tuneio/main.py +147 -0
- tuneio-2.1.0/tuneio/metrics.py +2 -0
- tuneio-2.1.0/tuneio/monitor.py +248 -0
- tuneio-2.1.0/tuneio/optimization.py +109 -0
- tuneio-2.1.0/tuneio/product.css +4 -0
- tuneio-2.1.0/tuneio/product_config.py +189 -0
- tuneio-2.1.0/tuneio/product_dashboard.html +46 -0
- tuneio-2.1.0/tuneio/product_ui.js +62 -0
- tuneio-2.1.0/tuneio/proxy.py +393 -0
- tuneio-2.1.0/tuneio/qualification_fixture.py +84 -0
- tuneio-2.1.0/tuneio/qualification_server.py +57 -0
- tuneio-2.1.0/tuneio/quality.py +29 -0
- tuneio-2.1.0/tuneio/release.py +92 -0
- tuneio-2.1.0/tuneio/reporting.py +24 -0
- tuneio-2.1.0/tuneio/response_cache.py +297 -0
- tuneio-2.1.0/tuneio/scenario_presets.json +200 -0
- tuneio-2.1.0/tuneio/scenarios.py +314 -0
- tuneio-2.1.0/tuneio/schemas.py +53 -0
- tuneio-2.1.0/tuneio/session.py +124 -0
- tuneio-2.1.0/tuneio/storage.py +465 -0
- tuneio-2.1.0/tuneio/terminal.py +667 -0
- tuneio-2.1.0/tuneio/terminal_reports.py +271 -0
- tuneio-2.1.0/tuneio/terminal_ui.py +288 -0
- tuneio-2.1.0/tuneio/workflow.js +109 -0
- tuneio-2.1.0/tuneio.egg-info/PKG-INFO +83 -0
- tuneio-2.1.0/tuneio.egg-info/SOURCES.txt +159 -0
- tuneio-2.1.0/tuneio.egg-info/dependency_links.txt +1 -0
- tuneio-2.1.0/tuneio.egg-info/entry_points.txt +2 -0
- tuneio-2.1.0/tuneio.egg-info/requires.txt +16 -0
- tuneio-2.1.0/tuneio.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 2.1.0 - Stable package version
|
|
4
|
+
|
|
5
|
+
- Publish tuneio under the MIT license using a stable version identifier.
|
|
6
|
+
- Install with pip, pipx or uv using the package name `tuneio`.
|
|
7
|
+
|
|
8
|
+
## 2.1.0b3 - Registry publishing preparation
|
|
9
|
+
|
|
10
|
+
- Publish under the MIT license.
|
|
11
|
+
- Add a manual TestPyPI and PyPI workflow that verifies release distributions against their tag before uploading.
|
|
12
|
+
|
|
13
|
+
## 2.1.0b2 - One-window terminal workspace
|
|
14
|
+
|
|
15
|
+
- Select capture stages, environments, invalidating write methods and approvals by number or with arrow keys. Paths and other custom values use editable text fields.
|
|
16
|
+
- Run the demo and proxy from the workspace. Quitting stops the processes started there.
|
|
17
|
+
- Read and compare live or saved metrics in scrollable tables. Open detailed evidence in the workspace and export full JSON when needed.
|
|
18
|
+
|
|
19
|
+
## 2.1.0b1 - Terminal workflow candidate
|
|
20
|
+
|
|
21
|
+
- Add a purple, keyboard-driven workspace with a block-letter title, guided setup and policy approvals.
|
|
22
|
+
- Preview and save adaptive cache policy revisions with pause, disable and rollback.
|
|
23
|
+
- Monitor request metrics, cache state, findings and resources in a live terminal. Export a snapshot and retained tuning decisions as JSON.
|
|
24
|
+
- Capture matched read workloads with stable-response verification and compare latency, throughput and cache hits.
|
|
25
|
+
- Add installed-wheel journeys for disposable RAM and SQLite upstreams, installer lifecycle checks and release evidence guidance.
|
|
26
|
+
|
|
27
|
+
- Save passive proxy baselines or preview and approve a bounded GET workload. Baseline JSON separates workload timings from rolling metrics and advisory findings.
|
|
28
|
+
|
|
29
|
+
- Discover direct FastAPI route candidates and import local or explicitly requested loopback OpenAPI descriptions.
|
|
30
|
+
- Preview selected operations and save a reviewed observe configuration to a new project-root JSON file.
|
|
31
|
+
|
|
32
|
+
- Add a keyboard-operated terminal workspace for configuration, session insights, cache controls and exports.
|
|
33
|
+
- Keep help, version and menu startup independent of proxy/database imports; interactive entry adds no runtime dependency.
|
|
34
|
+
- Support offline menu descriptions with `tuneio menu --json` and explicit non-interactive operation with `--no-input`.
|
|
35
|
+
- Wait for bounded server-side completion before benchmark checkpoints; keep leaks and accounting mismatches as failures.
|
|
36
|
+
- Fix cache waiter counts when lock acquisition is deferred, including on Python 3.11.
|
|
37
|
+
- Use product features and version information in public documentation and session metadata.
|
|
38
|
+
- Advertise supported capabilities while remaining compatible with older local servers.
|
|
39
|
+
|
|
40
|
+
## 2.0.0b2 — API Monitoring & Adaptive Caching
|
|
41
|
+
|
|
42
|
+
- Reserve scenario report destinations before submitting requests, preventing mutations when an output already exists or cannot be opened.
|
|
43
|
+
- Keep an incomplete report with its run ID when execution cannot be confirmed; no automatic replay.
|
|
44
|
+
- Reject ambiguous, duplicate, non-finite, overly nested and invalid-schema release evidence. Bound soak duration checks without integer-to-float overflow.
|
|
45
|
+
- Checkpoint prerelease only; qualification, licensing, registry publication and independent pilots remain pending.
|
|
46
|
+
|
|
47
|
+
## 2.0.0b1 — unreleased
|
|
48
|
+
|
|
49
|
+
- Installable observation proxy, local dashboard and ordered API scenarios.
|
|
50
|
+
- Explicit fixed-TTL/adaptive public-read caching and dependent write invalidation.
|
|
51
|
+
- Bounded SQLite telemetry, JSON/CSV reports and isolated benchmarks.
|
|
52
|
+
- Packaged disposable demo and offline candidate-evidence review.
|
|
53
|
+
- Release preparation only: qualification, compatibility CI, licensing, publisher setup and independent pilots remain open.
|
|
54
|
+
|
|
55
|
+
The original FastAPI demo remains available separately. Historical evidence lives in docs/product.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Follow AGENTS.md and the internal development contracts in docs/product. Install `.[test,benchmark,release]` in a Python virtual environment and Node 22 for UI checks.
|
|
4
|
+
|
|
5
|
+
Run `python -m pytest`, `python -m tuneio.quality coverage.json`, and `node --test tests/workflow.test.cjs tests/product_ui.test.cjs`. For packaging changes run `python -m build`, `python -m twine check dist/*` and `python scripts/smoke_wheel.py dist`. Keep dist limited to one candidate wheel.
|
|
6
|
+
|
|
7
|
+
Add isolated pytest coverage for behavior, errors and meaningful edge cases; preserve regression and concurrency tests. Use temporary data and controlled synchronization. Never weaken coverage gates or modify a user's application database. Do not commit credentials, private payloads or local telemetry.
|
|
8
|
+
|
|
9
|
+
Normal pytest is authoritative. scripts/test_socketless.py is a disclosed managed-sandbox fallback, not real TCP qualification. Record limits and unexecuted checks in review evidence. License and public contribution terms await owner approval.
|
tuneio-2.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Vedikgannoji
|
|
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.
|
tuneio-2.1.0/MANIFEST.in
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
include README.md README_DEMO.md CHANGELOG.md CONTRIBUTING.md SECURITY.md
|
|
2
|
+
include LICENSE
|
|
3
|
+
include docs/TERMINAL_GUIDE.md
|
|
4
|
+
include docs/reference/tuneio_CLI_Product_PRD.md
|
|
5
|
+
recursive-include tuneio *.py *.html *.css *.js *.json
|
|
6
|
+
recursive-include examples *.py *.json
|
|
7
|
+
recursive-include scripts *.py
|
|
8
|
+
recursive-include tests *.py *.cjs
|
|
9
|
+
recursive-include docs/product *.md *.json
|
|
10
|
+
recursive-include docs/release *.json *.md
|
tuneio-2.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tuneio
|
|
3
|
+
Version: 2.1.0
|
|
4
|
+
Summary: Local API observation proxy with explicit public-read caching and auditable adaptive policies
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Repository, https://github.com/Vedikgannoji/API-Performance-Auto-Tuner
|
|
7
|
+
Project-URL: Issues, https://github.com/Vedikgannoji/API-Performance-Auto-Tuner/issues
|
|
8
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
|
|
15
|
+
Requires-Python: >=3.11
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: fastapi<1,>=0.104.1
|
|
19
|
+
Requires-Dist: uvicorn<1,>=0.24
|
|
20
|
+
Requires-Dist: pydantic<3,>=2.5
|
|
21
|
+
Requires-Dist: httpx<1,>=0.27
|
|
22
|
+
Provides-Extra: test
|
|
23
|
+
Requires-Dist: pytest<9,>=7.4; extra == "test"
|
|
24
|
+
Requires-Dist: pytest-cov<8,>=5; extra == "test"
|
|
25
|
+
Requires-Dist: httpx<1,>=0.27; extra == "test"
|
|
26
|
+
Provides-Extra: benchmark
|
|
27
|
+
Requires-Dist: psutil<8,>=5.9; extra == "benchmark"
|
|
28
|
+
Provides-Extra: release
|
|
29
|
+
Requires-Dist: build<2,>=1.2; extra == "release"
|
|
30
|
+
Requires-Dist: twine<7,>=6; extra == "release"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# tuneio
|
|
34
|
+
|
|
35
|
+
tuneio is a terminal-first tool for observing HTTP APIs and applying reviewed adaptive caching. Discover FastAPI candidates or import OpenAPI, capture a baseline, approve a cache policy, and compare it with a matched run. tuneio 2.1.0 is distributed under the MIT license.
|
|
36
|
+
|
|
37
|
+
## Install a local wheel
|
|
38
|
+
|
|
39
|
+
Use Python 3.11, 3.12 or 3.13 and a wheel from this project.
|
|
40
|
+
|
|
41
|
+
| Installer | Command |
|
|
42
|
+
| --- | --- |
|
|
43
|
+
| pip in an activated virtual environment | `python -m pip install PATH_TO_WHEEL` |
|
|
44
|
+
| pipx | `pipx install PATH_TO_WHEEL` |
|
|
45
|
+
| uv | `uv tool install PATH_TO_WHEEL` |
|
|
46
|
+
|
|
47
|
+
Run `tuneio --version`, then start `tuneio` from your project. For a source checkout, install with `python -m pip install -e .`. Use the wheel's path until a registry release is verified and announced.
|
|
48
|
+
|
|
49
|
+
After the release is published to PyPI, install `tuneio` with `python -m pip install tuneio`, `pipx install tuneio`, or `uv tool install tuneio`. All three install the `tuneio` command.
|
|
50
|
+
|
|
51
|
+
## Work in the terminal
|
|
52
|
+
|
|
53
|
+
The workspace has a purple pixel-art title, highlighted selections, and arrow-key and number navigation. Use **Enter** to open a selection, **b** to go back, **h** for help and **q** to quit. If your terminal needs line prompts, use `tuneio menu --plain`. The CLI uses your terminal's font. Cascadia Mono and JetBrains Mono render the block characters clearly.
|
|
54
|
+
|
|
55
|
+
1. In **Setup and configuration**, discover operations and save a reviewed observe configuration. Start your API with its usual command, or choose **Start or stop demo API** for the bundled fixture. Choose **Start or restart workspace proxy** to connect it.
|
|
56
|
+
2. In **Session and insights**, inspect traffic, save a baseline, or open the live monitor. Switch monitor views with **Tab** or arrow keys and use **/** to filter, **Space** to pause, **r** to refresh, and **i** to change the refresh interval.
|
|
57
|
+
3. In **Cache and policies**, review a public GET rule and its dependent writes. Saving an approval selects the new config revision. Use **Start or restart workspace proxy** to apply it. The policy menu also provides pause, disable and rollback.
|
|
58
|
+
4. In **Reports and history**, compare matched reads or export JSON. Scriptable commands expose the same actions.
|
|
59
|
+
|
|
60
|
+
The [terminal guide](docs/TERMINAL_GUIDE.md) includes the complete disposable demo, matched capture walkthrough and command reference. For the original demo and optional browser interface, see the [demo guide](README_DEMO.md).
|
|
61
|
+
|
|
62
|
+
## Supported deployment
|
|
63
|
+
|
|
64
|
+
- A single-worker loopback HTTP/1.x proxy for finite requests. Point clients at the proxy to measure their traffic.
|
|
65
|
+
- Adaptive response caching for reviewed public GETs. HTTP freshness, request variants, credential bypass, memory limits and declared write invalidation govern cache serving.
|
|
66
|
+
- Static FastAPI discovery covers literal decorators on direct apps and simple factories. Use OpenAPI for assembled routers and dynamic routes, or configure operations manually.
|
|
67
|
+
- Tuning uses measured origin latency and reuse to activate caching and adjust TTL. Admission and concurrency limits are configured. Concurrency findings are advisory.
|
|
68
|
+
- Telemetry stays local in bounded SQLite storage. Keep the proxy on a trusted machine and avoid exposing its management interface to untrusted clients.
|
|
69
|
+
|
|
70
|
+
## Develop and qualify
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
python -m pip install -e ".[test,benchmark,release]"
|
|
74
|
+
python -m pytest
|
|
75
|
+
python -m tuneio.quality coverage.json
|
|
76
|
+
python -m build
|
|
77
|
+
python -m twine check dist/*
|
|
78
|
+
python scripts/smoke_wheel.py dist
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The optional browser UI checks use `node --test tests/workflow.test.cjs tests/product_ui.test.cjs`. The managed Windows sandbox can use `python scripts/test_socketless.py` for in-process tests. The installed-wheel journey and performance qualification require real loopback HTTP.
|
|
82
|
+
|
|
83
|
+
See the [candidate checklist](docs/release/DEVELOPER_BETA.md), [contributing guide](CONTRIBUTING.md), [security policy](SECURITY.md), and [changelog](CHANGELOG.md).
|
tuneio-2.1.0/README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# tuneio
|
|
2
|
+
|
|
3
|
+
tuneio is a terminal-first tool for observing HTTP APIs and applying reviewed adaptive caching. Discover FastAPI candidates or import OpenAPI, capture a baseline, approve a cache policy, and compare it with a matched run. tuneio 2.1.0 is distributed under the MIT license.
|
|
4
|
+
|
|
5
|
+
## Install a local wheel
|
|
6
|
+
|
|
7
|
+
Use Python 3.11, 3.12 or 3.13 and a wheel from this project.
|
|
8
|
+
|
|
9
|
+
| Installer | Command |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| pip in an activated virtual environment | `python -m pip install PATH_TO_WHEEL` |
|
|
12
|
+
| pipx | `pipx install PATH_TO_WHEEL` |
|
|
13
|
+
| uv | `uv tool install PATH_TO_WHEEL` |
|
|
14
|
+
|
|
15
|
+
Run `tuneio --version`, then start `tuneio` from your project. For a source checkout, install with `python -m pip install -e .`. Use the wheel's path until a registry release is verified and announced.
|
|
16
|
+
|
|
17
|
+
After the release is published to PyPI, install `tuneio` with `python -m pip install tuneio`, `pipx install tuneio`, or `uv tool install tuneio`. All three install the `tuneio` command.
|
|
18
|
+
|
|
19
|
+
## Work in the terminal
|
|
20
|
+
|
|
21
|
+
The workspace has a purple pixel-art title, highlighted selections, and arrow-key and number navigation. Use **Enter** to open a selection, **b** to go back, **h** for help and **q** to quit. If your terminal needs line prompts, use `tuneio menu --plain`. The CLI uses your terminal's font. Cascadia Mono and JetBrains Mono render the block characters clearly.
|
|
22
|
+
|
|
23
|
+
1. In **Setup and configuration**, discover operations and save a reviewed observe configuration. Start your API with its usual command, or choose **Start or stop demo API** for the bundled fixture. Choose **Start or restart workspace proxy** to connect it.
|
|
24
|
+
2. In **Session and insights**, inspect traffic, save a baseline, or open the live monitor. Switch monitor views with **Tab** or arrow keys and use **/** to filter, **Space** to pause, **r** to refresh, and **i** to change the refresh interval.
|
|
25
|
+
3. In **Cache and policies**, review a public GET rule and its dependent writes. Saving an approval selects the new config revision. Use **Start or restart workspace proxy** to apply it. The policy menu also provides pause, disable and rollback.
|
|
26
|
+
4. In **Reports and history**, compare matched reads or export JSON. Scriptable commands expose the same actions.
|
|
27
|
+
|
|
28
|
+
The [terminal guide](docs/TERMINAL_GUIDE.md) includes the complete disposable demo, matched capture walkthrough and command reference. For the original demo and optional browser interface, see the [demo guide](README_DEMO.md).
|
|
29
|
+
|
|
30
|
+
## Supported deployment
|
|
31
|
+
|
|
32
|
+
- A single-worker loopback HTTP/1.x proxy for finite requests. Point clients at the proxy to measure their traffic.
|
|
33
|
+
- Adaptive response caching for reviewed public GETs. HTTP freshness, request variants, credential bypass, memory limits and declared write invalidation govern cache serving.
|
|
34
|
+
- Static FastAPI discovery covers literal decorators on direct apps and simple factories. Use OpenAPI for assembled routers and dynamic routes, or configure operations manually.
|
|
35
|
+
- Tuning uses measured origin latency and reuse to activate caching and adjust TTL. Admission and concurrency limits are configured. Concurrency findings are advisory.
|
|
36
|
+
- Telemetry stays local in bounded SQLite storage. Keep the proxy on a trusted machine and avoid exposing its management interface to untrusted clients.
|
|
37
|
+
|
|
38
|
+
## Develop and qualify
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
python -m pip install -e ".[test,benchmark,release]"
|
|
42
|
+
python -m pytest
|
|
43
|
+
python -m tuneio.quality coverage.json
|
|
44
|
+
python -m build
|
|
45
|
+
python -m twine check dist/*
|
|
46
|
+
python scripts/smoke_wheel.py dist
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The optional browser UI checks use `node --test tests/workflow.test.cjs tests/product_ui.test.cjs`. The managed Windows sandbox can use `python scripts/test_socketless.py` for in-process tests. The installed-wheel journey and performance qualification require real loopback HTTP.
|
|
50
|
+
|
|
51
|
+
See the [candidate checklist](docs/release/DEVELOPER_BETA.md), [contributing guide](CONTRIBUTING.md), [security policy](SECURITY.md), and [changelog](CHANGELOG.md).
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Self-Optimizing API Performance Monitoring System
|
|
2
|
+
|
|
3
|
+
The installable CLI includes the product dashboard, declarative scenario runner and isolated reliability benchmarks. It runs beside the generic proxy, independently of the original demo below. Start your upstream, run `tuneio serve --config examples/adaptive-demo.json`, then open `tuneio dashboard --config examples/adaptive-demo.json` in another terminal. The product dashboard is at `http://127.0.0.1:8080/_autotuner/dashboard`; the proxy root continues forwarding to your upstream.
|
|
4
|
+
|
|
5
|
+
For isolated product benchmarks, install `python -m pip install -e ".[test,benchmark]"` and run `tuneio benchmark --profile quick --output product-quick.json`. It starts and stops its own temporary SQL upstream and proxy without targeting your application. Use `tuneio benchmark --help` for workload options. These checks alone do not establish completed performance qualification.
|
|
6
|
+
|
|
7
|
+
For generic proxy installation and complete startup commands, see the [product guide](README.md). Browser assets have no build step or Node dependency. Optional developer checks use `node --test tests/workflow.test.cjs tests/product_ui.test.cjs`. The demo below runs on port 8000; the proxy dashboard uses port 8080.
|
|
8
|
+
|
|
9
|
+
FastAPI backend with persistent business APIs, request monitoring, adaptive response caching, and baseline-based regression analysis. The Python backend is the current implementation; the original Express source remains in the repository for historical reference.
|
|
10
|
+
|
|
11
|
+
## One-click start (Windows)
|
|
12
|
+
|
|
13
|
+
After installing dependencies once, double-click `start.bat` or run it from Command Prompt. It uses `.venv` when present, starts FastAPI from the project root, waits for startup, then opens the dashboard in your browser. The frontend is bundled with the backend, so no separate frontend server is needed. Keep the terminal open; press Ctrl+C there to stop.
|
|
14
|
+
|
|
15
|
+
If port 8000 is occupied, stop the existing server or run `start.bat --port 8001`. Use `start.bat --no-browser` to start without opening a tab.
|
|
16
|
+
|
|
17
|
+
## Quick start
|
|
18
|
+
|
|
19
|
+
Python 3.11 or newer is required. Run from the repository root:
|
|
20
|
+
|
|
21
|
+
```powershell
|
|
22
|
+
python -m venv .venv
|
|
23
|
+
.venv\Scripts\Activate.ps1
|
|
24
|
+
python -m pip install -e ".[test]"
|
|
25
|
+
# Optional: create a NEW database with a realistic reporting workload before starting.
|
|
26
|
+
python scripts/seed_demo.py --orders 50000
|
|
27
|
+
python -m uvicorn tuneio.main:create_app --factory --host 127.0.0.1 --port 8000
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Linux/macOS: activate with `source .venv/bin/activate`. The seed command refuses to overwrite an existing database. Seeding is optional: without it the service creates an empty database and records can be created through the API.
|
|
31
|
+
|
|
32
|
+
Open the [dashboard](http://127.0.0.1:8000) and [interactive API documentation](http://127.0.0.1:8000/docs). Cache controls work without a token or login. Anyone who can reach the server can change cache settings. Business APIs are public demo APIs; use local binding as shown.
|
|
33
|
+
|
|
34
|
+
## Dashboard
|
|
35
|
+
|
|
36
|
+
The root URL serves a responsive dashboard with persistent light/dark theme selection and a Getting started guide tab. Overview, API playground, Cache & insights, and Getting started have separate views with matching active navigation and browser history. It includes a charcoal-and-sage monitoring workspace with live monitoring, percentile bars, a cache-offload meter, selectable time windows, pause/refresh controls, and an API playground for all 13 business operations. Inspect response JSON, status, client timing and cache headers; repeat GET requests six times to observe learning. A session-only history retains the last 20 playground requests.
|
|
37
|
+
|
|
38
|
+
The cache panel shows policies, TTLs, occupancy and decisions, with directly available mode and invalidation controls. POST and PATCH requests modify real business data. Monitoring polls do not generate business traffic. Browser client timings and server latency metrics are labeled separately.
|
|
39
|
+
|
|
40
|
+
## Automated playground workflows
|
|
41
|
+
|
|
42
|
+
In API playground, use **Automated API workflows** to preview and run a sequential scenario:
|
|
43
|
+
|
|
44
|
+
- **Full business lifecycle:** creates a unique user and product, uses returned IDs to create an order, covers all 13 business method/path operations, observes repeated reads, checks updates/report freshness and original order prices, then pays and ships the order. Optional expected 409/422 checks are counted as successful assertions.
|
|
45
|
+
- **Read-only cache observation:** repeats user, product, order and sales-report reads using existing data.
|
|
46
|
+
|
|
47
|
+
Configure 1-5 cycles, 1-30 reads per group and 0-2000 ms pacing. Adaptive mode can optionally be enabled before running; otherwise the existing global mode is respected. Each step logs method, URL, expected/actual status, client timing, cache header and response data. Unexpected failures stop dependencies immediately. Export the latest run as JSON for review.
|
|
48
|
+
|
|
49
|
+
Stop waits for the current request to finish and prevents further steps. Completed writes persist: the full scenario creates one user, one product and one shipped order per cycle, with no automatic deletion. Intentional 4xx requests increase monitored error rates. This runner exercises correctness and cache feedback; use the separate benchmark for concurrent load-performance claims.
|
|
50
|
+
|
|
51
|
+
Browser code needs no Node installation. Developers can run `node --test tests/workflow.test.cjs` for nine engine tests. When Node is available, pytest also runs the JavaScript workflow against the actual ASGI application through a pipe bridge; it skips that one integration check otherwise. CI installs Node and runs both suites.
|
|
52
|
+
|
|
53
|
+
## Implemented operations
|
|
54
|
+
|
|
55
|
+
| Resource | Operations |
|
|
56
|
+
| --- | --- |
|
|
57
|
+
| Users | GET/POST `/api/users`; GET/PATCH `/api/users/{item_id}` |
|
|
58
|
+
| Products | GET/POST `/api/products`; GET/PATCH `/api/products/{item_id}` |
|
|
59
|
+
| Orders | GET/POST `/api/orders`; GET `/api/orders/{item_id}`; PATCH `/api/orders/{item_id}/status` |
|
|
60
|
+
| Reports | GET `/api/reports/sales` |
|
|
61
|
+
|
|
62
|
+
All 13 business method/path operations are monitored. Lists support `limit` (1-100) and `offset`. Prices are integer cents from 1 to 1,000,000,000. IDs and pagination are bounded to avoid database integer overflow. Orders snapshot the product price at creation. Valid transitions are pending -> paid/cancelled and paid -> shipped/cancelled; repeating the current status is allowed. Foreign keys, duplicate email conflicts, strict request validation, pagination, and not-found behavior are covered by tests.
|
|
63
|
+
|
|
64
|
+
| Monitoring/control | Behavior |
|
|
65
|
+
| --- | --- |
|
|
66
|
+
| GET `/health` | Liveness; uncached and excluded from business metrics |
|
|
67
|
+
| GET `/metrics?window=60` | Count, RPS, p50/p95/p99, errors, server errors, and cache hits, per operation and overall |
|
|
68
|
+
| GET `/metrics/comparison` | Cache-hit versus origin server durations per route; null improvement until both cohorts exist |
|
|
69
|
+
| GET `/analysis` | Origin regression alerts, adaptive policies, bounded decision history |
|
|
70
|
+
| PUT `/cache/mode` | Body `{"mode":"off"}` or `{"mode":"adaptive"}` |
|
|
71
|
+
| DELETE `/cache` | Clear stored responses; no token required |
|
|
72
|
+
|
|
73
|
+
## How optimization works
|
|
74
|
+
|
|
75
|
+
Only explicitly registered public GET operations use the cache. Requests with Authorization or Cookie headers bypass shared caching. Keys include the path and query parameters; duplicate parameter order is preserved. Cached JSON receives `X-Cache: HIT`, `MISS`, or `BYPASS` and `Cache-Control: no-store` to prevent downstream stale caches.
|
|
76
|
+
|
|
77
|
+
The cache starts cold in adaptive mode. Each route retains the latest 20 origin observations. After at least four observations, a mean origin duration of at least 2 ms, reuse of the current key, and zero observed failures enable caching. TTL scales with origin latency, bounded to 2-30 seconds. A 5-second policy cooldown limits oscillation; origin failures bypass the cooldown to disable an active policy. An active policy uses a 1.5 ms lower disable threshold (versus 2 ms for activation) to avoid oscillation. Reuse evidence expires after 60 seconds. Fast or low-reuse workloads disable it after new origin observations. Expiry provides new origin samples; cache hits never dilute origin latency measurements. Policies, automatic enable/disable/TTL decisions, bottleneck alerts and contention counters appear in `/analysis` and the Cache & insights view.
|
|
78
|
+
|
|
79
|
+
The response cache and reuse history each hold at most 256 keys, and decision history holds at most 100 entries. Per-key locks coalesce cold misses while independent reads run concurrently through an eight-worker origin semaphore. Hot hits bypass the origin queue. Writes serialize separately, invalidate only dependent resources, and use generation checks to prevent stale in-flight reads from refilling the cache. SQLite work runs in worker threads; policy samples measure origin execution without queue delay. A persistent covering index accelerates the sales-report join.
|
|
80
|
+
|
|
81
|
+
Monitoring wraps all business processing, including malformed JSON, validation failures, not-found responses, cache hits, and handled database failures. Routes use templates rather than raw IDs. Metrics retain at most 10,000 completed observations. RPS divides observed requests by the complete requested window; capped retention can undercount a high-volume window. Latency measures server processing through response transmission to ASGI, not client network round-trip time. Error rate includes 4xx and 5xx; server-error rate includes 5xx only. Percentiles use nearest rank.
|
|
82
|
+
|
|
83
|
+
Regression analysis compares the latest five successful origin observations with the preceding five for the same method and route. An alert requires both a >=1.5x mean duration increase and at least 5 ms absolute increase, with both cohorts inside the last five minutes. These are disjoint sample cohorts within retained history, not a persisted historical baseline. Cache comparisons are observational and may mix query variants; use the controlled benchmark for causal performance evidence.
|
|
84
|
+
|
|
85
|
+
## Tests and benchmark
|
|
86
|
+
|
|
87
|
+
```powershell
|
|
88
|
+
python -m pytest
|
|
89
|
+
python scripts/benchmark.py --orders 50000 --requests 120 --concurrency 8 --repeats 3
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Coverage includes every Python module in `tuneio`, with branch reporting and an enforced 90% combined coverage floor. The benchmark starts fresh single-worker HTTP servers, uses real SQL sales aggregation without artificial sleeps, alternates baseline/adaptive order, validates response hashes and status codes, and saves raw client timings plus cache decisions to `benchmarks/latest.json`. Adaptive rounds include cold policy learning. It exits unsuccessfully if the median mean-latency reduction is below 20%.
|
|
93
|
+
|
|
94
|
+
**Evidence:** Earlier demo results and the retained user-run HTTP benchmark (73.54% median mean-latency reduction for its workload) predate the product proxy; they are not current product performance evidence. See [test guide](docs/TEST_GUIDE.md) for the historical demo boundary.
|
|
95
|
+
|
|
96
|
+
## Configuration and scope
|
|
97
|
+
|
|
98
|
+
- `AUTOTUNER_DB`: SQLite path, default `autotuner.sqlite3` in the working directory.
|
|
99
|
+
- Deploy with one worker. Metrics, cache, and policies are process-local and reset on restart; business data persists in SQLite.
|
|
100
|
+
- This is a local backend engineering demonstration, without business-user authentication, tenant isolation, Redis, shared multi-worker metrics, or production deployment hardening. Add those before exposing private data or scaling to multiple workers.
|
|
101
|
+
|
|
102
|
+
Source: `tuneio/`; tests: `tests/`; tools: `scripts/`; CI: `.github/workflows/backend.yml`. The original Node routes, dashboard and test scripts target the legacy server and are not the Python validation suite.
|
|
103
|
+
|
|
104
|
+
See [tuning review](docs/TUNING_REVIEW.md) for the bottleneck fixes, automatic feedback rules, and isolated SQL measurements. Rerun the HTTP benchmark after these changes; the previous 94.67% result belongs to the earlier implementation.
|
|
105
|
+
|
|
106
|
+
### Cache bypass diagnostics
|
|
107
|
+
|
|
108
|
+
Dashboard requests explicitly omit browser credentials so ambient localhost cookies cannot silently bypass the public demo cache. External requests carrying Cookie or Authorization headers still bypass shared caching. These database reads are now counted in origin telemetry and a dedicated credential-bypass counter, while remaining excluded from shared policy learning. `X-Cache-Reason` identifies credentials, disabled caching, hits or origin observation. Policy cards expose sample counts, measured origin mean and activation threshold. Restart the server after updating; historical metrics cannot be retroactively added to the new counters. Empty stored responses can still be normal after writes or TTL expiry, and fast origins may correctly remain uncached.
|
|
109
|
+
|
|
110
|
+
### Timing and regression precision
|
|
111
|
+
|
|
112
|
+
Cache expiry, cooldown, origin duration and queue measurements now use `perf_counter`, a monotonic high-resolution clock. On the tested Windows/Python 3.12 environment, the old `monotonic` clock used a 15.625 ms timer while `perf_counter` reports a 100 ns resolution. Sub-millisecond origin durations are retained rather than quantized to zero. Policy cards explain sample collection, fast origins, low reuse, origin failures and cooldown. Regression alerts require both a 1.5x mean increase and at least 5 ms absolute increase across two five-sample cohorts within the last five minutes. This suppresses small changes such as 3.04 to 4.68 ms.
|
|
113
|
+
|
|
114
|
+
## CLI monitoring and caching
|
|
115
|
+
|
|
116
|
+
The installable CLI runs a configurable proxy alongside your API. Use the [product guide](README.md) for setup, commands and current limitations.
|
|
117
|
+
|
|
118
|
+
- Inspect requests with `tuneio endpoints` and `tuneio insights`.
|
|
119
|
+
- Export retained JSON/CSV with `tuneio report`; list history with `tuneio sessions`.
|
|
120
|
+
- Review approved cache policies with `tuneio cache explain`.
|
|
121
|
+
- Use `examples/cache-demo.json` for fixed-TTL caching or `examples/adaptive-demo.json` for adaptive policies against the disposable demo upstream.
|
|
122
|
+
|
|
123
|
+
The original demo sends no-store responses. Use the disposable upstream for generic proxy caching examples. Commands require the matching `--config` path; fast origins may correctly remain uncached.
|
tuneio-2.1.0/SECURITY.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Security reporting
|
|
2
|
+
|
|
3
|
+
This is an unqualified beta candidate. Use loopback deployments with one worker. Shared caching requires explicit public-read approval and correct invalidation rules.
|
|
4
|
+
|
|
5
|
+
Use GitHub private vulnerability reporting if enabled. Otherwise open a minimal issue requesting a private contact without exploit details, credentials, private payloads or sensitive routes. A response SLA and private contact channel have not yet been established.
|
|
6
|
+
|
|
7
|
+
Include version, OS, sanitized configuration, expected boundary and a disposable reproduction. Do not expose the management listener to reproduce an issue.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# tuneio terminal guide
|
|
2
|
+
|
|
3
|
+
## Start the workspace
|
|
4
|
+
|
|
5
|
+
Run `tuneio` from your project or use `tuneio menu --project PATH --config FILE`. Entry is offline. It reads terminal input after you select a menu action. Use arrows and Enter, number keys, **b** to go back, **q** to quit and **h** for help.
|
|
6
|
+
|
|
7
|
+
Choose a listed number or move the highlight with **Up/Down** and press **Enter**. For matched captures, **1** selects **Baseline** or **Local**, and **2** selects **Optimized** or **Staging** on the corresponding screen. Approvals default to **No**. Press **1** for **Yes**. Paths and other custom values use the text box.
|
|
8
|
+
|
|
9
|
+
The terminal supplies the font. For the purple block-letter title and highlighted selection, use a true-color terminal such as Windows Terminal with Cascadia Mono or JetBrains Mono. On narrow terminals the title fits on one line. `--plain` and `NO_COLOR=1` use line prompts. Redirected scripts can use `tuneio menu --json` for the action list.
|
|
10
|
+
|
|
11
|
+
The keyboard-driven workspace holds menus, forms, reports, and the live monitor on the same screen. Use **Up/Down** and **PgUp/PgDn** to scroll reports. Press **d** where offered to see detailed metrics, then **Enter** to return. Use **Reports and history** to view stored telemetry, open a saved capture or comparison, or export full JSON. Scripting commands also support `--json` where shown in help.
|
|
12
|
+
|
|
13
|
+
Start the demo from **Setup and configuration → Start or stop demo API**. With a config selected, choose **Start or restart workspace proxy**. The rich workspace runs its proxy in the background, so you can open **Session and insights → Open live monitor** in the same window. After saving a policy revision, use the same proxy action to activate it. The workspace stops the processes it started when you quit. Plain mode also supports a foreground proxy with Ctrl+C to return.
|
|
14
|
+
|
|
15
|
+
## Run the demo in one tuneio window
|
|
16
|
+
|
|
17
|
+
From the checkout with tuneio installed, run `tuneio menu --config examples/adaptive-demo.json`. The demo uses port 3000 and the proxy uses port 8080. Free those ports before starting.
|
|
18
|
+
|
|
19
|
+
1. Open **Setup and configuration** and select **9 Start or stop demo API**. Confirm and press **Enter** to return to Setup.
|
|
20
|
+
2. Select **3 Start or restart workspace proxy**. Confirm, press **Enter** to return and press **b** for the workspace menu.
|
|
21
|
+
3. Open **Session and insights** and select **5 Capture matched GET workload**. With this sample config, choose **2 Optimized**. Enter `/api/products` and the application identifier `demo-seed-v1`, select **1 Local**, and enter eight measured requests and five warmup requests. Enter a new JSON filename and choose **1 Yes** on the preview. To make a matched pair, capture the baseline first with an observe config that defines the same operation and upstream, then switch to the optimized config and restart the proxy. Keep the demo running for both captures.
|
|
22
|
+
4. Select **6 Open live monitor** to see request volume, latency, errors, cache behavior, findings and resource usage. Press **q** to go back to the workspace. Open **Reports and history** to revisit saved captures or compare a matched pair.
|
|
23
|
+
|
|
24
|
+
## Scripted demo on Windows
|
|
25
|
+
|
|
26
|
+
Use three Command Prompt windows. Choose free ports if 3000 or 8080 are already occupied. The RAM upstream and the files under `tmp\beta-review` are disposable. Choose a new directory name for a second run.
|
|
27
|
+
|
|
28
|
+
Install once from the checkout. If you already have a development environment, activate it and install the current source.
|
|
29
|
+
|
|
30
|
+
```bat
|
|
31
|
+
cd /d E:\API-Performance-Auto-Tuner
|
|
32
|
+
python -m venv .venv
|
|
33
|
+
.venv\Scripts\activate
|
|
34
|
+
python -m pip install -e ".[test,benchmark,release]"
|
|
35
|
+
tuneio --version
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Terminal 1** starts the upstream. Keep it running for both captures so application state remains the same.
|
|
39
|
+
|
|
40
|
+
```bat
|
|
41
|
+
cd /d E:\API-Performance-Auto-Tuner
|
|
42
|
+
.venv\Scripts\activate
|
|
43
|
+
tuneio demo --listen 127.0.0.1:3000
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Terminal 2** describes the disposable API, previews a project config and runs the proxy. Copy the preview's `review_token` into the apply command.
|
|
47
|
+
|
|
48
|
+
```bat
|
|
49
|
+
cd /d E:\API-Performance-Auto-Tuner
|
|
50
|
+
.venv\Scripts\activate
|
|
51
|
+
mkdir tmp\beta-review
|
|
52
|
+
>tmp\beta-review\openapi.json echo {"openapi":"3.1.0","paths":{"/api/products":{"get":{}},"/api/products/{id}":{"patch":{}}}}
|
|
53
|
+
tuneio discover --project tmp\beta-review
|
|
54
|
+
tuneio setup --project tmp\beta-review --select 1 --select 2 --upstream http://127.0.0.1:3000 --output observe.json --json
|
|
55
|
+
tuneio setup --project tmp\beta-review --select 1 --select 2 --upstream http://127.0.0.1:3000 --output observe.json --apply SETUP_TOKEN --json
|
|
56
|
+
tuneio serve --config tmp\beta-review\observe.json
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Terminal 3** verifies forwarding, previews the baseline, then captures it. Replace `BASELINE_TOKEN` with the preview's token. The browser is optional.
|
|
60
|
+
|
|
61
|
+
```bat
|
|
62
|
+
cd /d E:\API-Performance-Auto-Tuner
|
|
63
|
+
.venv\Scripts\activate
|
|
64
|
+
curl.exe -i http://127.0.0.1:8080/api/products
|
|
65
|
+
tuneio baseline --config tmp\beta-review\observe.json --output tmp\beta-review\before.json --get /api/products --environment local --requests 8 --warmup 5 --app-state demo-seed-v1 --json
|
|
66
|
+
tuneio baseline --config tmp\beta-review\observe.json --output tmp\beta-review\before.json --get /api/products --environment local --requests 8 --warmup 5 --app-state demo-seed-v1 --apply BASELINE_TOKEN --json
|
|
67
|
+
tuneio optimize enable --config tmp\beta-review\observe.json --route /api/products --baseline tmp\beta-review\before.json --output tmp\beta-review\adaptive.json --json
|
|
68
|
+
tuneio optimize enable --config tmp\beta-review\observe.json --route /api/products --baseline tmp\beta-review\before.json --output tmp\beta-review\adaptive.json --apply POLICY_TOKEN --json
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Replace `POLICY_TOKEN` with the optimization preview's token. Verify the preview includes the PATCH dependency and adaptive thresholds. Stop the proxy in Terminal 2 with **Ctrl+C**. Start the new revision in that terminal.
|
|
72
|
+
|
|
73
|
+
```bat
|
|
74
|
+
tuneio serve --config tmp\beta-review\adaptive.json
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
In **Terminal 3**, use the same application-state identifier and request options. Replace `OPTIMIZED_TOKEN` with the new capture preview's token.
|
|
78
|
+
|
|
79
|
+
```bat
|
|
80
|
+
tuneio baseline --config tmp\beta-review\adaptive.json --stage optimized --output tmp\beta-review\after.json --get /api/products --environment local --requests 8 --warmup 5 --app-state demo-seed-v1 --json
|
|
81
|
+
tuneio baseline --config tmp\beta-review\adaptive.json --stage optimized --output tmp\beta-review\after.json --get /api/products --environment local --requests 8 --warmup 5 --app-state demo-seed-v1 --apply OPTIMIZED_TOKEN --json
|
|
82
|
+
tuneio compare tmp\beta-review\before.json tmp\beta-review\after.json --output tmp\beta-review\comparison.json
|
|
83
|
+
tuneio monitor --config tmp\beta-review\adaptive.json --output tmp\beta-review\monitor.json
|
|
84
|
+
tuneio menu --project tmp\beta-review --config adaptive.json
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The demo can run below the adaptive activation threshold. The capture reports the observed hit count and both latency distributions. In the menu, choose **Session and insights**, then **Open live monitor**. Use tabs to switch among endpoints, cache, findings and resources. Filter with **/**, scroll with **↑/↓** or **j/k**, pause with **Space**, refresh with **r**, choose the refresh interval with **i**, and return with **q**.
|
|
88
|
+
|
|
89
|
+
To verify rollback, exit the menu and run the following in Terminal 3. Replace `ROLLBACK_TOKEN` with the token printed by the first command.
|
|
90
|
+
|
|
91
|
+
```bat
|
|
92
|
+
tuneio optimize rollback --config tmp\beta-review\adaptive.json --output tmp\beta-review\restored.json --json
|
|
93
|
+
tuneio optimize rollback --config tmp\beta-review\adaptive.json --output tmp\beta-review\restored.json --apply ROLLBACK_TOKEN --json
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Press **Ctrl+C** in Terminal 2 and restart it with `tuneio serve --config tmp\beta-review\restored.json`. In Terminal 3, run `curl.exe -i http://127.0.0.1:8080/api/products` and verify `x-autotuner-cache-reason: mode_observe`. Stop Terminal 2 and then Terminal 1 with **Ctrl+C**.
|
|
97
|
+
|
|
98
|
+
On Linux and macOS, use your checkout path, `source .venv/bin/activate`, and `curl`. Write the same OpenAPI JSON using your shell's file redirection.
|
|
99
|
+
|
|
100
|
+
## Use your own API
|
|
101
|
+
|
|
102
|
+
- **Discovery.** Select **Discover and set up this project** or run `tuneio discover --project .`. Select observed operations by ID and start the API using its usual command. An explicit `--openapi-url` fetches a live OpenAPI description from a loopback IP. Static candidates can omit mounted routers, dynamic endpoints or generated routes.
|
|
103
|
+
- **Analysis.** Use `tuneio insights --config FILE --json` or save a passive snapshot with `tuneio baseline --config FILE --output FILE.json`. Use a concrete GET with test data for active runs. Active runs are sequential, stop on failed responses, and allow up to 20 requests including warmup. Ctrl+C requests a stop after the current request.
|
|
104
|
+
- **Policy.** Approve only responses that are public across callers and safe for the reviewed TTL and variant rules. Include all relevant write dependencies. Configured writes are included conservatively, and `--invalidate METHOD PATH` adds dependencies. Use `--read-only` for resources with no dependent writes. Writes made outside the proxy rely on origin freshness and TTL. Cache failure handling can deactivate a rule until there is fresh, successful evidence.
|
|
105
|
+
- **Pause or restore.** Use `optimize pause` for recommendation mode, `optimize disable` to turn caching off, and `optimize rollback` to restore the preceding policy. Each action previews an immutable revision and takes effect on restarting the proxy with that file. Keep revision files in the project so you can inspect the history. The existing `cache clear` command evicts live entries.
|
|
106
|
+
- **Matching and privacy.** Keep route, environment, warmup, request count, pacing, timeout, proxy source, transport configuration and application/data revision the same. Matched captures compare SHA-256 fingerprints of the measured response bytes and can reject changing content. Use non-sensitive public test data. Capture JSON retains fingerprints, normalized operations and counters. Compare reports summarize latency, throughput and cache hits. Rolling observations can include unrelated traffic and have separate sampling indicators.
|
|
107
|
+
- **Export.** `tuneio monitor --once --json` returns a machine-readable snapshot. Use `--output FILE` to save it. `tuneio compare` supports the same export option. `tuneio sessions` lists retained sessions. `tuneio report --format json` retains tuning decisions and `--format csv` exports route metrics. Use `--live` to request a checkpoint from the running proxy.
|
|
108
|
+
|
|
109
|
+
## Troubleshooting
|
|
110
|
+
|
|
111
|
+
| Symptom | What to check |
|
|
112
|
+
| --- | --- |
|
|
113
|
+
| Cannot reach proxy | Select **Start or restart workspace proxy** in **Setup and configuration**. Select the same configuration in the workspace and the monitor. For scripts, start `tuneio serve --config FILE`. |
|
|
114
|
+
| Upstream failure | Start the upstream and verify its listener with `tuneio doctor --config FILE --connect`. |
|
|
115
|
+
| Cache never serves | Check `tuneio cache explain PATH --config FILE --json` for training, privacy, freshness or mutation reasons. |
|
|
116
|
+
| Preview was rejected | Repeat the preview after edits and apply the current token to the same target file. An existing output needs a new filename. |
|
|
117
|
+
| Comparison exits 3 | Inspect the reason codes. Capture a fresh pair with matching options and stable response data. |
|
|
118
|
+
| Monitor is plain or truncated | Widen the terminal, check its font/ANSI support, or use `--once --json` for machine-readable output. |
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Benchmark checkpoint completion boundary
|
|
2
|
+
|
|
3
|
+
## CI evidence
|
|
4
|
+
|
|
5
|
+
Run 43732273878 at commit f538a589f51a9195dce5a2aa3816d3832f6e2ddd passed the Python test suites on all nine OS/Python combinations. Eight complete jobs passed. The macOS/Python 3.11 job failed its two-second soak smoke after the tests, clean installation and quick benchmark succeeded.
|
|
6
|
+
|
|
7
|
+
The uploaded soak-smoke.json reports 200 requests, zero unexpected failures, zero storage write errors, reconciled final monitoring and graceful shutdown. Three intermediate checkpoints sampled these pairs of client requests/server completions: 60/59, 100/99 and 140/139. Each had one request still in flight. Later checkpoints and the final 200/200 snapshot were settled. The stability gate treated those transient post-response samples as leaks.
|
|
8
|
+
|
|
9
|
+
Client receipt of the response's final bytes can precede ASGI post-response cleanup and metric recording. A checkpoint taken immediately after client completion therefore does not establish that server bookkeeping has completed.
|
|
10
|
+
|
|
11
|
+
## Correction
|
|
12
|
+
|
|
13
|
+
Before recording a proxy benchmark checkpoint, observe the read-only status endpoint until completed requests exactly match the measured request count, origin and hot-read admission counters are zero, and coordination keys are released. Bound the observation by a five-second deadline and 100 polls. Each status request is limited by the remaining deadline. Yield scheduling between busy observations without assuming a fixed cleanup delay.
|
|
14
|
+
|
|
15
|
+
Record settlement state, poll count and waiting duration alongside every checkpoint. This applies to paired measurements as well as soak batches. Waiting occurs outside timed client load: no workload request is replayed, no response timing or correctness result is discarded, and no favorable benchmark cohort is selected.
|
|
16
|
+
|
|
17
|
+
If the server remains unsettled, retain its last status as an explicitly unsettled checkpoint. Correctness/stability still fail. If status cannot be obtained, fail the run instead of manufacturing evidence. Cache-budget, persistence-health, shutdown, growth, workload-mixture and 30-minute qualification requirements remain enforced. A two-second smoke can exercise the runner but cannot qualify 30-minute stability.
|
|
18
|
+
|
|
19
|
+
## Regression coverage
|
|
20
|
+
|
|
21
|
+
- Deferred accounting reaches a settled snapshot before recording a checkpoint.
|
|
22
|
+
- Under-counted/over-counted completions, admitted requests, hot reads and coordination leaks remain unsettled.
|
|
23
|
+
- Deadline and poll exhaustion are bounded; timeouts and control errors cannot qualify a sample.
|
|
24
|
+
- Full soak orchestration accepts transient completion lag and rejects persistent lag.
|
|
25
|
+
|
|
26
|
+
Local verification uses controlled synchronization and injected clocks with the managed Windows socketless runner. Real macOS/TCP verification requires the next hosted run. Results are recorded in benchmark_checkpoint_validation.json.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Cache waiter telemetry compatibility fix
|
|
2
|
+
|
|
3
|
+
## Observed failure
|
|
4
|
+
|
|
5
|
+
GitHub run 43730587474, commit be2eb1ae72d5d7ac05d79ef3c323c430f471e348, failed the same test on Windows, Linux and macOS with Python 3.11. Each job reported 500 passing tests and one failure in `test_coalesces_cold_key_and_releases_all_coordination`. The Python 3.12/3.13 jobs passed.
|
|
6
|
+
|
|
7
|
+
The original integration test confirmed one upstream call, seven cached responses and released coordination resources. Its final assertion expected seven coalesced waiters but received zero. This was a telemetry defect rather than a failure of those already-asserted request-sharing behaviors.
|
|
8
|
+
|
|
9
|
+
## Cause and correction
|
|
10
|
+
|
|
11
|
+
The counter inspected `asyncio.Lock.locked()` during registration. On Python 3.11, `asyncio.wait_for(lock.acquire(), timeout)` can queue acquisition in another task. Additional requests can register before that task acquires the lock, so all registrations observe an unlocked lock.
|
|
12
|
+
|
|
13
|
+
Count additional registrations in the active same-key coordination group instead. Registration and reference-count increments contain no await, making the count independent of acquisition scheduling within the supported single event loop. The first request for each group is its leader; later registrations increment the cumulative waiter counter. Cancellation releases references but does not undo the fact that a request joined that group.
|
|
14
|
+
|
|
15
|
+
## Verification
|
|
16
|
+
|
|
17
|
+
Keep the original eight-request integration assertion unchanged. New deterministic cases register the same group with and without immediate leader acquisition. Both require seven waiters; a separate key adds no waiter. Cancelled registrations release references, completed groups retain no coordination objects, and a new group starts with a leader without incrementing the counter.
|
|
18
|
+
|
|
19
|
+
The fix does not change cache keys, cached content, admission limits, invalidation, lock acquisition or release behavior. No CI matrix entry, test assertion, coverage threshold or supported Python version is removed. Verification results and execution limits are recorded in cache_waiter_validation.json. Hosted Python 3.11 verification requires a new run after the fix is pushed.
|