tminus 1.0.1__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.
- tminus-1.0.1/.github/workflows/ci.yml +15 -0
- tminus-1.0.1/.github/workflows/release.yml +73 -0
- tminus-1.0.1/.gitignore +35 -0
- tminus-1.0.1/AGENTS.md +23 -0
- tminus-1.0.1/CHANGELOG.md +12 -0
- tminus-1.0.1/LICENSE +21 -0
- tminus-1.0.1/PKG-INFO +124 -0
- tminus-1.0.1/README.md +103 -0
- tminus-1.0.1/docs/DECISIONS.md +13 -0
- tminus-1.0.1/docs/DEVLOG.md +92 -0
- tminus-1.0.1/docs/architecture.md +43 -0
- tminus-1.0.1/docs/gap-analysis.md +43 -0
- tminus-1.0.1/docs/releasing.md +23 -0
- tminus-1.0.1/docs/roadmap.md +43 -0
- tminus-1.0.1/docs/rule-schema.md +54 -0
- tminus-1.0.1/docs/source-verification.md +38 -0
- tminus-1.0.1/docs/stages.md +35 -0
- tminus-1.0.1/docs/tech-stack.md +23 -0
- tminus-1.0.1/docs/v16-change-catalog.md +140 -0
- tminus-1.0.1/docs/vision.md +30 -0
- tminus-1.0.1/pyproject.toml +60 -0
- tminus-1.0.1/report.txt +202 -0
- tminus-1.0.1/src/tminus/__init__.py +3 -0
- tminus-1.0.1/src/tminus/cli/__init__.py +0 -0
- tminus-1.0.1/src/tminus/cli/main.py +177 -0
- tminus-1.0.1/src/tminus/engine/__init__.py +0 -0
- tminus-1.0.1/src/tminus/engine/app_packaging.py +160 -0
- tminus-1.0.1/src/tminus/engine/baseline.py +84 -0
- tminus-1.0.1/src/tminus/engine/context.py +53 -0
- tminus-1.0.1/src/tminus/engine/env_check.py +133 -0
- tminus-1.0.1/src/tminus/engine/frappe_refs.py +310 -0
- tminus-1.0.1/src/tminus/engine/guards.py +32 -0
- tminus-1.0.1/src/tminus/engine/jinja_refs.py +89 -0
- tminus-1.0.1/src/tminus/engine/js_refs.py +464 -0
- tminus-1.0.1/src/tminus/engine/loader.py +55 -0
- tminus-1.0.1/src/tminus/engine/matchers/__init__.py +22 -0
- tminus-1.0.1/src/tminus/engine/matchers/call.py +65 -0
- tminus-1.0.1/src/tminus/engine/matchers/doctype.py +50 -0
- tminus-1.0.1/src/tminus/engine/matchers/import_path.py +59 -0
- tminus-1.0.1/src/tminus/engine/matchers/query_syntax.py +249 -0
- tminus-1.0.1/src/tminus/engine/matchers/returns_none.py +86 -0
- tminus-1.0.1/src/tminus/engine/matchers/subclass.py +27 -0
- tminus-1.0.1/src/tminus/engine/models.py +217 -0
- tminus-1.0.1/src/tminus/engine/names.py +33 -0
- tminus-1.0.1/src/tminus/engine/paths.py +13 -0
- tminus-1.0.1/src/tminus/engine/pyparse.py +13 -0
- tminus-1.0.1/src/tminus/engine/ref_rules.py +50 -0
- tminus-1.0.1/src/tminus/engine/runner.py +78 -0
- tminus-1.0.1/src/tminus/engine/scanners/__init__.py +0 -0
- tminus-1.0.1/src/tminus/engine/scanners/hooks.py +413 -0
- tminus-1.0.1/src/tminus/engine/scanners/js_ast.py +16 -0
- tminus-1.0.1/src/tminus/engine/scanners/packaging.py +88 -0
- tminus-1.0.1/src/tminus/engine/scanners/print_format.py +105 -0
- tminus-1.0.1/src/tminus/engine/scanners/python_ast.py +29 -0
- tminus-1.0.1/src/tminus/engine/sql_refs.py +92 -0
- tminus-1.0.1/src/tminus/engine/suppress.py +15 -0
- tminus-1.0.1/src/tminus/engine/versions.py +127 -0
- tminus-1.0.1/src/tminus/report/__init__.py +0 -0
- tminus-1.0.1/src/tminus/report/files.py +51 -0
- tminus-1.0.1/src/tminus/report/pdf.py +146 -0
- tminus-1.0.1/src/tminus/report/render.py +407 -0
- tminus-1.0.1/src/tminus/rules/v16/target.yaml +18 -0
- tminus-1.0.1/src/tminus/rules/v16/v16-app-dependency-pins.yaml +102 -0
- tminus-1.0.1/src/tminus/rules/v16/v16-app-frappe-bound-missing.yaml +20 -0
- tminus-1.0.1/src/tminus/rules/v16/v16-app-frappe-bound.yaml +21 -0
- tminus-1.0.1/src/tminus/rules/v16/v16-app-node-engine.yaml +21 -0
- tminus-1.0.1/src/tminus/rules/v16/v16-app-requires-python.yaml +22 -0
- tminus-1.0.1/src/tminus/rules/v16/v16-db-commit-in-doc-events.yaml +26 -0
- tminus-1.0.1/src/tminus/rules/v16/v16-erpnext-get-item-tax-map-keyword-only.yaml +25 -0
- tminus-1.0.1/src/tminus/rules/v16/v16-erpnext-get-itemised-tax-takes-doc.yaml +26 -0
- tminus-1.0.1/src/tminus/rules/v16/v16-erpnext-removed-get-batch-incoming-rate.yaml +26 -0
- tminus-1.0.1/src/tminus/rules/v16/v16-erpnext-removed-or-renamed-fields.yaml +171 -0
- tminus-1.0.1/src/tminus/rules/v16/v16-erpnext-removed-tax-withholding-helpers.yaml +49 -0
- tminus-1.0.1/src/tminus/rules/v16/v16-erpnext-validate-party-frozen-disabled-company-arg.yaml +25 -0
- tminus-1.0.1/src/tminus/rules/v16/v16-first-row-without-order-by.yaml +25 -0
- tminus-1.0.1/src/tminus/rules/v16/v16-frappe-removed-fields.yaml +59 -0
- tminus-1.0.1/src/tminus/rules/v16/v16-get-all-sql-strings.yaml +23 -0
- tminus-1.0.1/src/tminus/rules/v16/v16-get-doc-extra-keywords.yaml +28 -0
- tminus-1.0.1/src/tminus/rules/v16/v16-has-permission-hook-returns-none.yaml +23 -0
- tminus-1.0.1/src/tminus/rules/v16/v16-has-permission-hook-unreadable.yaml +22 -0
- tminus-1.0.1/src/tminus/rules/v16/v16-hrms-removed-fields.yaml +42 -0
- tminus-1.0.1/src/tminus/rules/v16/v16-hrms-removed-get-max-benefits.yaml +26 -0
- tminus-1.0.1/src/tminus/rules/v16/v16-override-doctype-class-no-base.yaml +25 -0
- tminus-1.0.1/src/tminus/rules/v16/v16-override-doctype-class-unreadable.yaml +22 -0
- tminus-1.0.1/src/tminus/rules/v16/v16-removed-doctypes.yaml +54 -0
- tminus-1.0.1/src/tminus/rules/v16/v16-removed-hooks.yaml +24 -0
- tminus-1.0.1/src/tminus/rules/v16/v16-removed-python-stdlib.yaml +21 -0
- tminus-1.0.1/tests/fixtures/app_bad/chaico_app/hooks.py +8 -0
- tminus-1.0.1/tests/fixtures/app_bad/chaico_app/permissions.py +16 -0
- tminus-1.0.1/tests/fixtures/app_clean/chaico_app/hooks.py +5 -0
- tminus-1.0.1/tests/fixtures/app_clean/chaico_app/permissions.py +11 -0
- tminus-1.0.1/tests/fixtures/clean.py +46 -0
- tminus-1.0.1/tests/fixtures/hooks_bad/chaico_hk/events.py +5 -0
- tminus-1.0.1/tests/fixtures/hooks_bad/chaico_hk/hooks.py +3 -0
- tminus-1.0.1/tests/fixtures/hooks_clean/chaico_hc/events.py +5 -0
- tminus-1.0.1/tests/fixtures/hooks_clean/chaico_hc/hooks.py +2 -0
- tminus-1.0.1/tests/fixtures/overrides_bad/chaico_custom/hooks.py +7 -0
- tminus-1.0.1/tests/fixtures/overrides_bad/chaico_custom/overrides.py +11 -0
- tminus-1.0.1/tests/fixtures/overrides_clean/chaico_custom/hooks.py +5 -0
- tminus-1.0.1/tests/fixtures/overrides_clean/chaico_custom/overrides.py +14 -0
- tminus-1.0.1/tests/fixtures/pkg_bad/chaico_pkg/hooks.py +1 -0
- tminus-1.0.1/tests/fixtures/pkg_bad/package.json +4 -0
- tminus-1.0.1/tests/fixtures/pkg_bad/pyproject.toml +7 -0
- tminus-1.0.1/tests/fixtures/pkg_clean/chaico_ok/hooks.py +1 -0
- tminus-1.0.1/tests/fixtures/pkg_clean/package.json +4 -0
- tminus-1.0.1/tests/fixtures/pkg_clean/pyproject.toml +7 -0
- tminus-1.0.1/tests/fixtures/pkg_nobound/chaico_nb/hooks.py +1 -0
- tminus-1.0.1/tests/fixtures/pkg_nobound/pyproject.toml +4 -0
- tminus-1.0.1/tests/fixtures/violations.py +42 -0
- tminus-1.0.1/tests/test_baseline.py +288 -0
- tminus-1.0.1/tests/test_call_matcher.py +130 -0
- tminus-1.0.1/tests/test_cli.py +209 -0
- tminus-1.0.1/tests/test_doctype_refs.py +168 -0
- tminus-1.0.1/tests/test_env_check.py +120 -0
- tminus-1.0.1/tests/test_hooks_scanner.py +85 -0
- tminus-1.0.1/tests/test_import_path.py +58 -0
- tminus-1.0.1/tests/test_js_refs.py +208 -0
- tminus-1.0.1/tests/test_loader.py +76 -0
- tminus-1.0.1/tests/test_names.py +51 -0
- tminus-1.0.1/tests/test_override_hook.py +69 -0
- tminus-1.0.1/tests/test_packaging.py +162 -0
- tminus-1.0.1/tests/test_print_formats.py +128 -0
- tminus-1.0.1/tests/test_real_app_fixes.py +38 -0
- tminus-1.0.1/tests/test_report_files.py +27 -0
- tminus-1.0.1/tests/test_returns_none.py +98 -0
- tminus-1.0.1/tests/test_rule_coverage.py +36 -0
- tminus-1.0.1/tests/test_sql_refs.py +110 -0
- tminus-1.0.1/tests/test_subclass.py +58 -0
- tminus-1.0.1/tests/test_typed_hooks.py +152 -0
- tminus-1.0.1/tests/test_v1_rules.py +281 -0
- tminus-1.0.1/tests/test_versions.py +71 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
on: [push, pull_request]
|
|
3
|
+
jobs:
|
|
4
|
+
test:
|
|
5
|
+
runs-on: ubuntu-latest
|
|
6
|
+
steps:
|
|
7
|
+
- uses: actions/checkout@v4
|
|
8
|
+
- uses: actions/setup-python@v5
|
|
9
|
+
with:
|
|
10
|
+
python-version: "3.12"
|
|
11
|
+
- run: pip install -e ".[dev]"
|
|
12
|
+
- run: ruff check . # lint
|
|
13
|
+
- run: ruff format --check . # formatting
|
|
14
|
+
- run: mypy # types
|
|
15
|
+
- run: pytest # tests
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ["v*"]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
- uses: actions/setup-python@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: "3.12"
|
|
19
|
+
- run: python -m pip install --upgrade pip build
|
|
20
|
+
- run: python -m build
|
|
21
|
+
- uses: actions/upload-artifact@v4
|
|
22
|
+
with:
|
|
23
|
+
name: distributions
|
|
24
|
+
path: dist/
|
|
25
|
+
|
|
26
|
+
wheel-smoke-test:
|
|
27
|
+
needs: build
|
|
28
|
+
runs-on: ubuntu-latest
|
|
29
|
+
steps:
|
|
30
|
+
- uses: actions/checkout@v4
|
|
31
|
+
- uses: actions/setup-python@v5
|
|
32
|
+
with:
|
|
33
|
+
python-version: "3.12"
|
|
34
|
+
- uses: actions/download-artifact@v4
|
|
35
|
+
with:
|
|
36
|
+
name: distributions
|
|
37
|
+
path: dist/
|
|
38
|
+
- run: python -m venv .wheel-test
|
|
39
|
+
- run: .wheel-test/bin/pip install dist/*.whl
|
|
40
|
+
- run: .wheel-test/bin/tminus --version
|
|
41
|
+
- run: .wheel-test/bin/tminus scan tests/fixtures/clean.py --target v16 --fail-on never
|
|
42
|
+
|
|
43
|
+
github-release:
|
|
44
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
45
|
+
needs: wheel-smoke-test
|
|
46
|
+
runs-on: ubuntu-latest
|
|
47
|
+
permissions:
|
|
48
|
+
contents: write
|
|
49
|
+
steps:
|
|
50
|
+
- uses: actions/download-artifact@v4
|
|
51
|
+
with:
|
|
52
|
+
name: distributions
|
|
53
|
+
path: dist/
|
|
54
|
+
- uses: softprops/action-gh-release@v2
|
|
55
|
+
with:
|
|
56
|
+
generate_release_notes: true
|
|
57
|
+
files: dist/*
|
|
58
|
+
|
|
59
|
+
publish-pypi:
|
|
60
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
61
|
+
needs: wheel-smoke-test
|
|
62
|
+
runs-on: ubuntu-latest
|
|
63
|
+
environment:
|
|
64
|
+
name: pypi
|
|
65
|
+
url: https://pypi.org/p/tminus
|
|
66
|
+
steps:
|
|
67
|
+
- uses: actions/download-artifact@v4
|
|
68
|
+
with:
|
|
69
|
+
name: distributions
|
|
70
|
+
path: dist/
|
|
71
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
72
|
+
with:
|
|
73
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
tminus-1.0.1/.gitignore
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
|
|
6
|
+
# Virtual environments
|
|
7
|
+
.venv/
|
|
8
|
+
venv/
|
|
9
|
+
env/
|
|
10
|
+
|
|
11
|
+
# Build files
|
|
12
|
+
dist/
|
|
13
|
+
build/
|
|
14
|
+
|
|
15
|
+
# Testing
|
|
16
|
+
.pytest_cache/
|
|
17
|
+
.coverage
|
|
18
|
+
htmlcov/
|
|
19
|
+
|
|
20
|
+
# Code quality tools
|
|
21
|
+
.mypy_cache/
|
|
22
|
+
.ruff_cache/
|
|
23
|
+
|
|
24
|
+
# Environment variables and secrets
|
|
25
|
+
.env
|
|
26
|
+
.env.*
|
|
27
|
+
!.env.example
|
|
28
|
+
|
|
29
|
+
# IDE
|
|
30
|
+
.vscode/
|
|
31
|
+
.idea/
|
|
32
|
+
|
|
33
|
+
# OS
|
|
34
|
+
.DS_Store
|
|
35
|
+
Thumbs.db
|
tminus-1.0.1/AGENTS.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# AGENTS.md — rules for coding agents working on or with T-MINUS
|
|
2
|
+
|
|
3
|
+
## Working on T-MINUS itself
|
|
4
|
+
1. Rules are data (`rules/<target>/*.yaml`). Adding a rule must never need an engine change; if it does, extend a match type instead.
|
|
5
|
+
2. Every rule needs: a source reference, a violation fixture, a clean fixture. `tests/test_rule_coverage.py` fails otherwise.
|
|
6
|
+
3. Verify each claim against framework source or a merged PR before writing the rule. Do not rely on memory.
|
|
7
|
+
4. Core must not import `frappe`. Anything needing live Frappe lives in `tminus_app`.
|
|
8
|
+
5. Work from the user's latest provided code. No full rewrites when a surgical change suffices.
|
|
9
|
+
|
|
10
|
+
## Using T-MINUS to upgrade a site
|
|
11
|
+
1. Never run against production. Only a restored copy; if the site cannot be identified, stop and ask.
|
|
12
|
+
2. Data fixes happen on v15, followed by a fresh backup. Never fix only the restored copy.
|
|
13
|
+
3. Never delete rows to make a patch pass. Write the script, explain it, stop for human review.
|
|
14
|
+
4. Never edit `apps/frappe`, `apps/erpnext`, `apps/hrms`. Fix the custom app.
|
|
15
|
+
5. One commit per fix, naming the v16 change behind it.
|
|
16
|
+
6. Port code, do not redesign it. Behaviour must stay the same.
|
|
17
|
+
7. A clean exit code is not a clean migration: always read the whole log (`tminus trial` does this).
|
|
18
|
+
8. Report what could not be fixed. A silent guess is worse than an open question.
|
|
19
|
+
|
|
20
|
+
## Project history
|
|
21
|
+
- Design decisions go into `docs/DECISIONS.md`; a short entry per work session goes into `docs/DEVLOG.md`.
|
|
22
|
+
- Work from the latest code in the repo (or the version the user pastes), not from earlier generated output.
|
|
23
|
+
- Keep code comments to short one-liners; every new function gets one.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.0 (2026-11-21)
|
|
4
|
+
|
|
5
|
+
First release: the T-30 static scanner for Frappe/ERPNext v15 → v16.
|
|
6
|
+
|
|
7
|
+
- `tminus scan`: Python, JavaScript, Jinja print formats, `hooks.py`, SQL text and app
|
|
8
|
+
packaging checks; text, JSON, HTML, PDF and SARIF reports; `--fail-on`; `--baseline` / `--write-baseline`;
|
|
9
|
+
`# tminus: ignore[rule-id]` comments.
|
|
10
|
+
- `tminus env`: compare Python, Node, MariaDB and Redis on this machine with what v16 needs.
|
|
11
|
+
- 25 rules, each a YAML file with its evidence, checked against frappe, erpnext and hrms
|
|
12
|
+
version-15 and version-16 source.
|
tminus-1.0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ayush Patel
|
|
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.
|
tminus-1.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: tminus
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: Count down to a clean Frappe/ERPNext upgrade.
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Requires-Python: >=3.12
|
|
7
|
+
Requires-Dist: packaging>=23
|
|
8
|
+
Requires-Dist: pydantic>=2.6
|
|
9
|
+
Requires-Dist: pyyaml>=6.0
|
|
10
|
+
Requires-Dist: reportlab>=4.0
|
|
11
|
+
Requires-Dist: tree-sitter-javascript>=0.23
|
|
12
|
+
Requires-Dist: tree-sitter>=0.23
|
|
13
|
+
Requires-Dist: typer>=0.12
|
|
14
|
+
Provides-Extra: dev
|
|
15
|
+
Requires-Dist: build>=1.2; extra == 'dev'
|
|
16
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
17
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
18
|
+
Requires-Dist: ruff>=0.5; extra == 'dev'
|
|
19
|
+
Requires-Dist: types-pyyaml; extra == 'dev'
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# T-MINUS
|
|
23
|
+
|
|
24
|
+
> Count down to a clean Frappe/ERPNext upgrade.
|
|
25
|
+
|
|
26
|
+
T-MINUS is a read-only command line scanner that finds what will break (or silently
|
|
27
|
+
change) when you upgrade a Frappe/ERPNext app from **v15 to v16**, before you migrate.
|
|
28
|
+
|
|
29
|
+
It reads your app's source, never your site, and never changes anything.
|
|
30
|
+
|
|
31
|
+
## Install
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
git clone <this repository> && cd tminus
|
|
35
|
+
python3 -m venv .venv && . .venv/bin/activate
|
|
36
|
+
pip install -e .
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Python 3.12 or newer is needed to run the tool (it analyses code, it does not run it).
|
|
40
|
+
|
|
41
|
+
## Use
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
tminus scan path/to/your_app --target v16 # scan an app (or a whole bench apps/ folder)
|
|
45
|
+
tminus scan path/to/your_app --target v16 --format pdf
|
|
46
|
+
tminus scan path/to/your_app --target v16 --format sarif
|
|
47
|
+
tminus env path/to/bench --target v16 # compare Python, Node, MariaDB, Redis with v16's needs
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Options of `scan`:
|
|
51
|
+
|
|
52
|
+
| Option | Meaning |
|
|
53
|
+
|---|---|
|
|
54
|
+
| `--format text` / `html` / `pdf` / `json` / `sarif` | Terminal, browser, PDF, JSON, or code-scanning report |
|
|
55
|
+
| `--output FILE` | Choose where to save a report instead of its default Downloads-folder location |
|
|
56
|
+
| `--no-open` | Save an HTML or PDF report without opening it (useful in scripts and CI) |
|
|
57
|
+
| `--color auto` / `always` / `never` | Use color in terminal output; `auto` is the default and disables it for saved output |
|
|
58
|
+
| `--fail-on error` / `warning` / `info` / `never` | Lowest severity that gives exit code 1 (default `error`) |
|
|
59
|
+
| `--write-baseline FILE` | Save today's findings and exit 0 |
|
|
60
|
+
| `--baseline FILE` | Hide findings already in the baseline; only new ones count |
|
|
61
|
+
|
|
62
|
+
Exit codes: `0` clean, `1` findings at or above `--fail-on`, `2` usage error, `3` scan could not run.
|
|
63
|
+
|
|
64
|
+
The text report starts with a plain-language checklist, then groups complete evidence by the
|
|
65
|
+
upgrade rule that found it. It retains the rule ID, every file/line, source snippet and
|
|
66
|
+
rule-provided suggested action. Terminal colors make errors, warnings and behavior reviews
|
|
67
|
+
easier to distinguish; saved output stays plain text by default.
|
|
68
|
+
|
|
69
|
+
The HTML report is self-contained and has collapsible location lists. The PDF report is a
|
|
70
|
+
shareable, paginated version of the same grouped findings. HTML and PDF reports save by default in
|
|
71
|
+
your Downloads folder as `<app>-tminus-<target>-report.<format>`; the machine-readable SARIF
|
|
72
|
+
report saves there too. HTML and PDF reports open automatically after saving; use `--no-open` in
|
|
73
|
+
scripts or CI. Use `--output FILE` to choose another location.
|
|
74
|
+
|
|
75
|
+
SARIF (`.sarif`) is for GitHub code scanning, VS Code and CI tools: it preserves each rule ID,
|
|
76
|
+
severity, file/line location, suggested action and technical context as clickable findings.
|
|
77
|
+
|
|
78
|
+
Silence one finding with a comment on its line: `# tminus: ignore[rule-id]` (Python, Jinja
|
|
79
|
+
`{# ... #}`, `pyproject.toml`) or `// tminus: ignore[rule-id]` (JavaScript).
|
|
80
|
+
|
|
81
|
+
## What it checks (stage T-30)
|
|
82
|
+
|
|
83
|
+
| Area | Examples |
|
|
84
|
+
|---|---|
|
|
85
|
+
| Python | removed stdlib modules (Python 3.14), removed or changed ERPNext/HRMS functions, `get_all` with SQL strings, `frappe.db.commit()` in `doc_events`, `get_doc(..., field=value)`, `has_permission` hooks that can return `None`, `override_doctype_class` that does not subclass |
|
|
86
|
+
| Fields and DocTypes | fields removed or moved (for example `acc_frozen_upto`, `gross_purchase_amount`), removed DocTypes, in Python, SQL text, query-builder variables, hook parameters |
|
|
87
|
+
| Client code | `frm.doc.field`, `frm.set_value(...)`, `frappe.db.get_value(...)` and similar in JavaScript; `{{ doc.field }}` in print formats |
|
|
88
|
+
| Hooks | hooks v16 no longer reads (`leaderboards`, `advance_payment_doctypes`, ...) |
|
|
89
|
+
| Packaging | `requires-python`, `frappe-dependencies` bound, dependency pins that conflict with Frappe v16, Node range |
|
|
90
|
+
|
|
91
|
+
Every rule is a YAML file in `src/tminus/rules/v16/` with the evidence it was built from. The
|
|
92
|
+
rules were checked against the real `frappe`, `erpnext` and `hrms` version-15 and version-16
|
|
93
|
+
source, and they do not fire on v16's own application code.
|
|
94
|
+
|
|
95
|
+
Findings are classified as **data**, **loud** (fails during migrate), **quiet** (fails when
|
|
96
|
+
the code runs) or **silent** (runs but behaves differently).
|
|
97
|
+
|
|
98
|
+
## What it does not check (yet)
|
|
99
|
+
|
|
100
|
+
A clean report means "no known problems", not "safe to upgrade".
|
|
101
|
+
|
|
102
|
+
- Your site's data (invalid JSON, custom field clashes, rows of removed DocTypes) and code
|
|
103
|
+
stored in the database (Client Scripts, Server Scripts, Print Formats saved on the site)
|
|
104
|
+
- `bench migrate` itself (log analysis) and rehearsal timing
|
|
105
|
+
- Differences in behaviour between a v15 and a v16 site (permissions, report numbers)
|
|
106
|
+
- JavaScript in shared controller classes, child-table rows in print formats
|
|
107
|
+
|
|
108
|
+
See [docs/roadmap.md](docs/roadmap.md) for what comes next.
|
|
109
|
+
|
|
110
|
+
## Development
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
pip install -e ".[dev]"
|
|
114
|
+
ruff check . && ruff format --check . && mypy && pytest
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
To add a rule, see [docs/rule-schema.md](docs/rule-schema.md): a rule is one YAML file, and
|
|
118
|
+
`tests/test_rule_coverage.py` fails until it has a violating and a clean example.
|
|
119
|
+
|
|
120
|
+
See [docs/releasing.md](docs/releasing.md) for the wheel, GitHub Release and PyPI release process.
|
|
121
|
+
|
|
122
|
+
## License
|
|
123
|
+
|
|
124
|
+
MIT
|
tminus-1.0.1/README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# T-MINUS
|
|
2
|
+
|
|
3
|
+
> Count down to a clean Frappe/ERPNext upgrade.
|
|
4
|
+
|
|
5
|
+
T-MINUS is a read-only command line scanner that finds what will break (or silently
|
|
6
|
+
change) when you upgrade a Frappe/ERPNext app from **v15 to v16**, before you migrate.
|
|
7
|
+
|
|
8
|
+
It reads your app's source, never your site, and never changes anything.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
git clone <this repository> && cd tminus
|
|
14
|
+
python3 -m venv .venv && . .venv/bin/activate
|
|
15
|
+
pip install -e .
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Python 3.12 or newer is needed to run the tool (it analyses code, it does not run it).
|
|
19
|
+
|
|
20
|
+
## Use
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
tminus scan path/to/your_app --target v16 # scan an app (or a whole bench apps/ folder)
|
|
24
|
+
tminus scan path/to/your_app --target v16 --format pdf
|
|
25
|
+
tminus scan path/to/your_app --target v16 --format sarif
|
|
26
|
+
tminus env path/to/bench --target v16 # compare Python, Node, MariaDB, Redis with v16's needs
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Options of `scan`:
|
|
30
|
+
|
|
31
|
+
| Option | Meaning |
|
|
32
|
+
|---|---|
|
|
33
|
+
| `--format text` / `html` / `pdf` / `json` / `sarif` | Terminal, browser, PDF, JSON, or code-scanning report |
|
|
34
|
+
| `--output FILE` | Choose where to save a report instead of its default Downloads-folder location |
|
|
35
|
+
| `--no-open` | Save an HTML or PDF report without opening it (useful in scripts and CI) |
|
|
36
|
+
| `--color auto` / `always` / `never` | Use color in terminal output; `auto` is the default and disables it for saved output |
|
|
37
|
+
| `--fail-on error` / `warning` / `info` / `never` | Lowest severity that gives exit code 1 (default `error`) |
|
|
38
|
+
| `--write-baseline FILE` | Save today's findings and exit 0 |
|
|
39
|
+
| `--baseline FILE` | Hide findings already in the baseline; only new ones count |
|
|
40
|
+
|
|
41
|
+
Exit codes: `0` clean, `1` findings at or above `--fail-on`, `2` usage error, `3` scan could not run.
|
|
42
|
+
|
|
43
|
+
The text report starts with a plain-language checklist, then groups complete evidence by the
|
|
44
|
+
upgrade rule that found it. It retains the rule ID, every file/line, source snippet and
|
|
45
|
+
rule-provided suggested action. Terminal colors make errors, warnings and behavior reviews
|
|
46
|
+
easier to distinguish; saved output stays plain text by default.
|
|
47
|
+
|
|
48
|
+
The HTML report is self-contained and has collapsible location lists. The PDF report is a
|
|
49
|
+
shareable, paginated version of the same grouped findings. HTML and PDF reports save by default in
|
|
50
|
+
your Downloads folder as `<app>-tminus-<target>-report.<format>`; the machine-readable SARIF
|
|
51
|
+
report saves there too. HTML and PDF reports open automatically after saving; use `--no-open` in
|
|
52
|
+
scripts or CI. Use `--output FILE` to choose another location.
|
|
53
|
+
|
|
54
|
+
SARIF (`.sarif`) is for GitHub code scanning, VS Code and CI tools: it preserves each rule ID,
|
|
55
|
+
severity, file/line location, suggested action and technical context as clickable findings.
|
|
56
|
+
|
|
57
|
+
Silence one finding with a comment on its line: `# tminus: ignore[rule-id]` (Python, Jinja
|
|
58
|
+
`{# ... #}`, `pyproject.toml`) or `// tminus: ignore[rule-id]` (JavaScript).
|
|
59
|
+
|
|
60
|
+
## What it checks (stage T-30)
|
|
61
|
+
|
|
62
|
+
| Area | Examples |
|
|
63
|
+
|---|---|
|
|
64
|
+
| Python | removed stdlib modules (Python 3.14), removed or changed ERPNext/HRMS functions, `get_all` with SQL strings, `frappe.db.commit()` in `doc_events`, `get_doc(..., field=value)`, `has_permission` hooks that can return `None`, `override_doctype_class` that does not subclass |
|
|
65
|
+
| Fields and DocTypes | fields removed or moved (for example `acc_frozen_upto`, `gross_purchase_amount`), removed DocTypes, in Python, SQL text, query-builder variables, hook parameters |
|
|
66
|
+
| Client code | `frm.doc.field`, `frm.set_value(...)`, `frappe.db.get_value(...)` and similar in JavaScript; `{{ doc.field }}` in print formats |
|
|
67
|
+
| Hooks | hooks v16 no longer reads (`leaderboards`, `advance_payment_doctypes`, ...) |
|
|
68
|
+
| Packaging | `requires-python`, `frappe-dependencies` bound, dependency pins that conflict with Frappe v16, Node range |
|
|
69
|
+
|
|
70
|
+
Every rule is a YAML file in `src/tminus/rules/v16/` with the evidence it was built from. The
|
|
71
|
+
rules were checked against the real `frappe`, `erpnext` and `hrms` version-15 and version-16
|
|
72
|
+
source, and they do not fire on v16's own application code.
|
|
73
|
+
|
|
74
|
+
Findings are classified as **data**, **loud** (fails during migrate), **quiet** (fails when
|
|
75
|
+
the code runs) or **silent** (runs but behaves differently).
|
|
76
|
+
|
|
77
|
+
## What it does not check (yet)
|
|
78
|
+
|
|
79
|
+
A clean report means "no known problems", not "safe to upgrade".
|
|
80
|
+
|
|
81
|
+
- Your site's data (invalid JSON, custom field clashes, rows of removed DocTypes) and code
|
|
82
|
+
stored in the database (Client Scripts, Server Scripts, Print Formats saved on the site)
|
|
83
|
+
- `bench migrate` itself (log analysis) and rehearsal timing
|
|
84
|
+
- Differences in behaviour between a v15 and a v16 site (permissions, report numbers)
|
|
85
|
+
- JavaScript in shared controller classes, child-table rows in print formats
|
|
86
|
+
|
|
87
|
+
See [docs/roadmap.md](docs/roadmap.md) for what comes next.
|
|
88
|
+
|
|
89
|
+
## Development
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
pip install -e ".[dev]"
|
|
93
|
+
ruff check . && ruff format --check . && mypy && pytest
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
To add a rule, see [docs/rule-schema.md](docs/rule-schema.md): a rule is one YAML file, and
|
|
97
|
+
`tests/test_rule_coverage.py` fails until it has a violating and a clean example.
|
|
98
|
+
|
|
99
|
+
See [docs/releasing.md](docs/releasing.md) for the wheel, GitHub Release and PyPI release process.
|
|
100
|
+
|
|
101
|
+
## License
|
|
102
|
+
|
|
103
|
+
MIT
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# DECISIONS
|
|
2
|
+
|
|
3
|
+
Short decision records. Add new ones at the bottom. Status: accepted | superseded.
|
|
4
|
+
|
|
5
|
+
| # | Date | Decision | Why | Status |
|
|
6
|
+
|---|---|---|---|---|
|
|
7
|
+
| 1 | 2026-10-30 | Project name: T-MINUS, CLI `tminus` | Countdown maps to upgrade stages T-30..T-0 | accepted |
|
|
8
|
+
| 2 | 2026-10-30 | Architecture: standalone Python CLI core + thin Frappe app | CI use without a bench, plus UI and runtime checks | accepted |
|
|
9
|
+
| 3 | 2026-10-30 | Read-only by default; mutation only via `tminus fix --apply` | Safety; matches playbook rules | accepted (confirmed by user's approval of stage design; re-confirm if disputed) |
|
|
10
|
+
| 4 | 2026-10-30 | v1 scope: Frappe/ERPNext v15 -> v16 only | Engine stays version-agnostic; other frameworks are a later idea | accepted (same note as #3) |
|
|
11
|
+
| 5 | 2026-10-30 | Stack: Python 3.12+, typer, ast + libcst, tree-sitter, jinja2 parser, YAML + pydantic v2, PyMySQL/mariadb read-only, pytest, ruff, mypy | See docs/tech-stack.md | accepted |
|
|
12
|
+
| 6 | 2026-10-30 | Core never imports `frappe`; live-Frappe checks live in `tminus_app` | Core must run anywhere | accepted |
|
|
13
|
+
| 7 | 2026-10-30 | Project history kept in repo files (DEVLOG, DECISIONS, git log) | Continuity across work sessions | accepted |
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# DEVLOG
|
|
2
|
+
|
|
3
|
+
Newest first. One entry per working session or logical change. Records what changed in each session.
|
|
4
|
+
|
|
5
|
+
## Template
|
|
6
|
+
```
|
|
7
|
+
## YYYY-MM-DD — <short title>
|
|
8
|
+
- Commit: <hash or "uncommitted">
|
|
9
|
+
- Changed: <repo-relative paths>
|
|
10
|
+
- Why: <one line>
|
|
11
|
+
- Tests: <what ran, result>
|
|
12
|
+
- Open: <anything unfinished or risky>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 2026-11-21 — Version 1.0.0 release preparation
|
|
16
|
+
- Commit: uncommitted
|
|
17
|
+
- Changed: pyproject.toml, src/tminus/__init__.py, CHANGELOG.md
|
|
18
|
+
- Why: align the installed package and CLI version with the first release tag.
|
|
19
|
+
- Tests: 310 passed; ruff, ruff format --check and mypy --strict clean. Built `tminus-1.0.0` wheel and source archive; installed the wheel in a fresh environment and ran `tminus --version` plus a clean scan.
|
|
20
|
+
- Open: configure PyPI Trusted Publishing, commit this version bump, then push tag `v1.0.0`.
|
|
21
|
+
|
|
22
|
+
## 2026-11-21 — Release workflow and wheel smoke test
|
|
23
|
+
- Commit: uncommitted
|
|
24
|
+
- Changed: .github/workflows/release.yml, pyproject.toml, README.md, docs/releasing.md
|
|
25
|
+
- Why: build a wheel and source distribution, install the wheel in a clean environment, then create a GitHub Release and publish through PyPI Trusted Publishing only for an intentional version tag.
|
|
26
|
+
- Tests: 310 passed; ruff, ruff format --check and mypy --strict clean. Built the wheel and source archive; installed the wheel into a fresh environment and ran `tminus --version` plus a clean scan.
|
|
27
|
+
- Open: configure PyPI Trusted Publishing before the first tagged release.
|
|
28
|
+
|
|
29
|
+
## 2026-11-21 — Saved HTML, PDF and SARIF reports
|
|
30
|
+
- Commit: uncommitted
|
|
31
|
+
- Changed: pyproject.toml, cli/main.py, report/{files,pdf,render}.py, tests/{test_cli,test_baseline,test_report_files}.py, README.md, CHANGELOG.md, docs/{roadmap,tech-stack}.md
|
|
32
|
+
- Why: write and automatically open self-contained HTML or PDF reports without shell redirection; use an installed Linux browser rather than an HTML file association that can launch the wrong application; use app-named Downloads-folder files by default; export SARIF 2.1.0 for code-scanning tools.
|
|
33
|
+
- Tests: 310 passed; ruff, ruff format --check and mypy --strict clean. A real CLI export produced SARIF 2.1.0 with 25 rule definitions and 22 findings; PDF rendered to five A4 pages and visually inspected.
|
|
34
|
+
- Open: upload integration for a specific CI provider is deliberately left to that provider's workflow.
|
|
35
|
+
|
|
36
|
+
## 2026-11-21 — Real-app scan noise fixes
|
|
37
|
+
- Commit: uncommitted
|
|
38
|
+
- Changed: engine/{pyparse,jinja_refs}.py, engine/{scanners/python_ast,matchers/query_syntax}.py, tests/test_real_app_fixes.py
|
|
39
|
+
- Why: precision_mass exposed a parser warning, duplicate unordered-query findings, and valid Jinja inline conditionals reported as unchecked.
|
|
40
|
+
- Tests: 298 passed; ruff, ruff format --check and mypy --strict clean. precision_mass: no SyntaxWarning or unparsable-Jinja note; first-row findings reduced 19 -> 16.
|
|
41
|
+
- Open: review the remaining real-app upgrade findings separately.
|
|
42
|
+
|
|
43
|
+
## 2026-11-04 — M1.7 bench and app compatibility
|
|
44
|
+
- New: engine/{versions,app_packaging,env_check}.py, scanners/packaging.py, 5 rules v16-app-*, fixtures pkg_*, tests/{test_versions,test_packaging,test_env_check}.py
|
|
45
|
+
- Edited: models.py (PackageMatch, TargetInfo), loader.py (load_target), runner.py (pass 5), cli/main.py (env), target.yaml (requirements), render.py
|
|
46
|
+
- Why: an app whose python/frappe/pins/node ranges exclude v16 cannot be installed on a v16 bench. Facts verified in frappe 16.54.0, erpnext/hrms v15+v16 and bench source.
|
|
47
|
+
- Tests: 236 passed. ERPNext v15 flagged (frappe bound, pycountry pin); ERPNext v16 and HRMS v16 clean.
|
|
48
|
+
- Open: frappe pins go stale when v16 is updated (regenerate); required_apps / version-16 branch existence needs --online; symlinked app folders are not followed.
|
|
49
|
+
|
|
50
|
+
## 2026-11-04 — M1.6 Print Formats and client JavaScript
|
|
51
|
+
- New: engine/{jinja_refs,js_refs,ref_rules}.py, scanners/{js_ast,print_format}.py, tests/{test_js_refs,test_print_formats}.py
|
|
52
|
+
- Edited: runner.py (JS and print format passes), frappe_refs.py (seed), matchers/doctype.py (name_hits), suppress.py (// comments), pyproject.toml (tree-sitter)
|
|
53
|
+
- Why: client scripts and print formats reach fields through frm.doc / doc, not through get_doc.
|
|
54
|
+
- Tests: 176 passed. ERPNext v15: 82 genuine JS findings; v16 sources: only stale upstream leftovers.
|
|
55
|
+
- Open: shared controllers (this.frm.doc), child rows in print formats, DB-stored print formats and client scripts, other Jinja (Notification, Email Template).
|
|
56
|
+
|
|
57
|
+
## 2026-10-31 — M1.3 call matcher
|
|
58
|
+
- Changed (new): engine/{guards,names,context}.py, engine/matchers/call.py, 6 rules in rules/v16/ (get-batch-incoming-rate, get-item-tax-map, get-itemised-tax, validate-party-frozen-disabled, hrms get-max-benefits, tax-withholding helpers), tests/{test_names,test_call_matcher}.py
|
|
59
|
+
- Changed (edited): models.py (CallMatch), matchers/__init__.py, matchers/import_path.py, scanners/python_ast.py (FileContext), tests/test_loader.py, fixtures
|
|
60
|
+
- Why: removed/changed ERPNext and HRMS functions fail at import or call time. Paths and signatures verified against erpnext/hrms version-15 and version-16 source.
|
|
61
|
+
- Tests: 90 passed. Scan of ERPNext v15 = 12 real findings; ERPNext v16 + HRMS v16 = 0.
|
|
62
|
+
- Open: positional_count misses keyword-style calls; first_arg_named is a heuristic; alias table is scope-insensitive; string paths (frappe.get_attr("...")) not followed.
|
|
63
|
+
|
|
64
|
+
## 2026-10-31 — M1.2 override_doctype_class rule
|
|
65
|
+
- Commit: <your hash>
|
|
66
|
+
- Changed (new): engine/matchers/subclass.py, rules/v16/v16-override-doctype-class-{no-base,unreadable}.yaml, tests/{test_subclass,test_override_hook}.py, tests/fixtures/overrides_{bad,clean}/
|
|
67
|
+
- Changed (edited): engine/models.py (HookClassMatch), engine/scanners/hooks.py (refactored: _apply_rule, HookContext, Located), report/render.py, tests/test_rule_coverage.py, docs/rule-schema.md
|
|
68
|
+
- Why: v16 requires an override class to inherit from the class it overrides (PR #26152).
|
|
69
|
+
- Tests: 62 passed; ruff, ruff format --check, mypy --strict clean.
|
|
70
|
+
- Open: cannot verify a base is the original controller (needs runtime stage); only module-level classes resolved.
|
|
71
|
+
|
|
72
|
+
## 2026-10-30 — M1.1 has_permission rule (app-level scanning)
|
|
73
|
+
- Commit: uncommitted
|
|
74
|
+
- Changed (new): src/tminus/engine/{suppress,paths}.py, engine/matchers/returns_none.py, engine/scanners/hooks.py, rules/v16/{v16-has-permission-hook-returns-none,v16-has-permission-hook-unreadable}.yaml, tests/{test_returns_none,test_hooks_scanner}.py, tests/fixtures/app_bad/, tests/fixtures/app_clean/
|
|
75
|
+
- Changed (edited): engine/models.py (HookFunctionMatch, match union, Finding.detail + from_rule), engine/matchers/import_path.py (type guard), engine/scanners/python_ast.py and engine/runner.py (refactored: shared suppress/paths, second pass for hook rules), report/render.py (detail line), tests/test_rule_coverage.py (file + app fixtures), docs/rule-schema.md
|
|
76
|
+
- Why: a has_permission hook that can return None now denies access in v16 (silent behaviour; Administrator hides it). Needs hooks.py + the target function, so an app-level pass was added after the per-file pass.
|
|
77
|
+
- Tests: 46 passed; ruff, ruff format --check, mypy --strict clean.
|
|
78
|
+
- Open: only module-level functions are resolved (not class methods); hooks other than has_permission not covered yet; non-literal hook tables are listed as "not checked".
|
|
79
|
+
|
|
80
|
+
## 2026-10-30 — M0 skeleton
|
|
81
|
+
- Commit: uncommitted
|
|
82
|
+
- Changed: pyproject.toml, .gitignore, .github/workflows/ci.yml, src/tminus/{__init__,cli/main,engine/{models,loader,runner},engine/matchers/{__init__,import_path},engine/scanners/python_ast,report/render}.py, src/tminus/rules/v16/{target.yaml,v16-removed-python-stdlib.yaml}, tests/{test_loader,test_import_path,test_rule_coverage,test_cli}.py, tests/fixtures/{violations,clean}.py
|
|
83
|
+
- Why: working base for T-30: rule models, YAML loader, import_path matcher (skips try/except ImportError, supports `# tminus: ignore[id]`), `tminus scan` with exit codes 0/1/2/3, text and json output.
|
|
84
|
+
- Tests: 24 passed; ruff check, ruff format --check and mypy --strict clean (Python 3.12.3).
|
|
85
|
+
- Open: version-gated code (`if frappe.__version__ ...`) not skipped yet; only the import_path matcher exists; starter rule's module list still to verify against Python 3.14 release notes.
|
|
86
|
+
|
|
87
|
+
## 2026-10-30 — Design docs created and source-verified
|
|
88
|
+
- Commit: uncommitted
|
|
89
|
+
- Changed: README.md, AGENTS.md, docs/{vision,gap-analysis,architecture,stages,rule-schema,v16-change-catalog,tech-stack,roadmap,source-verification,DECISIONS,DEVLOG}.md
|
|
90
|
+
- Why: define T-MINUS (v15 -> v16 upgrade readiness tool) before writing code; catalog cross-checked against the Frappe v16 wiki and Preflight rules page.
|
|
91
|
+
- Tests: none (docs only)
|
|
92
|
+
- Open: name availability (PyPI/GitHub/Frappe app) unchecked; orphan-doctype data-loss claim disputed between sources; catalog entries still need verification against framework source.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
T-MINUS is a read-only Python package (`src/tminus/`). The core never imports `frappe`.
|
|
4
|
+
|
|
5
|
+
## Layout
|
|
6
|
+
|
|
7
|
+
| Path | Role |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `cli/main.py` | `scan` and `env` commands, exit codes |
|
|
10
|
+
| `engine/models.py`, `loader.py` | rule/finding models (pydantic), YAML loading, `target.yaml` |
|
|
11
|
+
| `engine/runner.py` | runs the scan passes below |
|
|
12
|
+
| `engine/context.py`, `names.py`, `guards.py` | per-file facts: import aliases, `try/except ImportError` regions |
|
|
13
|
+
| `engine/matchers/` | one function per match type (`import_path`, `call`, `doctype`, `query_syntax`, ...) |
|
|
14
|
+
| `engine/scanners/` | app-level passes: `hooks`, `js_ast`, `print_format`, `packaging` |
|
|
15
|
+
| `engine/frappe_refs.py`, `sql_refs.py`, `jinja_refs.py`, `js_refs.py` | find DocType/field references in Python, SQL text, Jinja, JavaScript |
|
|
16
|
+
| `engine/app_packaging.py`, `versions.py`, `env_check.py` | packaging facts, version ranges, `tminus env` |
|
|
17
|
+
| `engine/baseline.py`, `report/render.py` | baselines, text/JSON reports |
|
|
18
|
+
| `rules/v16/*.yaml` | the rules (data) |
|
|
19
|
+
|
|
20
|
+
## Scan passes (`tminus scan`)
|
|
21
|
+
|
|
22
|
+
1. Per Python file: parse once, build the file context, run the per-file matchers.
|
|
23
|
+
2. `hooks.py`: hook functions/classes, removed hooks, typed hook parameters, `doc_events`.
|
|
24
|
+
3. JavaScript files (tree-sitter).
|
|
25
|
+
4. Standard print formats (JSON + Jinja template).
|
|
26
|
+
5. App packaging (`pyproject.toml`, `setup.py`, `requirements.txt`, `package.json`).
|
|
27
|
+
|
|
28
|
+
Then the baseline is applied, the report is printed, and the exit code is set.
|
|
29
|
+
|
|
30
|
+
## Safety
|
|
31
|
+
|
|
32
|
+
Read-only: nothing is written except an optional baseline file you ask for. `frappe`,
|
|
33
|
+
`erpnext` and `hrms` themselves are skipped as upstream apps where their v15 files would only
|
|
34
|
+
add noise.
|
|
35
|
+
|
|
36
|
+
## Exit codes
|
|
37
|
+
|
|
38
|
+
0 clean, 1 findings at or above `--fail-on`, 2 usage error, 3 scan could not run.
|
|
39
|
+
|
|
40
|
+
## Not built yet
|
|
41
|
+
|
|
42
|
+
Data checks (T-14), the migrate runner (T-7), rehearsal and cutover (T-1/T-0), the Frappe app,
|
|
43
|
+
differential tests, codemods, SARIF/HTML. See `roadmap.md`.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Gap analysis
|
|
2
|
+
|
|
3
|
+
Sources: kaulith/preflight docs (README, overview, rules, writing-a-rule), BWH *ERPNext Upgrade Playbook*, Frappe wiki *Migrating to version 16*.
|
|
4
|
+
Source code of Preflight was not reviewed; items marked "no rule found" are based on its published rule list.
|
|
5
|
+
|
|
6
|
+
## What Preflight does well (keep)
|
|
7
|
+
- Rules as validated YAML, proof link per rule, `fix: before | with-upgrade`, optional `shim`.
|
|
8
|
+
- Fixtures for violations and clean cases, with a rule-coverage test.
|
|
9
|
+
- Skips code written to survive the change (`try/except ImportError`, version-gated code).
|
|
10
|
+
- Bench compatibility checks (Python, node, `required_apps`, dependency pins, wheels).
|
|
11
|
+
- `--baseline`, `preflight: ignore[rule]`, SARIF/HTML output, exit codes 0-3.
|
|
12
|
+
- Honest "not checked" reporting.
|
|
13
|
+
|
|
14
|
+
## More Preflight features to keep
|
|
15
|
+
- Upstream apps (on frappe's own version branch) listed apart and not counted; `--app` counts them.
|
|
16
|
+
- Findings in patches already run (Patch Log) listed apart; patches still to run are counted and marked.
|
|
17
|
+
- Disabled Server/Client Scripts skipped; `--skip-tests`; `--open`; built files skipped; `--path` mode reports what it could not check.
|
|
18
|
+
- Reads site records for: workspaces without a module, private workspaces, Repost Allowed Types.
|
|
19
|
+
|
|
20
|
+
## Gaps T-MINUS closes
|
|
21
|
+
| # | Gap | Source | T-MINUS answer |
|
|
22
|
+
|---|---|---|---|
|
|
23
|
+
| 1 | Only frappe + ERPNext rules (113) | Preflight rules.md | Rule generator for any app (hrms, payments, india_compliance, custom) |
|
|
24
|
+
| 2 | Rules written by hand per version | writing-a-rule.md | Branch-diff rule generator, human reviewed |
|
|
25
|
+
| 3 | Static only; cannot see silent behaviour | overview.md "Limits" | Differential tests (T-3) |
|
|
26
|
+
| 4 | Reads only some site records (workspaces, repost types, customisations); no integrity checks such as bad `item_tax_rate` JSON that crashes an ERPNext patch | overview.md, Playbook | `tminus data` (T-14) |
|
|
27
|
+
| 5 | No row counts for doctypes leaving the framework. Sources disagree on whether their data is dropped (Playbook) or survives (Preflight) | Playbook, rules.md | Row counts at T-14, plus a table-survival comparison before/after migrate at T-7 to settle it per site |
|
|
28
|
+
| 6 | Does not run or read `bench migrate` | Playbook | `tminus trial` log analysis; flags "Skipping fixture ... ImportError" warnings with exit 0 |
|
|
29
|
+
| 7 | Custom field vs new standard field clash not detected | Playbook | Compare custom fields to target's standard fields |
|
|
30
|
+
| 8 | Site-saved code list omits Print Formats (Jinja), Email Templates, `depends_on`/`fetch_from` expressions | overview.md | Jinja + expression scanning |
|
|
31
|
+
| 9 | JS matched line by line with regex | overview.md | tree-sitter parsing |
|
|
32
|
+
| 10 | No autofix | overview.md | Opt-in libcst codemods for safe rules |
|
|
33
|
+
| 11 | Sort change `modified`→`creation` deliberately not covered | rules.md "Not covered" | Targeted heuristics: first/last-row logic without `order_by`, DocType `sort_field`, differential list check |
|
|
34
|
+
| 12 | Upgrade steps not covered | overview.md | Stages T-7 to T-0 |
|
|
35
|
+
| 13 | HRMS changes (Holiday List Assignment, removed benefit helpers) not covered | Playbook | HRMS rule set + data check for Employee holiday lists |
|
|
36
|
+
| 14 | Wiki items with no rule found | Wiki | See `v16-change-catalog.md` (marked NEW) |
|
|
37
|
+
|
|
38
|
+
## Wiki items with no Preflight rule found (candidates)
|
|
39
|
+
`db.commit()` in doc hooks; `db.get_value` casting single doctypes; JS in Reports/Charts/Pages evaluated as IIFEs;
|
|
40
|
+
`get_doc(dt, name, field=value)` no longer updates; `sendmail(now=True)` no longer commits; POST-only methods
|
|
41
|
+
(`logout`, `web_logout`, `upload_file`, `send_login_link`); `site_cache` with unhashable args; `!= None` filter fix;
|
|
42
|
+
time-field default removed; `meta.get_valid_columns` excludes virtual fields; `get_translated_dict` hook and translate helpers removed;
|
|
43
|
+
System Console admin-only; Country `code` now required.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Releasing T-MINUS
|
|
2
|
+
|
|
3
|
+
The release workflow runs when a `v*` tag is pushed. It builds the wheel and source distribution,
|
|
4
|
+
installs the wheel in a fresh virtual environment, runs a scanner smoke test, creates the GitHub
|
|
5
|
+
release and publishes to PyPI.
|
|
6
|
+
|
|
7
|
+
Before the first release, configure PyPI Trusted Publishing for this GitHub repository:
|
|
8
|
+
|
|
9
|
+
- owner and repository: this repository's GitHub location
|
|
10
|
+
- workflow: `release.yml`
|
|
11
|
+
- environment: `pypi`
|
|
12
|
+
|
|
13
|
+
The workflow uses GitHub's OIDC token, so no PyPI API token is stored in the repository.
|
|
14
|
+
|
|
15
|
+
Release only after the CI workflow is green:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
git tag v1.0.0
|
|
19
|
+
git push origin v1.0.0
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The tag is the deliberate publish action. Running the workflow manually only builds and tests the
|
|
23
|
+
artifacts; it does not create a GitHub release or publish to PyPI.
|