Skip to content

fix(types): одноимённые дети без владельца сливают свои коллекции - #4558

Merged
nixel2007 merged 2 commits into
developfrom
fix/types-metadata-same-named-children-merged
Sep 28, 2026
Merged

nixel2007 merged 2 commits into
developfrom
fix/types-metadata-same-named-children-merged

Conversation

@sfaqer

@sfaqer sfaqer commented Sep 27, 2026 •

Copy link
Copy Markdown
Member

Стоит поверх #4557 — там же MetadataCollectionSpecializer. После его слияния база вернётся на develop.

Что было

У общего описания вида (ОбъектМетаданных: Документ — например, из Для Каждого МД Из Метаданные.Документы)
владелец неизвестен. Его коллекции (ТабличныеЧасти, Реквизиты, …) собраны по имени из детей всей
конфигурации, и тип ОбъектМетаданных: ТабличнаяЧасть.Товары описывает табличную часть «Товары» какого угодно
документа. Колонки же ему доставались от первой встреченной: registerPerOwner пропускал всех последующих
одноимённых владельцев.

Порядок обхода берётся из Configuration.getChildrenByMdoRef() — это Collectors.toUnmodifiableMap, а у
неизменяемых карт JDK порядок перемешивается случайной солью на каждый запуск. Поэтому
МД.ТабличныеЧасти.Товары.Реквизиты.Х получал UnknownMember то в одном прогоне, то в другом.

Что стало

Коллекции одноимённых детей сливаются: у ОбъектМетаданных: ТабличнаяЧасть.Товары есть колонки каждой
табличной части «Товары». Раз владелец неизвестен, годится любая из них. Защита от повторной регистрации
теперь держится на паре «тип — владелец», а не на типе.

Тесты

MetadataCollectionSpecializerUnitTest.specialize_sameNamedChildrenOfUnknownOwner_mergeTheirCollections: две
табличные части «Товары» с разными колонками. Без правки остаются колонки одной из них, а какой именно, решает
соль порядка.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Fixed metadata collection handling when multiple metadata objects have tabular sections with the same name but unknown owners. Their distinct columns are now included together in the resulting collection, rather than one object's columns being omitted. This makes the collection more complete when metadata is combined across objects.

@coderabbitai

coderabbitai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: 1c-syntax/bsl-language-server/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 6ed84655-2d2b-43a9-af33-ce1eaeb20783

📥 Commits

Reviewing files that changed from the base of the PR and between f414f9a and 830d69c.

📒 Files selected for processing (2)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/types/registry/MetadataCollectionSpecializer.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/types/registry/MetadataCollectionSpecializerUnitTest.java

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.


📝 Walkthrough

Walkthrough

Per-owner synthetic type registration now tracks owners by object identity. Distinct owners with the same synthetic type can each contribute overrides. A unit test checks that tabular-section columns from two metadata objects are merged into the synthetic collection.

Changes

Per-owner metadata registration

Layer / File(s) Summary
Track owners during synthetic type registration
src/main/java/com/github/_1c_syntax/bsl/languageserver/types/registry/MetadataCollectionSpecializer.java, src/test/java/com/github/_1c_syntax/bsl/languageserver/types/registry/MetadataCollectionSpecializerUnitTest.java
Registration now tracks owners by identity for each type. It adds overrides for each new owner and registers the shared non-generic member source once. The unit test checks that the synthetic collection contains columns from both tabular sections.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: nixel2007

Merge Risk: ⚪ Minimal · up to 830d6

No concrete issue currently prevents merging. The test’s coverage of repeat-owner registration remains unconfirmed.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 830d6

The change affects inferred metadata members within a workspace. The reviewed path does not expose a privileged operation or a cross-workspace capability, but recovery behavior and the wider security surface are not fully established.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The demonstrated effect is on member inference in the selected workspace. Attacker control of workspace configuration was not established, and no wider independently attackable scope was demonstrated by the traced path.

Trust Boundaries and Controls

  • observed — The entrypoint selects configuration through the current workspace URI before processing metadata, and registration writes member sources for BSL type resolution.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: merging collections from same-named metadata children when their owners are unknown.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

 4 260 files  ±0   4 260 suites  ±0   1h 5m 38s ⏱️ - 8m 56s
 4 437 tests +1   4 348 ✅ +1   89 💤 ±0  0 ❌ ±0 
26 622 runs  +6  26 080 ✅ +6  542 💤 ±0  0 ❌ ±0 

Results for commit 830d69c. ± Comparison against base commit f414f9a.

♻️ This comment has been updated with latest results.

sfaqer and others added 2 commits September 28, 2026 09:03
У общего описания вида (`ОбъектМетаданных: Документ`, полученного из
`Для Каждого МД Из Метаданные.Документы`) владелец неизвестен, и его
`ТабличныеЧасти.Товары` — табличная часть «Товары» какого угодно документа.
Колонки ей доставались от первой встреченной, а порядок обхода метаданных
(`Configuration.getChildrenByMdoRef()` — неизменяемая карта JDK) от запуска
к запуску разный: UnknownMember на `МД.ТабличныеЧасти.Товары.Реквизиты.Х`
то появлялся, то нет.

Теперь коллекции одноимённых детей сливаются: колонки есть у каждой из
табличных частей с этим именем.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Первый владелец определяется по размеру набора после добавления (S1941),
статический импорт `mock` (S8924); тест проходит коллекцию, объявленную двумя
видами объектов, — повторный владелец не регистрируется.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sfaqer
sfaqer force-pushed the fix/types-metadata-same-named-children-merged branch from df7cf8a to 830d69c Compare September 27, 2026 23:22
@sonarqubecloud

Copy link
Copy Markdown

@sfaqer

sfaqer commented Sep 28, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@sfaqer
sfaqer requested a review from nixel2007 September 28, 2026 10:54
Base automatically changed from fix/types-own-metadata-object to develop September 28, 2026 12:23
@nixel2007
nixel2007 merged commit 0079ce0 into develop Sep 28, 2026
33 checks passed
@nixel2007
nixel2007 deleted the fix/types-metadata-same-named-children-merged branch September 28, 2026 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants