aKode fase 5: test e snapshot adeguati alla rinomina, 429 distinto (ProviderRateLimited), cargo fmt dopo il cambio dei prefissi
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -40,12 +40,9 @@ impl From<String> for SkillLocator {
|
||||
return None;
|
||||
}
|
||||
index.parse::<usize>().ok()?;
|
||||
[
|
||||
SkillSourceKind::Executor,
|
||||
SkillSourceKind::Host,
|
||||
]
|
||||
.into_iter()
|
||||
.find(|source| alias_prefix(source) == Some(prefix))
|
||||
[SkillSourceKind::Executor, SkillSourceKind::Host]
|
||||
.into_iter()
|
||||
.find(|source| alias_prefix(source) == Some(prefix))
|
||||
});
|
||||
Self {
|
||||
value,
|
||||
|
||||
@@ -27,7 +27,11 @@ fn update_spends_budget_only_on_accepted_rows_and_their_new_roots() {
|
||||
"e0",
|
||||
"skill://writing",
|
||||
);
|
||||
let docs = skill("- docs: (executor package: e0/docs)", "e0", "skill://writing");
|
||||
let docs = skill(
|
||||
"- docs: (executor package: e0/docs)",
|
||||
"e0",
|
||||
"skill://writing",
|
||||
);
|
||||
let expected = "\n## Selected-environment skills update\n### Skill roots\nThese mappings replace earlier mappings for the same aliases.\n- `e0` = `skill://writing`\n### Added or updated skills:\n- release-notes: (executor package: e0/notes)\n- docs: (executor package: e0/docs)\n";
|
||||
let mut remaining = SkillMetadataBudget::Characters(expected.chars().count());
|
||||
let mut snapshot = CatalogSnapshot::default();
|
||||
@@ -37,7 +41,10 @@ fn update_spends_budget_only_on_accepted_rows_and_their_new_roots() {
|
||||
assert!(draft.try_append_skill(¬es, &mut snapshot, &mut remaining));
|
||||
assert!(draft.try_append_skill(&docs, &mut snapshot, &mut remaining));
|
||||
|
||||
assert_eq!(draft.into_body("Selected-environment").as_deref(), Some(expected));
|
||||
assert_eq!(
|
||||
draft.into_body("Selected-environment").as_deref(),
|
||||
Some(expected)
|
||||
);
|
||||
assert_eq!(
|
||||
snapshot.roots,
|
||||
BTreeMap::from([("e0".into(), "skill://writing".into())])
|
||||
|
||||
@@ -8,9 +8,9 @@ mod multi_query_lexical;
|
||||
mod routing_card_lexical;
|
||||
mod rrf_lexical_char;
|
||||
mod weighted_lexical;
|
||||
use akode_skills::SkillDependencies;
|
||||
pub(crate) use character_ngram::CharacterNgramSkillSelector;
|
||||
pub(crate) use character_routing_card::CharacterRoutingCardSkillSelector;
|
||||
use akode_skills::SkillDependencies;
|
||||
pub(crate) use fielded_bm25::FieldedBm25SkillSelector;
|
||||
pub(crate) use lru::LruSkillSelector;
|
||||
pub(crate) use lru_plus_character_routing::LruPlusCharacterRoutingSkillSelector;
|
||||
|
||||
@@ -385,9 +385,9 @@ where
|
||||
let mut fragments: Vec<Box<dyn ContextualUserFragment + Send>> = Vec::new();
|
||||
if config.include_instructions && !host_catalog_in_world_state {
|
||||
let mut turn_catalog = catalog.clone();
|
||||
turn_catalog.entries.retain(|entry| {
|
||||
entry.authority.kind != SkillSourceKind::Executor
|
||||
});
|
||||
turn_catalog
|
||||
.entries
|
||||
.retain(|entry| entry.authority.kind != SkillSourceKind::Executor);
|
||||
let model_info = thread_store.get::<ModelInfo>();
|
||||
let include_usage = model_info
|
||||
.as_deref()
|
||||
|
||||
@@ -625,8 +625,8 @@ pub(crate) fn render_prepared_skill_catalogs(
|
||||
);
|
||||
|
||||
for candidate in [host_only_aliases, executor_only_aliases, all_source_aliases]
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.into_iter()
|
||||
.flatten()
|
||||
{
|
||||
if combined_render_is_better(
|
||||
&candidate,
|
||||
|
||||
@@ -797,10 +797,7 @@ fn mixed_catalogs_alias_all_skill_sources_under_budget_pressure() {
|
||||
.any(|line| line.contains("(file: r0/host-0/SKILL.md)"))
|
||||
);
|
||||
assert_eq!(
|
||||
(
|
||||
executor.report.included_count,
|
||||
host.report.included_count,
|
||||
),
|
||||
(executor.report.included_count, host.report.included_count,),
|
||||
(3, 3)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -124,10 +124,7 @@ async fn turn_input_and_history_advance_while_ranking_is_blocked()
|
||||
catalog: thread_store
|
||||
.get::<SkillsThreadState>()
|
||||
.unwrap()
|
||||
.prepare_step_catalog(
|
||||
SkillCatalog::default(),
|
||||
/*discovery_v2*/ false,
|
||||
),
|
||||
.prepare_step_catalog(SkillCatalog::default(), /*discovery_v2*/ false),
|
||||
host_catalog: Some(host_catalog),
|
||||
config: config.clone(),
|
||||
});
|
||||
|
||||
@@ -6,7 +6,6 @@ use std::sync::Mutex;
|
||||
use std::sync::atomic::AtomicUsize;
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
use assert_matches::assert_matches;
|
||||
use akode_attachment_store::InlineAttachmentStore;
|
||||
use akode_config::ConfigLayerEntry;
|
||||
use akode_config::ConfigLayerSource;
|
||||
@@ -91,6 +90,7 @@ use akode_skills_extension::provider::SkillReadRequest;
|
||||
use akode_skills_extension::provider::SkillSearchRequest;
|
||||
use akode_utils_absolute_path::AbsolutePathBuf;
|
||||
use akode_utils_path_uri::PathUri;
|
||||
use assert_matches::assert_matches;
|
||||
use opentelemetry_sdk::metrics::InMemoryMetricExporter;
|
||||
use opentelemetry_sdk::metrics::data::AggregatedMetrics;
|
||||
use opentelemetry_sdk::metrics::data::MetricData;
|
||||
@@ -791,8 +791,8 @@ async fn executor_and_host_share_catalog_world_state_flow() -> TestResult {
|
||||
|
||||
let expected_metrics = ["executor_world_state", "host_world_state"]
|
||||
.into_iter()
|
||||
.flat_map(|surface| expected_catalog_metric_samples(surface, /*count*/ 1))
|
||||
.collect::<Vec<_>>();
|
||||
.flat_map(|surface| expected_catalog_metric_samples(surface, /*count*/ 1))
|
||||
.collect::<Vec<_>>();
|
||||
assert_eq!(metrics.samples(), expected_metrics);
|
||||
|
||||
Ok(())
|
||||
@@ -1840,17 +1840,16 @@ async fn default_context_truncates_catalog_descriptions() -> TestResult {
|
||||
entry
|
||||
})
|
||||
.collect();
|
||||
let providers = SkillProviders::new()
|
||||
.with_executor_provider(Arc::new(StaticSkillProvider {
|
||||
catalog: SkillCatalog {
|
||||
is_partial: false,
|
||||
entries: executor_entries,
|
||||
warnings: Vec::new(),
|
||||
},
|
||||
read_requests: Arc::new(Mutex::new(Vec::new())),
|
||||
list_calls: None,
|
||||
fail_first_list: false,
|
||||
}));
|
||||
let providers = SkillProviders::new().with_executor_provider(Arc::new(StaticSkillProvider {
|
||||
catalog: SkillCatalog {
|
||||
is_partial: false,
|
||||
entries: executor_entries,
|
||||
warnings: Vec::new(),
|
||||
},
|
||||
read_requests: Arc::new(Mutex::new(Vec::new())),
|
||||
list_calls: None,
|
||||
fail_first_list: false,
|
||||
}));
|
||||
let mut builder = ExtensionRegistryBuilder::new();
|
||||
install_with_providers(&mut builder, providers, skills_extension_config);
|
||||
let registry = builder.build();
|
||||
@@ -1902,17 +1901,16 @@ async fn extreme_budget_pressure_removes_descriptions_before_omitting_entries()
|
||||
entry
|
||||
})
|
||||
.collect();
|
||||
let providers = SkillProviders::new()
|
||||
.with_executor_provider(Arc::new(StaticSkillProvider {
|
||||
catalog: SkillCatalog {
|
||||
is_partial: false,
|
||||
entries: executor_entries,
|
||||
warnings: Vec::new(),
|
||||
},
|
||||
read_requests: Arc::new(Mutex::new(Vec::new())),
|
||||
list_calls: None,
|
||||
fail_first_list: false,
|
||||
}));
|
||||
let providers = SkillProviders::new().with_executor_provider(Arc::new(StaticSkillProvider {
|
||||
catalog: SkillCatalog {
|
||||
is_partial: false,
|
||||
entries: executor_entries,
|
||||
warnings: Vec::new(),
|
||||
},
|
||||
read_requests: Arc::new(Mutex::new(Vec::new())),
|
||||
list_calls: None,
|
||||
fail_first_list: false,
|
||||
}));
|
||||
let (event_tx, event_rx) = std::sync::mpsc::channel();
|
||||
let mut builder =
|
||||
ExtensionRegistryBuilder::with_event_sink(Arc::new(ChannelEventSink(event_tx)));
|
||||
@@ -2599,17 +2597,16 @@ async fn model_context_window_scales_executor_catalog() -> TestResult {
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
let providers =
|
||||
SkillProviders::new().with_executor_provider(Arc::new(StaticSkillProvider {
|
||||
catalog: SkillCatalog {
|
||||
is_partial: false,
|
||||
entries: executor_entries,
|
||||
warnings: Vec::new(),
|
||||
},
|
||||
read_requests: Arc::new(Mutex::new(Vec::new())),
|
||||
list_calls: None,
|
||||
fail_first_list: false,
|
||||
}));
|
||||
let providers = SkillProviders::new().with_executor_provider(Arc::new(StaticSkillProvider {
|
||||
catalog: SkillCatalog {
|
||||
is_partial: false,
|
||||
entries: executor_entries,
|
||||
warnings: Vec::new(),
|
||||
},
|
||||
read_requests: Arc::new(Mutex::new(Vec::new())),
|
||||
list_calls: None,
|
||||
fail_first_list: false,
|
||||
}));
|
||||
let (event_tx, event_rx) = std::sync::mpsc::channel();
|
||||
let mut builder =
|
||||
ExtensionRegistryBuilder::with_event_sink(Arc::new(ChannelEventSink(event_tx)));
|
||||
|
||||
@@ -322,7 +322,8 @@ async fn v2_disabled_remote_plugin_blocks_executor_read_route() -> TestResult {
|
||||
#[tokio::test]
|
||||
async fn v1_reads_preserve_response_shape_without_installations_tool() -> TestResult {
|
||||
let executor = installed_skill("first", "work")?;
|
||||
let mut disabled = MergeHarness::new(provider(vec![executor.clone()]), default_config()).await?;
|
||||
let mut disabled =
|
||||
MergeHarness::new(provider(vec![executor.clone()]), default_config()).await?;
|
||||
disabled.snapshots = None;
|
||||
assert_eq!(
|
||||
disabled
|
||||
@@ -544,4 +545,3 @@ async fn v1_retains_legacy_plugin_disablement() -> TestResult {
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -103,9 +103,6 @@ async fn config_reload_during_preparation_applies_to_next_step() -> TestResult {
|
||||
}
|
||||
);
|
||||
}
|
||||
assert_eq!(
|
||||
*executor.queries.lock().unwrap(),
|
||||
vec![true, false]
|
||||
);
|
||||
assert_eq!(*executor.queries.lock().unwrap(), vec![true, false]);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user