Skip to content

Свой кэш значений у каждого XS-перечисления - #1771

Merged
EvilBeaver merged 1 commit into
EvilBeaver:developfrom
sfaqer:bugfix/xs-enums-cache
Oct 1, 2026
Merged

EvilBeaver merged 1 commit into
EvilBeaver:developfrom
sfaqer:bugfix/xs-enums-cache

Conversation

@sfaqer

@sfaqer sfaqer commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Шесть перечислений XS (ЗавершенностьСхемыXS, НедопустимыеПодстановкиXS и др.) оборачивают один XmlSchemaDerivationMethod и делили статический кэш значений: каждое новое перечисление очищало его, и FromNativeValue возвращал значения последнего созданного. Из-за этого, например, СхемаXML.ЗавершенностьПоУмолчанию.Ограничение оставалось Ложь после добавления ЗавершенностьСхемыXS.Ограничение.

Кэш теперь свой у каждого перечисления (ClrEnumWrapperCached<TSelf, T>), остальные наследники ClrEnumWrapperCached<T> не меняются.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Corrected how cached XML Schema enumeration values are scoped across wrapper types, preventing values from one enumeration wrapper from affecting another.
  • Tests
    • Added coverage for schema finalization and default substitution-blocking flags.

Шесть перечислений XS оборачивают один XmlSchemaDerivationMethod и делили
статический кэш значений: FromNativeValue возвращал значения последнего
созданного перечисления. Кэш теперь свой у каждого перечисления.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 30, 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: defaults

Review profile: CHILL

Plan: Advanced

Run ID: a4b57a74-f83c-4501-813b-5be939645ff3

📥 Commits

Reviewing files that changed from the base of the PR and between 36e2ca9 and 13e6154.

📒 Files selected for processing (8)
  • src/OneScript.StandardLibrary/XMLSchema/Enumerations/XSComplexFinal.cs
  • src/OneScript.StandardLibrary/XMLSchema/Enumerations/XSDisallowedSubstitutions.cs
  • src/OneScript.StandardLibrary/XMLSchema/Enumerations/XSProhibitedSubstitutions.cs
  • src/OneScript.StandardLibrary/XMLSchema/Enumerations/XSSchemaFinal.cs
  • src/OneScript.StandardLibrary/XMLSchema/Enumerations/XSSimpleFinal.cs
  • src/OneScript.StandardLibrary/XMLSchema/Enumerations/XSSubstitutionGroupExclusions.cs
  • src/ScriptEngine/Machine/Contexts/ClrEnumWrapper.cs
  • tests/XMLSchema/test-XMLSchema.os

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


📝 Walkthrough

Walkthrough

The cached CLR enum wrapper now supports cache ownership by wrapper type. Six XML Schema enum wrappers use the updated generic form, and two tests check default schema flags after adding Ограничение.

Changes

Enum wrapper cache

Layer / File(s) Summary
Wrapper-specific cache base
src/ScriptEngine/Machine/Contexts/ClrEnumWrapper.cs
A new two-parameter cached wrapper owns the static enum-value cache. The existing one-parameter wrapper delegates construction to it.
XML Schema wrapper adoption
src/OneScript.StandardLibrary/XMLSchema/Enumerations/*, tests/XMLSchema/test-XMLSchema.os
Six XML Schema enum wrappers now pass their own type and XmlSchemaDerivationMethod to the cached base. Two tests add Ограничение to default schema settings and check the Ограничение and Расширение flags.

Priority: ➖ Normal

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

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 13e61

The change isolates XML Schema enumeration caches and adds default-flag regression tests. No actionable merge-blocking risk is identified; merge after normal checks pass.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 13e61

The change isolates enum values by wrapper type and corrects cross-wrapper interference. No new security bypass was identified in the reviewed paths. Runtime initialization assumptions and downstream security-sensitive uses were not fully established, so some uncertainty remains.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The demonstrated exposure is in-process enum identity and XML Schema flag interpretation. Isolation is by wrapper class, not by runtime instance or tenant: repeated construction of the same wrapper type still shares its static cache. No broader security-sensitive outcome was established by the scoped evidence.

Trust Boundaries and Controls

  • inferred — The inspected change restores the identity used for enum registration and lookup rather than adding authority. Public native-value lookup returns a registered enum wrapper; these reviewed paths do not demonstrate a new authorization, identity, or sandbox boundary transition. Downstream security-sensitive use remains unestablished.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 7 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Заголовок точно описывает основное изменение: отдельный кэш значений для каждого XS-перечисления.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 7 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • 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.

@EvilBeaver
EvilBeaver merged commit f780bb4 into EvilBeaver:develop Oct 1, 2026
2 checks passed
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