@@ -408,12 +408,45 @@ void main() {
408408 await nativeEngine.loadModelSource (source, options: options);
409409
410410 expect (downloadManager.ensureModelCalls, 1 );
411- expect (downloadManager.lastSource, source);
411+ expect (downloadManager.lastSource? .path, source.path);
412+ expect (downloadManager.lastSource? .cacheKey, source.cacheKey);
412413 expect (downloadManager.lastOptions, same (options));
413414 expect (nativeBackend.lastModelPath, '/models/model.gguf' );
414415 },
415416 );
416417
418+ test (
419+ 'native loadModelSource honors resolver-provided local path' ,
420+ () async {
421+ final source = ModelSource .path ('/models/original.gguf' );
422+ final resolvedSource = ModelSource .path ('/models/resolved.gguf' );
423+ final entry = ModelCacheEntry (
424+ sourceCanonicalKey: resolvedSource.metadataSourceKey,
425+ cacheKey: resolvedSource.cacheKey,
426+ fileName: resolvedSource.fileName,
427+ filePath: '/models/resolved.gguf' ,
428+ createdAt: DateTime .utc (2026 ),
429+ updatedAt: DateTime .utc (2026 ),
430+ );
431+ final resolver = MockModelResolver (
432+ const LocalModelFile ('/models/resolved.gguf' ),
433+ );
434+ final downloadManager = MockModelDownloadManager (entry);
435+ final nativeBackend = MockLlamaBackend ();
436+ final nativeEngine = LlamaEngine (
437+ nativeBackend,
438+ modelResolver: resolver,
439+ modelDownloadManager: downloadManager,
440+ );
441+
442+ await nativeEngine.loadModelSource (source);
443+
444+ expect (resolver.lastSource, source);
445+ expect (downloadManager.lastSource? .path, '/models/resolved.gguf' );
446+ expect (nativeBackend.lastModelPath, '/models/resolved.gguf' );
447+ },
448+ );
449+
417450 test ('loadModelFromUrl unsupported on non-URL backend' , () async {
418451 expect (
419452 () => engine.loadModelFromUrl ('http://test.gguf' ),
0 commit comments