Skip to content

Add  SheetPrototype  and  SheetBorderPrototype  elements (BisCore 01.00.27) - #9823

Open
tigistmebrate11 wants to merge 21 commits into
masterfrom
tm/sheet-prototype
Open

tigistmebrate11 wants to merge 21 commits into
masterfrom
tm/sheet-prototype

Conversation

@tigistmebrate11

Copy link
Copy Markdown
Contributor

Description

  • Adds  SheetPrototype  and  SheetBorderPrototype  element classes,  Sheet.sheetPrototype , and the matching props/relationship classes for BisCore 01.00.27.

Purpose

  • #826 Graduates the sheet prototype concept from  DrawingProductionExperimental  (dpex) into BisCore so it is platform-level and shareable across apps/catalogs.

Changes

  • Added SheetPrototype and SheetBorderPrototype interfaces to define properties for sheet templates and borders.
  • Updated SheetProps to include a reference to the originating SheetPrototype.
  • Enhanced documentation to describe the purpose and usage of SheetPrototype and SheetBorderPrototype.
  • Updated change history to reflect the introduction of these new elements in the BisCore schema.

@mergify

mergify Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

This pull request is now in conflicts. Could you fix it @tigistmebrate11? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

@aruniverse aruniverse left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for contributing sheet prototype support!

Reviewed assuming the BisCore 01.00.27 schema changes are available in native. I found two functional integration gaps and one API-tag inconsistency, detailed inline.

Validation: all 10 new tests passed in an adapted runtime harness using the PR's Element/NavigationRelationship handlers and BisCore 01.00.27 imported into installed native 5.16.3. Additional assertion-based checks reproduced the relationship and definition-cleanup findings. This was not a full Rush build/lint run or validation of the eventual native package.

Comment thread core/backend/src/Element.ts Resolved
Comment thread core/backend/src/Element.ts Resolved
Comment thread core/common/src/ElementProps.ts Resolved
@mergify

mergify Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Queue requested — the merge queue status continues in this comment ↓.

@mergify

mergify Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🛑 Queue command cancelled

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Relationship assertions fail on valid insertions due to incorrect separators, and the purge recheck can leave unreferenced GeometryParts incorrectly reported as in use.

2 open issues
What changed in this PR

Adds BisCore 01.00.27 sheet prototypes to the common and backend APIs, supporting reusable sheet layouts and border definitions.

Changes:

  • Adds prototype elements, props, navigation relationships, and creation helpers; deprecates legacy sheet templates.
  • Extends definition cleanup and adds tests for schema compatibility, references, sub-model restrictions, and deletion.
  • Updates API reports, export summaries, documentation, and package change entries.
File Description
docs/​changehistory/​NextVersion.md Announces sheet prototypes and schema requirements.
docs/​bis/​domains/​drawings-sheets.md Explains prototype modeling and relationships.
core/​common/​src/​ElementProps.ts Adds prototype props and deprecates legacy template props.
core/​backend/​src/​test/​element/​SheetPrototype.test.ts Tests creation, references, restrictions, and cleanup.
core/​backend/​src/​NavigationRelationship.ts Adds four prototype relationship helpers.
core/​backend/​src/​Element.ts Implements prototype elements and sheet references.
core/​backend/​src/​EditTxn.ts Extends usage rechecks during definition cleanup.
common/​changes/​@itwin/​core-common/​tm-sheet-prototype_2026-10-15-12-00-00.json Records common API additions.
common/​changes/​@itwin/​core-backend/​tm-sheet-prototype_2026-10-15-12-00-00.json Records backend prototype support.
common/​api/​summary/​core-common.exports.csv Updates common export classifications.
common/​api/​summary/​core-backend.exports.csv Updates backend export classifications.
common/​api/​core-common.api.md Records common API additions and deprecations.
common/​api/​core-backend.api.md Records backend API additions and deprecations.

Review effort: Balanced

Comment thread core/backend/src/EditTxn.ts Resolved

Copilot AI commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

One or more custom setup steps configured for this repository failed during this Copilot code review run:

Install dependencies

Setup steps run before each review. If the review above is missing context, or no review was posted at all, the failing step above may be the cause. See the workflow run for failure details, fix your setup steps configuration, and re-request a review.

Note

You can configure setup steps for Copilot code review separately from Copilot cloud agent with a copilot-code-review.yml file. Read the docs for details.

@markschlosseratbentley markschlosseratbentley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My feedback right now aligns with Copilot's review.

…he colon separator'

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@mergify

mergify Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

queue

🛑 The queue request has been cancelled: new commits were pushed

Details

@tigistmebrate11 pushed to this pull request after queue was requested. Review the new commits and request it again.

@aruniverse aruniverse left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the updates! The specialized modeling relationships and the common property's beta tag are now corrected. The original cleanup finding is only partially fixed: native usage detection and the used-ID filtering now protect the definition elements, but tree cleanup can still delete their sub-models and graphics. I am following up in the original thread on that remaining data-loss case.

Two additional issues are detailed inline below. Validation against the PR's native 5.16.33 (BisCore 01.00.27): the latest SheetPrototype suite has 10 passing and 4 failing tests in a runtime harness using the PR sources. The existing DeleteDefinitionElements / should delete if not used regression passed, and additional assertions reproduced the loss of content from retained definitions. Full Rush build/lint and the complete backend suite were not run.

Comment thread core/backend/src/EditTxn.ts Resolved
@aruniverse aruniverse added this to the iTwin.js 5.16 milestone Nov 23, 2026
Comment thread core/common/src/ElementProps.ts Outdated

/** Properties of a [SheetBorderTemplate]($backend)
* @beta
* @deprecated in 5.15 - might be removed in next major version. Use [SheetBorderPrototypeProps]($common) instead.

@aruniverse aruniverse Nov 23, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @deprecated in 5.15 - might be removed in next major version. Use [SheetBorderPrototypeProps]($common) instead.
* @deprecated in 5.15 use [SheetBorderPrototypeProps]($common) instead.

We have a linter that will publish the "might be removed in next major". This applies to all repeats

Comment thread core/backend/src/EditTxn.ts Outdated
});
}
for (const id of subModeledIds) {
const result = this.deleteElements([id]);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Evaluate mutually referencing template-model roots as one deletion set

Calling deleteElements([id]) separately for each root treats references from another requested sub-model as external references. If the sub-models reference each other, both calls report a constraint violation, both roots enter usedIdSet, and the loop returns without deleting anything.

I reproduced this at dd044e98 against native 5.16.35 with two otherwise-unused SheetPrototypes whose graphics use each other's IDs as their code scopes. There are no references outside the requested pair:

  • deleteDefinitionElements([a, b]) retains both prototypes and reports both as used.
  • deleteElements([a, b]) succeeds when given the same roots together.

Impact: This can leave unused template models, definitions, and graphics behind after the requested cleanup. We will still want to clean up these leftover template models rather than silently treating them as genuinely in use.

Please evaluate dependent model roots together in the bulk-delete operation, distinguish references within the requested set from genuinely external references, and add a cross-model regression test.

Comment thread core/backend/src/Element.ts Outdated
@@ -1579,13 +1581,15 @@ export class SheetBorderTemplate extends Document {

/** The template for a [[Sheet]]
* @public @preview

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want to remove the preview from the deprecated functions

protected override collectReferenceIds(referenceIds: EntityReferenceSet): void {
super.collectReferenceIds(referenceIds);
// eslint-disable-next-line @typescript-eslint/no-deprecated
if (undefined !== this.sheetTemplate)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these be one or the other? Is there a risk when both are passed in? (same question for the constructor)

});

const used = withEditTxn(db, (txn) => txn.deleteDefinitionElements([ids.protoA, ids.protoB, protoC]));
expect([...used]).to.deep.equal([protoC]);
});

const used = withEditTxn(db, (txn) => txn.deleteDefinitionElements([protoId]));
expect([...used]).to.deep.equal([protoId]);
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.

Add SheetPrototype and SheetBorderPrototype for BisCore 01.00.27

5 participants