Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -33,15 +33,15 @@ 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()],
}),
..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);
Expand All @@ -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(),
Expand All @@ -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);
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -205,7 +205,7 @@ async fn test_all_versions_aggregation_logic() {
"2024-01-{:02}T00:00:00Z",
version.replace(".", "").parse::<u32>().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,
Expand Down Expand Up @@ -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;
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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();
Expand All @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
Loading