Provisions/tears down the ONE disposable FreeBSD jail (parties-test, 10.0.0.7) used to live-verify the identity/parties tenant-isolation fixes against a real Postgres -- never pg0 (the fleet's source-of-truth DB, explicitly flagged elsewhere in this workspace as never to be touched by experimental/adversarial writes). The jail name is a compile-time constant, not a CLI argument, specifically so this tool cannot be pointed at any other jail by mistake.
| Tier | tools |
| Role | unclassified (baselined) |
| Path | crates/tools/parties-test-db |
| Edition | 2021 |
| Targets | tools-parties-test-db, tools_parties_test_db |
| Public items | 18 across 0 modules |
| Tests | 3 |
What it is for
Idempotent provision/teardown of the ONE disposable jail used to live-verify identity/parties tenant-isolation fixes against a real Postgres.
# Why a jail, and why not pg0
pg0 is this fleet's postgres jail, but it is documented elsewhere in this workspace (the inventory-shop USD module's own source comment) as the "laptop's source-of-truth," never to be touched by a module that isn't specifically provisioning it. Loading adversarial two-tenant test data into it -- even into a separate database -- is exactly the kind of use that documentation warns against. This tool creates a SEPARATE, disposable jail instead: same host (freebsd-vm, reached directly via SSH -- this is dev/test infra, not a fleet node behind the usd relay), its own IP, destroyable at any time with zero effect on anything else.
# Why the jail name is a constant, not a parameter
JAIL_NAME is baked in, not a CLI flag. teardown() runs jstop then jremove -- there is no code path in this crate that can construct that command with any other name, by construction, not by a runtime check that could be bypassed with the wrong flag.
# What this does NOT do
It does not run the identity/parties migrations or the crate's own integration tests -- those already exist (crates/identity/parties/ tests/integration_tests.rs, driven by TEST_DATABASE_URL). verify() wires provision -> port-forward -> migrate -> test -> teardown into one procedure by SHELLING OUT to sqlx-cli and cargo test (existing, established tools) rather than reimplementing migration-running or test execution here -- rule 14 is about not hand-running this ad-hoc, not about not reusing what already exists.
Capabilities
verb:constants
Idempotent provision/teardown of the ONE disposable jail used to
| Item |
|---|
pub const JAIL_NAME: & str |
pub const JAIL_IP: & str |
pub const JAIL_VER: & str |
pub const DB_NAME: & str |
pub const DB_ROLE: & str |
pub const DB_PASSWORD: & str |
verb:jail
Idempotent provision/teardown of the ONE disposable jail used to
| Item |
|---|
fn jail_exists() -> Result <bool> |
fn jail_running() -> Result <bool> |
verb:postgres
Idempotent provision/teardown of the ONE disposable jail used to
| Item |
|---|
fn postgres_installed() -> Result <bool> |
fn postgres_initialized() -> Result <bool> |
fn postgres_configured() -> Result <bool> |
fn postgres_running() -> Result <bool> |
verb:provision
Idempotent provision/teardown of the ONE disposable jail used to
| Item |
|---|
fn provision() -> Result <()> |
verb:ssh
Idempotent provision/teardown of the ONE disposable jail used to
| Item |
|---|
fn ssh_argv(remote_cmd : & str) -> Vec <String> |
verb:status
Idempotent provision/teardown of the ONE disposable jail used to
| Item |
|---|
fn status() -> Result <()> |
verb:teardown
Idempotent provision/teardown of the ONE disposable jail used to
| Item |
|---|
fn teardown() -> Result <()> |
verb:test
Idempotent provision/teardown of the ONE disposable jail used to
| Item |
|---|
fn test_db_exists() -> Result <bool> |
verb:verify
Idempotent provision/teardown of the ONE disposable jail used to
| Item |
|---|
fn verify() -> Result <()> |
How to use it
No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.
Module structure
No public modules: the crate root is its whole surface.
Public surface
`crate root`
| Item | What it is |
|---|---|
pub const JAIL_NAME: & str | — |
pub const JAIL_IP: & str | — |
pub const JAIL_VER: & str | — |
pub const DB_NAME: & str | — |
pub const DB_ROLE: & str | — |
pub const DB_PASSWORD: & str | Not a real secret: the role is only reachable from inside the jail bridge subnet (never exposed beyond an explicit SSH port-forward the operator runs by hand), and the whole jail is destroyable on demand. |
fn ssh_argv(remote_cmd : & str) -> Vec <String> | Build the ssh argv for one remote command |
fn jail_exists() -> Result <bool> | — |
fn jail_running() -> Result <bool> | — |
fn postgres_installed() -> Result <bool> | — |
fn postgres_initialized() -> Result <bool> | — |
fn postgres_configured() -> Result <bool> | Distinct from postgres_initialized -- initdb and "listen_addresses was appended to postgresql.conf" are two different steps that can fail independently (found live: initdb succeeded, the config-append step failed on a quoting bug, and a naive "PG_VERSION exists -> skip this whole block" check would have silently skipped the config step forever on re-run) |
fn postgres_running() -> Result <bool> | — |
fn test_db_exists() -> Result <bool> | — |
fn provision() -> Result <()> | Idempotent: every step checks before acting. |
fn verify() -> Result <()> | The wired procedure: provision -> port-forward -> migrate -> test -> always tear the tunnel down (jail itself is left running -- teardown is a separate, explicit step, not implied by a passing test run). |
fn teardown() -> Result <()> | Stop and remove the jail |
fn status() -> Result <()> | — |
No pub use re-exports: every item above is declared in this crate.
Boundary
Depends on no other workspace tier.
Shares tier tools with 84 other crates: tools-advisory-reach, tools-archive-guard, tools-artifact-scaffold, tools-ask-ai-core, tools-ask-ais, tools-ask-gemini, tools-book, tools-book-report, … (84 total).
_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._
Where it sits
| Tier (ontology) | tools |
| Architectural role (taxonomy) | unclassified (baselined) |
| Location | crates/tools/parties-test-db |
| Vocabulary in force (lexicon) | current |
Dependencies
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
anyhow | ^1 | — | no | always |
Development. None.
Build. None.
Depended on by. Nothing in this workspace.
Feature flags
No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.
Targets
| Kind | Name | Source |
|---|---|---|
| bin | tools-parties-test-db | `src/main.rs` |
| lib | tools_parties_test_db | `src/lib.rs` |
Error model
No public error type was detected: no public item declares a type named *Error, and no public signature returns one.
Operational characteristics
| Property | Evidence |
|---|---|
| async public surface | none detected |
| async runtime | none detected |
| database access | none detected |
| network I/O | none detected |
| unsafe code | none detected |
| environment variables | yes |
No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.
Configuration
| Variable | Read in |
|---|---|
CARGO_MANIFEST_DIR | src/lib.rs |
Related capabilities
No workspace crate depends on this one.
Verification
| Kind | Count |
|---|---|
| Unit tests | 3 |
| Integration tests | 0 |
| Examples | 0 |
| Doctests | 0 |
Evidence by module. How often each public module is named by something executable.
| Module | Tests | Examples | Consumers |
|---|---|---|---|
crate root | 18 | 0 | 0 |
What the tests establish, by name:
jail_ip_is_not_any_existing_jails_address—src/lib.rsonly_the_constant_jail_name_is_ever_used—src/lib.rsssh_argv_always_targets_the_configured_host_and_port—src/lib.rs
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 6 | 18 |
Public modules with a //! block | 0 | 0 |
pie showData
title Public items with rustdoc
"Documented" : 6
"No rustdoc detected" : 12
Metrics
| Metric | Value |
|---|---|
| Rust source files | 2 |
| Source lines | 563 |
| Code lines | 361 |
| Public API items | 18 |
| Public modules | 0 |
| Tests | 3 |
| Examples | 0 |
| Cargo features | 0 |
| Direct runtime dependencies | 1 |
| Workspace reverse dependencies | 0 |
pie showData
title Public API by kind
"constant" : 6
"function" : 12
pie showData
title Rust source composition
"Code" : 361
"Blank or comment" : 202
Generation
Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.