mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-08-01 09:17:44 +03:00
test(subsystem-compile): cover bottom-up -Parent flow; hide children shortcut
The bottom-up flow (compile child with -Parent pointing at parent's XML — skill creates the real child file AND registers it in parent's ChildObjects) has been the documented canonical way to build nested subsystems since forever. It's in SKILL.md Примеры:58 and implemented in subsystem-compile.ps1:430-506. But zero test cases exercised it — all 7 pre-existing cases used the top-down `children: [...]` shortcut thataa93031made honest with stubs. Two problems with the status quo: 1. A model reading SKILL.md saw `"children": ["ДочерняяА", "ДочерняяБ"]` right in the main JSON-definition example and took it as the canonical way to create nested structure. It's a trap — the shortcut creates placeholder stubs with empty Synonym/Content that the model almost never actually wants. The natural flow (one subsystem-compile call per real subsystem) wasn't visible where the model looks first. 2. The canonical flow had no test safety net — nothing caught regressions in the register-in-parent code path (lines 430-506). Fix, minimal surface: - SKILL.md: remove `"children": [...]` from the JSON-definition example. Leave the `-Parent` example in the Примеры section (already there). The children field stays fully supported in the scripts (aa93031stub behavior unchanged) for legacy JSON — just not advertised. - New test case `nested-parent.json`: preRun compiles "Продажи" parent, main run compiles "Настройки" child with `-Parent Subsystems/Продажи.xml`. Verifies the real bottom-up flow: snapshot shows full child file with real Synonym/Explanation AND parent's `<ChildObjects>` updated to reference the child. verify-snapshots confirms platform accepts it. - Runner plumbing: `_skill.json` gains `{ "flag": "-Parent", "from": "workPath", "field": "parent", "optional": true }`. Required extending both `tests/skills/runner.mjs` and `tests/skills/verify-snapshots.mjs` (they each have their own copy of buildArgs) to support `optional: true` on workPath mappings — otherwise existing cases without params.parent would get the flag pushed with an empty value. Verification: - runner --filter subsystem-compile (PS1): 8/8 (was 7/7 +1) - runner --filter subsystem-compile --runtime python: 8/8 (dual-port clean) - verify-snapshots --skill subsystem-compile: 8/8 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
dc4ffa1fc8
commit
7a8f437e77
+10
-2
@@ -223,8 +223,16 @@ function buildArgs(skillConfig, caseData, workDir, inputFilePath, runtime) {
|
||||
case 'workPath':
|
||||
// workDir + value from case.params or case (specified in mapping.field)
|
||||
const wpField = mapping.field || 'objectPath';
|
||||
const wpVal = caseData.params?.[wpField] ?? caseData[wpField] ?? '';
|
||||
args.push(join(workDir, wpVal));
|
||||
const wpVal = caseData.params?.[wpField] ?? caseData[wpField];
|
||||
if (wpVal === undefined || wpVal === null || wpVal === '') {
|
||||
if (mapping.optional) {
|
||||
args.pop(); // remove the flag we pushed at the top of the loop
|
||||
break;
|
||||
}
|
||||
args.push(join(workDir, ''));
|
||||
} else {
|
||||
args.push(join(workDir, wpVal));
|
||||
}
|
||||
break;
|
||||
case 'switch':
|
||||
// flag already pushed, no value needed — remove the flag and re-push conditionally
|
||||
|
||||
Reference in New Issue
Block a user