Skip to content

Codacy bug/package cleanup - #645

Merged
StuartFerguson merged 2 commits into
mainfrom
task/codcay_bug_package
Aug 26, 2026
Merged

StuartFerguson merged 2 commits into
mainfrom
task/codcay_bug_package

Conversation

@StuartFerguson

Copy link
Copy Markdown
Member

Closes #637
Closes #635
Closes #634
Closes #631
Closes #627
Closes #624
Closes #621
Closes #620
Closes #617
Closes #610
Closes #606
Closes #602
Closes #598
Closes #590
Closes #508
Closes #507
Closes #506
Closes #505
Closes #502
Closes #494
Closes #486
Closes #485
Closes #483
Closes #478
Closes #477
Closes #466
Closes #464
Closes #448
Closes #447
Closes #444
Closes #440

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@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: 78dd6c148e

ℹ️ 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".

"user": {
"email_address": "estateuser@stagingestate1.co.uk",
"password": "123456",
"password": "",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Supply setup user passwords from a secret source

On a fresh staging setup, this empty value is deserialized verbatim by GetEstatesConfig and then assigned directly to CreateEstateUserRequest.Password; merchant passwords in the same file follow the same path. Unlike the identity-server secrets, no environment-variable substitution is applied, so setup either fails user creation or creates users that cannot authenticate. The development and production setup files contain the same regression.

Useful? React with 👍 / 👎.

Comment on lines 155 to +156
IdentityServerConfiguration identityServerConfiguration = StringSerialiser.Deserialise<IdentityServerConfiguration>(identityServerJsonData);
ApplyIdentityServerSecrets(identityServerConfiguration);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Defer identity secrets until security setup is selected

With the currently selected Mode.EstateSetup, Main still calls this method before the mode switch, and this new call requires secrets for every API resource and client. Consequently, an estate-only setup now aborts unless all identity-server environment variables are present, even though that mode only needs the service-client secret. Load and populate this configuration only for Mode.SecuritySetup, or avoid requiring unrelated secrets in other modes.

Useful? React with 👍 / 👎.

Comment on lines 2 to +3
[string]$BaseUrl = "http://localhost:2113",
[string]$Username,
[string]$Password
[System.Management.Automation.PSCredential]$Credential

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Update the Pester callers for the credential-only interface

The pull-request workflow runs ScheduledTasks/Tests, but Scavenge.Tests.ps1 still invokes this script with -Username and -Password and expects a Basic authorization header. Those arguments no longer populate anything in the script, so $Credential remains null and the authorization assertion fails. Retain compatibility or update the checked-in callers and tests to construct a PSCredential in the same change.

Useful? React with 👍 / 👎.

Comment on lines +65 to +71
await RecordMerchantRunResultAsync(
runId,
merchant,
scheduledRunUtc,
MerchantRunStatuses.Failed,
string.Join(Environment.NewLine + Environment.NewLine, contractFailures.Select(ex => ex.ToString())),
cancellationToken);

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 Record each failed merchant run only once

When one or more contracts fail, this inserts a failed MerchantRunRecord and then throws an AggregateException; the outer catch at line 32 catches that exception and inserts another failed record for the same run. RecordMerchantRunResultAsync always adds a new row, so every contract-level failure now produces duplicate history/dashboard entries and can consume two different completion timestamps. Restore the previous recorded-result guard or let only one layer persist the failure.

Useful? React with 👍 / 👎.

Comment on lines +395 to +398
var pendingLookup = fileSendRows
.Where(record => (bool)record.ProcessingCompleted == false && !string.IsNullOrWhiteSpace((string)record.MerchantId))
.GroupBy(record => (string)record.MerchantId)
.ToDictionary(group => group.Key, group => group.Count(), StringComparer.OrdinalIgnoreCase);

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 Restrict merchant pending counts to successful uploads

For merchants with failed file-send records, this in-memory predicate counts those records as pending because failed records also retain ProcessingCompleted == false. The previous database query required Status == Succeeded, matching the actual status-polling predicate, so the operations dashboard now reports failed uploads as files awaiting completion checks. Add the succeeded-status condition back to this lookup.

Useful? React with 👍 / 👎.

@StuartFerguson
StuartFerguson merged commit 567ab29 into main Aug 26, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment