mirror of
https://github.com/hanzoai/insights.git
synced 2026-11-02 14:32:45 +00:00
PersonHog was the last of it, and it was not only a name. The package is personinsights and the types in it are already Person* -- the shipped descriptor under personinsights_client/proto/generated says PersonService and the tests say TestFakePersonClient -- but the .proto still declared PersonHogService. A client dialling one service name and a server built from a .proto declaring another is not a naming problem, it is a wire that does not connect; the only reason nobody hit it is that none of these services runs here yet. Five service declarations now say what the generated client has said all along. StreamHog was a second fictional company, invented so a Stripe mock had someone to bill. This fork already has Hedgebox, in five hundred fixtures, so the mock bills Hedgebox and there is one made-up company again instead of two. REVIEW_HOG was an enum member in three enums that had to agree, whose value has been `review` since the app was renamed. Only the member said otherwise. Every rule is in bin/debrand and every spelling is refused there, so a fresh upstream import lands on these names and none of them can come back. Two are named as outstanding rather than refused, with the reason each is still sayable: hogdesk survives inside applied migrations' choices lists, where Django compares it in Python and never writes it -- the member is Desk = "desk" and all three tables that store it hold no rows; sherlockhog keys a service in another repository that still calls itself that, and renaming our half would classify its traffic as a product that does not exist. Co-authored-by: Hanzo Dev <[email protected]>
85 lines
2.4 KiB
Rust
85 lines
2.4 KiB
Rust
use tonic::{Code, Request};
|
|
|
|
use personinsights_identity::lifecycle::validation::MAX_DELETE_BATCH_SIZE;
|
|
use personinsights_identity::lifecycle::PersonLifecycleService;
|
|
use personinsights_proto::personinsights::lifecycle::v1::person_lifecycle_server::PersonLifecycle;
|
|
use personinsights_proto::personinsights::lifecycle::v1::DeletePersonsRequest;
|
|
|
|
fn valid_request() -> DeletePersonsRequest {
|
|
DeletePersonsRequest {
|
|
team_id: 1,
|
|
person_ids: vec![42],
|
|
op_id: "018f6f60-8c5a-7000-8000-000000000000".to_string(),
|
|
}
|
|
}
|
|
|
|
async fn delete_status(request: DeletePersonsRequest) -> Code {
|
|
let service = PersonLifecycleService::new();
|
|
service
|
|
.delete_persons(Request::new(request))
|
|
.await
|
|
.expect_err("skeleton service never returns Ok")
|
|
.code()
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn invalid_requests_are_rejected_before_the_saga() {
|
|
let cases: Vec<(&str, DeletePersonsRequest)> = vec![
|
|
(
|
|
"zero team_id",
|
|
DeletePersonsRequest {
|
|
team_id: 0,
|
|
..valid_request()
|
|
},
|
|
),
|
|
(
|
|
"team_id above i32 wraps in int4 storage",
|
|
DeletePersonsRequest {
|
|
team_id: i64::from(i32::MAX) + 1,
|
|
..valid_request()
|
|
},
|
|
),
|
|
(
|
|
"empty person_ids",
|
|
DeletePersonsRequest {
|
|
person_ids: vec![],
|
|
..valid_request()
|
|
},
|
|
),
|
|
(
|
|
"batch above cap",
|
|
DeletePersonsRequest {
|
|
person_ids: (1..=(MAX_DELETE_BATCH_SIZE as i64 + 1)).collect(),
|
|
..valid_request()
|
|
},
|
|
),
|
|
(
|
|
"non-positive person id",
|
|
DeletePersonsRequest {
|
|
person_ids: vec![42, 0],
|
|
..valid_request()
|
|
},
|
|
),
|
|
(
|
|
"op_id not a uuid",
|
|
DeletePersonsRequest {
|
|
op_id: "not-a-uuid".to_string(),
|
|
..valid_request()
|
|
},
|
|
),
|
|
];
|
|
|
|
for (name, request) in cases {
|
|
assert_eq!(
|
|
delete_status(request).await,
|
|
Code::InvalidArgument,
|
|
"case: {name}"
|
|
);
|
|
}
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn valid_request_reports_unimplemented_until_the_engine_lands() {
|
|
assert_eq!(delete_status(valid_request()).await, Code::Unimplemented);
|
|
}
|