Skip to content

Expense Agent: capture submission policy evaluation history - #11628

Draft
Prangshuman Das (t-prda) wants to merge 5 commits into
mainfrom
private/prdas/policy-evaluation-history
Draft

Prangshuman Das (t-prda) wants to merge 5 commits into
mainfrom
private/prdas/policy-evaluation-history

Conversation

@t-prda

@t-prda Prangshuman Das (t-prda) commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Capture at most one report-level PolicyEvaluated history snapshot for each submission/resubmission using two existing BC execution paths.

  • Store outcome, passed/failed line-policy counts, and distinct flagged category display names (description with code fallback).
  • Use the history event time only; no snapshot-present flag, separate evaluation timestamp, or category-count field.
  • Share a bounded JSON-array helper with the existing Categories snapshot; append a separate final "..." entry on overflow while continuing to count all policy checks.
  • After submission/resubmission, log if all report lines have complete, current evaluations.
  • After the existing MarkPoliciesEvaluated line confirmation, use the same helper to check the whole pending-approval report and log when ready.
  • Require submission history and deduplicate against the latest Submitted/Resubmitted entry using existing log ordering.
  • Keep draft/recalled manual checks unlogged. A check completing for a pending report follows the same state-based rule regardless of its trigger.
  • Preserve detailed evaluations, approval behavior, history permissions, and posting behavior.
  • Keep the helper in Expense Activity Log Mgt. with header-first report-scoped locking.

Simplification

Removed the separate Expense Policy History codeunit, new submit/completion API actions, capability, correlation fields, context hashes, and header-invalidation subscribers. No service callback is required. Only the existing read-only activity API gains snapshot fields.

Tracking

Closes #11627

Related planning: AB#634361 and AB#626515 (neither slice is closed by this PR).
Companion service issue: https://microsoft.ghe.com/bic/BC-ExpenseAgent/issues/2754

Companion draft PR: https://microsoft.ghe.com/bic/BC-ExpenseAgent/pull/2755

Validation and review

  • Static AL structure/field checks and git diff --check.
  • Consolidated 20 added regression tests in codeunits 148342 and 148343, retaining aggregation, name deduplication/overflow, completion, lifecycle, posting-reassignment, and API coverage.
  • AL compile/publish/runtime tests: intentionally deferred to manual validation.
  • Existing API, permissions, and concurrent-capture verification.
  • End-to-end validation with the companion service change.

Draft for code review. No dispatch or AL execution was performed.
The initial implementation targets main; the planned 29.0 backport is not included.

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

Copilot-Session: d9178a5c-c5ff-43a4-b9cb-877ec18618fa
@github-actions github-actions Bot added AL: Apps (W1) Add-on apps for W1 Team: Finance GitHub request for Finance area labels Sep 18, 2026
@github-actions github-actions Bot added this to the Version 30.0 milestone Sep 18, 2026
Remove callback APIs, capability and separate policy history codeunit. Reuse existing activity writer with per-submission deduplication.

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

Copilot-Session: d9178a5c-c5ff-43a4-b9cb-877ec18618fa
Use distinct category names with shared JSON ellipsis handling and consolidate policy history regression tests.

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

Copilot-Session: d9178a5c-c5ff-43a4-b9cb-877ec18618fa
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: d9178a5c-c5ff-43a4-b9cb-877ec18618fa
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: d9178a5c-c5ff-43a4-b9cb-877ec18618fa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1 Team: Finance GitHub request for Finance area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expense Agent: capture submission policy evaluation history

1 participant