fix(skills): preserve preparation traces on the package path

Keep repository projection timing and verify both discovery and installed-version preparation without adding inventory work to the fast path.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-10-28 17:15:19 -05:00
1 parent 0bb36b2c6b
commit 7b90df0fad
2 files changed
+9 -4

No files matched your search

@@ -78,8 +78,9 @@ describeDatabase("runtime skill observability", () => {
return { companyId, service, options };
}
it("parents real preparation work and ends acquisition before the consumer settles", async () => {
it.each([false, true])("parents preparation and releases acquisition before consumption (discovery: %s)", async discover => {
const f = await fixture();
if (discover) f.options.onlyKeys.add(`company/${f.companyId}/not-installed`);
exporter.reset();
lifecycle.length = 0;
const entered = deferred(), release = deferred();
@@ -97,13 +98,17 @@ describeDatabase("runtime skill observability", () => {
await provider.forceFlush();
const spans = exporter.getFinishedSpans();
const span = (name: string) => { const found = spans.find(candidate => candidate.name === name); assert.ok(found, name); return found; };
for (const [child, parent] of [
["heartbeat.prepare.configuration_skills", "task.execution_attempt"],
const inventoryParents = discover ? [
["skills.inventory", "heartbeat.prepare.configuration_skills"],
["skills.inventory.bundled", "skills.inventory"],
["skills.inventory.releases", "skills.inventory"],
["skills.inventory.folders", "skills.inventory"],
["skills.inventory.local_sources", "skills.inventory"],
] : [];
if (!discover) expect(spans.some(value => value.name.startsWith("skills.inventory"))).toBe(false);
for (const [child, parent] of [
["heartbeat.prepare.configuration_skills", "task.execution_attempt"],
...inventoryParents,
["skills.cache.acquire", "heartbeat.prepare.configuration_skills"],
["skills.rows", "heartbeat.prepare.configuration_skills"],
["skills.version.read", "heartbeat.prepare.configuration_skills"],
+1 -1
View File
@@ -87,7 +87,7 @@ export function skillPackageRuntime(db: Db) {
return [...files, ...generatedFiles];
}
async function materialize(version: StoredSkillVersion, directory: string) {
const files = await projection(version);
const files = await measureRunPhase("skills.repository.read", () => projection(version));
const parent = path.dirname(directory);
await ensureSkillCacheDirectory(parent, true);
if (await measureRunPhase("skills.version.verify", () => verifySkillPackageDirectory(directory, files), { fileCount: files.length })) return directory;