diff --git a/.github/workflows/trigger-integration.yml b/.github/workflows/trigger-integration.yml index 39ed231..4cb4127 100644 --- a/.github/workflows/trigger-integration.yml +++ b/.github/workflows/trigger-integration.yml @@ -1,6 +1,8 @@ name: Trigger Integration Tests on: + pull_request: + branches: [main] release: types: [published] @@ -10,9 +12,16 @@ jobs: steps: - name: Trigger integration tests env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.INTEGRATION_TOKEN }} run: | - gh api repos/xPyD-hub/xPyD-integration/dispatches \ - -f event_type=release-check \ - -f "client_payload[repo]=xPyD-proxy" \ - -f "client_payload[version]=${{ github.event.release.tag_name }}" + if [ "${{ github.event_name }}" = "pull_request" ]; then + gh api repos/xPyD-hub/xPyD-integration/dispatches \ + -f event_type=pr-check \ + -f "client_payload[repo]=xPyD-proxy" \ + -f "client_payload[ref]=${{ github.head_ref }}" + else + gh api repos/xPyD-hub/xPyD-integration/dispatches \ + -f event_type=release-check \ + -f "client_payload[repo]=xPyD-proxy" \ + -f "client_payload[version]=${{ github.event.release.tag_name }}" + fi diff --git a/bot/AUTHOR_POLICY.md b/bot/AUTHOR_POLICY.md new file mode 100644 index 0000000..135b917 --- /dev/null +++ b/bot/AUTHOR_POLICY.md @@ -0,0 +1,47 @@ + + + +# Author Policy — xPyD-proxy + +Rules for the bot that writes code and submits PRs. + +## Identity +| Role | GitHub Account | +|------|---------------| +| Author | `hlin99` | + +## Before Coding +1. Pull latest main: `git pull origin main` +2. Create branch: `git checkout -b /` +3. Read [DESIGN_PRINCIPLES.md](DESIGN_PRINCIPLES.md) for architecture constraints. + +## Code Quality +- Run pre-commit: `pre-commit run --all-files` +- Run lint: `ruff check xpyd tests` +- Run tests: `pytest tests/ -q` +- All must pass locally before pushing. + +## PR Submission +1. One PR per task. Don't bundle unrelated changes. +2. Descriptive title: `type: short description` +3. PR body: what changed, why, test coverage, breaking changes. Reference issues (`closes #N`). +4. All CI must pass before requesting review. + +## Responding to Review +1. Address ALL `REQUEST_CHANGES` feedback before requesting re-review. +2. Always push new commits — never amend or force-push. +3. Reply to each review comment with fix commit ref (e.g. "Fixed in `abc1234`"). +4. Re-request review after pushing fixes (don't wait for reviewer to notice). +5. If reviewer is wrong, explain with evidence (link to source, docs, spec). + + +## Documentation Updates +Every PR must update relevant documentation: + +| Change Type | Update | +|---|---| +| New feature / CLI argument | `docs/guide.md` | +| Architecture change | `docs/architecture.md` | +| Design decision | `docs/design.md` | +| Quick Start affected | `README.md` (keep one screen, link to guide.md) | + diff --git a/bot/BOT_POLICY.md b/bot/BOT_POLICY.md new file mode 100644 index 0000000..cccddec --- /dev/null +++ b/bot/BOT_POLICY.md @@ -0,0 +1,49 @@ + + + +# Bot Policy — xPyD-proxy + +## Language +- **English only** — all code, docs, issues, PRs, comments on GitHub must be in English. No Chinese characters. + +## Branch Rules +- **Never push directly to main.** All changes go through PR. +- **Never force push.** If branch is too messy, close PR and open new one. +- Branch from latest main. Keep branch up-to-date by merging main into it. +- Each PR must be independent — no stacking PRs or branching off feature branches. + +## Commit Rules +- **Commit identity**: `git -c user.name="hlin99" -c user.email="tony.lin@intel.com" commit -s` +- Always use `tony.lin@intel.com` as commit email. Never use noreply address. +- Always include `Signed-off-by` trailer (`-s` flag) for DCO compliance. +- Never add `Co-authored-by` trailers. +- Follow conventional commits: `: ` (fix, feat, test, docs, refactor, chore, ci). + +## Before Pushing +1. Run pre-commit: `pre-commit run --all-files` +2. Run lint: `ruff check xpyd tests` +3. Run tests: `pytest tests/ -q` +4. All three must pass locally before pushing. + +## Merge Policy +- **Bots must NEVER merge a PR.** All merges done by human maintainer. +- **Bots must NEVER close a PR.** Only human maintainer closes. +- Non-negotiable. Do not call merge or close API under any circumstances. + +## CI +- CI must be 100% green before merge. No skips allowed. +- No test may be skipped. If a test can't run, fix it or remove it. + +## Testing +- Unit tests in `tests/` — pure bench logic, no external dependencies. +- Integration tests in [xPyD-integration](https://github.com/xPyD-hub/xPyD-integration). + +## Secrets +- Never hardcode tokens or credentials in code, PR descriptions, or bot prompts. + +## Freshness +- **Always pull latest main and re-read BOT_POLICY.md before starting any work.** This is a living document. Never rely on cached copies. + +## Architecture +- Lightweight PD-disaggregated LLM serving proxy. +- Follow vLLM bench CLI compatibility (see [DESIGN_PRINCIPLES.md](DESIGN_PRINCIPLES.md)). diff --git a/BOT_POLICY.md b/bot/BOT_POLICY_LEGACY.md similarity index 100% rename from BOT_POLICY.md rename to bot/BOT_POLICY_LEGACY.md diff --git a/bot/ENTRY.md b/bot/ENTRY.md new file mode 100644 index 0000000..d016486 --- /dev/null +++ b/bot/ENTRY.md @@ -0,0 +1,15 @@ + + + + +# Bot Entry Point + +Read this file first when starting any automated task on this repo. + +## Required Reading (in order) + +1. **[BOT_POLICY.md](BOT_POLICY.md)** — Hard rules. Must follow. +2. **[AUTHOR_POLICY.md](AUTHOR_POLICY.md)** — Rules for writing code and submitting PRs. +3. **[REVIEW_POLICY.md](REVIEW_POLICY.md)** — Rules for reviewing PRs. +4. **[DESIGN_PRINCIPLES.md](DESIGN_PRINCIPLES.md)** — Architecture constraints and design rules. +Files 1-4 are mandatory. No DEV_LOOP in this repo (non-loop mode). diff --git a/bot/REVIEW_POLICY.md b/bot/REVIEW_POLICY.md new file mode 100644 index 0000000..39d2cf6 --- /dev/null +++ b/bot/REVIEW_POLICY.md @@ -0,0 +1,55 @@ + + + +# Review Policy — xPyD-proxy + +## Roles +| Role | GitHub Account | Action | +|------|---------------|--------| +| Implementer | `hlin99` | Write code, submit PRs | +| Reviewer 1 | `hlin99-Review-Bot` | Review PRs | +| Reviewer 2 | `hlin99-Review-BotX` | Review PRs | + +Each reviewer uses its own dedicated token. Never use author's token for reviews. + +## Reviewer Schedule +| Condition | Check Frequency | +|-----------|----------------| +| Open PRs exist | every 5 minutes | +| No open PRs | every 15 minutes | + +## What to Review +1. Skip draft PRs. +2. Skip already-reviewed commits (only APPROVE counts as reviewed). +3. Re-requested reviews take priority — always perform fresh review. +4. One review per PR per commit SHA — never submit multiple reviews for same commit. + +## Review Process + +Review every non-draft PR with proxy-level strict standards. Every line examined. + +## Review Checklist +For each non-draft PR with a new commit: + +| Area | Check | +|---|---| +| CI | Must be fully green before APPROVE. May submit REQUEST_CHANGES or COMMENT while pending. | +| Merge conflicts | If mergeable == false, REQUEST_CHANGES. | +| Logic errors | Incorrect conditions, off-by-one, unhandled edge cases. | +| Type safety | Mismatched types, missing None checks. | +| Concurrency | Race conditions, missing locks, shared mutable state. | +| Exception handling | Bare except, swallowed exceptions, resource leaks. | +| Security | Injection risks, hardcoded secrets, unsanitized input. | +| Code style | Unused imports, shadowed variables, unclear naming. | +| Test coverage | New logic must have corresponding tests. | +| Design conformance | Implementation must match the linked GitHub Issue design. | + +## Verdicts +- **APPROVE** — code correct, CI green, no issues. +- **REQUEST_CHANGES** — any issue found. Use inline comments. +- **COMMENT** — CI pending or noting something without blocking. + +## Merge Policy +- **Bots must NEVER merge a PR.** Human maintainer only. +- **Bots must NEVER close a PR.** Human maintainer only. +- At least 1 approval required before human can merge.