mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-25 14:11:02 +03:00
fix(support-guard): не блокировать автономные внешние обработки/отчёты (#39)
При поиске корня конфигурации guard поднимался по дереву вверх и «проскакивал» собственный корень автономной внешней обработки/отчёта (ExternalDataProcessor / ExternalReport), лежащей внутри дерева выгрузки конфигурации. Если у охватывающей конфигурации выключена возможность изменения (G=1), внешний объект ложно блокировался как «объект типовой конфигурации на поддержке», а info-навыки выводили нерелевантную строку «Поддержка: конфигурация read-only». Теперь climb останавливается на границе автономного объекта: если целевой файл или встреченный по пути <каталог>.xml имеет корень ExternalDataProcessor/ExternalReport, подъём прекращается и объект не привязывается к конфигурации. Корень внешнего объекта всегда глубже Configuration.xml, поэтому встречается первым — регрессии для обычных объектов конфигурации нет. Синхронно во всех копиях guard-а (навыки автономны): хук support-state.mjs (decideSupport + findConfigRoot), 16 мутаторов (Assert-EditAllowed), 5 info-навыков и meta-info (Get-SupportStatusForPath / Get-ObjectSupportStatus) — ps1 и py. Для info-навыков строка «Поддержка:» для внешнего объекта опускается. Тесты: hooks/test/run.mjs — секция внешней границы (G=1 + встроенная EPF); tests/skills — кейсы mxl-compile (guard пропускает) и mxl-info (строка опущена). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
e7b5df4d50
commit
ddc1641176
+40
-1
@@ -4,7 +4,7 @@
|
||||
// No live hook registration needed: exercises decideSupport / getEditMode / findConfigRoot
|
||||
// directly. Run: node hooks/test/run.mjs
|
||||
|
||||
import { decideSupport, findConfigRoot, rootUuid } from '../common/support-state.mjs';
|
||||
import { decideSupport, findConfigRoot, rootUuid, isExternalObjectRoot } from '../common/support-state.mjs';
|
||||
import { getEditMode, getSuggesterMode } from '../common/project.mjs';
|
||||
import { processInput as guard } from '../support-guard.mjs';
|
||||
import { processInput as suggest } from '../skill-suggester.mjs';
|
||||
@@ -96,6 +96,45 @@ console.log('=== support-state: synthetic per-object f1 (G=0) ===');
|
||||
check('synth remove removed (f1=2) → NOT blocked', rmRemoved.blocked === false, JSON.stringify(rmRemoved));
|
||||
}
|
||||
|
||||
console.log('=== support-state: external object boundary (issue #39) ===');
|
||||
{
|
||||
// Autonomous EPF/ERF parked INSIDE a config tree whose capability is off (G=1). The
|
||||
// climb must stop at the external object's root and NOT attribute it to the config.
|
||||
const ROOT = join(REPO, 'test-tmp', 'hooks-ext');
|
||||
const cat = '66666666-6666-6666-6666-666666666666';
|
||||
mkdirSync(join(ROOT, 'Ext'), { recursive: true });
|
||||
mkdirSync(join(ROOT, 'Catalogs'), { recursive: true });
|
||||
mkdirSync(join(ROOT, 'print-forms', 'Демо', 'Templates', 'Макет', 'Ext'), { recursive: true });
|
||||
// G=1 (capability off), K=1 — blocks every config object unconditionally.
|
||||
const binText = `{6,1,1,aaaaaaaa-0000-0000-0000-000000000000,0,bbbbbbbb-0000-0000-0000-000000000000,` +
|
||||
`"1.0","Vendor","Name",1,0,0,${cat}}`;
|
||||
writeFileSync(join(ROOT, 'Ext', 'ParentConfigurations.bin'),
|
||||
Buffer.concat([Buffer.from([0xef, 0xbb, 0xbf]), Buffer.from(binText, 'utf8')]));
|
||||
writeFileSync(join(ROOT, 'Configuration.xml'),
|
||||
`<?xml version="1.0" encoding="UTF-8"?>\n<MetaDataObject><Configuration uuid="11111111-1111-1111-1111-111111111111"></Configuration></MetaDataObject>`);
|
||||
writeFileSync(join(ROOT, 'Catalogs', 'InConfig.xml'),
|
||||
`<?xml version="1.0" encoding="UTF-8"?>\n<MetaDataObject><Catalog uuid="${cat}"></Catalog></MetaDataObject>`);
|
||||
writeFileSync(join(ROOT, 'print-forms', 'Демо.xml'),
|
||||
`<?xml version="1.0" encoding="UTF-8"?>\n<MetaDataObject xmlns="http://v8.1c.ru/8.3/MDClasses">\n\t<ExternalDataProcessor uuid="99999999-9999-9999-9999-999999999999"><Properties><Name>Демо</Name></Properties></ExternalDataProcessor>\n</MetaDataObject>`);
|
||||
writeFileSync(join(ROOT, 'print-forms', 'Демо', 'Templates', 'Макет', 'Ext', 'Template.xml'),
|
||||
`<?xml version="1.0"?><document xmlns="http://v8.1c.ru/8.1/data/spreadsheet"></document>`);
|
||||
|
||||
const epfRoot = join(ROOT, 'print-forms', 'Демо.xml');
|
||||
const epfTpl = join(ROOT, 'print-forms', 'Демо', 'Templates', 'Макет', 'Ext', 'Template.xml');
|
||||
const cfgObj = join(ROOT, 'Catalogs', 'InConfig.xml');
|
||||
|
||||
check('isExternalObjectRoot(EPF root) → true', isExternalObjectRoot(epfRoot) === true);
|
||||
check('isExternalObjectRoot(config Catalog) → false', isExternalObjectRoot(cfgObj) === false);
|
||||
check('EPF root → NOT blocked (G=1 config ignored)', decideSupport(epfRoot, 'editable').blocked === false, JSON.stringify(decideSupport(epfRoot, 'editable')));
|
||||
const rTpl = decideSupport(epfTpl, 'editable');
|
||||
check('EPF template → NOT blocked (climb stops at EPF root)', rTpl.blocked === false, JSON.stringify(rTpl));
|
||||
const rCfg = decideSupport(cfgObj, 'editable');
|
||||
check('control: config object under G=1 → blocked', rCfg.blocked === true && rCfg.code === 'capability-off', JSON.stringify(rCfg));
|
||||
check('findConfigRoot(EPF template) → no cfgDir', findConfigRoot(epfTpl).cfgDir === null, JSON.stringify(findConfigRoot(epfTpl)));
|
||||
const rGuard = guard({ tool_name: 'Edit', cwd: REPO, tool_input: { file_path: epfTpl } });
|
||||
check('guard on EPF template → allow (no stdout)', rGuard.stdout === '' && rGuard.exitCode === 0, JSON.stringify(rGuard));
|
||||
}
|
||||
|
||||
console.log('=== project: reaction modes ===');
|
||||
{
|
||||
const m = getEditMode(ACC, REPO);
|
||||
|
||||
Reference in New Issue
Block a user