Skip to content

Latest commit

 

History

History
110 lines (87 loc) · 5.19 KB

CONTRIBUTING.md

File metadata and controls

110 lines (87 loc) · 5.19 KB

Contributing to anvil

anvil is a Rust/GTK application using the shared terminal runtime and a deliberately strict boundary between terminal I/O, persisted state, and Relm4 UI operations. Small, reviewable changes are preferred over broad rewrites.

Development environment

Nix with flakes enabled is the supported development path:

nix develop
make verify
make security

Useful focused commands include make run, make test, make check, and make clippy. make package builds the same portable archive layout used by the release workflow. All Cargo operations that resolve dependencies use the committed lockfile.

jagent and jterm_core are Git dependencies, and the lockfile carries no checksum for those. When you repin either revision, update the matching entry in cargoLock.outputHashes in flake.nix as well, otherwise nix develop and nix build fail to evaluate. Set the entry to pkgs.lib.fakeHash, run nix build .#default, and copy the got: hash from the mismatch error.

Historical renderer oracle

Production Cargo.toml, Cargo.lock, Nix and Flatpak packages contain no libvte. cargo check --all-targets --locked checks the production binary and standalone integration targets. Inline application fixtures run only in the independent oracle, including pure/shared fixtures alongside historical renderer comparisons. python3 scripts/check-no-vte.py target/release/anvil checks the resolved graph and linked ELF boundary.

The old renderer exists only as an independent comparison fixture. Run python3 tools/vte-oracle/run.py test --all-targets --offline for its full inline suite, or make test-display for the registered display fixtures. The runner creates a source overlay under the target cache, injects exact vte4 0.10.0 using its separate lockfile, and explicitly enables anvil_vte_oracle and the legacy renderer cfg. Production launches cannot fall back to this fixture. Nix's dev shell retains VTE development libraries solely for that comparison suite. After changing a shared Git pin, update the oracle lockfile deliberately as well as the production lock; --locked rejects a stale fixture lock.

Quality gate

Before opening a pull request, run:

make verify
make security

This checks formatting, all Rust targets, tests, the repository Clippy policy, and documentation. GitHub Actions additionally exercises GTK tests under Xvfb, validates the desktop entry, smoke-tests the headless CLI, builds the portable bundle, and builds the Nix package.

make security runs Cargo audit with --deny warnings, so dependency vulnerabilities and advisory warnings, including unmaintained dependencies, fail the gate. Resolve the dependency finding and rerun the check before submitting a change. ShellCheck runs after the dependency audit succeeds.

CI also exercises a real cross-surface mouse drag through XTest. To include that check locally, install libxtst6 and Python 3 alongside Xvfb, then run:

ANVIL_XTEST_DRIVER="$PWD/scripts/qa-cross-selection-pointer.py" make test-display

The pointer helper only targets the synthetic, named QA window in the isolated test display. It does not generate keystrokes or execute terminal commands. The same display gate runs qa-enter-ownership.py against a raw, nonexecuting PTY recorder. It covers held main/keypad Enter, focus changes, missed releases, modifier changes, refused recalls, ordinary repeats, and fresh deliberate presses. Run these helpers only in an isolated test display; no shell is launched by the Enter fixture.

The canonical Clippy warning baseline lives in scripts/clippy.sh. Update that single file only when accepting a new repository-wide lint exception; do not add ad-hoc allow flags to CI or local scripts.

bash scripts/test-release-install.sh checks both installers' desktop launchers using the system Python's GIO bindings (python3-gi on Debian/Ubuntu). It launches only a recording fixture in temporary HOME/XDG trees; no GTK display is needed.

Architecture guidelines

  • Keep GTK work on the main thread. Filesystem, Git, process, and network work that can block belongs on a worker path with a bounded result returned to the UI.
  • Preserve explicit approval before an AI agent command reaches a terminal.
  • Bound terminal output retained for history, diagnostics, and AI context.
  • Treat session and history files as recoverable state: write atomically and never let one malformed record prevent loading the remaining records.
  • Add tests for parsers, shell quoting, persistence, command recall, and other behavior that can be checked without a visible desktop.
  • Keep user configuration backward-compatible. New keys need safe defaults, validation in config_store, and documentation in config.toml.example.
  • Configuration writes must preserve unknown sections, hold the advisory lock, compare the expected revision, rotate backups before replacement, and sync the file and parent directory. Add conflict and recovery tests for changes here.

Pull requests

Explain the user-visible effect, implementation approach, and validation that was run. Keep generated build output and local configuration out of commits. Changes that alter packaging should exercise both make package and nix flake check.