# diesel-rs/diesel — codebase unpack

> Canonical page: https://codevetter.com/unpack/diesel

This is a deterministic Repo Unpack scan of diesel-rs/diesel — a structural map, not a review, security audit, or maintainer-endorsed description.

- Scanned commit: 5cdf54e1434b87084a4630c100249f1028f3e32d (2026-10-02)
- Last upstream commit: Merge pull request #5261 from malandrina/lw-local-mysql-version
- Generated by codevetter 1.15.0 on 2026-10-02
- 2273 files scanned · 8.4 MB

Source inspection; upstream code and tests were not executed.

## Languages

- Rust: 898 files
- SQL: 446 files
- TOML: 135 files
- Markdown: 23 files
- YAML: 20 files
- HTML: 1 files
- JavaScript: 1 files
- Python: 1 files

## Repository structure

- diesel_cli/ — 782 files
- diesel_compile_tests/ — 378 files
- diesel/ — 308 files
- examples/ — 237 files
- diesel_derives/ — 141 files
- migrations/ — 132 files
- diesel_tests/ — 67 files
- fuzz/ — 47 files

Probable source entrypoint: `Cargo.toml` (inferred from the tree, not upstream docs)

## Package

- Cargo.toml: null — 0 declared dependencies

## Structural health signals

Average score 7.7/10 across 96 files; 21 hotspots. These are deterministic review leads, not proof of a bug.

## Recent history

- 5cdf54e1434b (2026-10-02) Merge pull request #5261 from malandrina/lw-local-mysql-version
- 69f8b047fb84 (2026-10-02) Merge pull request #5258 from Samyra312007/miri-ffi-tests
- 2d66feaa5865 (2026-10-02) Merge pull request #5170 from LucaCappelletti94/mysql-negative-time
- 298d0fcb1441 (2026-10-02) Post merge fixes
- 7146c77e4506 (2026-10-02) Merge remote-tracking branch 'upstream/main' into miri-ffi-tests

## Overview

Diesel is a Rust ORM and typed SQL query builder for PostgreSQL, SQLite, MySQL, and MariaDB, accompanied by a database-management CLI and migration libraries. It serves application developers who want schema-aware queries, model conversion, associations, and explicit database execution through mutable connections. This pinned revision also includes runtime schemas, view nullability inference, Rust migration callbacks, and SQLite examples targeting WebAssembly and embedded hardware.

## System map

The workspace separates typed query execution, code generation, database tooling, and migration management into cooperating crates. Applications link Diesel directly, while the diesel executable supplies operational commands. Backend features select native drivers and dialect implementations, with additional SQLite platform support. Distribution and developer verification are implemented through cargo-dist, xtask, and GitHub Actions.
- The root workspace includes diesel, diesel_cli, diesel_derives, diesel_migrations, diesel_dynamic_schema, diesel_infer_query, parser crates, examples, and xtask; its shared baseline is Rust 1.88.0 and edition 2024. — [Cargo.toml#L1-L43](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/Cargo.toml#L1-L43)
- The actual diesel and diesel_cli package versions are 2.3.13; the CLI manifest declares the diesel binary at src/main.rs. — [diesel/Cargo.toml#L1-L13](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/Cargo.toml#L1-L13) [diesel_cli/Cargo.toml#L1-L13](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/Cargo.toml#L1-L13) [diesel_cli/Cargo.toml#L30-L33](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/Cargo.toml#L30-L33)
- diesel/src/lib.rs exposes associations, expressions, query_builder, query_dsl, serialization, rows, migrations, and feature-gated backend modules; query construction and driver execution are separate module boundaries. — [diesel/src/lib.rs#L320-L355](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/lib.rs#L320-L355) [diesel/src/query_dsl/load_dsl.rs#L42-L71](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/query_dsl/load_dsl.rs#L42-L71)
- diesel_derives is a procedural-macro crate depending on shared attribute/table parsers and dsl_auto_type; diesel_attribute_parser explicitly identifies itself as internal. — [diesel_derives/Cargo.toml#L14-L32](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_derives/Cargo.toml#L14-L32) [diesel_attribute_parser/Cargo.toml#L1-L17](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_attribute_parser/Cargo.toml#L1-L17)
- Backend features connect PostgreSQL through pq-sys, MySQL/MariaDB through mysqlclient-sys, and SQLite through target-specific libsqlite3-sys or sqlite-wasm-rs dependencies. — [diesel/Cargo.toml#L27-L30](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/Cargo.toml#L27-L30) [diesel/Cargo.toml#L54-L58](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/Cargo.toml#L54-L58) [diesel/Cargo.toml#L89-L110](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/Cargo.toml#L89-L110)
- PgConnection owns a statement cache, PostgreSQL metadata cache, raw connection, transaction state, and instrumentation; persisted migration versions belong to __diesel_schema_migrations in the database. — [diesel/src/pg/connection/mod.rs#L125-L129](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/pg/connection/mod.rs#L125-L129) [diesel/src/pg/connection/mod.rs#L181-L190](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/pg/connection/mod.rs#L181-L190) [diesel_migrations/src/migration_harness.rs#L16-L21](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_migrations/src/migration_harness.rs#L16-L21)
- cargo xtask is a Cargo alias for the xtask package, whose commands include run-tests, clippy, tidy, and semver-checks; CONTRIBUTING.md directs contributors to run-tests and tidy. — [.cargo/config.toml#L1-L2](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/.cargo/config.toml#L1-L2) [xtask/src/main.rs#L11-L39](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/xtask/src/main.rs#L11-L39) [CONTRIBUTING.md#L122-L128](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/CONTRIBUTING.md#L122-L128) [CONTRIBUTING.md#L148-L150](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/CONTRIBUTING.md#L148-L150)
- cargo-dist targets five macOS/Linux/Windows architectures with shell and PowerShell installers, bundled CLI dependencies, SBOMs, and attestations; release publication is gated by the workflow's publishing output. — [dist-workspace.toml#L5-L31](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/dist-workspace.toml#L5-L31) [diesel_cli/Cargo.toml#L96-L97](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/Cargo.toml#L96-L97) [.github/workflows/release.yml#L244-L277](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/.github/workflows/release.yml#L244-L277)

## Feature catalog

Diesel's primary interface is a Rust API for composing and executing queries against typed schemas. The CLI adds database setup, migration lifecycle commands, schema generation, and shell completions. Supporting libraries offer runtime schema names, custom type conversion, and several migration sources. Examples demonstrate associations, authenticated blog operations, and embedded SQLite.
- Query composition includes filtering, selection, ordering, limits, and association-based subqueries; construction remains separate from load execution. — [README.md#L69-L83](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/README.md#L69-L83) [diesel/src/query_dsl/mod.rs#L694-L699](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/query_dsl/mod.rs#L694-L699) [diesel/src/query_dsl/mod.rs#L1702-L1706](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/query_dsl/mod.rs#L1702-L1706)
- The DSL exports insert_into, update, delete, insert_or_ignore_into, replace_into, select, and sql_query; execute returns affected-row counts, while get_result returns the first row or Error::NotFound. — [diesel/src/lib.rs#L385-L392](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/lib.rs#L385-L392) [diesel/src/query_dsl/load_dsl.rs#L91-L99](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/query_dsl/load_dsl.rs#L91-L99) [diesel/src/query_dsl/mod.rs#L1886-L1893](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/query_dsl/mod.rs#L1886-L1893)
- Associations support belonging_to and grouped_by, while joins support related and nullable records; the PostgreSQL relations example demonstrates one-to-many and many-to-many traversal. — [examples/postgres/relations/src/main.rs#L67-L111](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/examples/postgres/relations/src/main.rs#L67-L111) [examples/postgres/relations/src/main.rs#L118-L140](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/examples/postgres/relations/src/main.rs#L118-L140)
- CLI commands are migration, setup, database/db, completions, and print-schema; migration dispatch implements run, revert, redo, list, pending, and generate. — [diesel_cli/src/cli.rs#L55-L79](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/cli.rs#L55-L79) [diesel_cli/src/migrations/mod.rs#L207-L239](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/migrations/mod.rs#L207-L239) [diesel_cli/src/migrations/mod.rs#L241-L272](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/migrations/mod.rs#L241-L272)
- Schema configuration supports documentation, table filters, column order, schema namespaces, patches, imported/custom types, Rust enums, views, and experimental view-nullability inference. — [diesel_cli/src/config.rs#L488-L523](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/config.rs#L488-L523)
- Migration generation can compare a Rust schema with the live database to produce up/down SQL; migration libraries additionally support filesystem SQL, embedded SQL, and Rust callbacks or TypedMigration implementations. — [diesel_cli/src/migrations/mod.rs#L281-L330](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/migrations/mod.rs#L281-L330) [diesel_migrations/src/file_based_migrations.rs#L15-L32](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_migrations/src/file_based_migrations.rs#L15-L32) [diesel_migrations/migrations_macros/src/lib.rs#L31-L40](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_migrations/migrations_macros/src/lib.rs#L31-L40) [diesel_migrations/src/rust_migrations.rs#L10-L29](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_migrations/src/rust_migrations.rs#L10-L29)
- diesel_dynamic_schema constructs tables and columns at runtime with explicit selections; custom Rust values can implement ToSql and FromSql, as illustrated by the Language enum. — [diesel_dynamic_schema/src/lib.rs#L13-L27](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_dynamic_schema/src/lib.rs#L13-L27) [diesel_dynamic_schema/src/lib.rs#L48-L57](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_dynamic_schema/src/lib.rs#L48-L57) [examples/postgres/custom_types/src/model.rs#L7-L35](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/examples/postgres/custom_types/src/model.rs#L7-L35)
- The advanced blog example offers paginated posts/comments, registration, post creation/editing/publishing, and comment creation/editing; the embedded SQLite example repeatedly queries both static and dynamic schemas. — [examples/postgres/advanced-blog-cli/src/main.rs#L34-L79](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/examples/postgres/advanced-blog-cli/src/main.rs#L34-L79) [examples/postgres/advanced-blog-cli/src/main.rs#L81-L153](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/examples/postgres/advanced-blog-cli/src/main.rs#L81-L153) [examples/sqlite/embedded/src/main.rs#L63-L94](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/examples/sqlite/embedded/src/main.rs#L63-L94)

## Data flow

Library input becomes a typed query representation before a backend serializes binds and executes SQL. Connections own runtime caches and transaction state, while row conversion produces application values. CLI input combines arguments, environment variables, and TOML configuration before accessing databases or filesystem outputs. Migration state and generated schema files are separate persistence boundaries.
- QueryFragment::walk_ast defines AST-node behavior; to_sql performs a SQL-generation pass, while bind values are serialized separately from SQL placeholders. — [diesel/src/query_builder/mod.rs#L255-L277](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/query_builder/mod.rs#L255-L277)
- LoadQuery requires backend-compatible result types, converts the source through as_query, obtains a connection cursor, and maps each row through U::build_from_row with DeserializationError conversion. — [diesel/src/query_dsl/load_dsl.rs#L42-L71](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/query_dsl/load_dsl.rs#L42-L71) [diesel/src/query_dsl/load_dsl.rs#L121-L148](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/query_dsl/load_dsl.rs#L121-L148)
- PostgreSQL collect_binds produces raw byte values and type metadata; with_prepared_query passes metadata to the statement cache and values separately to execution. — [diesel/src/pg/connection/mod.rs#L548-L558](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/pg/connection/mod.rs#L548-L558) [diesel/src/pg/connection/mod.rs#L572-L600](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/pg/connection/mod.rs#L572-L600)
- The statement cache checks query cache safety, reuses occupied entries, registers newly prepared statements when capacity permits, and prepares uncached statements for unsafe or capacity-limited cases. — [diesel/src/connection/statement_cache/mod.rs#L326-L365](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/connection/statement_cache/mod.rs#L326-L365)
- CLI database URLs prefer explicit options over DATABASE_URL; config paths prefer arguments over DIESEL_CONFIG_FILE, and migration paths prefer arguments, MIGRATION_DIRECTORY, configuration, then ancestor discovery. — [diesel_cli/src/database.rs#L575-L578](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/database.rs#L575-L578) [diesel_cli/src/config.rs#L29-L49](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/config.rs#L29-L49) [diesel_cli/src/migrations/mod.rs#L571-L594](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/migrations/mod.rs#L571-L594)
- SchemaResolverImpl owns catalog-result caching and a recursive resolution chain; requested tables load catalog metadata, views invoke load_view_data, and cycles return CyclicViewDefinition. — [diesel_cli/src/infer_schema_internals/schema_resolver.rs#L10-L17](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/infer_schema_internals/schema_resolver.rs#L10-L17) [diesel_cli/src/infer_schema_internals/schema_resolver.rs#L40-L61](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/infer_schema_internals/schema_resolver.rs#L40-L61) [diesel_cli/src/infer_schema_internals/schema_resolver.rs#L64-L105](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/infer_schema_internals/schema_resolver.rs#L64-L105)
- Generated schema data passes through relation/custom-type formatting, rustfmt, and optional diffy patch application; print-schema writes to its output writer, while regeneration writes configured files or compares them in locked mode. — [diesel_cli/src/print_schema.rs#L814-L842](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/print_schema.rs#L814-L842) [diesel_cli/src/print_schema.rs#L844-L896](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/print_schema.rs#L844-L896) [diesel_cli/src/print_schema.rs#L402-L418](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/print_schema.rs#L402-L418) [diesel_cli/src/main.rs#L302-L325](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/main.rs#L302-L325)
- SQL migration files are read into strings and passed to batch_execute; successful application inserts a version record, successful reversal deletes it, and applied versions are read in descending order. — [diesel_migrations/src/file_based_migrations.rs#L283-L300](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_migrations/src/file_based_migrations.rs#L283-L300) [diesel_migrations/src/migration_harness.rs#L178-L195](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_migrations/src/migration_harness.rs#L178-L195) [diesel_migrations/src/migration_harness.rs#L210-L225](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_migrations/src/migration_harness.rs#L210-L225) [diesel_migrations/src/migration_harness.rs#L235-L241](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_migrations/src/migration_harness.rs#L235-L241)

## Behavior traces

The inspected flows cover CLI startup, database setup, migration application, schema printing, query execution, and example operations. Each trace follows named functions across their implementation boundaries. Migration application reaches both SQL execution and version bookkeeping before optional schema regeneration. PostgreSQL query tracing distinguishes cached named statements from uncached parameterized execution.
- Startup: main calls inner_main, which initializes DIESEL_LOG tracing, invokes dotenvy::dotenv, tolerates a missing dotenv file, parses Cli, and dispatches; returned errors are printed before exit code 1. — [diesel_cli/src/main.rs#L50-L108](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/main.rs#L50-L108)
- Setup: run_setup_command calls create_migrations_dir and create_config_file, then setup_database resolves the URL, creates the database if needed, optionally creates default migrations, and invokes schema-table setup/migration execution. — [diesel_cli/src/database.rs#L213-L223](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/database.rs#L213-L223) [diesel_cli/src/database.rs#L266-L281](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/database.rs#L266-L281) [diesel_cli/src/main.rs#L128-L135](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/main.rs#L128-L135) [diesel_cli/src/main.rs#L161-L184](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/main.rs#L161-L184)
- Migration run: run_migration_command calls conn_and_migration_dir, which establishes InferConnection and validates FileBasedMigrations; run_migrations_with_output delegates to HarnessWithOutput::run_pending_migrations, then regenerates schema unless --no-schema. — [diesel_cli/src/migrations/mod.rs#L207-L214](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/migrations/mod.rs#L207-L214) [diesel_cli/src/migrations/mod.rs#L343-L353](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/migrations/mod.rs#L343-L353) [diesel_cli/src/migrations/mod.rs#L492-L503](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/migrations/mod.rs#L492-L503)
- Migration persistence: run_pending_migrations calls pending_migrations, removes already applied versions and sorts remaining versions ascending, then run_migration executes SQL and inserts bookkeeping inside a transaction when metadata permits. — [diesel_migrations/src/migration_harness.rs#L31-L47](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_migrations/src/migration_harness.rs#L31-L47) [diesel_migrations/src/migration_harness.rs#L111-L129](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_migrations/src/migration_harness.rs#L111-L129) [diesel_migrations/src/migration_harness.rs#L172-L201](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_migrations/src/migration_harness.rs#L172-L201) [diesel_migrations/src/file_based_migrations.rs#L193-L199](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_migrations/src/file_based_migrations.rs#L193-L199)
- Print schema: run_infer_schema establishes a connection, reads/overrides configuration, computes multi-schema context, and calls run_print_schema; output_schema discovers relations and foreign keys, resolves metadata, formats/patches Rust, then writes stdout. — [diesel_cli/src/print_schema.rs#L330-L359](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/print_schema.rs#L330-L359) [diesel_cli/src/print_schema.rs#L402-L418](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/print_schema.rs#L402-L418) [diesel_cli/src/print_schema.rs#L772-L812](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/print_schema.rs#L772-L812) [diesel_cli/src/print_schema.rs#L863-L896](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/print_schema.rs#L863-L896)
- PostgreSQL load: RunQueryDsl::load calls internal_load and collects results; internal_load calls connection.load, which uses with_prepared_query, inner_load, Statement::execute, and the selected loading mode's cursor before row deserialization. — [diesel/src/query_dsl/mod.rs#L1702-L1706](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/query_dsl/mod.rs#L1702-L1706) [diesel/src/query_dsl/load_dsl.rs#L62-L71](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/query_dsl/load_dsl.rs#L62-L71) [diesel/src/pg/connection/mod.rs#L255-L289](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/pg/connection/mod.rs#L255-L289) [diesel/src/query_dsl/load_dsl.rs#L128-L148](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/query_dsl/load_dsl.rs#L128-L148)
- PostgreSQL execution branch: Statement::execute builds parameter pointers/lengths, rejects counts or sizes exceeding i32, sends named statements through send_query_prepared or unnamed SQL through send_query_params, optionally enables row-by-row mode, and retrieves a result. — [diesel/src/pg/connection/stmt/mod.rs#L26-L95](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/pg/connection/stmt/mod.rs#L26-L95) [diesel/src/pg/connection/raw.rs#L74-L95](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/pg/connection/raw.rs#L74-L95) [diesel/src/pg/connection/raw.rs#L106-L124](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/pg/connection/raw.rs#L106-L124)
- Blog create-post: run_cli establishes PgConnection, current_user delegates to current_user_from_env/find_user and Argon2 verification, editor::edit_string round-trips a temporary file through an external editor, then insert_into returns the post ID. — [examples/postgres/advanced-blog-cli/src/main.rs#L31-L32](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/examples/postgres/advanced-blog-cli/src/main.rs#L31-L32) [examples/postgres/advanced-blog-cli/src/main.rs#L68-L79](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/examples/postgres/advanced-blog-cli/src/main.rs#L68-L79) [examples/postgres/advanced-blog-cli/src/auth.rs#L42-L76](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/examples/postgres/advanced-blog-cli/src/auth.rs#L42-L76) [examples/postgres/advanced-blog-cli/src/editor.rs#L8-L27](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/examples/postgres/advanced-blog-cli/src/editor.rs#L8-L27)

## Testing signals

Tests and CI were inspected, not executed; no passing result or measured coverage is asserted. The repository combines Rust runtime tests, compile-failure diagnostics, procedural-macro snapshots, CLI subprocess tests, and fuzzing workflows. The inspected tests verify concrete database and generated-code behavior, with backend-specific conditions. This inventory is bounded and does not establish exhaustive coverage or whole-repository test gaps.
- diesel_tests registers integration modules for CRUD, associations, joins, raw SQL, transactions, migrations, instrumentation, types, views, and window functions, with some modules gated by backend features. — [diesel_tests/tests/lib.rs#L16-L74](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_tests/tests/lib.rs#L16-L74)
- Transaction tests inspect cross-connection visibility and rollback on returned errors; the visibility test explicitly excludes SQLite because it requires a file-backed database, and the rollback-error test is SQLite-specific. — [diesel_tests/tests/transactions.rs#L5-L35](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_tests/tests/transactions.rs#L5-L35) [diesel_tests/tests/transactions.rs#L44-L61](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_tests/tests/transactions.rs#L44-L61) [diesel_tests/tests/transactions.rs#L64-L92](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_tests/tests/transactions.rs#L64-L92)
- Despite its trybuild.rs filename, the compile-failure harness uses ui_test against tests/fail, normalizes diagnostic paths/text, and enables output blessing whenever BLESS exists; an inspected fixture rejects integer/string comparisons. — [diesel_compile_tests/tests/trybuild.rs#L4-L14](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_compile_tests/tests/trybuild.rs#L4-L14) [diesel_compile_tests/tests/trybuild.rs#L80-L102](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_compile_tests/tests/trybuild.rs#L80-L102) [diesel_compile_tests/tests/fail/expressions_can_only_be_compared_for_equality_to_expressions_of_same_type.rs#L12-L18](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_compile_tests/tests/fail/expressions_can_only_be_compared_for_equality_to_expressions_of_same_type.rs#L12-L18)
- Procedural-macro tests expand tokens, parse the result with syn, apply FixupVisitor, format through prettyplease, and assert insta snapshots; these assertions check generated text rather than database execution. — [diesel_derives/src/tests/mod.rs#L87-L112](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_derives/src/tests/mod.rs#L87-L112)
- CLI tests register database and migration command suites; migration_run_runs_pending_migrations checks command success, emitted migration output, and actual table creation. — [diesel_cli/tests/tests.rs#L3-L17](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/tests/tests.rs#L3-L17) [diesel_cli/tests/migration_run.rs#L7-L32](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/tests/migration_run.rs#L7-L32)
- Schema tests compare CLI/config-generated output with insta snapshots and conditionally compile it in a temporary Cargo project; check_compile=false deliberately skips that compilation assertion for selected cases. — [diesel_cli/tests/print_schema.rs#L717-L749](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/tests/print_schema.rs#L717-L749) [diesel_cli/tests/print_schema.rs#L782-L834](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/tests/print_schema.rs#L782-L834) [diesel_cli/tests/print_schema.rs#L14-L21](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/tests/print_schema.rs#L14-L21)
- CI defines a four-backend, five-platform stable matrix plus Linux beta/nightly entries, invokes cargo xtask run-tests, skips doctests/example-schema checks outside Linux, and uploads coverage outside merge_group events. — [.github/workflows/ci.yml#L32-L72](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/.github/workflows/ci.yml#L32-L72) [.github/workflows/ci.yml#L340-L375](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/.github/workflows/ci.yml#L340-L375)
- Fuzz CI runs harness tests on PRs/pushes, but cargo-fuzz target execution is workflow_dispatch-only; separate ClusterFuzzLite PR jobs specify address sanitization and 600 seconds, while audit CI runs cargo deny check. — [.github/workflows/fuzz.yml#L25-L47](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/.github/workflows/fuzz.yml#L25-L47) [.github/workflows/fuzz.yml#L73-L81](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/.github/workflows/fuzz.yml#L73-L81) [.github/workflows/cflite_pr.yml#L13-L31](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/.github/workflows/cflite_pr.yml#L13-L31) [.github/workflows/audit.yml#L15-L26](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/.github/workflows/audit.yml#L15-L26)

## Risk map

These findings describe source-level trust boundaries and review hotspots, not runtime-confirmed vulnerabilities. Database operations can mutate remote databases or local files, and raw SQL reduces compile-time validation. Migration commits and schema-file verification occur at different stages. The advanced blog example contains security-relevant teaching shortcuts and an update target that warrants focused review.
- Source observation: EditComment loads a comment scoped to the current user, but executes diesel::update(comments) without a filter or identified-record target; the update construction does not preserve the preceding ownership selection. — [examples/postgres/advanced-blog-cli/src/main.rs#L116-L128](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/examples/postgres/advanced-blog-cli/src/main.rs#L116-L128)
- Source observation: blog registration hashes passwords with Argon2 using a constant salt; the implementation explicitly warns against this pattern in real applications. — [examples/postgres/advanced-blog-cli/src/auth.rs#L10-L10](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/examples/postgres/advanced-blog-cli/src/auth.rs#L10-L10) [examples/postgres/advanced-blog-cli/src/auth.rs#L80-L99](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/examples/postgres/advanced-blog-cli/src/auth.rs#L80-L99)
- Operational boundary: database reset calls drop before setup; server backends execute DROP DATABASE, while SQLite drop removes an existing path supplied as database_url. — [diesel_cli/src/database.rs#L257-L264](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/database.rs#L257-L264) [diesel_cli/src/database.rs#L410-L440](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/database.rs#L410-L440) [diesel_cli/src/database.rs#L443-L474](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/database.rs#L443-L474)
- Source observation: --locked-schema validation runs after migrations; a schema mismatch returns SchemaWouldChange, and the inspected dispatch provides no enclosing rollback around migration execution and file comparison. — [diesel_cli/src/migrations/mod.rs#L207-L214](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/migrations/mod.rs#L207-L214) [diesel_cli/src/main.rs#L308-L325](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/main.rs#L308-L325) [diesel_migrations/src/migration_harness.rs#L191-L201](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_migrations/src/migration_harness.rs#L191-L201)
- Migration metadata read/parse errors are discarded by unwrap_or_default; transaction-disabled migrations execute SQL and insert bookkeeping without the harness transaction wrapper. — [diesel_migrations/src/file_based_migrations.rs#L176-L185](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_migrations/src/file_based_migrations.rs#L176-L185) [diesel_migrations/migrations_internals/src/lib.rs#L36-L54](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_migrations/migrations_internals/src/lib.rs#L36-L54) [diesel_migrations/src/migration_harness.rs#L178-L195](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_migrations/src/migration_harness.rs#L178-L195)
- Raw SqlQuery binds cannot validate SQL placeholder types or parameter counts, and dynamic schemas cannot verify runtime table/column existence or declared types; these are documented reductions in static guarantees. — [diesel/src/query_builder/sql_query.rs#L34-L46](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/query_builder/sql_query.rs#L34-L46) [diesel_dynamic_schema/src/lib.rs#L13-L27](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_dynamic_schema/src/lib.rs#L13-L27)
- Native PostgreSQL execution crosses unsafe libpq boundaries for connection pointers and parameter arrays; Statement::execute includes explicit i32 conversion checks, so preserving ownership and bounds behavior is essential when editing this code. — [diesel/src/pg/connection/raw.rs#L19-L46](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/pg/connection/raw.rs#L19-L46) [diesel/src/pg/connection/stmt/mod.rs#L26-L89](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/pg/connection/stmt/mod.rs#L26-L89)
- External trust boundaries include PATH-resolved rustfmt, VISUAL/EDITOR-selected subprocesses, temporary editor files, and configured schema/patch paths; relative paths are joined to the config directory without a repository-containment check in the inspected code. — [diesel_cli/src/print_schema.rs#L899-L923](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/print_schema.rs#L899-L923) [examples/postgres/advanced-blog-cli/src/editor.rs#L8-L35](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/examples/postgres/advanced-blog-cli/src/editor.rs#L8-L35) [diesel_cli/src/config.rs#L546-L556](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/config.rs#L546-L556) [diesel_cli/src/main.rs#L294-L325](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/main.rs#L294-L325)

## Extension points

Extensions primarily enter through Rust traits, procedural macros, configuration fields, and explicit CLI dispatch. Backend support separates dialect metadata from connection implementation. Applications can add custom value conversion, query fragments, instrumentation, and migration sources. Internal extension interfaces sometimes require an explicit feature acknowledging compatibility risk.
- Custom Backend implementations supply QueryBuilder, RawValue, BindCollector, SqlDialect, TypeMetadata, and SQL-type mappings; access requires the third-party-backend opt-in feature. — [diesel/src/backend.rs#L30-L60](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/backend.rs#L30-L60) [diesel/src/backend.rs#L84-L113](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/backend.rs#L84-L113)
- Custom connections implement Connection with backend and transaction-manager ownership; the documentation also calls for backend-specific FromSql/ToSql conversions and gates implementations through ConnectionSealed. — [diesel/src/connection/mod.rs#L202-L245](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/connection/mod.rs#L202-L245)
- New query AST nodes implement QueryFragment::walk_ast, which supplies SQL-generation and other AST-pass behavior; execution/loading requires appropriate QueryFragment and QueryId implementations. — [diesel/src/query_builder/mod.rs#L241-L271](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/query_builder/mod.rs#L241-L271) [diesel/src/query_dsl/load_dsl.rs#L42-L49](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/query_dsl/load_dsl.rs#L42-L49) [diesel/src/query_dsl/load_dsl.rs#L91-L98](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/query_dsl/load_dsl.rs#L91-L98)
- Custom SQL value types implement ToSql and FromSql and derive expression/row support; the Language example serializes enum variants as PostgreSQL bytes and rejects unknown variants during decoding. — [examples/postgres/custom_types/src/model.rs#L7-L35](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/examples/postgres/custom_types/src/model.rs#L7-L35)
- Instrumentation extensions implement on_connection_event or use a closure, can be installed per connection, and can register a global constructor for future connections when std is enabled. — [diesel/src/connection/instrumentation.rs#L249-L264](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/connection/instrumentation.rs#L249-L264) [diesel/src/connection/instrumentation.rs#L269-L299](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/connection/instrumentation.rs#L269-L299) [diesel/src/pg/connection/mod.rs#L235-L240](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/pg/connection/mod.rs#L235-L240) [diesel_cli/src/database.rs#L199-L207](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/database.rs#L199-L207)
- Migration extensions implement Migration, MigrationMetadata, and MigrationSource; RustMigrationSource additionally registers callbacks, functions, RustMigration values, or custom TypedMigration implementations. — [diesel/src/migration/mod.rs#L99-L144](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/migration/mod.rs#L99-L144) [diesel_migrations/src/rust_migrations.rs#L10-L29](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_migrations/src/rust_migrations.rs#L10-L29)
- CLI additions enter DieselCliCommand or MigrationCommand and their dispatch matches; schema customization enters PrintSchema configuration and the Config::read/update path. — [diesel_cli/src/cli.rs#L55-L79](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/cli.rs#L55-L79) [diesel_cli/src/main.rs#L81-L107](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/main.rs#L81-L107) [diesel_cli/src/migrations/mod.rs#L241-L272](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/migrations/mod.rs#L241-L272) [diesel_cli/src/config.rs#L488-L523](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/config.rs#L488-L523)
- SchemaResolver is exported for SQL/view inference, and SchemaResolverImpl adapts CLI catalog metadata to it; table_proc routes table macro expansion into query_source_macro, while view declarations use the corresponding generated schema model. — [diesel_infer_query/src/lib.rs#L18-L22](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_infer_query/src/lib.rs#L18-L22) [diesel_cli/src/infer_schema_internals/schema_resolver.rs#L109-L127](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/infer_schema_internals/schema_resolver.rs#L109-L127) [diesel_derives/src/lib.rs#L1506-L1508](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_derives/src/lib.rs#L1506-L1508) [diesel_derives/src/lib.rs#L1596-L1609](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_derives/src/lib.rs#L1596-L1609)

## Contributor handoff

Use the pinned manifests and affected crate implementation as the starting context, because the supplied inventory contains simplified version and backend information. Tests and CI were inspected, not executed, and this brief covers a bounded set of source paths. Future implementation work should preserve backend gates and use dedicated test databases before authorizing execution. Public API changes, generated diagnostics, schema snapshots, and embedded migration rebuilds require special attention.
- Read Cargo.toml and the affected crate manifest first: Rust 1.88.0/edition 2024, Diesel 2.3.13, four backend features, and target-specific SQLite dependencies are concrete constraints in this revision. — [Cargo.toml#L40-L43](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/Cargo.toml#L40-L43) [diesel/Cargo.toml#L1-L13](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/Cargo.toml#L1-L13) [diesel/Cargo.toml#L54-L58](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/Cargo.toml#L54-L58) [diesel/Cargo.toml#L89-L110](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/Cargo.toml#L89-L110)
- For query-runtime changes, follow RunQueryDsl::load, LoadQuery::internal_load, backend LoadConnection, statement preparation, and row decoding before choosing an edit boundary. — [diesel/src/query_dsl/mod.rs#L1702-L1706](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/query_dsl/mod.rs#L1702-L1706) [diesel/src/query_dsl/load_dsl.rs#L62-L71](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/query_dsl/load_dsl.rs#L62-L71) [diesel/src/pg/connection/mod.rs#L255-L289](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/pg/connection/mod.rs#L255-L289) [diesel/src/query_dsl/load_dsl.rs#L128-L148](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel/src/query_dsl/load_dsl.rs#L128-L148)
- For CLI/schema work, read cli.rs, main.rs, config.rs, and print_schema.rs together; configuration overrides, relative paths, multi-schema context, patches, and locked-file handling all affect observable output. — [diesel_cli/src/cli.rs#L20-L44](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/cli.rs#L20-L44) [diesel_cli/src/config.rs#L29-L58](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/config.rs#L29-L58) [diesel_cli/src/print_schema.rs#L330-L359](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/print_schema.rs#L330-L359) [diesel_cli/src/main.rs#L294-L325](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/src/main.rs#L294-L325)
- The inspected test sources and workflow declarations describe intended checks, not execution results: review CLI schema snapshots/compilation, migration assertions, compile-failure diagnostics, and CI configuration before planning validation. — [diesel_cli/tests/print_schema.rs#L717-L749](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/tests/print_schema.rs#L717-L749) [diesel_cli/tests/migration_run.rs#L7-L32](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_cli/tests/migration_run.rs#L7-L32) [diesel_compile_tests/tests/trybuild.rs#L96-L102](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_compile_tests/tests/trybuild.rs#L96-L102) [.github/workflows/ci.yml#L352-L375](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/.github/workflows/ci.yml#L352-L375)
- In authorized implementation work, start with the affected backend/test and use cargo xtask run-tests for broader checks; xtask resolves backend-specific database variables, runs migrations first, and invokes nextest with coordinated crate features. — [CONTRIBUTING.md#L124-L128](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/CONTRIBUTING.md#L124-L128) [xtask/src/tests/mod.rs#L186-L220](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/xtask/src/tests/mod.rs#L186-L220) [xtask/src/tests/mod.rs#L224-L256](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/xtask/src/tests/mod.rs#L224-L256)
- Preserve compile-error and snapshot expectations deliberately: BLESS presence rewrites ui_test outputs, while CONTRIBUTING.md calls for reviewing insta changes; tidy and semver-checks are existing tooling entrypoints. — [diesel_compile_tests/tests/trybuild.rs#L96-L102](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_compile_tests/tests/trybuild.rs#L96-L102) [CONTRIBUTING.md#L194-L208](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/CONTRIBUTING.md#L194-L208) [xtask/src/main.rs#L19-L30](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/xtask/src/main.rs#L19-L30)
- Embedded migrations have a documented rebuild trap: changes only to migration files may not rerun the procedural macro, and consuming applications should use build.rs rerun-if-changed declarations. — [diesel_migrations/migrations_macros/src/lib.rs#L105-L120](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/diesel_migrations/migrations_macros/src/lib.rs#L105-L120)
- Contribution conventions require minimal, reviewed, verified changes and AI-use disclosure; the guide reserves mentoring/good-first-issue work from AI use and asks authors to write their own PR descriptions. — [CONTRIBUTING.md#L155-L171](https://github.com/diesel-rs/diesel/blob/5cdf54e1434b87084a4630c100249f1028f3e32d/CONTRIBUTING.md#L155-L171)

Source repository: https://github.com/diesel-rs/diesel
Full evidence corpus: https://github.com/Codevetter/codevetter/tree/main/benchmarks/repo-unpacks/diesel.json

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
