Skip to content

🩹 [Patch]: Common context operations complete faster#122

Draft
Marius Storhaug (MariusStorhaug) wants to merge 6 commits into
mainfrom
addon-speed-analysis
Draft

🩹 [Patch]: Common context operations complete faster#122
Marius Storhaug (MariusStorhaug) wants to merge 6 commits into
mainfrom
addon-speed-analysis

Conversation

@MariusStorhaug

@MariusStorhaug Marius Storhaug (MariusStorhaug) commented Jul 23, 2026

Copy link
Copy Markdown
Member

Context vault creation, context storage, retrieval, and repeated session use complete faster while retaining encrypted storage and existing command behavior.

Changed: Common operations scale better with populated vaults

Exact-ID reads and writes no longer repeatedly scan every context file in a vault. Encryption setup and recursive object conversion also reuse safe work where possible, reducing latency as vaults grow.

Changed: New PowerShell sessions load Context faster

Sodium is validated and loaded only when encryption or decryption is first needed, reducing startup overhead for sessions that import Context before using stored data.

Fixed: Context file operations stay inside the selected vault

Vault names containing path separators are rejected, and file operations use the actual discovered metadata file path instead of trusting a stored path value.

Changed: CI aligned with Process-PSModule v6.1.13

The reusable workflow is pinned to v6.1.13 (from v5.4.6). Per the v6.0.0 breaking change, secrets: inherit is replaced with an explicit APIKey secret. Context has no test-specific secrets so TestData is omitted.

Adopted release-note items:

  • v6.0.0TEST_* secrets removed; calling convention migrated to explicit APIKey.
  • v6.1.0 — Plan job / artifact-integrity pipeline (internal to Process-PSModule; no caller changes required).
  • v6.1.1–v6.1.13 — Bug fixes and doc-site changes (internal; no caller changes required).

Skipped / not applicable:

  • TestData JSON secret (v6.0.0): Context has no test secrets, so the TestData input is intentionally omitted.
  • ImportantFilePatterns (v5.5.0): Defaults (^src/, ^README\.md$) match this repo's layout; no override needed.
  • Coverage / $IsWindows shim removal (v5.4.7): internal framework change, no consumer action.

Technical Details

  • Adds per-session context-file and vault-key caches with invalidation on writes, removals, and vault deletion.
  • Moves hot-path collection, string, and file work to direct .NET APIs.
  • Uses Sodium 2.2.4 and validates its cryptography commands lazily.
  • Migrates tests to Pester 6 and adds heavy workload and path-hardening coverage.
  • PSScriptAnalyzer passes with the repository configuration; changed PowerShell files parse without errors; source-level random read/write smoke coverage passes.
  • Deterministic baseline versus optimized benchmarks: initial source load improves from 382.32ms to 121.85ms (68.13%); 360 context writes improve from 17.07s to 3.02s (82.32%); 1,200 mixed operations improve from 39.80s to 8.54s (78.54%); average load across 10 fresh PowerShell sessions improves from 442.75ms to 342.46ms (22.65%).

No issue is linked; this PR was explicitly requested during the performance investigation.

Replace pipeline-heavy recursion with direct .NET collection and string operations while preserving secure-string and nested-object behavior.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Cache exact-ID file lookups and vault keypairs, defer Sodium loading until cryptography is used, and harden paths used for vault file operations.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Run the suite on Pester 6 and cover populated-vault workloads, repeated context roundtrips, cross-vault exact-ID results, and path traversal protections.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Wrap long calls, declare recursive output types, and document why in-memory cache helpers do not use ShouldProcess.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@MariusStorhaug Marius Storhaug (MariusStorhaug) added the Patch Fixes bugs or adds small fixes to existing functionality label Jul 23, 2026
@github-actions

Copy link
Copy Markdown

Super-linter summary

Language Validation result
CHECKOV Pass ✅
GITHUB_ACTIONS Pass ✅
GITLEAKS Pass ✅
GIT_MERGE_CONFLICT_MARKERS Pass ✅
MARKDOWN Pass ✅
NATURAL_LANGUAGE Pass ✅
POWERSHELL Pass ✅
PRE_COMMIT Pass ✅
SPELL_CODESPELL Pass ✅
TRIVY Pass ✅
YAML Pass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

- Pin workflow to v6.1.13 (SHA fb1bdb8fefd243292f779d2a856a38db6fe6daf4)
- Replace secrets: inherit with explicit APIKey secret per v6.0.0 breaking change
- Context has no test secrets so TestData is omitted

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

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown

Super-linter summary

Language Validation result
CHECKOV Pass ✅
GITHUB_ACTIONS Pass ✅
GITLEAKS Pass ✅
GIT_MERGE_CONFLICT_MARKERS Pass ✅
MARKDOWN Pass ✅
NATURAL_LANGUAGE Pass ✅
POWERSHELL Pass ✅
PRE_COMMIT Pass ✅
SPELL_CODESPELL Pass ✅
TRIVY Pass ✅
YAML Pass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

Translates all mkdocs.yml settings to Zensical TOML format:
- Preserves palette colors (black/green dark, indigo/green light)
- Updates palette toggle icons from material/ to lucide/
- Retains all navigation features and markdown extensions
- Adds content.code.copy and pymdownx.superfences (Zensical standard)
- Social links and cookie consent carried over

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Patch Fixes bugs or adds small fixes to existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant