mind-body: types, forbid(unsafe_code) and pair-wise gate properties carry the Grant rule
Per ruling mind-launch-forge-scanner-bound: compile_fail doctests for the struct literal and each derive-provided path on Grant; forbid(unsafe_code) in the library; the gate property draws the mind's own instance from the same slug generator as the Grant's and tests pairs; Persona claim shapes are drawn and rotated by seed; the path-literal and static-keyword scanners are deleted from the public-surface test, whose limits are written at its top. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
7f70bbda13
commit
8e8fb0d17d
5 changed files with 237 additions and 216 deletions
|
|
@ -131,6 +131,41 @@ pub enum Effective {
|
|||
/// `read_effective` makes one; `open_and_launch` takes it by value and refuses
|
||||
/// one read for another instance, so one reading opens at most one run, of the
|
||||
/// instance it was read for.
|
||||
///
|
||||
/// Outside this crate the type system leaves no way to make one: the fields are
|
||||
/// private, there is no public constructor, and the derives give no path (no
|
||||
/// `Default`, `Clone`, `Deserialize` or `From`). Each way is tried here and
|
||||
/// refused:
|
||||
///
|
||||
/// ```compile_fail,E0451
|
||||
/// use mind_body::control::Grant;
|
||||
/// // a struct literal
|
||||
/// let _ = Grant { instance: eureka_pipeline::Slug("eureka".into()), cadence: std::time::Duration::ZERO, run_cap_usd: rust_decimal::Decimal::ONE };
|
||||
/// ```
|
||||
///
|
||||
/// ```compile_fail,E0277
|
||||
/// // not Default
|
||||
/// let _: mind_body::control::Grant = Default::default();
|
||||
/// ```
|
||||
///
|
||||
/// ```compile_fail,E0599
|
||||
/// // not Clone, so a reading cannot be copied into a second run
|
||||
/// fn copy(grant: &mind_body::control::Grant) -> mind_body::control::Grant {
|
||||
/// grant.clone()
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// ```compile_fail,E0277
|
||||
/// // not Deserialize
|
||||
/// fn read<T: serde::de::DeserializeOwned>() {}
|
||||
/// read::<mind_body::control::Grant>();
|
||||
/// ```
|
||||
///
|
||||
/// ```compile_fail,E0277
|
||||
/// // not From its parts
|
||||
/// use mind_body::control::Grant;
|
||||
/// let _ = Grant::from((eureka_pipeline::Slug("eureka".into()), std::time::Duration::ZERO, rust_decimal::Decimal::ONE));
|
||||
/// ```
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub struct Grant {
|
||||
instance: Slug,
|
||||
|
|
@ -253,12 +288,6 @@ pub fn load_state(source: &impl ControlSource) -> Result<ControlState> {
|
|||
/// ```
|
||||
///
|
||||
/// ```compile_fail
|
||||
/// use mind_body::control::Grant;
|
||||
/// // a Grant cannot be written out
|
||||
/// let _ = Grant { instance: eureka_pipeline::Slug("eureka".into()), cadence: std::time::Duration::ZERO, run_cap_usd: rust_decimal::Decimal::ONE };
|
||||
/// ```
|
||||
///
|
||||
/// ```compile_fail
|
||||
/// // and the test constructor is not in the library build
|
||||
/// let _ = mind_body::control::Grant::for_test;
|
||||
/// ```
|
||||
|
|
|
|||
Loading…
Reference in a new issue