hero_rpc#123 follow-up: codegen-emit per-(field × shape) _find E2E tests #128
No reviewers
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_rpc!128
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-123-find-tests-codegen"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up to merged hero_rpc#127 (commit
e62d448). The typed<root>_findmethod and<Root>FindParamsstruct are emitted by codegen but onlyStrFilter::Eq(str+enum equality) andNumFilter::Ltare exercised over the real wire today (via the osis_benchespreflightasserts). Closes the gap.What this PR emits
For every rootobject with at least one
@indexfield the workspace-root tests emitter now writes a siblingtests/generated/<root>_find_e2e.rsalongside the existing CRUD lifecycle file. One#[tokio::test]per (indexed field × filter shape) pair:str @index→eq,prefix,contains(StrFilter)bool @index→eq(BoolFilter)@index→eq,gt,gte,lt,lte,range(NumFilter)@index→eq,one_of(EnumFilter)Plus, per rootobject:
<root>_find_and_across_fields(when ≥2 indexed fields) — pins AND-across-fields semantics against the 4-row combinatorial seed<root>_find_no_match_returns_empty— pins the empty-result contract on a probe value no seeded row carriesEach test owns its seed rows (5–10 per test, deterministic), asserts on returned sids as a
HashSetagainst the expected subset, and deletes its seeds socargo testreruns are idempotent. The generated file embeds an inlineindexer_reachable()helper that mirrorscrates/osis/tests/indexer_smoke.rs::indexer_reachable— CI environments without hero_indexer skip each test cleanly witheprintln!rather than panicking.Per-shape filter test counts on hero_service's bench domain
Validated by rebuilding hero_service (
/private/tmp/hero_service_findtestsworktree) against this branch:IndexedSingle(1 str @index)titleIndexedMulti(1 str + 1 enum)title,categoryIndexedNonStr(1 numeric)priority: u32 @indexServiceDefinition(1 str)nameTotal across the four indexed rootobjects: 22 new
#[tokio::test]bodies. Pre-PR baseline (the existing<root>_full_lifecycleCRUD entry per rootobject) keeps emitting unchanged.No
#[ignore]gates were needed —EnumFilter::OneOfandBoolFilter::Eqhave full server-side lowerings incrates/generator/src/rust/rust_struct.rs::render_find_params_to_indexer_queryalready, so every filter shape this PR emits is end-to-end testable on a livehero_indexer.What changed in the generator
crates/generator/src/build/fixture.rs—FieldInfonow carriesis_indexed: bool+rust_type: Stringso the find-test emitter can pick concreteNumFilter<T>/EnumFilter<T>type parameters and enum variant identifiers.crates/generator/src/build/find_tests_emit.rs(new, ~860 LOC) — renders the<root>_find_e2e.rscontent. One render fn per (filter shape, variant) pair. The AND-across-fields and no-match templates pick representative match / miss values per shape via a smallfilter_match_pair()helper.crates/generator/src/build/tests_emit.rs— drives find-file emission, extendsmod.rsindex, and now also rewrites the trailing[[test]]section oftests/Cargo.tomlin place so existing consumers (whosetests/Cargo.tomliswrite_preservedby the scaffolder) pick up the new[[test]]registrations oncargo build.crates/generator/src/build/scaffold.rs— emits the new[[test]]Cargo.toml entries on initial scaffold runs too.Validation
cargo build -p hero_rpc_generatorclean.cargo test -p hero_rpc_generator --lib— 137 passed; 0 failed; 1 ignored (baseline)./private/tmp/hero_service_findtests(offorigin/development@7763ab0) with hero_rpc deps repointed at this branch:cargo build --workspaceclean.cargo test --workspace --no-runclean — every find_e2e binary links.cargo test --test <name> -- --list).OsisIndexerRuntime::new() + block_on()issue (#127 introduced this; pre-existing CRUD tests hit the sameCannot start a runtime from within a runtimepanic on hero_service7763ab0— not caused by this PR; the codegen surface is independently green).Companion hero_service PR
Will open against
lhumina_code/hero_servicedevelopment after this lands, restamping thetests/generated/payload +tests/Cargo.tomlagainst the merged hero_rpc tip.