Forge reviews module. Sprint 61.
| Tier | application |
| Role | unclassified (baselined) |
| Path | crates/application/reviews |
| Edition | 2024 |
| Targets | application_reviews, pg_forge_reviews |
| Public items | 20 across 5 modules |
| Tests | 7 |
What it is for
application-reviews — Layer 3 module. Sprint 61.
B-009 Gate-0.5 investigation: before this, migrations() returned Vec::new() and migrate_pending returned Ok(0) while ignoring the pool, even though services::reviews is itself a thin adapter over the reviews / review_summaries tables + triggers owned by domain-reviews (crates/domain/reviews, migrations/001_reviews_init.sql + 002_curation_fields.sql) — this crate's own Cargo.toml didn't even depend on domain-reviews before this pass, despite services/reviews.rs's and api/reviews_admin.rs's doc comments explicitly naming it as the schema owner. Mirrors application-catalog's and application-encounters's pattern: vendor the library crate's own migration files via include_str! so a host mounting application-reviews alone still gets the schema.
Note: application-engine's central platform set already vendors both files (migrations/014_primitives_reviews_init.sql, 015_primitives_reviews_curation.sql) for its own review widgets, so on a DB where the central set has already run, this module's own migrate_pending is a no-op (both source files use IF NOT EXISTS / idempotent forms throughout, so re-applying is safe rather than erroring — unlike application-tenant's documented CREATE TABLE non-idempotency gap).
No permission_codes() added: neither domain-reviews nor this crate defines permission/capability constants to draw from.
Capabilities
ReviewsModule
application-reviews — Layer 3 module. Sprint 61.
| Item |
|---|
pub struct ReviewsModule |
ReviewsModule :: fn new() -> Self |
ReviewsModule :: fn name(& self) -> & 'static str |
ReviewsModule :: fn version(& self) -> & 'static str |
ReviewsModule :: fn migrations(& self) -> Vec <MigrationSet> |
ReviewsModule :: async fn migrate_pending(& self, pool : & PgPool) -> Result <u32, MigrationError> |
api (other)
HTTP routers for application-reviews. Sprint 65: extracted from rust-cms-engine.
| Item |
|---|
fn admin_router <S>() -> Router <S> where S : Clone + Send + Sync + 'static, PgPool : FromRef <S>, |
fn public_router <S>() -> Router <S> where S : Clone + Send + Sync + 'static, PgPool : FromRef <S>, |
api::reviews_admin (other)
Reviews admin REST router.
| Item |
|---|
fn router <S>() -> Router <S> where S : Clone + Send + Sync + 'static, PgPool : FromRef <S>, |
api::reviews_public (other)
Reviews public read endpoint.
| Item |
|---|
fn router <S>() -> Router <S> where S : Clone + Send + Sync + 'static, PgPool : FromRef <S>, |
TopQuery
Reviews public read endpoint.
| Item |
|---|
pub struct TopQuery |
services::reviews (other)
Reviews service — wraps the reviews table from
| Item |
|---|
async fn list(pool : & PgPool, filter : ListFilter) -> Result <Vec <Review>, ReviewError> |
async fn get(pool : & PgPool, id : Uuid) -> Result <Option <Review>, ReviewError> |
async fn create(pool : & PgPool, input : UpsertReviewInput) -> Result <Review, ReviewError> |
async fn update(pool : & PgPool, id : Uuid, input : UpsertReviewInput,) -> Result <Review, ReviewError> |
ListFilter
Reviews service — wraps the reviews table from
| Item |
|---|
pub struct ListFilter |
Review
Reviews service — wraps the reviews table from
| Item |
|---|
pub struct Review |
ReviewError
Reviews service — wraps the reviews table from
| Item |
|---|
pub enum ReviewError |
async fn delete(pool : & PgPool, id : Uuid) -> Result <(), ReviewError> |
UpsertReviewInput
Reviews service — wraps the reviews table from
| Item |
|---|
pub struct UpsertReviewInput |
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
application_reviews
apiapi::reviews_adminapi::reviews_publicservicesservices::reviews
flowchart TD n_application_reviews["application_reviews"] n_application_reviews --> n_api["api"] n_api --> n_api__reviews_admin["reviews_admin"] n_api --> n_api__reviews_public["reviews_public"] n_application_reviews --> n_services["services"] n_services --> n_services__reviews["reviews"]
Public surface
`crate root`
| Item | What it is |
|---|---|
pub struct ReviewsModule | — |
ReviewsModule :: fn new() -> Self | — |
ReviewsModule :: fn name(& self) -> & 'static str | — |
ReviewsModule :: fn version(& self) -> & 'static str | — |
ReviewsModule :: fn migrations(& self) -> Vec <MigrationSet> | — |
ReviewsModule :: async fn migrate_pending(& self, pool : & PgPool) -> Result <u32, MigrationError> | — |
`api`
| Item | What it is |
|---|---|
fn admin_router <S>() -> Router <S> where S : Clone + Send + Sync + 'static, PgPool : FromRef <S>, | Admin-facing reviews routes (/reviews, /reviews/:id). |
fn public_router <S>() -> Router <S> where S : Clone + Send + Sync + 'static, PgPool : FromRef <S>, | Public customer-facing reviews routes (/reviews/top). |
`api::reviews_admin`
| Item | What it is |
|---|---|
fn router <S>() -> Router <S> where S : Clone + Send + Sync + 'static, PgPool : FromRef <S>, | — |
`api::reviews_public`
| Item | What it is |
|---|---|
pub struct TopQuery | — |
fn router <S>() -> Router <S> where S : Clone + Send + Sync + 'static, PgPool : FromRef <S>, | — |
`services::reviews`
| Item | What it is |
|---|---|
pub enum ReviewError | — |
pub struct Review | Engine-side row struct that maps to the reviews table |
pub struct UpsertReviewInput | — |
pub struct ListFilter | — |
async fn list(pool : & PgPool, filter : ListFilter) -> Result <Vec <Review>, ReviewError> | List reviews with optional filtering |
async fn get(pool : & PgPool, id : Uuid) -> Result <Option <Review>, ReviewError> | — |
async fn create(pool : & PgPool, input : UpsertReviewInput) -> Result <Review, ReviewError> | — |
async fn update(pool : & PgPool, id : Uuid, input : UpsertReviewInput,) -> Result <Review, ReviewError> | — |
async fn delete(pool : & PgPool, id : Uuid) -> Result <(), ReviewError> | — |
No pub use re-exports: every item above is declared in this crate.
Boundary
Reaches into domain, platform.
Shares tier application with 120 other crates: application-agreements, application-ai, application-analytics, application-approvals, application-assessments, application-audit-log, application-auth, application-billing, … (120 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) | application |
| Architectural role (taxonomy) | unclassified (baselined) |
| Location | crates/application/reviews |
| Vocabulary in force (lexicon) | current |
Tier flow. Which tiers this crate's own edges cross.
flowchart LR n_application["application"] --> n_domain["domain"] n_application["application"] --> n_platform["platform"]
Dependencies
Runtime, in this workspace.
| Crate | Tier | Optional | Only on |
|---|---|---|---|
| `application-core` | application | no | always |
| `domain-reviews` | domain | no | always |
| `platform-dto` | platform | no | always |
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
async-trait | ^0.1 | — | no | always |
axum | ^0.7 | multipart | no | always |
chrono | ^0.4 | serde | no | always |
serde | ^1 | derive | no | always |
serde_json | ^1 | — | no | always |
sqlx | ^0.8 | runtime-tokio, postgres, chrono, uuid, json | no | always |
thiserror | ^2 | — | no | always |
tracing | ^0.1 | — | no | always |
uuid | ^1 | v4, v7, serde, js | no | always |
Development, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
tokio | ^1 | full | no | always |
Build. None.
Depended on by. Nothing in this workspace.
Signal flow — what reaches this crate, and what it reaches.
flowchart LR SELF["application-reviews"] SELF -->|runtime| n_application_core["application-core"] SELF -->|runtime| n_domain_reviews["domain-reviews"] SELF -->|runtime| n_platform_dto["platform-dto"] classDef self fill:#1f883d,stroke:#1f883d,color:#fff; class SELF self;
Feature flags
No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.
Targets
| Kind | Name | Source |
|---|---|---|
| lib | application_reviews | `src/lib.rs` |
| test | pg_forge_reviews | `tests/pg_forge_reviews.rs` |
Error model
| Error type | Named by |
|---|---|
ReviewError | create, delete, get, list, update |
Operational characteristics
| Property | Evidence |
|---|---|
| async public surface | yes |
| async runtime | none detected |
| database access | yes |
| network I/O | yes |
| 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_PKG_VERSION | src/lib.rs |
Related capabilities
No workspace crate depends on this one.
Verification
| Kind | Count |
|---|---|
| Unit tests | 6 |
| Integration tests | 1 |
| Examples | 0 |
| Doctests | 0 |
Evidence by module. How often each public module is named by something executable.
| Module | Tests | Examples | Consumers |
|---|---|---|---|
crate root | 1 | 0 | 0 |
api | 2 | 0 | 0 |
api::reviews_admin | 1 | 0 | 0 |
api::reviews_public | 2 | 0 | 0 |
services::reviews | 9 | 0 | 0 |
What the tests establish, by name:
migrate_pending_creates_reviews_table—tests/pg_forge_reviews.rsreview_round_trip_through_serde—src/api/reviews_public.rstop_query_defaults_are_unbounded—src/api/reviews_public.rstest_module_migrations_non_empty—src/lib.rsduplicate_source_error_renders_without_thiserror_collision—src/services/reviews.rsinvalid_source_kind_carries_value—src/services/reviews.rslist_filter_default_is_unconstrained—src/services/reviews.rs
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 4 | 20 |
Public modules with a //! block | 4 | 5 |
pie showData
title Public items with rustdoc
"Documented" : 4
"No rustdoc detected" : 16
Metrics
| Metric | Value |
|---|---|
| Rust source files | 6 |
| Source lines | 698 |
| Code lines | 548 |
| Public API items | 20 |
| Public modules | 5 |
| Tests | 7 |
| Examples | 0 |
| Cargo features | 0 |
| Direct runtime dependencies | 12 |
| Workspace reverse dependencies | 0 |
pie showData
title Public API by kind
"enum" : 1
"function" : 9
"method" : 5
"struct" : 5
pie showData
title Rust source composition
"Code" : 548
"Blank or comment" : 150
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.