Чтение предопределенных данных (предопределенных значений)#610
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (23)
📒 Files selected for processing (22)
🚧 Files skipped from review as they are similar to previous changes (22)
📝 WalkthroughWalkthroughThis PR adds support for predefined values across metadata catalogs and charts through a new ChangesPredefined Values Support
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/test/java/com/github/_1c_syntax/bsl/mdclasses/ConfigurationTest.java (1)
105-106: ⚡ Quick winAvoid self-referential expected-size assertions for predefined values.
At Line 105 (and the same pattern on Lines 219, 256, 298), the expected value is derived from
cf.getPlainChildren()itself, so a predefined-values regression can still pass. Please assert predefined count separately (fixture-specific expected value or explicit non-zero where expected).Suggested pattern
-assertThat(cf.getPlainChildren()) - .hasSize(9810 + predefinedCount(cf.getPlainChildren())) +var plainChildren = cf.getPlainChildren(); +assertThat(predefinedCount(plainChildren)).isGreaterThan(0); // where fixture guarantees predefined values +assertThat(plainChildren) + .hasSize(9810 + predefinedCount(plainChildren))Also applies to: 219-220, 256-257, 298-299
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/test/java/com/github/_1c_syntax/bsl/mdclasses/ConfigurationTest.java` around lines 105 - 106, The test currently computes expected size using predefinedCount(cf.getPlainChildren()), which is self-referential and can hide regressions; change the assertions in ConfigurationTest (the blocks using .hasSize(9810 + predefinedCount(cf.getPlainChildren())) and similar at the other locations) to compare the collection size against a literal or fixture-specific expected predefined count instead of calling predefinedCount on the same cf.getPlainChildren() result; compute or hardcode the known predefinedCount value (or assert it is > 0 explicitly) and then use .hasSize(<explicit expected> + <literal predefinedCount>) and keep the .allMatch(md -> md.getSupportVariant().equals(SupportVariant.NOT_EDITABLE)) check as-is.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/test/java/com/github/_1c_syntax/bsl/mdclasses/ConfigurationTest.java`:
- Around line 105-106: The test currently computes expected size using
predefinedCount(cf.getPlainChildren()), which is self-referential and can hide
regressions; change the assertions in ConfigurationTest (the blocks using
.hasSize(9810 + predefinedCount(cf.getPlainChildren())) and similar at the other
locations) to compare the collection size against a literal or fixture-specific
expected predefined count instead of calling predefinedCount on the same
cf.getPlainChildren() result; compute or hardcode the known predefinedCount
value (or assert it is > 0 explicitly) and then use .hasSize(<explicit expected>
+ <literal predefinedCount>) and keep the .allMatch(md ->
md.getSupportVariant().equals(SupportVariant.NOT_EDITABLE)) check as-is.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 1b4a453b-1100-4ab9-8518-131b24ebf13a
⛔ Files ignored due to path filters (1)
src/test/resources/fixtures/mdclasses_3_24/Configuration_edt.jsonis excluded by!src/test/resources/**
📒 Files selected for processing (23)
build.gradle.ktssrc/main/java/com/github/_1c_syntax/bsl/mdo/Catalog.javasrc/main/java/com/github/_1c_syntax/bsl/mdo/ChartOfAccounts.javasrc/main/java/com/github/_1c_syntax/bsl/mdo/ChartOfCalculationTypes.javasrc/main/java/com/github/_1c_syntax/bsl/mdo/ChartOfCharacteristicTypes.javasrc/main/java/com/github/_1c_syntax/bsl/mdo/ExchangePlan.javasrc/main/java/com/github/_1c_syntax/bsl/mdo/PredefinedDataOwner.javasrc/main/java/com/github/_1c_syntax/bsl/mdo/children/PredefinedValue.javasrc/main/java/com/github/_1c_syntax/bsl/mdo/storage/PredefinedData.javasrc/main/java/com/github/_1c_syntax/bsl/mdo/utils/LazyLoader.javasrc/main/java/com/github/_1c_syntax/bsl/reader/MDReader.javasrc/main/java/com/github/_1c_syntax/bsl/reader/common/context/MDReaderContext.javasrc/main/java/com/github/_1c_syntax/bsl/reader/common/converter/PredefinedValueConverter.javasrc/main/java/com/github/_1c_syntax/bsl/reader/designer/DesignerReader.javasrc/main/java/com/github/_1c_syntax/bsl/reader/designer/converter/MDChildConverter.javasrc/main/java/com/github/_1c_syntax/bsl/reader/designer/converter/PredefinedDataConverter.javasrc/main/java/com/github/_1c_syntax/bsl/reader/edt/converter/MDChildConverter.javasrc/main/java/com/github/_1c_syntax/bsl/reader/edt/converter/Unmarshaller.javasrc/test/java/com/github/_1c_syntax/bsl/mdclasses/ConfigurationTest.javasrc/test/java/com/github/_1c_syntax/bsl/mdclasses/ConfigurationTest2.javasrc/test/java/com/github/_1c_syntax/bsl/mdo/CatalogTest.javasrc/test/java/com/github/_1c_syntax/bsl/mdo/ChartOfCharacteristicTypesTest.javasrc/test/java/com/github/_1c_syntax/bsl/test_utils/MDTestUtils.java
0955bef to
9b83e9c
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/main/java/com/github/_1c_syntax/bsl/mdo/PredefinedDataOwner.java`:
- Line 35: Add the org.jspecify.annotations.NonNull annotation to the interface
method to declare its non-null contract: import org.jspecify.annotations.NonNull
and annotate the method getPredefinedValues() in PredefinedDataOwner so the
signature becomes annotated with `@NonNull` (ensuring implementors’ `@Singular`
non-null collections are reflected in the interface contract).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 13d732e2-61b5-424f-b81e-55ca6a65fac2
⛔ Files ignored due to path filters (23)
src/test/resources/fixtures/mdclasses/Catalogs.Справочник1.jsonis excluded by!src/test/resources/**src/test/resources/fixtures/mdclasses/Catalogs.Справочник1_edt.jsonis excluded by!src/test/resources/**src/test/resources/fixtures/mdclasses/ChartsOfAccounts.ПланСчетов1.jsonis excluded by!src/test/resources/**src/test/resources/fixtures/mdclasses/ChartsOfAccounts.ПланСчетов1_edt.jsonis excluded by!src/test/resources/**src/test/resources/fixtures/mdclasses/ChartsOfCalculationTypes.ПланВидовРасчета1.jsonis excluded by!src/test/resources/**src/test/resources/fixtures/mdclasses/ChartsOfCharacteristicTypes.ПланВидовХарактеристик1.jsonis excluded by!src/test/resources/**src/test/resources/fixtures/mdclasses/ChartsOfCharacteristicTypes.ПланВидовХарактеристик1_edt.jsonis excluded by!src/test/resources/**src/test/resources/fixtures/mdclasses/Configuration.jsonis excluded by!src/test/resources/**src/test/resources/fixtures/mdclasses/Configuration_edt.jsonis excluded by!src/test/resources/**src/test/resources/fixtures/mdclasses/ExchangePlans.ПланОбмена1.jsonis excluded by!src/test/resources/**src/test/resources/fixtures/mdclasses/ExchangePlans.ПланОбмена1_edt.jsonis excluded by!src/test/resources/**src/test/resources/fixtures/mdclasses_3_18/Configuration.jsonis excluded by!src/test/resources/**src/test/resources/fixtures/mdclasses_3_18/Configuration_edt.jsonis excluded by!src/test/resources/**src/test/resources/fixtures/mdclasses_3_24/Configuration_edt.jsonis excluded by!src/test/resources/**src/test/resources/fixtures/mdclasses_5_1/Configuration.jsonis excluded by!src/test/resources/**src/test/resources/fixtures/ssl_3_1/Catalogs.ВерсииФайлов.jsonis excluded by!src/test/resources/**src/test/resources/fixtures/ssl_3_1/Catalogs.ВерсииФайлов_edt.jsonis excluded by!src/test/resources/**src/test/resources/fixtures/ssl_3_1/Catalogs.Заметки.jsonis excluded by!src/test/resources/**src/test/resources/fixtures/ssl_3_1/Catalogs.Заметки_edt.jsonis excluded by!src/test/resources/**src/test/resources/fixtures/ssl_3_1/ChartsOfCharacteristicTypes.ДополнительныеРеквизитыИСведения.jsonis excluded by!src/test/resources/**src/test/resources/fixtures/ssl_3_1/ChartsOfCharacteristicTypes.ДополнительныеРеквизитыИСведения_edt.jsonis excluded by!src/test/resources/**src/test/resources/fixtures/ssl_3_1/ExchangePlans.ОбновлениеИнформационнойБазы.jsonis excluded by!src/test/resources/**src/test/resources/fixtures/ssl_3_1/ExchangePlans.ОбновлениеИнформационнойБазы_edt.jsonis excluded by!src/test/resources/**
📒 Files selected for processing (22)
build.gradle.ktssrc/main/java/com/github/_1c_syntax/bsl/mdo/Catalog.javasrc/main/java/com/github/_1c_syntax/bsl/mdo/ChartOfAccounts.javasrc/main/java/com/github/_1c_syntax/bsl/mdo/ChartOfCalculationTypes.javasrc/main/java/com/github/_1c_syntax/bsl/mdo/ChartOfCharacteristicTypes.javasrc/main/java/com/github/_1c_syntax/bsl/mdo/ExchangePlan.javasrc/main/java/com/github/_1c_syntax/bsl/mdo/PredefinedDataOwner.javasrc/main/java/com/github/_1c_syntax/bsl/mdo/children/PredefinedValue.javasrc/main/java/com/github/_1c_syntax/bsl/mdo/storage/PredefinedData.javasrc/main/java/com/github/_1c_syntax/bsl/mdo/utils/LazyLoader.javasrc/main/java/com/github/_1c_syntax/bsl/reader/MDReader.javasrc/main/java/com/github/_1c_syntax/bsl/reader/common/context/MDReaderContext.javasrc/main/java/com/github/_1c_syntax/bsl/reader/common/converter/PredefinedValueConverter.javasrc/main/java/com/github/_1c_syntax/bsl/reader/designer/DesignerReader.javasrc/main/java/com/github/_1c_syntax/bsl/reader/designer/converter/MDChildConverter.javasrc/main/java/com/github/_1c_syntax/bsl/reader/designer/converter/PredefinedDataConverter.javasrc/main/java/com/github/_1c_syntax/bsl/reader/edt/converter/MDChildConverter.javasrc/main/java/com/github/_1c_syntax/bsl/reader/edt/converter/Unmarshaller.javasrc/test/java/com/github/_1c_syntax/bsl/mdclasses/ConfigurationTest.javasrc/test/java/com/github/_1c_syntax/bsl/mdclasses/ConfigurationTest2.javasrc/test/java/com/github/_1c_syntax/bsl/mdo/CatalogTest.javasrc/test/java/com/github/_1c_syntax/bsl/mdo/ChartOfCharacteristicTypesTest.java
🚧 Files skipped from review as they are similar to previous changes (15)
- src/main/java/com/github/_1c_syntax/bsl/mdo/ChartOfCharacteristicTypes.java
- src/main/java/com/github/_1c_syntax/bsl/reader/edt/converter/MDChildConverter.java
- src/main/java/com/github/_1c_syntax/bsl/mdo/ChartOfAccounts.java
- src/main/java/com/github/_1c_syntax/bsl/reader/MDReader.java
- src/main/java/com/github/_1c_syntax/bsl/mdo/storage/PredefinedData.java
- src/main/java/com/github/_1c_syntax/bsl/mdo/utils/LazyLoader.java
- src/main/java/com/github/_1c_syntax/bsl/mdo/Catalog.java
- src/test/java/com/github/_1c_syntax/bsl/mdo/CatalogTest.java
- src/test/java/com/github/_1c_syntax/bsl/mdo/ChartOfCharacteristicTypesTest.java
- src/main/java/com/github/_1c_syntax/bsl/reader/designer/DesignerReader.java
- src/test/java/com/github/_1c_syntax/bsl/mdclasses/ConfigurationTest.java
- src/main/java/com/github/_1c_syntax/bsl/reader/common/converter/PredefinedValueConverter.java
- src/main/java/com/github/_1c_syntax/bsl/mdo/children/PredefinedValue.java
- src/test/java/com/github/_1c_syntax/bsl/mdclasses/ConfigurationTest2.java
- src/main/java/com/github/_1c_syntax/bsl/reader/designer/converter/PredefinedDataConverter.java
Добавлено чтение предопределенных данных для справочников, планов видов характеристик, планов счетов, планов видов расчета и планов обмена в обоих форматах: - Конфигуратор: отдельный файл <Объект>/Ext/Predefined.xml; - EDT: встроенный элемент <predefined> в файле объекта. Модель: - PredefinedValue (MDChild + ChildrenOwner, поддерживает иерархию childItems); - интерфейс-владелец PredefinedDataOwner; - контейнер PredefinedData для файла Ext/Predefined.xml. Предопределенные значения включаются в getChildren()/getPlainChildren(), получают mdoReference (тип PREDEFINED_VALUE), owner и наследуют supportVariant владельца. Требует bsl-common-library 0.11.0 (новый тип метаданных PREDEFINED_VALUE). Co-Authored-By: Claude Opus 4.8 <[email protected]>
9b83e9c to
71a8cd5
Compare
|



Что сделано
Добавлено чтение предопределённых данных (предопределённых значений) для объектов:
Catalog,ChartOfCharacteristicTypes,ChartOfAccounts,ChartOfCalculationTypes,ExchangePlan.Поддержаны оба формата хранения:
<Объект>/Ext/Predefined.xml. Читается проактивно (как модули), через новый методMDReader.readPredefinedData(...); кореньPredefinedDataразбирает@DesignerConverter PredefinedDataConverter.<predefined>в файле объекта. Разбирается вedt/converter/Unmarshaller; обработка включается только дляPredefinedDataOwner, поэтому булев<predefined>у регламентных заданий/ботов не задевается.Элементы (
<Item>/<items>) читаются общим рекурсивнымcommon/converter/PredefinedValueConverter(иерархия —ChildItems/вложенныеitems; код в EDT берётся из вложенного<value>).Модель
mdo/children/PredefinedValue—MDChild+ChildrenOwner, поддерживает иерархию (childItems); поля:code,description,folder, дерево;mdo/PredefinedDataOwner— интерфейс-владелец (реализуют 5 объектов выше);mdo/storage/PredefinedData— контейнер для файлаExt/Predefined.xml.Поведение
getChildren()/getPlainChildren()(черезLazyLoader);mdoReferenceтипаPREDEFINED_VALUE(напримерCatalog.Справочник1.Predefined.ПредопределённыйЭлемент),ownerи наследуютsupportVariantвладельца — это проставляется вMDReaderContext.build().Зависимость
Требует
bsl-common-library:0.11.0— в него добавлен новый тип метаданныхPREDEFINED_VALUE(обновлено вbuild.gradle.kts).Тесты и фикстуры
predefinedValuesвключены в JSON-эталоны (23 файла); дифф — только добавление поля, без сдвигов@reference.CatalogTest(Справочник1, оба формата) иChartOfCharacteristicTypesTest.testPredefined(ssl_3_1, оба формата) — имя/код/наименование/группа/дерево/owner/mdoReference.ConfigurationTest/ConfigurationTest2дополнены динамическим слагаемымpredefinedCount(...)(предопределённые входят вgetPlainChildren()).Примечание
Фикстура
mdclasses_3_24/Configuration_edt.jsonобновлена под фикс режима совместимостиDontUse(8.3.99→8.99.99), пришедший вместе с подъёмомbsl-common-libraryна 0.11.0 — к предопределённым не относится.Дальнейшее (отдельной задачей)
Типоспецифичные поля предопределённых счетов/расчётов (
AccountingFlags-значения,ExtDimensionTypes,AccountType,actionPeriodIsBase) + синтетические фикстуры для счетов/расчётов/планов обмена.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Tests
Dependencies