Skip to content

Phase 4: repository infrastructure — CI, pyproject, lint, Docker, tools - #4

Merged
kutsibalci merged 4 commits into
mainfrom
faz-4/altyapi
Oct 22, 2026
Merged

kutsibalci merged 4 commits into
mainfrom
faz-4/altyapi

Conversation

@kutsibalci

Copy link
Copy Markdown
Owner

Stacked on #3. Merge order: #1 → #2 → #3 → this. The licence stays all-rights-reserved (owner's decision), so there is no CONTRIBUTING file.

What's added

  • CI (GitHub Actions)
    • ruff and pytest on Python 3.12 and 3.13.
    • A Docker job that builds and runs the image, then checks /health, /demo, one demo scenario, a 401 on an unauthenticated write, and a non-root user.
  • pyproject.toml
    • Metadata, dependency ranges, pytest config (replaces pytest.ini) and ruff config.
    • requirements.txt pins the runtime versions; requirements-dev.txt adds pytest and ruff.
  • Lint: correctness only (pyflakes, syntax errors, bugbear)
    • There is no formatter, so no whole-file diffs.
    • It found missing exception chaining in three places, a zip without strict, unused imports, and one real bug in this branch (an undefined ROOT after the tools refactor).
  • Docker image
    • Non-root (uid 10001).
    • Only apps/, packages/ and fixtures/; no tests, tools, evidence, docs or local venv.
    • Built and smoke-tested locally.
  • Tools
    • Paths no longer depend on the clone being named heatshield, and output goes to evidence/ as the docs said.
    • One .env loader instead of five.
  • SECURITY.md, CHANGELOG.md, and a CI badge in the README.

Guard against accidental live calls

During this phase a smoke run of three tools found the real .env in the parent folder and made about 25 live Nokia sandbox calls.

  • The keys went only to Nokia.
  • Nothing from that run is committed, and the results matched the 9 Sep evidence (Location Verification still does not discriminate by area).

The fix:

  • Every live tool now exits unless given --live.
  • verify_live.py requires --mode (it used to default to live).
  • tests/test_tools.py checks this by parsing the tools, never running them.

Known and left for phase 5

tools/verify_live.py (623 lines) still carries portfolio-era table-patching code (PROJECTS, api-availability-master.md). It can't be exercised without live keys, so it is only guarded here, not refactored.

Note on history

c02d8be also carries the pytest.ini removal; 191c23c adds the pyproject.toml that replaces it. Squash-merging makes this invisible.

🤖 Generated with Claude Code

kutsibalci and others added 4 commits September 27, 2026 13:40
…ive calls

- Three tools built their paths from parents[2] / "heatshield", so they
  broke if the clone had any other name, and they wrote output to tools/
  instead of evidence/ as the docs say. A shared tools/_common.py now
  provides the repository root, a python-dotenv loader (replacing five
  hand-written parsers) and evidence_file().
- Every tool that reaches a live API (the Nokia sandbox, Gemini or Groq) now
  exits unless given --live. verify_live.py requires --mode; it used to
  default to live. The reason: a smoke run of these tools during this phase
  found a real .env in the parent folder and made about 25 live sandbox
  calls. Nothing was committed from that run, and the results matched the
  9 Sep evidence.
- tests/test_tools.py checks these guards by parsing the tools, never by
  running them.
- .gitignore drops the portfolio-era _ortak/ rules and ignores the sink log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The image ran as root and COPY . . pulled in tests, tools, evidence, docs
and any local virtualenv. It now copies apps/, packages/ and fixtures/,
installs only runtime dependencies, and runs as an unprivileged user
(uid 10001). Built and run locally: /health, /demo and a demo scenario
return 200, and an unauthenticated write returns 401.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- GitHub Actions: ruff and pytest on Python 3.12 and 3.13, plus a Docker
  job that builds the image, runs it, and checks /health, /demo, one demo
  scenario, a 401 on an unauthenticated write, and a non-root user.
- SECURITY.md: how to report privately, the scope, and the guarantees the
  code makes, with where they are tested. There is no CONTRIBUTING file,
  because the licence stays all-rights-reserved.
- CHANGELOG.md summarises phases 1-4 against v0.1-hackathon.
- README gains a CI badge; the test count is now 194.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This belongs before the tools commit. It was left unstaged when an earlier
`git add pytest.ini` failed, so pytest.ini's removal landed in c02d8be.

- pyproject.toml holds the project metadata, compatible dependency ranges,
  pytest settings (replacing pytest.ini) and ruff config.
- requirements.txt pins the runtime versions the tests and the image run.
  pytest moved to requirements-dev.txt with ruff.
- Ruff checks correctness only: pyflakes, syntax errors, bugbear. B008 is
  ignored because it is FastAPI's idiom. There is no formatter, so a lint
  run never rewrites whole files. The fixes it asked for: unused imports,
  exception chaining (`from e`) in three places, and a strict zip in the
  planner guard.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kutsibalci
kutsibalci changed the base branch from faz-3/guvenlik to main October 22, 2026 21:44
@kutsibalci
kutsibalci merged commit 9eef138 into main Oct 22, 2026
3 checks passed
@kutsibalci
kutsibalci deleted the faz-4/altyapi branch October 22, 2026 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant