diff --git a/tests/core_project_tests.rs b/crates/fastskill-core/tests/core_project_tests.rs similarity index 96% rename from tests/core_project_tests.rs rename to crates/fastskill-core/tests/core_project_tests.rs index cf266085..de101827 100644 --- a/tests/core_project_tests.rs +++ b/crates/fastskill-core/tests/core_project_tests.rs @@ -1,8 +1,8 @@ //! Unit tests for file resolution priority #![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)] -use fastskill::core::manifest::ProjectContext; -use fastskill::core::project::{detect_context, resolve_project_file}; +use fastskill_core::core::manifest::ProjectContext; +use fastskill_core::core::project::{detect_context, resolve_project_file}; use std::fs; use tempfile::TempDir; diff --git a/tests/cors_tests.rs b/crates/fastskill-core/tests/cors_tests.rs similarity index 91% rename from tests/cors_tests.rs rename to crates/fastskill-core/tests/cors_tests.rs index ae98ffad..bd03052f 100644 --- a/tests/cors_tests.rs +++ b/crates/fastskill-core/tests/cors_tests.rs @@ -13,17 +13,17 @@ clippy::assertions_on_constants )] -use fastskill::core::manifest::SkillProjectToml; -use fastskill::core::service::HttpServerConfig; +use fastskill_core::core::manifest::SkillProjectToml; +use fastskill_core::core::service::HttpServerConfig; use std::fs; use tempfile::TempDir; #[test] fn test_build_cors_layer_no_config() { // When no server config is present, should deny all origins - let config = fastskill::ServiceConfig::default(); + let config = fastskill_core::ServiceConfig::default(); - let _cors_layer = fastskill::http::server::build_cors_layer(&config); + let _cors_layer = fastskill_core::http::server::build_cors_layer(&config); // We can't easily test the CORS layer internals, but we verified it compiles // and logs a warning about no config found @@ -33,7 +33,7 @@ fn test_build_cors_layer_no_config() { #[test] fn test_build_cors_layer_empty_origins() { // When allowed_origins is empty, should deny all origins - let config = fastskill::ServiceConfig { + let config = fastskill_core::ServiceConfig { http_server: Some(HttpServerConfig { allowed_origins: vec![], allowed_headers: vec!["Content-Type".to_string(), "Authorization".to_string()], @@ -41,7 +41,7 @@ fn test_build_cors_layer_empty_origins() { ..Default::default() }; - let _cors_layer = fastskill::http::server::build_cors_layer(&config); + let _cors_layer = fastskill_core::http::server::build_cors_layer(&config); // Verified it compiles assert!(true); @@ -50,7 +50,7 @@ fn test_build_cors_layer_empty_origins() { #[test] fn test_build_cors_layer_with_origins() { // When allowed_origins is set, should allow those origins - let config = fastskill::ServiceConfig { + let config = fastskill_core::ServiceConfig { http_server: Some(HttpServerConfig { allowed_origins: vec![ "https://example.com".to_string(), @@ -61,7 +61,7 @@ fn test_build_cors_layer_with_origins() { ..Default::default() }; - let _cors_layer = fastskill::http::server::build_cors_layer(&config); + let _cors_layer = fastskill_core::http::server::build_cors_layer(&config); // Verified it compiles assert!(true); @@ -86,7 +86,7 @@ allowed_headers = ["Content-Type", "Authorization", "X-API-Key"] fs::write(&project_file, content).unwrap(); - let config_result = fastskill::core::load_project_config(temp_dir.path()); + let config_result = fastskill_core::core::load_project_config(temp_dir.path()); assert!(config_result.is_ok()); // Load project TOML and verify server config diff --git a/tests/git_consumption_test.rs b/crates/fastskill-core/tests/git_consumption_test.rs similarity index 99% rename from tests/git_consumption_test.rs rename to crates/fastskill-core/tests/git_consumption_test.rs index d308811c..9caa5dee 100644 --- a/tests/git_consumption_test.rs +++ b/crates/fastskill-core/tests/git_consumption_test.rs @@ -2,7 +2,7 @@ #![allow(clippy::all, clippy::unwrap_used, clippy::expect_used, clippy::panic)] -use fastskill::core::repository::{ +use fastskill_core::core::repository::{ RepositoryConfig, RepositoryDefinition, RepositoryManager, RepositoryType, }; use tempfile::TempDir; diff --git a/tests/index_manager_test.rs b/crates/fastskill-core/tests/index_manager_test.rs similarity index 96% rename from tests/index_manager_test.rs rename to crates/fastskill-core/tests/index_manager_test.rs index d471df96..bf8b281e 100644 --- a/tests/index_manager_test.rs +++ b/crates/fastskill-core/tests/index_manager_test.rs @@ -2,9 +2,9 @@ #![allow(clippy::all, clippy::unwrap_used, clippy::expect_used)] -use fastskill::core::registry::index_manager::IndexManager; -use fastskill::core::registry_index::{ScopedSkillName, VersionEntry}; -use fastskill::core::service::ServiceError; +use fastskill_core::core::registry::index_manager::IndexManager; +use fastskill_core::core::registry_index::{ScopedSkillName, VersionEntry}; +use fastskill_core::core::service::ServiceError; use std::collections::HashMap; use tempfile::TempDir; diff --git a/tests/integration_skill_project_toml_test.rs b/crates/fastskill-core/tests/integration_skill_project_toml_test.rs similarity index 99% rename from tests/integration_skill_project_toml_test.rs rename to crates/fastskill-core/tests/integration_skill_project_toml_test.rs index f016d28f..2de5eb29 100644 --- a/tests/integration_skill_project_toml_test.rs +++ b/crates/fastskill-core/tests/integration_skill_project_toml_test.rs @@ -2,7 +2,7 @@ #![allow(clippy::all, clippy::unwrap_used, clippy::expect_used)] -use fastskill::core::manifest::{ +use fastskill_core::core::manifest::{ DependenciesSection, DependencySpec, MetadataSection, SkillProjectToml, }; use std::collections::HashMap; diff --git a/tests/integration_unified_format_test.rs b/crates/fastskill-core/tests/integration_unified_format_test.rs similarity index 94% rename from tests/integration_unified_format_test.rs rename to crates/fastskill-core/tests/integration_unified_format_test.rs index af5c4273..9dec9c86 100644 --- a/tests/integration_unified_format_test.rs +++ b/crates/fastskill-core/tests/integration_unified_format_test.rs @@ -2,9 +2,11 @@ #![allow(clippy::all, clippy::unwrap_used, clippy::expect_used)] -use fastskill::core::manifest::ProjectContext; -use fastskill::core::manifest::SkillProjectToml; -use fastskill::core::project::{detect_context, detect_context_from_content, resolve_project_file}; +use fastskill_core::core::manifest::ProjectContext; +use fastskill_core::core::manifest::SkillProjectToml; +use fastskill_core::core::project::{ + detect_context, detect_context_from_content, resolve_project_file, +}; use std::fs; use tempfile::TempDir; @@ -178,8 +180,8 @@ version = "1.0.0" /// T065: Test edge cases for empty/missing files #[test] fn test_edge_case_empty_missing_files() { - use fastskill::core::manifest::SkillProjectToml; - use fastskill::core::project::resolve_project_file; + use fastskill_core::core::manifest::SkillProjectToml; + use fastskill_core::core::project::resolve_project_file; use std::fs; use tempfile::TempDir; @@ -231,8 +233,8 @@ fn test_edge_case_empty_missing_files() { /// T064: Integration test for all CLI commands with unified format #[test] fn test_all_cli_commands_with_unified_format() { - use fastskill::core::manifest::{DependenciesSection, DependencySpec, SkillProjectToml}; - use fastskill::core::project::resolve_project_file; + use fastskill_core::core::manifest::{DependenciesSection, DependencySpec, SkillProjectToml}; + use fastskill_core::core::project::resolve_project_file; use std::collections::HashMap; use std::fs; use tempfile::TempDir; @@ -271,7 +273,7 @@ test-skill = "1.0.0" // Test 5: Verify skill-project.toml with all sections let full_project = SkillProjectToml { - metadata: Some(fastskill::core::manifest::MetadataSection { + metadata: Some(fastskill_core::core::manifest::MetadataSection { id: None, version: None, description: Some("Test project".to_string()), diff --git a/tests/metadata_validation_test.rs b/crates/fastskill-core/tests/metadata_validation_test.rs similarity index 91% rename from tests/metadata_validation_test.rs rename to crates/fastskill-core/tests/metadata_validation_test.rs index 6c2727c5..b35f5f9d 100644 --- a/tests/metadata_validation_test.rs +++ b/crates/fastskill-core/tests/metadata_validation_test.rs @@ -2,7 +2,7 @@ #![allow(clippy::all, clippy::unwrap_used, clippy::expect_used)] -use fastskill::core::validation::{validate_identifier, validate_semver}; +use fastskill_core::core::validation::{validate_identifier, validate_semver}; #[test] fn test_validate_semver_valid() { @@ -38,7 +38,7 @@ fn test_validate_identifier_invalid() { #[test] fn test_validate_project_structure() { - use fastskill::core::validation::validate_project_structure; + use fastskill_core::core::validation::validate_project_structure; // Valid: has metadata assert!(validate_project_structure(true, false).is_ok()); diff --git a/tests/registry_atomic_test.rs b/crates/fastskill-core/tests/registry_atomic_test.rs similarity index 97% rename from tests/registry_atomic_test.rs rename to crates/fastskill-core/tests/registry_atomic_test.rs index 8035f74c..e7fa099a 100644 --- a/tests/registry_atomic_test.rs +++ b/crates/fastskill-core/tests/registry_atomic_test.rs @@ -2,14 +2,13 @@ #![allow(clippy::all, clippy::unwrap_used, clippy::expect_used)] -use fastskill::core::registry::index_manager::IndexManager; -use fastskill::core::registry_index::{read_skill_versions, VersionEntry}; +use fastskill_core::core::registry::index_manager::IndexManager; +use fastskill_core::core::registry_index::{read_skill_versions, VersionEntry}; use std::collections::HashMap; use std::sync::Arc; use tempfile::TempDir; #[tokio::test] -#[ignore] // TODO: Fix atomic_update implementation - concurrent writes to same skill not properly serialized async fn test_concurrent_writes_same_skill() { // Test that two concurrent writes to the same skill file are serialized correctly let temp_dir = TempDir::new().unwrap(); @@ -245,6 +244,9 @@ async fn test_readers_dont_block_during_writes() { } #[tokio::test] +// Perf SLA (SC-003, p95 < 100ms): timing/load-sensitive and flaky under parallel +// nextest. Run manually with `--ignored`, not in the default CI gate. +#[ignore] async fn test_index_update_performance() { // Test that 95% of index updates complete in under 100ms (SC-003) let temp_dir = TempDir::new().unwrap(); @@ -298,7 +300,6 @@ async fn test_index_update_performance() { } #[tokio::test] -#[ignore] // TODO: Fix atomic_update implementation - data loss in sequential operations (only 1 of 100 entries saved) async fn test_sequential_publish_operations() { // Test that 1000 sequential publish operations complete without data loss (SC-005) let temp_dir = TempDir::new().unwrap(); diff --git a/tests/registry_index_test.rs b/crates/fastskill-core/tests/registry_index_test.rs similarity index 94% rename from tests/registry_index_test.rs rename to crates/fastskill-core/tests/registry_index_test.rs index 278c9911..9e64e1a1 100644 --- a/tests/registry_index_test.rs +++ b/crates/fastskill-core/tests/registry_index_test.rs @@ -7,8 +7,8 @@ clippy::needless_borrows_for_generic_args )] -use fastskill::core::registry::index_manager::IndexManager; -use fastskill::core::registry_index::{read_skill_versions, ScopedSkillName, VersionEntry}; +use fastskill_core::core::registry::index_manager::IndexManager; +use fastskill_core::core::registry_index::{read_skill_versions, ScopedSkillName, VersionEntry}; use std::collections::HashMap; use tempfile::TempDir; @@ -56,7 +56,7 @@ async fn test_index_served_from_filesystem() { let registry_path = temp_dir.path().to_path_buf(); // Create a test index file directly in filesystem - use fastskill::core::registry_index::get_skill_index_path; + use fastskill_core::core::registry_index::get_skill_index_path; use std::fs; use std::io::Write; @@ -132,7 +132,7 @@ async fn test_server_restart_no_git_clone() { let registry_path = temp_dir.path().to_path_buf(); // Create index files directly (simulating filesystem-based index) - use fastskill::core::registry_index::get_skill_index_path; + use fastskill_core::core::registry_index::get_skill_index_path; use std::fs; use std::io::Write; @@ -174,7 +174,7 @@ async fn test_server_restart_no_git_clone() { async fn test_all_versions_aggregation_logic() { // Test T044: Unit test for all-versions aggregation logic in server-side scan (list_index_skills) - use fastskill::core::registry_index::{ + use fastskill_core::core::registry_index::{ scan_registry_index, update_skill_version, ListSkillsOptions, VersionMetadata, }; use std::collections::HashMap; @@ -205,7 +205,7 @@ async fn test_all_versions_aggregation_logic() { "2024-01-{:02}T00:00:00Z", version.replace(".", "").parse::().unwrap_or(1) % 30 ), - metadata: Some(fastskill::core::registry_index::IndexMetadata { + metadata: Some(fastskill_core::core::registry_index::IndexMetadata { description: Some(format!("Version {} of multi-version skill", version)), author: None, license: None, @@ -245,7 +245,7 @@ async fn test_all_versions_aggregation_logic() { async fn test_duplicate_version_deduplication() { // Test T045: Unit test for duplicate version deduplication - use fastskill::core::registry_index::{ + use fastskill_core::core::registry_index::{ scan_registry_index, update_skill_version, ListSkillsOptions, VersionMetadata, }; use std::collections::HashMap; @@ -267,7 +267,7 @@ async fn test_duplicate_version_deduplication() { links: None, download_url: "https://example.com/first.zip".to_string(), published_at: "2024-01-01T00:00:00Z".to_string(), - metadata: Some(fastskill::core::registry_index::IndexMetadata { + metadata: Some(fastskill_core::core::registry_index::IndexMetadata { description: Some("First entry".to_string()), author: None, license: None, @@ -285,7 +285,7 @@ async fn test_duplicate_version_deduplication() { links: None, download_url: "https://example.com/second.zip".to_string(), published_at: "2024-01-02T00:00:00Z".to_string(), - metadata: Some(fastskill::core::registry_index::IndexMetadata { + metadata: Some(fastskill_core::core::registry_index::IndexMetadata { description: Some("Second entry (duplicate)".to_string()), author: None, license: None, @@ -309,7 +309,7 @@ async fn test_duplicate_version_deduplication() { // Should deduplicate: only one entry per version string // The first valid entry should be used - let version_entries: Vec<&fastskill::core::registry_index::SkillSummary> = summaries + let version_entries: Vec<&fastskill_core::core::registry_index::SkillSummary> = summaries .iter() .filter(|s| s.id == skill_id && s.latest_version == version) .collect(); @@ -329,7 +329,7 @@ async fn test_duplicate_version_deduplication() { #[tokio::test] async fn test_concurrent_reads_no_locking() { // Test that concurrent reads of index files are safe without locking - use fastskill::core::registry_index::{update_skill_version, VersionMetadata}; + use fastskill_core::core::registry_index::{update_skill_version, VersionMetadata}; use std::sync::Arc; use tokio::task; diff --git a/tests/skill_project_toml_test.rs b/crates/fastskill-core/tests/skill_project_toml_test.rs similarity index 99% rename from tests/skill_project_toml_test.rs rename to crates/fastskill-core/tests/skill_project_toml_test.rs index b950f7ac..bf9595f9 100644 --- a/tests/skill_project_toml_test.rs +++ b/crates/fastskill-core/tests/skill_project_toml_test.rs @@ -2,7 +2,7 @@ #![allow(clippy::all, clippy::unwrap_used, clippy::expect_used)] -use fastskill::core::manifest::{ +use fastskill_core::core::manifest::{ DependenciesSection, DependencySource, DependencySpec, MetadataSection, SkillProjectToml, SourceSpecificFields, };