Skip to content

core: record handler and provider provenance in plans and results - #342

Merged
blindzero merged 1 commit into
mainfrom
feature/323-handler-provider-provenance
Oct 31, 2026
Merged

blindzero merged 1 commit into
mainfrom
feature/323-handler-provider-provenance

Conversation

@blindzero

Copy link
Copy Markdown
Owner

Summary

Plans, execution results and plan exports now record which module and version provided each step handler and each provider.

Motivation

#323: For IAM audits ("which code disabled this account?") and troubleshooting, plans and results had no information about which code ran. This matters more now that extension step packs (#292) and providers are mixed with first-party modules.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring / internal improvement

Changes

  • Record shape: Source = @{ Module; Version }. Module and Version are $null for host functions and provider objects without a module, and for handlers that cannot be resolved at planning time.
  • Plan:
    • Steps[].Source and OnFailureSteps[].Source: the handler expected at planning time.
    • ProviderSources: map from provider alias to source.
    • Recording provenance never makes planning fail. StepRegistry validation stays at execution time, as before.
  • Execution result:
    • Steps[].Source and OnFailure.Steps[].Source: the handler that actually ran.
    • Source is $null for steps whose handler did not run (NotApplicable, Blocked, PreconditionSkipped).
    • ProviderSources.
  • Providers: Only Providers entries that expose GetCapabilities() are listed. A provider's module is the module that defines that method.
  • Plan export:
    • New fields steps[].source and plan.providers[].
    • schemaVersion goes from 1.0 to 1.1. The spec classifies additive changes as MINOR.
    • The spec now has a version history.
  • FirstParty intentionally not recorded (deviation from the issue):
  • Tests: Two existing tests no longer depend on the locale. They checked localized PowerShell messages and now check exception type and ErrorId instead.

Testing

  • Unit tests
  • Contract tests
  • Manual testing

New file tests/Core/Provenance.Tests.ps1 (7 tests) covers:

  • plan sources for first-party handlers, host handlers, and handlers registered only at execution time
  • provider sources: providers only, sorted by alias
  • execution sources, including skipped steps, failed steps and OnFailure steps
  • the export fields

The expected export fixture is updated.

Local full suite: 904 passed, 0 failed. PSScriptAnalyzer: 0 errors; the 17 warnings are the same as on main. The step reference is unchanged.

How to test & review

Checklist

  • Code follows STYLEGUIDE.md
  • Tests added or updated
  • Documentation updated
  • No UI/auth logic added to IdLE.Core
  • No breaking changes without discussion

Related Issues

Related: #322 (needs its own first-party detection, for example using the same logic as the mixed-version guard in IdLE.Init.ps1).

Closes #323

🤖 Generated with Claude Code

Plans, execution results and plan exports record which module (and
version) provided each step handler and each provider.

- Plan: Steps[].Source / OnFailureSteps[].Source (planning-time view),
  ProviderSources (alias -> source).
- Execution result: Steps[].Source / OnFailure.Steps[].Source for the
  handler that actually ran ($null if the handler did not run),
  ProviderSources.
- Plan export: steps[].source and plan.providers; schemaVersion 1.1.
- Source = @{ Module; Version }; Module/Version are $null for handlers
  or providers without a module and for handlers not resolvable at
  planning time. Planning never fails because of provenance; registry
  validation stays at execution time.
- Providers are Providers entries exposing GetCapabilities(); their
  module is the module defining that method.
- FirstParty is intentionally not recorded: it is no integrity proof,
  and first-party detection is only needed for enforcement (#322).

Also make two tests locale-independent (assert exception type/ErrorId
instead of localized PowerShell messages).

Closes #323

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T20:24:22.467215Z 903e4e1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@claude

claude Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Verdict: PASS

Provenance is recorded without breaking planning, the execution and export contracts are consistent, and tests and docs cover the change.

No CRITICAL, MAJOR or MINOR findings.

@github-actions

Copy link
Copy Markdown

Code Coverage Report

Overall Project 74.48% 🍏

There is no coverage information present for the Files changed

@blindzero
blindzero merged commit 27786b4 into main Oct 31, 2026
9 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 903e4e16f0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

return $sources
}

$entries = @{}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve case-distinct provider aliases

If a host supplies a case-sensitive IDictionary with aliases that differ only by case, this @{} scratch map (and the ordered map above) merges them because PowerShell hashtable literals are case-insensitive (PowerShell case-sensitivity docs). ProviderSources can then omit an alias or report the wrong provider's module and version, making the audit provenance diverge from the providers available at execution; preserve keys in a case-sensitive representation throughout.

Useful? React with 👍 / 👎.

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.

Record handler and provider provenance in plans and execution results

1 participant