Skip to content

chore: clear the CodeQL backlog and add codeql.yml query-filters (Standards §4.4, §3.0.1) - #32

Merged
StuartMeeks merged 1 commit into
mainfrom
chore/codeql-conformance
Aug 22, 2026
Merged

chore: clear the CodeQL backlog and add codeql.yml query-filters (Standards §4.4, §3.0.1)#32
StuartMeeks merged 1 commit into
mainfrom
chore/codeql-conformance

Conversation

@StuartMeeks

Copy link
Copy Markdown
Owner

Replaces #30, which GitHub auto-closed when its base branch (chore/standards-style-baseline, #29) was deleted on merge. Same commit, rebased onto main.

Prepares the repo for §4.12, which requires a code_scanning merge-protection rule at alerts_threshold: all. Every open alert blocks merge under that rule, so the 177-alert backlog has to be resolved or dismissed before the setting can go on.

§3.0.1 / §4.4 — query-filters

codeql.yml gains the canonical query-filters block excluding cs/unmanaged-code and cs/call-to-unmanaged-code. This package contains no P/Invoke, so the block matches nothing here — it is carried because §3.0.1 requires the workflow to equal the template in non-comment content, and a repo that omits it has forked the template rather than customised it. Closes the 3.0.1 workflow content audit row.

Alerts fixed

Rule Count Fix
cs/path-combine 134 Path.CombinePath.Join, src + tests
cs/catch-of-all-exceptions 19 see below — for dismissal, not fixes
cs/local-not-disposed 13 10 fixed with using; 3 deliberately not (see below)
cs/linq/missed-where 5 Where/Any predicates
cs/linq/missed-select 2 Select
cs/useless-assignment-to-local 1 dropped the unread binding

Path.JoinPath.Combine returns its last rooted argument and silently discards everything before it. Nothing here was reachable with a rooted segment: ValidateAssetName rejects rooted and separator-bearing asset names before any path is built. So this is defence in depth on the install-directory path construction, not a fix for a live defect.

Three alerts deliberately not fixed

Three cs/local-not-disposed sites create a TestConsole that escapes its harness method via the return value; the calling test reads console.Output after that method returns. Applying using at the creation site closes the writer before the command under test writes to it — I tried it, and it failed 46 tests with ObjectDisposedException. Those three now carry a comment explaining why they are not using, and are for dismissal as false positives.

The 19 generic catches

All are deliberate boundary or best-effort catches, and several are contractual: IUpdateSource's XML docs require implementations to swallow transient failures and return null rather than throw, and CleanupOldInstall documents that failures are swallowed and retried next startup. Narrowing them would convert documented never-throw contracts into throwing paths. These are for dismissal with justification — the same treatment Auth gave its boundary catches — not code changes.

Verification

Release build: 0 warnings, 0 errors. dotnet test --configuration Release: 392 passed, 0 failed (196 × net8.0/net10.0).

No change to the public surface or package contents.

🤖 Generated with Claude Code

Prepares the repo for NextIteration.Standards §4.12, which requires a
code_scanning merge-protection rule at alerts_threshold: all — every open
alert blocks merge, so the backlog has to be resolved or dismissed first.

§3.0.1 / §4.4 — codeql.yml gains the canonical query-filters block excluding
cs/unmanaged-code and cs/call-to-unmanaged-code. This package has no P/Invoke
so it matches nothing; it is carried because the workflow must equal the
template in non-comment content. Closes the `3.0.1 workflow content` row.

Genuine fixes, no suppression hacks:

- Path.Combine -> Path.Join, 134 sites across src and tests. Combine returns
  its last rooted argument and drops what precedes it; Join always
  concatenates. ValidateAssetName already rejects rooted and separator-bearing
  asset names, so this is defence in depth, not a live-defect fix.
- cs/linq/missed-where + missed-select: DefaultAssetResolver's five matcher
  loops become FirstOrDefault/Any predicates (the RID walk stays lazy),
  Sha256SumsManifest.Parse maps with Select, UpdateInstaller.IsPreserved
  filters with Where/Any behind a named helper.
- cs/local-not-disposed: ten test-local TestConsole instances now use `using`.
- cs/useless-assignment-to-local: dropped the unread `first` binding.

Three cs/local-not-disposed sites are deliberately NOT fixed and now carry a
comment saying why: the console escapes its harness method via the return
value and the calling test reads console.Output afterwards, so disposing at
the creation site closes the writer before the command writes to it. Applying
`using` there failed 46 tests with ObjectDisposedException.

The 19 cs/catch-of-all-exceptions alerts are all deliberate boundary or
best-effort catches, several of them contractual — IUpdateSource's XML docs
require implementations to swallow transient failures and return null, and
CleanupOldInstall documents that failures are swallowed and retried. Narrowing
them would break the documented contract, so they are for dismissal, not fixes.

Release build: 0 warnings. 392 tests (196 × net8.0/net10.0) pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@StuartMeeks
StuartMeeks merged commit 7dc09f8 into main Aug 22, 2026
9 checks passed
@StuartMeeks
StuartMeeks deleted the chore/codeql-conformance branch August 22, 2026 00:14
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.

1 participant