Skip to content

[MCP] Clear environment description after environment copy - #12152

Merged
Nikola Kukrika (nikolakukrika) merged 17 commits into
mainfrom
feature/cleanup-environment-description-on-copy
Oct 5, 2026
Merged

Nikola Kukrika (nikolakukrika) merged 17 commits into
mainfrom
feature/cleanup-environment-description-on-copy

Conversation

@nikolakukrika

@nikolakukrika Nikola Kukrika (nikolakukrika) commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

What & why

Clear the database-wide environment description when an environment is copied so the destination does not retain context describing the source environment.

  • Subscribe Environment Information to the database-level environment cleanup event.
  • Clear the environment description BLOB for every environment-copy scenario.
  • Add a regression test through OnAfterCopyEnvironmentPerDatabase.

Depends on #11741.

Linked work

Fixes AB#650134
Fixes AB#650130

How I validated this

  • I read the full diff and it contains only changes I intended.
  • I built the affected app(s) locally with no new analyzer warnings.
  • I ran the change in Business Central and confirmed it behaves as expected.
  • I added or updated tests for the new behavior.

What I tested and the outcome

  • Added a test that sets an environment description, raises the platform database-copy trigger, and verifies the description is empty.
  • Ran git diff --check and validated the updated app.json.
  • Local AL compilation was not available without the repository's container-based build tooling.

Risk & compatibility

  • Cleanup runs once per copied database, matching the environment description's DataPerCompany = false scope.
  • Existing descriptions are unchanged except when the platform raises the environment-copy cleanup event.

Adds BLOB-backed company and database-wide environment descriptions, exposes them in the v2 company information API, and updates UI and tests across localized layers.

AB#650134
AB#650130

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 163db552-26bd-4164-9d35-8b66f98611b6
AB#650134
AB#650130

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 163db552-26bd-4164-9d35-8b66f98611b6
AB#650134
AB#650130

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 163db552-26bd-4164-9d35-8b66f98611b6
AB#650134

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 163db552-26bd-4164-9d35-8b66f98611b6
AB#650130

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 163db552-26bd-4164-9d35-8b66f98611b6
AB#650134
AB#650130

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 163db552-26bd-4164-9d35-8b66f98611b6
AB#650134
AB#650130

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 163db552-26bd-4164-9d35-8b66f98611b6
AB#650134

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 163db552-26bd-4164-9d35-8b66f98611b6
Persist company and environment descriptions from their field validation triggers so closing a stale page cannot overwrite newer values.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 163db552-26bd-4164-9d35-8b66f98611b6
Exclude the new HTTP API test consistently with the existing company information API tests, which cannot authenticate in the BCApps integration-test environment.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 163db552-26bd-4164-9d35-8b66f98611b6
Reconstruct multiline BLOB text with separators only between lines so company and environment descriptions do not gain a trailing newline.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 163db552-26bd-4164-9d35-8b66f98611b6
Refactor company and environment description getters to rebuild multiline text with the standard first-line separator pattern.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 163db552-26bd-4164-9d35-8b66f98611b6
Clear the database-wide environment description during environment cleanup so copied environments do not retain source context. Add coverage through the platform environment-copy trigger.

AB#650134
AB#650130

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 89095217-42e1-4135-9d15-45c32fb7d277
@github-actions github-actions Bot added AL: System Application Team: Integrations GitHub request for Integrations area labels Sep 30, 2026
Base automatically changed from feature/company-environment-descriptions to main September 30, 2026 14:23
@github-actions github-actions Bot added this to the Version 30.0 milestone Sep 30, 2026
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 1

Recommendation: Accept with Suggestions

What this PR does

This change clears the database-wide environment description when the platform copies an environment. The subscriber uses the per-database cleanup event and clears only the environment description BLOB, so the production behavior matches the intended scope.

Problem-solution fit

Fit: Strong

The change directly prevents a copied environment from keeping source-specific context. It uses the existing database cleanup lifecycle and does not affect company descriptions.

Suggestions

S1 (🟠 Moderate): Use a compatible test transaction model
The test raises the database-wide cleanup event while using AutoRollback. Existing subscribers call Commit(), so the test can fail before the description assertion runs. Use AutoCommit with runner-level test isolation, or test the new handler through an isolated seam.

Risk assessment and necessity

Risk: The production change is narrow: the new dependency is acyclic, the cleanup event runs after the database-copy trigger, and only the database-wide description is cleared. The main verification risk is that the current regression test can stop in an existing cleanup subscriber before it verifies this change.

Necessity: Without this change, a copied environment keeps the source environment description and can give consumers misleading context. The only workaround is to clear or replace the description after each copy.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=12152 round=1 by=alexei-dobriansky at=2026-09-30T23:46:32Z lastSha=0a0fcd5a9380fc65c1b3eeb12da578c768ac49db reviewKey=67f3b2bcbc12991984d341948669eb47a74961f8789d1dc3cb0ebef6cbed4100 suggestions=S1@1147f863

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 89095217-42e1-4135-9d15-45c32fb7d277
Avoid invoking all environment-copy cleanup subscribers from the unit test while exercising the same description-clearing implementation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2787cc43-59c7-41e2-afe0-b914d5f5863e
Raise the actual environment-copy trigger and use AutoCommit because the subscriber chain commits. Remove the test-only helper introduced by the previous fix.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2787cc43-59c7-41e2-afe0-b914d5f5863e
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 2

Recommendation: Accept

What this PR does

The follow-up change replaces the rollback-incompatible test path with an AutoCommit test that raises the actual per-database environment-copy trigger. This exercises the new subscriber through the real cleanup chain while allowing existing subscribers to commit.

Status of previous suggestions
ID Title Status Author response
S1 Use a compatible test transaction model Addressed Fixed in 5c28dc37 by using AutoCommit and the actual copy trigger.
New observations (commits since round 1)

None - changes only addressed the prior suggestion.

Risk assessment and necessity

Risk: The production change remains narrow and clears only the database-wide description during environment-copy cleanup. The updated test permits existing cleanup subscribers to commit, and the reported checks pass.

Necessity: Without this cleanup, a copied environment retains source-specific descriptive context and can expose misleading information to consumers.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=12152 round=2 by=alexei-dobriansky at=2026-10-01T22:27:18Z lastSha=5c28dc37b5c241ebd6f788b0dabbf9716774acc0 reviewKey=d180ea105f2970da7ef16c2eea7cc7a288bffbecbeb9cc93e947794dcb7c7114 suggestions=S1@1147f863:addressed parentRound=1

Co-authored-by: nikolakukrika <39086991+nikolakukrika@users.noreply.github.com>
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 3

Recommendation: Accept with Suggestions

What this PR does

The latest commit removes AutoCommit from the regression test while leaving the production cleanup unchanged. This reopens the earlier verification issue because the test raises the full database-cleanup event, whose existing subscribers include explicit Commit() calls.

Status of previous suggestions
ID Title Status Author response
S1 Use a compatible test transaction model Disputed The transaction model attribute was removed because it was considered unsuitable.
New observations (commits since round 2)

None. The latest commit reopens S1 by removing AutoCommit.

Risk assessment and necessity

Risk: The production change remains narrow and correct, but the test now defaults to AutoRollback. Existing database-cleanup subscribers call Commit(), so the test can stop before its assertion and fail to verify this behavior.

Necessity: Without this cleanup, a copied environment retains source-specific descriptive context and can give consumers misleading information.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=12152 round=3 by=alexei-dobriansky at=2026-10-02T22:18:58Z lastSha=fdd8048645b8160a22a89f468de951a78213b864 reviewKey=fc48bea9b2aee8e9329acd54f7430bacb78a6d751edc65e90dee2c627260ddba suggestions=S1@1147f863:disputed parentRound=2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: System Application Team: Integrations GitHub request for Integrations area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants