Skip to content

Latest commit

 

History

History
163 lines (117 loc) · 3.57 KB

CONTRIBUTING.md

File metadata and controls

163 lines (117 loc) · 3.57 KB

Contributing

中文

This project uses a lightweight PR-based workflow. The coursework development cycle has ended, so the repository no longer accepts feature PRs. Maintenance fixes, documentation corrections, and release cleanup should still avoid direct pushes to main.

Branch Model

  • main is the stable integration branch.
  • Every change must be made on a short-lived branch and merged through a pull request.
  • Keep branches focused. One branch should solve one maintenance task.
  • Delete branches after merge.

Suggested branch names:

docs/git-workflow
fix/windows-paths
fix/report-export
test/engineio-disconnect

Use prefixes consistently:

  • core/ for database, scanner, runner, report, and shared architecture.
  • ui/ for NiceGUI pages and components.
  • docs/ for documentation.
  • fix/ for bug fixes.
  • test/ for test-only work.

Daily Workflow

  1. Start from the latest main.

    git switch main
    git pull
  2. Create a branch.

    git switch -c fix/report-export
  3. Commit small, related changes.

    git status
    git add .
    git commit -m "fix: handle report export path"
  4. Push the branch.

    git push -u origin fix/report-export
  5. Open a pull request.

  6. Wait for CI and review.

  7. Merge only after approval from the project lead.

Pull Request Rules

Every PR must include:

  • What changed.
  • How to test it.
  • Screenshots for visible GUI changes.
  • Plugin contract notes if a maintenance change touches plugin behavior.
  • Windows test notes if the change touches paths, files, SQLite, or dependencies.

Do not merge a PR if:

  • CI fails.
  • uv run ruff check . fails.
  • uv run pytest fails.
  • The PR bypasses the plugin contract.
  • The change writes plugin results directly to the database.
  • The change only works on one developer's machine.

Main Branch Rules

  • No direct commits to main.
  • No force push to main.
  • No large unreviewed rewrites.
  • Feature development is closed. Only bug fixes, documentation fixes, sample/report fixes, and release stabilization should be merged.

Keeping Branches Updated

Prefer rebasing short-lived branches before opening a PR:

git switch main
git pull
git switch your-branch
git rebase main

If rebase conflicts are confusing, stop and ask the project lead. Do not blindly choose "ours" or "theirs".

For branches already pushed and shared with others, prefer merge instead of rewriting history:

git switch your-branch
git merge main

Commit Message Style

Use short imperative commit messages:

Add hash manifest plugin
Fix Windows path normalization
Document plugin contract
Render artifact JSON details

Avoid vague messages:

update
fix
changes
final

Conflict Rules

  • Do not resolve conflicts by deleting another person's work unless the project lead confirms it.
  • If a conflict is in pyproject.toml, core/models.py, core/plugin.py, or docs/PLUGIN_CONTACT.md, ask for review before merging.
  • If two plugins need the same helper, put the helper under src/hzltfw/utils/ or ask before duplicating logic.

AI Coding Rules

AI-generated changes still need PR review.

When using AI coding tools:

  • Point the tool to ../AGENTS.md, ARCHITECTURE.md, and PLUGIN_CONTACT.md.
  • Ask it to keep changes scoped to the branch task.
  • Review generated code before committing.
  • Run checks before opening the PR.
  • Do not let AI rewrite unrelated files.

Useful Commands

uv sync --dev
uv run hzltfw
uv run ruff check .
uv run pytest
git status
git diff