EpicGames/lore · error

handler should succeed even for a miss

Error message

handler should succeed even for a miss

What it means

In the test immutable_local_get_metadata_routes_to_local_store, the replication store service's run_request_handler is expected to succeed even when the metadata lookup misses (returns MatchNone). The .expect fires when the handler itself returns an error rather than a well-formed miss response, meaning routing or store plumbing failed before a match decision could be made.

Solutions

  1. Verify the local store created by create_two_stores is registered with the service before run_request_handler
  2. Ensure the ExecutionContext is scoped (LORE_CONTEXT.scope) for the handler call exactly as production code does
  3. Check run_request_handler's error to see which store/route failed and fix the routing entry
  4. Update the test request construction if AttributeMap requirements changed

Example fix

// before
let service_output = service.run_request_handler(AttributeMap::default().into(), parse_output).await.expect("handler should succeed even for a miss");
// after
// ensure local store is routed first:
// service.register_local_store(local_store.clone());
let service_output = service.run_request_handler(AttributeMap::default().into(), parse_output).await.expect("handler should succeed even for a miss");
Defensive patterns

Strategy: validation

Validate before calling

// before running the handler, assert routing is set up
assert!(service.has_local_store_route(Command::ImmutableLocalGetMetadata), "local store route missing");

Type guard

fn is_well_formed_output(bytes: &[u8]) -> bool { !bytes.is_empty() } // pre-check before parse_response

Try / catch

match service.run_request_handler(attrs, parse_output).await {
    Ok(out) => { /* expect miss path */ },
    Err(e) => eprintln!("handler failed on miss; check local-store routing: {e:?}"),
}

Prevention

When it happens

Trigger: The local store is not wired into the service's routing (request goes to main store and errors), the execution context (LORE_CONTEXT scope) is missing/mismatched so the local store lookup fails, or run_request_handler returns an internal error for ImmutableLocalGetMetadata opcode.

Common situations: Changing routing tables so local-opcodes hit the wrong store, tearing down the local store before the request runs, or new required request attributes not being supplied in the test harness.

Related errors


AI-assisted analysis of EpicGames/lore@074eb0b0d1 (2026-09-13). Data as JSON: /api/errors/7bc658f111f70897. Report an issue: GitHub.

Appendix: source

Thrown at lore-server/src/quic/replication_store_service/server.rs:1057

            .run_request_handler(AttributeMap::default().into(), parse_output)
            .await
            .expect("handler failed");
        let parsed_response =
            get_metadata::parse_response(collapse_bytes(&service_output)).expect("Failed to parse");
        assert_eq!(parsed_response.match_made, StoreMatch::MatchFull);

        // Regular ImmutableGetMetadata should NOT find it (main store is empty)
        let parse_output = service
            .parse_request_bytes(
                &CommandHeader::new(Command::ImmutableGetMetadata as QuicOpCode, 0, 0),
                collapse_bytes_without_header(&request.to_quic_chunks()),
            )
            .expect("Failed to parse");

        let service_output = service
            .run_request_handler(AttributeMap::default().into(), parse_output)
            .await
            .expect("handler should succeed even for a miss");
        let parsed_response =
            get_metadata::parse_response(collapse_bytes(&service_output)).expect("Failed to parse");
        assert_eq!(parsed_response.match_made, StoreMatch::MatchNone);
    }

    /// Helper to create a second independent store for local-store routing tests
    async fn create_two_stores() -> (
        Arc<dyn ImmutableStore>,
        Arc<dyn ImmutableStore>,
        Arc<lore_revision::interface::ExecutionContext>,
    ) {
        let (main_store, _, execution) = test_store_create()
            .await
            .expect("Failed to create main store");
        let (local_store, _, _) = test_store_create()
            .await
            .expect("Failed to create local store");
        (main_store, local_store, execution)

View on GitHub (pinned to 074eb0b0d1)