From 14036afcd168dda870355ed651e35f6a08eb2281 Mon Sep 17 00:00:00 2001 From: euisuh <55032583+euisuh@users.noreply.github.com> Date: Wed, 28 Oct 2026 00:44:08 +0900 Subject: [PATCH] chore: add MIT license proposal, pytest smoke tests, ruff lint in CI Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01BQNvypim823UvUJXvw9amj --- .github/workflows/ci.yml | 29 +++++------------------------ .gitignore | 2 ++ LICENSE | 21 +++++++++++++++++++++ README.md | 6 +++++- tests/test_smoke.py | 28 ++++++++++++++++++++++++++++ 5 files changed, 61 insertions(+), 25 deletions(-) create mode 100644 LICENSE create mode 100644 tests/test_smoke.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e9f4eee..8a0fb76 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,29 +13,10 @@ jobs: # ponytail: pandas + requests only. vllm/torch need a GPU and multi-GB wheels, # and every experiment needs assets/CVEfixes.db, which is not in the repo. - - run: pip install pandas requests + - run: pip install pandas requests pytest ruff - - name: Compile all sources - run: python -m compileall -q . + - name: Lint (syntax errors and undefined names) + run: ruff check --select E9,F63,F7,F82 *.py tests - - name: Prompt library renders - run: | - python -c " - from prompts_kat import promptS1, promptR1, promptD1 - p = promptS1('int f(){}', 'Out-of-bounds Write') - assert 'int f(){}' in p and 'Out-of-bounds Write' in p, p - assert promptD1('x', 'Use After Free', 'desc').count('desc') == 1 - assert 'Out-of-bounds Write' in promptR1('int f(){}', 'Out-of-bounds Write') - " - - - name: Paired scoring is correct - run: | - python -c " - import pandas as pd - from utils import calculate_metrics - df = pd.DataFrame({'pred_before': [1, 0, -1], 'pred_after': [1, 0, -1]}) - assert calculate_metrics(df, 'pred_before', 'pred_after') == (1, 1, 1, 1, 1, 1) - " - - - name: Notebooks are valid JSON - run: python -c "import json,glob; [json.load(open(f)) for f in glob.glob('*.ipynb')]" + - name: Smoke tests + run: pytest -q diff --git a/.gitignore b/.gitignore index e9442ad..eb72081 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ kat_*/ assets/ __pycache__/ tmp/ +.DS_Store +.venv/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a0ec1ab --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Euisuh Jeong + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 40d0c5f..387b926 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,7 @@ print(calculate_metrics(df, 'pred_before', 'pred_after')) # (tp, fp, tn, fn, na " ``` -Both snippets run with only `pandas` installed — no GPU, no database. They are what CI executes on every push. +Both snippets run with only `pandas` installed — no GPU, no database. The same checks run as `pytest` (`tests/test_smoke.py`) in CI on every push, plus a `ruff` lint for syntax errors and undefined names. ## Example workflow @@ -236,3 +236,7 @@ C++ pairs were extracted (`CVEFixes_c++.csv`) but were not tabulated per CWE. of the original run, kept so the published `S2` numbers stay reproducible. - **Evaluated models are 7–8B open weights** (llama3, codeQwen, deepSeekCoder, artigenz) at temperature 0; results do not speak to larger or frontier models. + +## License + +MIT, see [`LICENSE`](LICENSE). The CVEfixes data is distributed separately under its own terms. diff --git a/tests/test_smoke.py b/tests/test_smoke.py new file mode 100644 index 0000000..80b86e2 --- /dev/null +++ b/tests/test_smoke.py @@ -0,0 +1,28 @@ +import json +import pathlib +import sys + +import pandas as pd + +ROOT = pathlib.Path(__file__).resolve().parent.parent +sys.path.insert(0, str(ROOT)) + +from prompts_kat import promptD1, promptR1, promptS1 # noqa: E402 +from utils import calculate_metrics # noqa: E402 + + +def test_prompts_render(): + p = promptS1("int f(){}", "Out-of-bounds Write") + assert "int f(){}" in p and "Out-of-bounds Write" in p + assert promptD1("x", "Use After Free", "desc").count("desc") == 1 + assert "Out-of-bounds Write" in promptR1("int f(){}", "Out-of-bounds Write") + + +def test_paired_scoring(): + df = pd.DataFrame({"pred_before": [1, 0, -1], "pred_after": [1, 0, -1]}) + assert calculate_metrics(df, "pred_before", "pred_after") == (1, 1, 1, 1, 1, 1) + + +def test_notebooks_are_valid_json(): + for f in ROOT.glob("*.ipynb"): + json.loads(f.read_text())