chore: revalidate against hero_rpc#128 (typed _find E2E tests) #10

Merged
timur merged 1 commit from issue-find-tests-codegen into development 2026-05-22 12:28:01 +00:00
Owner

Follow-up to merged hero_rpc#128 (commit f834ff99). The hero_rpc generator now emits one tests/generated/<root>_find_e2e.rs per rootobject with at least one @index field. Picks up the new test binaries by:

  • Bumping every hero_rpc{2,_osis} dep in Cargo.lock to f834ff99 (was e62d4485).
  • Restamping tests/Cargo.toml with the five new [[test]] entries the generator's new sync logic appended on cargo build.

Tests emitted by the regen

Rootobject Indexed fields #[tokio::test] count
IndexedSingle title: str @index 4 (eq + prefix + contains + no-match)
IndexedMulti title: str @index, category: BenchCategory @index 7 (3 str + 2 enum + AND + no-match)
IndexedNonStr priority: u32 @index 7 (eq + gt + gte + lt + lte + range + no-match)
ServiceDefinition name: str @index 4 (eq + prefix + contains + no-match)

Total: 22 new _find_e2e tests added across this revalidation. The pre-existing <root>_full_lifecycle CRUD tests are unchanged.

Each generated test:

  • Spins up the service via hero_service_tests::spin_up_service().
  • Checks the local hero_indexer socket via an inline indexer_reachable() helper (mirrors hero_rpc/crates/osis/tests/indexer_smoke.rs); when unreachable the test bails with eprintln! rather than panicking — keeps CI environments without hero_indexer green.
  • Seeds 5–10 rows with deterministic field values via <root>_new.
  • Calls <root>_find(<Root>FindParams { ... }) with the test's filter under exercise.
  • Asserts on the returned sids as a HashSet<String> against the combinatorial expected subset.
  • Deletes the seeded rows so reruns are idempotent.

Validation

  • cargo build --workspace clean.
  • cargo test --workspace --no-run clean — every _find_e2e binary links.
  • cargo test --test indexed_single_find_e2e -- --list returns 4 tests; indexed_multi_find_e2e returns 7; indexed_non_str_find_e2e returns 7; service_definition_find_e2e returns 4 — matches the table above.
  • cargo test --workspace --lib --bins clean (no test regressions in the unit-test surface).
  • The live-wire CRUD _full_lifecycle tests hit the orthogonal OsisIndexer Runtime::new() + block_on() panic that already affects hero_service development at 7763ab0 (Cannot start a runtime from within a runtime) — pre-existing, not caused by this PR. Fixing that runtime layering is a separate hero_rpc-side task.

Generator-side change driving the regen

hero_rpc#128 extends tests_emit.rs so the trailing [[test]] section of tests/Cargo.toml is rewritten in place on every build. Existing consumers (whose tests/Cargo.toml is write_preserved by the scaffolder) thus pick up the new <root>_find_e2e binaries automatically without needing to re-run the scaffolder.

Follow-up to merged hero_rpc#128 (commit `f834ff99`). The hero_rpc generator now emits one `tests/generated/<root>_find_e2e.rs` per rootobject with at least one `@index` field. Picks up the new test binaries by: - Bumping every `hero_rpc{2,_osis}` dep in `Cargo.lock` to `f834ff99` (was `e62d4485`). - Restamping `tests/Cargo.toml` with the five new `[[test]]` entries the generator's new sync logic appended on `cargo build`. ## Tests emitted by the regen | Rootobject | Indexed fields | #[tokio::test] count | |---|---|---| | `IndexedSingle` | `title: str @index` | 4 (eq + prefix + contains + no-match) | | `IndexedMulti` | `title: str @index`, `category: BenchCategory @index` | 7 (3 str + 2 enum + AND + no-match) | | `IndexedNonStr` | `priority: u32 @index` | 7 (eq + gt + gte + lt + lte + range + no-match) | | `ServiceDefinition` | `name: str @index` | 4 (eq + prefix + contains + no-match) | Total: **22 new `_find_e2e` tests** added across this revalidation. The pre-existing `<root>_full_lifecycle` CRUD tests are unchanged. Each generated test: - Spins up the service via `hero_service_tests::spin_up_service()`. - Checks the local `hero_indexer` socket via an inline `indexer_reachable()` helper (mirrors `hero_rpc/crates/osis/tests/indexer_smoke.rs`); when unreachable the test bails with `eprintln!` rather than panicking — keeps CI environments without hero_indexer green. - Seeds 5–10 rows with deterministic field values via `<root>_new`. - Calls `<root>_find(<Root>FindParams { ... })` with the test's filter under exercise. - Asserts on the returned sids as a `HashSet<String>` against the combinatorial expected subset. - Deletes the seeded rows so reruns are idempotent. ## Validation - `cargo build --workspace` clean. - `cargo test --workspace --no-run` clean — every `_find_e2e` binary links. - `cargo test --test indexed_single_find_e2e -- --list` returns 4 tests; `indexed_multi_find_e2e` returns 7; `indexed_non_str_find_e2e` returns 7; `service_definition_find_e2e` returns 4 — matches the table above. - `cargo test --workspace --lib --bins` clean (no test regressions in the unit-test surface). - The live-wire CRUD `_full_lifecycle` tests hit the orthogonal `OsisIndexer` `Runtime::new()` + `block_on()` panic that already affects `hero_service` development at `7763ab0` (`Cannot start a runtime from within a runtime`) — pre-existing, not caused by this PR. Fixing that runtime layering is a separate hero_rpc-side task. ## Generator-side change driving the regen hero_rpc#128 extends `tests_emit.rs` so the trailing `[[test]]` section of `tests/Cargo.toml` is rewritten in place on every build. Existing consumers (whose `tests/Cargo.toml` is `write_preserved` by the scaffolder) thus pick up the new `<root>_find_e2e` binaries automatically without needing to re-run the scaffolder.
hero_rpc#128 (merged at f834ff99) makes the generator emit one
tests/generated/<root>_find_e2e.rs per indexed rootobject — 22 new
tokio tests across the four indexed rootobjects:

- IndexedSingle    → 4   (3 str + 1 negative)
- IndexedMulti     → 7   (3 str + 2 enum + 1 AND + 1 negative)
- IndexedNonStr    → 7   (6 numeric + 1 negative)
- ServiceDefinition → 4  (3 str + 1 negative)

The new generator-side tests_emit also rewrites the trailing [[test]]
section of tests/Cargo.toml on every cargo build, so the manifest
updates are picked up automatically. This commit captures the
post-regen state of:

- Cargo.lock — hero_rpc deps bumped to f834ff99
- tests/Cargo.toml — five new [[test]] entries (one per new
  generated/<root>_find_e2e.rs binary)

The generated/*.rs files themselves stay gitignored (regenerated on
every build, per hero_rpc#96 layout).
timur merged commit 8c76589ba4 into development 2026-05-22 12:28:01 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_service_example!10
No description provided.