Skip to content

Add CLAUDE.md development guide for VAFT project#31

Open
HongSik-Yun-Fusion wants to merge 3 commits into
mainfrom
claude/update-claude-md-X5tTi
Open

Add CLAUDE.md development guide for VAFT project#31
HongSik-Yun-Fusion wants to merge 3 commits into
mainfrom
claude/update-claude-md-X5tTi

Conversation

@HongSik-Yun-Fusion

Copy link
Copy Markdown
Contributor

Summary

This PR adds a comprehensive development guide (CLAUDE.md) for the VAFT (Versatile Analytical Framework for Tokamak) project. The document serves as a reference for developers working on the codebase, covering project structure, setup, testing, and known issues.

Key Changes

  • Project Overview: Documents VAFT's purpose, version, Python requirements, and key dependencies
  • Build & Install Instructions: Provides setup commands for standard, editable, and development installations
  • Testing Guide: Explains how to run tests and notes external dependencies (HSDS server, MySQL database)
  • Code Style Standards: Documents use of black and flake8 with no configuration files
  • Project Structure: Maps out the directory layout with descriptions of each module's purpose
  • Dependencies Table: Lists key packages and their roles (numpy, scipy, matplotlib, h5py, omas, etc.)
  • Database Connectivity: Explains configuration for HSDS server and MySQL raw DAQ access
  • Known Limitations & Issues: Comprehensive catalog of code quality issues including:
    • SQL injection vulnerabilities in database/raw.py
    • Inconsistent return types and resource leaks
    • Missing imports (re module in code/efit.py)
    • Broad exception handling patterns
    • Wildcard imports without __all__ definitions
    • Hardcoded VEST-specific constants throughout the codebase
    • Lack of unified logging (374+ print() statements)
    • Missing CI/CD, pre-commit hooks, and type checking infrastructure
    • Stub modules, backup files, and dead code tracked in git
    • Unguarded numerical edge cases (division by zero)

Notable Details

The guide identifies 15+ categories of technical debt and code quality issues, providing specific file locations and examples. This serves as both documentation and a roadmap for future refactoring efforts.

https://claude.ai/code/session_01Y48mwJ3rs8pPFPtMK4Vuuh

Provides Claude Code with essential context: build/install instructions,
testing setup, project structure, key dependencies, database connectivity,
and a comprehensive list of known code limitations and issues.

https://claude.ai/code/session_01Y48mwJ3rs8pPFPtMK4Vuuh
Add missing re import bug in efit.py, stub modules (chease.py, gpec.py),
backup file (efit.sav), file I/O without context managers, and additional
numerical edge cases found in efit.py.

https://claude.ai/code/session_01Y48mwJ3rs8pPFPtMK4Vuuh
Add findings from full codebase scan: 374 print statements, empty test
files, hardcoded server paths in workflows and tests, unimplemented
function stubs, 2891-line deprecated old_codeset.py, and updated type
hint coverage stats (26% of files).

https://claude.ai/code/session_01Y48mwJ3rs8pPFPtMK4Vuuh
@HongSik-Yun-Fusion

Copy link
Copy Markdown
Contributor Author

@copilot Review

Copilot AI commented Feb 26, 2026

Copy link
Copy Markdown
Contributor

@Hikitonic I've opened a new pull request, #32, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a comprehensive development guide (CLAUDE.md) for the VAFT (Versatile Analytical Framework for Tokamak) project. The document serves as a centralized reference for developers working on the codebase, documenting the project structure, setup instructions, testing procedures, and most notably, a detailed catalog of known technical debt and code quality issues.

Changes:

  • Adds CLAUDE.md documenting project overview, build/install instructions, testing, code style, and project structure
  • Documents 15+ categories of technical debt including SQL injection vulnerabilities, missing imports, resource leaks, and infrastructure gaps
  • Provides dependency table, database connectivity details, and known limitations with specific file references

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CLAUDE.md
Comment on lines +25 to +26
# With dev dependencies (pytest, black, flake8)
pip install -e ".[dev]"

Copilot AI Feb 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The installation command for dev dependencies is incorrect. The project uses [dependency-groups] in pyproject.toml (line 60-66), not [project.optional-dependencies]. The pip install -e ".[dev]" syntax only works with optional-dependencies. For dependency-groups, users should use uv or convert the dev dependencies to optional-dependencies. Consider either: (1) documenting the correct uv command like uv pip install -e . --group dev, or (2) moving dev dependencies to [project.optional-dependencies] to support the pip syntax shown here.

Suggested change
# With dev dependencies (pytest, black, flake8)
pip install -e ".[dev]"
# With dev dependencies (pytest, black, flake8) using dependency groups
uv pip install -e . --group dev

Copilot uses AI. Check for mistakes.
Comment thread CLAUDE.md
1. **HSDS server** (HDF5 over HTTP) — for processed ODS data
- Configure with `hsconfigure` command
- Default endpoint: `http://147.46.36.244:5101`
- Public reader credentials: username `reader`, password `test`

Copilot AI Feb 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation includes actual database credentials (username 'reader', password 'test') for the public HSDS server. While these are described as "public reader credentials," consider whether it's appropriate to include actual passwords in developer documentation, even for read-only access. If these are truly intended for public use, consider clarifying that these credentials are safe to share publicly to avoid confusion about security practices.

Suggested change
- Public reader credentials: username `reader`, password `test`
- Public reader credentials (intentionally public, read-only access to non-sensitive HSDS data; safe to share in examples): username `reader`, password `test`

Copilot uses AI. Check for mistakes.
Comment thread CLAUDE.md
- Division by zero not guarded in several equilibrium/profile calculations (e.g., `psi_boundary == psi_axis`)
- `np.errstate` used to suppress warnings rather than handling edge cases
- Matrix exponential in eddy current solver can overflow for large eigenvalues
- `efit.py`: normalizes data by dividing by min/max without zero checks

Copilot AI Feb 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description mentions including a Claude.ai session link (https://claude.ai/code/session_01Y48mwJ3rs8pPFPtMK4Vuuh) as part of notable details, but this link is not present in the CLAUDE.md file. Consider whether this session link should be included in the document (perhaps in a "Development History" or "References" section) for traceability, or if it was intentionally excluded to keep the documentation focused on technical content.

Suggested change
- `efit.py`: normalizes data by dividing by min/max without zero checks
- `efit.py`: normalizes data by dividing by min/max without zero checks
## Development History
- Claude.ai session used for codebase analysis and documentation support:
https://claude.ai/code/session_01Y48mwJ3rs8pPFPtMK4Vuuh

Copilot uses AI. Check for mistakes.
Comment thread CLAUDE.md
| `snakemake` | Workflow automation |
| `astropy` | Physical units and constants |

A vendored copy of OMAS is used (`vendor/omas/`, editable install via uv).

Copilot AI Feb 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The statement "A vendored copy of OMAS is used (vendor/omas/, editable install via uv)" is accurate but incomplete. According to pyproject.toml lines 79-82, the vendor/omas path is specifically configured via uv.sources and is only used when installing the 'imas-python' extra. For standard installations, OMAS is fetched from PyPI (line 29: omas>=0.94.2). Consider clarifying that the vendored copy is only used with uv and the imas-python extra, not for all installations.

Suggested change
A vendored copy of OMAS is used (`vendor/omas/`, editable install via uv).
By default, OMAS is installed from PyPI (`omas>=0.94.2`). The vendored copy in `vendor/omas/` is only used via `uv.sources` when installing the `imas-python` extra (e.g. editable installs with uv).

Copilot uses AI. Check for mistakes.
@HongSik-Yun-Fusion

Copy link
Copy Markdown
Contributor Author

@copilot open a new pull request to apply changes based on the comments in this thread

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.

4 participants