Skip to content

Latest commit

 

History

History
197 lines (166 loc) · 11.1 KB

development.md

File metadata and controls

197 lines (166 loc) · 11.1 KB

Development notes

Product architecture and dual-process design: docs/ARCHITECTURE.md.

Optional Bunny.net deploy guidance (for self-hosters who want that shape): docs/DEPLOY-BUNNY.md.

Upgrades: docs/UPGRADE.md.

Contributor / agent build commands and invariants: AGENTS.md.

Local validation

For ordinary PRs, reproduce the reported failure and run focused local checks before pushing:

  • the regression for the changed behavior and the tests of the code you edited;
  • cargo fmt --check and Clippy -D warnings for each changed Rust package;
  • for browser or documentation changes, the matching cheap group below.

Record the commands and results in the PR. CI passed is the merge gate: GitHub Actions selects every affected group from the complete PR diff, including earlier code commits, and runs them as parallel jobs in about 10 minutes.

# Focused Rust feedback for the package you changed (replace the test-name
# filter with your own):
cargo test --locked -p jmodguard-bot dry_run_known_spam_does_not_displace_a_live_action
cargo clippy --locked -p jmodguard-bot --all-targets -- -D warnings
cargo fmt --check
# The API has two feature modes; lint both when you change it. The default
# mode embeds the WebUI, so build it first (see AGENTS.md Commands):
cargo clippy --locked -p jmodguard-api --all-targets -- -D warnings
cargo clippy --locked -p jmodguard-api --no-default-features --all-targets -- -D warnings
# Documentation or sample configuration:
bash scripts/ci-preflight.sh --only contracts
# Browser changes (includes dependency install/build, lint and frontend tests):
bash scripts/ci-preflight.sh --only frontend
# Inspect all groups CI will select for concrete paths:
bash scripts/select-checks.sh plan --files src/db.rs frontend/app.js

--affected runs the groups GitHub Actions would select for this checkout (its commits since the base plus uncommitted and untracked files), but one after another on one machine. A change to shared source or the bot selects nearly every Rust group, so a local run takes about as long as all CI jobs added together: about 30 minutes or more, compared with about 10 minutes on CI. It always checks the whole diff since the base, so a rerun after a small follow-up commit repeats all of that work. It is not a required pre-push step. Use it to reproduce a CI failure locally or when CI cannot run. It leaves out the Docker-based remote-database job and says so when that job is affected.

bash scripts/ci-preflight.sh --affected
# For a PR whose base is not main:
# bash scripts/ci-preflight.sh --affected --base origin/<base-branch>

--only runs the named groups; it does not add their affected consumers or boundary checks. CI runs the complete affected plan before merge.

Shared data changes need their consumers; service-boundary changes need integration and boundary checks. CI runs those consumers. Run bash scripts/ci-remote-database.sh when changing remote SQL/transaction behavior and you need local feedback; it uses disposable local libSQL containers, not a live provider, and CI runs it when affected.

Run the full preflight before submitting changes to CI orchestration, toolchains, workspace-wide dependency/build configuration, or when affected scope is uncertain. Do not run it for an ordinary change.

bash scripts/ci-preflight.sh
# Equivalent full-suite alias (not a cheap smoke command):
# bash scripts/smoke-dual-process.sh

After a follow-up edit, such as a review repair, rerun only the tests and lints for the code that edit touched, then push and let CI recheck the whole PR. Do not rerun --affected or the full suite because a commit or push occurred. Do not omit a distinct regression merely to lower the test count.

Install cargo-nextest for local Rust runs (cargo install cargo-nextest --locked --version 0.9.152, the CI pin). Preflight uses it automatically. Without nextest, the GNU timeout fallback invokes Cargo separately for each test and runs them sequentially; thousands of cases make this much slower. Both paths retain per-test timeouts. A cold install/build is setup cost, not application-test execution time.

Optional local hooks:

bash scripts/install-git-hooks.sh
# For a PR whose base is not main:
# bash scripts/install-git-hooks.sh --base origin/<base-branch>

This sets worktree-local core.hooksPath to .githooks. Pre-commit checks only staged whitespace; pre-push runs ci-preflight.sh --only contracts once and blocks on failure. Neither starts the full Rust suite. Run relevant tests before pushing; the hooks do not infer application coverage. Git uses only .githooks in this worktree; previous hook directories are not chained. Linked worktrees are unaffected unless you install there too. Existing installations pick up the tracked hook edits.

Keep secrets, production domains, and operator-specific promote steps out of this repository — document those in your own ops environment.

CI and image publication run on standard GitHub-hosted runners. Setup and manual builds: docs/CI.md.

Dependency updates

.github/dependabot.yml schedules weekly Cargo workspace checks and weekly npm updates for the host-only ESLint pin under tools/eslint after they are merged to main. Cargo and npm minor and patch version updates are grouped; major updates remain separate. Dependabot permits up to five open version-update PRs per ecosystem (Cargo and npm each). Review and run the GitHub Actions checks before merging dependency updates.

The libsql-sqlite3-parser Git patch is excluded from automatic updates: maintain its reviewed revision and security regression test manually. The vendored tokio-tungstenite compatibility patch also requires manual maintenance. Container images remain manual: Rust builder versions must stay aligned with rust-toolchain.toml, the root Cargo version requirements, and the CI toolchain. Dockerfile.{bot,api} pin rust:1.100.0-trixie and debian:trixie-slim by linux/amd64 digest. There is no Docker Dependabot job; bump those digests together with the toolchain pin. Publication stamps io.jmodguard.base-abi from the selected source's JMODGUARD_BASE_ABI (debian-trixie-amd64; older sources without it are debian-bookworm-amd64), and release admission enforces that metadata before promotion; it does not independently verify the image OS. A Bookworm container refuses Trixie releases. A Trixie container replaces an installed Bookworm application with its built-in one when that fits the database, and otherwise keeps running it; see the base-image rollout in docs/BUNNY-UPDATES.md.

Dependabot version updates are supported on this private GitHub.com repository. GitHub enqueues those jobs as Actions → Dependabot Updates dynamic workflows (dynamic/dependabot/dependabot-updates). They are not .github/workflows files, they do not replace application CI, and on standard GitHub-hosted runners they do not consume included Actions minutes. A missing Insights update log does not mean the weekly schedule is idle: if the job stays queued on a dependabot label and then cancelled at 24 hours, no runner matched.

Keep Settings → Advanced Security → Dependabot on self-hosted runners disabled so GitHub-hosted standard runners can execute the job. This repository has no GitHub Actions self-hosted runners; CI uses standard GitHub-hosted runners. The Socket Security manifest scan is .github/workflows/socket.yml on GitHub Actions. It is not CI. Set the repository Actions secret SOCKET_SECURITY_API_KEY to a Socket API key before relying on the scan. A missing secret skips the scan and does not fail the job, and the key is not stored in git. The scan uploads discovered Cargo and npm manifests outside ignored paths to Socket, including workspace and member Cargo.toml files, Cargo.lock, and tools/eslint/package.json and its lockfile. It may comment on a pull request with the GitHub Actions token. A new blocking alert can fail this check only when Socket compares a pull request change that touches a supported manifest. Push and full-report scans do not fail for alerts. Socket API errors do not fail this check. The CI passed check remains the merge gate. After enabling the key, let a scan run on main before relying on pull request comparisons; without a main baseline, Socket may treat existing dependencies as newly added. Do not register leftover Proxmox GHA runners or label any runner dependabot. bash scripts/dependabot-config-test.sh guards this YAML and the operator-copy contract.

The Cargo Git patch points back to this repository; it is not a GitHub Packages registry dependency. The 2026-09-08 GitHub Packages automatic-access change does not authenticate that git clone. If a job starts and then reports private Git authentication failures, inspect that run's Actions log. Do not put tokens in YAML. The separate GitHub Packages feature requires granting the consuming repository Read access under the package's Manage Actions access settings; it does not provide Git fetch authentication.

The dependency audit tracks these constraints on Rust updates.

  • Serenity 0.12.5 enables reqwest's rustls-tls feature, and the bot passes reqwest responses to Serenity. Moving both to reqwest 0.13 needs a release containing Serenity's TLS feature change.
  • Serenity also requires tokio-tungstenite 0.21. The patch under vendor/ exposes that version using 0.24 sources for rustls 0.23. Serenity constructs WebSocketConfig with a struct literal. Tungstenite 0.25 made that type non-exhaustive. The bot's independent test server already uses 0.30.
  • The libSQL remote client and connector still use Hyper 0.14. The h2 0.3 advisory exception and expiry are tracked in #349. Keep the parser Git patch until a published release includes the parser security fix.
  • Axum 0.8.9 pins matchit to 0.8.4, and crypto-common 0.1.7 pins generic-array to 0.14.7. Cargo can advance those copies when the parents relax their exact requirements.
  • On 2026-11-25, we retained Chrono 0.4.45 because the workspace shares its timestamp and serialization types with Serenity 0.12.5. RustSec reports an informational maintenance warning on every release. Keep the warning visible in cargo audit and revisit the decision when Serenity releases its Jiff timestamp backend or RustSec updates the advisory. See RUSTSEC-2026-0543 and Serenity's Jiff change.

Dependabot alerts and security updates are separate repository settings. Keep both enabled under Settings → Advanced Security → Dependabot; the weekly schedule controls version updates, not the timing of security fixes. After a job starts, check Actions → Dependabot Updates and Insights → Dependency graph → Dependabot. These jobs generate PRs; application CI and image publication remain on GitHub Actions.