Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/instructions/source-cmdlets--pester.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,23 @@ test that needs a new piece of tenant data, add a defaulted variable to `ISHRemo
(so CI/other tenants can override it) rather than hard-coding a value. **Never commit
`ISHRemote.PesterSetup.Debug.ps1`** — it holds credentials.

## Gating tests on the server version — inside the `It`, never in `-Skip`
Pester evaluates `-Skip:` expressions during the **Discovery** phase, before any `BeforeAll` has
run, so `$ishSession` is not initialized yet and a `-Skip:($ishSession...)` expression is silently
wrong. Check the server version **inside** the `It` block, where `$ishSession` exists, and wrap the
version-specific body in an `if`, as `AddIshBackgroundTask.Tests.ps1` does:

```powershell
It "Parameter Count" {
if (([Version]$ishSession.ServerVersion).Major -gt 15 -or (([Version]$ishSession.ServerVersion).Major -eq 15 -and ([Version]$ishSession.ServerVersion).Minor -ge 4)) { # 15.4.0 and up
# version-specific assertions
}
}
```

`-Skip:` remains fine for conditions known at Discovery time, such as
`-Skip:($PSVersionTable.PSVersion.Major -lt 7)`.

## Build test data per test, clean it up per test
Each file is responsible for **creating its own data and removing all of it**, leaving the tenant in
its original state:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ Authoring detail lives in
`ISHRemote.PesterSetup.ps1` — they must be runnable without a live server.
- [ ] **PS 7+ only tests** guard with `-Skip:($PSVersionTable.PSVersion.Major -lt 7)` on the
`It` or `Context` block.
- [ ] **Server-version gates** are an `if` on `[Version]$ishSession.ServerVersion` **inside** the
`It`, never `-Skip:($ishSession...)` — `-Skip:` is evaluated at Discovery, before `$ishSession`
exists.
- [ ] **Script / MCP tests** that mock collaborators use `Mock -ModuleName ISHRemote <FunctionName>
{ ... }` scoped to the module, not a global mock.

Expand Down
1 change: 1 addition & 0 deletions Doc/ReleaseNotes-ISHRemote-8.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ The below text describes the delta compared to fielded release ISHRemote v8.2.
* Fixed `New-IshSession` (protocol `WcfSoapWithOpenIdConnect`, PowerShell 7.2+/.NET 6.0+) throwing `FileLoadException: Could not load file or assembly 'Microsoft.IdentityModel.Tokens, Version=8.14.0.0, ...'. The located assembly's manifest definition does not match the assembly reference.` on machines where a different build of `Microsoft.IdentityModel.Tokens` (and related `Duende.IdentityModel.OidcClient`) is registered in the Global Assembly Cache (GAC) — observed on machines with Microsoft Intune Management Extension installed. `AppDomainModuleAssemblyInitializer` now force-loads ISHRemote's own bundled copies of `Duende.IdentityModel`, `Duende.IdentityModel.OidcClient`, `Microsoft.IdentityModel.Abstractions/.Logging/.Tokens/.Tokens.Saml/.Xml` as early as possible during module import, and `SessionCmdlet.BeginProcessing` now reports the full forced list over `-Verbose`. Root cause for the `Duende.IdentityModel.OidcClient` variant: `InfoShareOpenIdConnectSystemBrowser` was `public` and implemented `Duende.IdentityModel.OidcClient.Browser.IBrowser`, which put it in `Trisoft.ISHRemote.dll`'s exported types, forcing PowerShell's own binary-module cmdlet discovery (`Assembly.GetExportedTypes()`) to resolve `Duende.IdentityModel.OidcClient` before `IModuleAssemblyInitializer.OnImport()` ever ran — see Breaking Changes - Code. A new `TestPrerequisite.Tests.ps1` check asserts no assembly is ever loaded from the GAC on PowerShell Core. See #272. Thanks @ddemeyer
* Fixed cmdlets over protocol `WcfSoapWithOpenIdConnect` occasionally throwing `An unsecured or incorrectly secured fault was received from the other party` on the first SOAP call after a channel fault, requiring the user to re-run the same cmdlet for it to succeed (the existing #201/#219 rebuild-on-next-call logic only kicked in on a second, separate call). Each `Get*25Channel()` method in `InfoShareWcfSoapWithOpenIdConnectConnection` now returns the channel wrapped in a new `RetryOnFaultProxy<T>` (`System.Reflection.DispatchProxy`) that catches `CommunicationException`/`FaultException` on the actual SOAP call, rebuilds the channel via the existing rebuild logic, and retries exactly once within the same cmdlet invocation before propagating any further failure — with the original exception type/stack trace preserved. Requires a new `net48`-only NuGet dependency, `System.Reflection.DispatchProxy` (built into the BCL on `net6.0`/`net10.0`). See #273. Thanks @ddemeyer
* Package bumps, deliberate adding of `System.Security.Cryptography.Xml` to fix vulnerability coming from transitive `System.ServiceModel.Primitives`. See #278 and #279. Thanks @ddemeyer
* Augmented `Search-IshDocumentObj` with parameter `-SemanticQuery` as shorthand for a semantic vector search, next to the existing `-SimpleQuery` keyword search. It generates the same default `<ishquery>` but targets a semantic field instead of `ISHANYWHERE`, so `Search-IshDocumentObj -SemanticQuery "replace oil in vehicle"` is all you need. The new `-SemanticMode` parameter selects the behavior: `TopK` (default, field `ISHSEMANTICINCONTENT`) is faster but returns at most the K closest documents, so results and `-Count` can be incomplete; `VectorSimilarity` (field `ISHSEMANTICALLINCONTENT`) returns every document above the relevance threshold, but is slower and its count is approximate. Requires Tridion Docs 15.4.0 and up. See #289. Thanks @ddemeyer



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,51 @@ Describe "Search-IshDocumentObjData" -Tags "Read" {
$ishObject[0].fishstatustype -ge 0 | Should-Be $false # Basic does not return FISHSTATUSTYPE but extra RequestedMetadata parameter does
}
}
Context "Search-IshDocumentObj SemanticQueryGroup" {
It "Parameter IshSession invalid" {
{ Search-IshDocumentObj -IShSession "INVALIDISHSESSION" -SemanticQuery "cordless or wireless" } | Should-Throw
}
It "Parameter SemanticMode invalid" {
{ Search-IshDocumentObj -IshSession $ishSession -SemanticQuery "cordless or wireless" -SemanticMode "INVALIDSEMANTICMODE" } | Should-Throw
}
It "Parameter MaxHitsToReturn invalid" {
{ Search-IshDocumentObj -MaxHitsToReturn "INVALIDMAXHITSTORETURN" -SemanticQuery "cordless or wireless" } | Should-Throw
}
It "Parameter SemanticQuery throws before 15.4.0" {
if (([Version]$ishSession.ServerVersion).Major -lt 15 -or (([Version]$ishSession.ServerVersion).Major -eq 15 -and ([Version]$ishSession.ServerVersion).Minor -lt 4)) {
{ Search-IshDocumentObj -IshSession $ishSession -SemanticQuery "cordless or wireless" } | Should-Throw
}
}
It "Parameter MaxHitsToReturn" {
if (([Version]$ishSession.ServerVersion).Major -gt 15 -or (([Version]$ishSession.ServerVersion).Major -eq 15 -and ([Version]$ishSession.ServerVersion).Minor -ge 4)) {
$ishObject = Search-IshDocumentObj -IshSession $ishSession -MaxHitsToReturn 3 -SemanticQuery "cordless or wireless"
($ishObject.Count -le 3) | Should-Be $true
}
}
It "Parameter RequestedMetadata" {
if (([Version]$ishSession.ServerVersion).Major -gt 15 -or (([Version]$ishSession.ServerVersion).Major -eq 15 -and ([Version]$ishSession.ServerVersion).Minor -ge 4)) {
$requestedMetadata = Set-IshRequestedMetadataField -Level Lng -Name FISHSTATUSTYPE
$ishObject = Search-IshDocumentObj -IshSession $ishSession -MaxHitsToReturn 2 -SemanticQuery "cordless or wireless" -RequestedMetadata $requestedMetadata
if ($ishObject) {
$ishObject[0].IshRef | Should-NotBeNull
$ishObject[0].fishstatustype -ge 0 | Should-Be $true
}
}
}
It "Parameter SemanticMode TopK" {
if (([Version]$ishSession.ServerVersion).Major -gt 15 -or (([Version]$ishSession.ServerVersion).Major -eq 15 -and ([Version]$ishSession.ServerVersion).Minor -ge 4)) {
$ishObject = Search-IshDocumentObj -IshSession $ishSession -MaxHitsToReturn 3 -SemanticQuery "cordless or wireless" -SemanticMode TopK
($ishObject.Count -le 3) | Should-Be $true
}
}
It "Parameter SemanticMode VectorSimilarity" {
# Needs the server-side ISHSEMANTICALLINCONTENT field, fails until the server implements it
if (([Version]$ishSession.ServerVersion).Major -gt 15 -or (([Version]$ishSession.ServerVersion).Major -eq 15 -and ([Version]$ishSession.ServerVersion).Minor -ge 4)) {
$ishObject = Search-IshDocumentObj -IshSession $ishSession -MaxHitsToReturn 3 -SemanticQuery "cordless or wireless" -SemanticMode VectorSimilarity
($ishObject.Count -le 3) | Should-Be $true
}
}
}
Context "Search-IshDocumentObj XmlQueryQueryGroup" {
BeforeAll {
$xmlQueryLatestVersion = @"
Expand Down
Loading
Loading