|
| 1 | +# Contributing to Scan Request Service (SRS) |
| 2 | + |
| 3 | +Welcome! We’re excited you want to help make SRS better. This short guide walks you through: |
| 4 | + |
| 5 | +1. [Setting up a development environment](#1-development-environment-setup) |
| 6 | +2. [Understanding the project structure](#2-project-structure-high-level) |
| 7 | +3. [What to do before you open a Pull Request](#3-pull-requests-guidelines--presubmission-steps) |
| 8 | +4. [How to report issues](#4-reporting-issues) |
| 9 | +5. [Our code of conduct](#5-code-of-conduct) |
| 10 | + |
| 11 | +If you need further explanations or guidance, browse our [documentation](./docs/) and [Developer FAQ](./docs/developer_faq.md). |
| 12 | + |
| 13 | +--- |
| 14 | +## 1. Development Environment Setup |
| 15 | +### Prerequisites: |
| 16 | +* Python ≥ 3.10 |
| 17 | +* pip |
| 18 | +* virtualenv |
| 19 | +* Docker |
| 20 | +* GNU make |
| 21 | +* libmagic (for python-magic) |
| 22 | + |
| 23 | +### Steps: |
| 24 | +```bash |
| 25 | +make venv # creates venv/pat_dev_vm (dev virtualenv) |
| 26 | +make help # verify automation & targets render |
| 27 | +make test # run unit tests |
| 28 | +``` |
| 29 | +You normally do NOT need to manually `source` the venv; the `make` automation handles that. If a target complains that a virtualenv is active, deactivate it and retry. |
| 30 | + |
| 31 | +### Other targets you may use during development: |
| 32 | +```bash |
| 33 | +make it # integration tests (pytest + tavern) |
| 34 | +make lt # load tests (k6) |
| 35 | +make bp # instantiate an empty blueprint template |
| 36 | +make service # create a service stub within the service manifest |
| 37 | +make service_up # build & run a service container |
| 38 | +``` |
| 39 | + |
| 40 | +--- |
| 41 | +## 2. Project Structure (High Level) |
| 42 | +``` |
| 43 | +components/blueprints/ # Individual business logic units (Flask blueprints) |
| 44 | +chassis/ # Shared service chassis (e.g. k_api) |
| 45 | +services/ # Service definitions (composition lives in manifests) |
| 46 | +make_lib/ # Automation scripts + blueprint & service manifests |
| 47 | +docs/ # Developer guides & reference |
| 48 | +requirements.txt # Automation / tooling deps (not baked into service images) |
| 49 | +``` |
| 50 | +### Key ideas: |
| 51 | +- A service = one chassis + N blueprints. |
| 52 | +- Manifests in `make_lib/` define what blueprints and services exists, as well as how those services are composed; avoid manual edits unless extending following documented patterns. |
| 53 | +- Per‑blueprint and chassis `requirements.txt` files control runtime deps; root `requirements.txt` is only for development automation. |
| 54 | +- Use the automation whenever possible! Attempting to manually perform tasks that the automation can already handle via a `make` target can introduce unwanted behaviors. |
| 55 | + |
| 56 | +--- |
| 57 | +## 3. Pull Requests: Guidelines & Pre‑Submission Steps |
| 58 | +We follow a [Gitflow branching model](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow); all feature and bug branches should branch off of `develop`, while `develop` should be the only branch merging into `main`. |
| 59 | + |
| 60 | +When naming branches, use concise and unambiguous terminology that represents the work contained on the branch. Feature and bug branches should be prefixed with `feature/` and `bugfix/` respectively. |
| 61 | + |
| 62 | +### Before you open a PR: |
| 63 | +1. Keep scope focused (one logical change). |
| 64 | +2. Run and pass: |
| 65 | + |
| 66 | + ```bash |
| 67 | + make test |
| 68 | + make version_canary # ensures version & changelog alignment |
| 69 | + ``` |
| 70 | + Run `make it` / `make lt` if you changed integration or performance-sensitive code. |
| 71 | +3. Bump versions (chassis / blueprint / template / service) and update their README changelogs if any related code was changed. |
| 72 | +4. Update OpenAPI docs if you changed an API contract. |
| 73 | +5. Ensure any code changes are covered by unit tests. |
| 74 | +6. Ensure no stray debug prints, commented-out code, or secrets exist in the PR. |
| 75 | +7. Rebase your branch on the latest `develop` and squash to a single meaningful commit. |
| 76 | +8. Write a clear commit message: `feat(ping): add latency metric` (prefixes: feat, fix, docs, refactor, test, perf, chore, sec). |
| 77 | +9. If security-sensitive, note review considerations in the PR description. |
| 78 | + |
| 79 | +### Suggested PR checklist (copy into description): |
| 80 | +``` |
| 81 | +[ ] Single logical change (squashed & rebased on develop) |
| 82 | +[ ] Versions bumped + changelogs updated |
| 83 | +[ ] Tests added/updated & passing (unit + integration if needed) |
| 84 | +[ ] make version_canary passes |
| 85 | +[ ] OpenAPI spec updated (if API change) |
| 86 | +[ ] No secrets / debug leftovers |
| 87 | +[ ] Docs/help updated if user-facing behavior changed |
| 88 | +``` |
| 89 | +At least one reviewer approval is required. Provide context for your proposed changes (why, not just what) so reviewers can move quickly. |
| 90 | + |
| 91 | +--- |
| 92 | +## 4. Reporting Issues |
| 93 | +Please search existing issues and the [FAQ](./docs/developer_faq.md) first. |
| 94 | + |
| 95 | +Include in a new issue: |
| 96 | +- Environment (OS, Python version, Docker version) |
| 97 | +- Exact commands or steps to reproduce |
| 98 | +- Expected vs actual result |
| 99 | +- Relevant logs / stack traces / screenshots |
| 100 | + |
| 101 | +For suspected security vulnerabilities or anything that could expose sensitive data, **do not** open a public issue—use Splunk’s responsible disclosure process instead. |
| 102 | + |
| 103 | +### Feature requests: |
| 104 | +Describe the use case and why existing functionality is insufficient. Implementation suggestions are welcome, but keep them concise. |
| 105 | + |
| 106 | +--- |
| 107 | +## 5. Code of Conduct |
| 108 | +We are committed to a respectful, inclusive, and harassment‑free collaborative environment. By participating you agree to: |
| 109 | +- Assume good intent; ask clarifying questions before criticizing |
| 110 | +- Offer constructive, actionable feedback |
| 111 | +- Avoid discriminatory or exclusionary language |
| 112 | +- Respect differing experience levels and backgrounds |
| 113 | + |
| 114 | +Unacceptable behavior (harassment, personal attacks, derogatory comments, sharing private information) may result in removal from discussions or other corrective action. Escalate concerns privately to the maintainers. |
| 115 | + |
| 116 | +--- |
| 117 | +## Need Help? |
| 118 | +1. Read the [docs](./docs/) & [FAQ](./docs/developer_faq.md). |
| 119 | +2. Open a detailed [issue](https://github.com/splunk/scan-request-service/issues/new). |
| 120 | +3. For security, use private disclosure channels. |
| 121 | + |
| 122 | +We appreciate every improvement — large or small. Thank you for bettering SRS for the community :heart: |
0 commit comments