fix(ci): resolve backend lint F821 and stale frontend test mocks#629
Merged
utksh1 merged 2 commits intoJun 7, 2026
Merged
Conversation
Two separate CI regressions were introduced by commits 0e03877 and a2a7e02: Backend lint (F821 - Undefined name 'db') workflows.py._run_workflow() calls get_target_policy(db, ...) but 'db' was never acquired in that method. tick() obtains 'db' but does not pass it into _run_workflow(). Fixed by adding db = await get_db() at the top of _run_workflow(). Frontend unit test failures (3 tests) ToolConfig.tsx now calls listTargetPolicies(), listCredentialProfiles(), and listSessionProfiles() inside its useEffect via Promise.all. Tests that only mocked the original 3-4 API functions caused Promise.all to reject (unmocked vi.fn() returns undefined, not a Promise), making setServerLimits never execute and breaking max/min attribute assertions. Workflows.tsx changed emptySteps to include an execution_context object in each step. The createWorkflow assertion expected the old shape. Fixes applied: - ToolConfigDynamic.test.tsx: add listTargetPolicies, listCredentialProfiles, listSessionProfiles, getSettings to vi.mock factory and beforeEach mocks; update startTask assertion to accept the new 5th executionContext argument - ToolConfigTimeout.test.tsx: add the three new API functions to vi.mock factory and beforeEach mocks so Promise.all resolves correctly - Workflows.test.tsx: update createWorkflow expectation to include execution_context in the steps array
…mpliance
{ items: [] } was inferred as { items: never[] }, which does not satisfy
NamedResourceList<T> (requires items: T[] and total: number). Added total: 0
to all three mock returns so TypeScript accepts the fixture without casting.
This was referenced Jun 7, 2026
utksh1
approved these changes
Jun 7, 2026
Owner
utksh1
left a comment
There was a problem hiding this comment.
Focused CI baseline repair with the missing backend db acquisition and updated frontend mocks/resource-list fixtures. Checks are green; approving for merge.
This was referenced Jun 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes two CI regressions introduced by commits
0e03877anda2a7e02that are currently blocking all open PRs (backend-lint and frontend-checks failures).Root Causes
1. Backend lint failure —
F821 Undefined name 'db'(backend/secuscan/workflows.py:82)Commit
0e03877added aget_target_policy(db, ...)call insideWorkflowScheduler._run_workflow(), butdbwas never acquired in that method. Thetick()method correctly obtainsdb = await get_db()but does not pass it to_run_workflow().Fix: Added
db = await get_db()at the top of_run_workflow().2. Frontend test failures — stale mocks after
ToolConfig.tsxandWorkflows.tsxupdatesCommit
a2a7e02updatedToolConfig.tsxto call three new API functions in aPromise.all:Tests that only mocked the original API functions had these three return
undefined, causingPromise.allto resolve with a rejected upstream, which preventedsetServerLimitsfrom running and brokemax/minattribute assertions inToolConfigTimeout.test.tsx.The same commit also updated
startTaskto accept a 5thexecutionContextargument, breaking thestartTaskcall assertion inToolConfigDynamic.test.tsx.Workflows.tsxchangedemptyStepsto includeexecution_contextin each step object, making thecreateWorkflowassertion inWorkflows.test.tsxfail with a shape mismatch.Fixes applied:
ToolConfigDynamic.test.tsxlistTargetPolicies,listCredentialProfiles,listSessionProfiles,getSettingstovi.mockfactory andbeforeEachmock returns; updatedstartTaskassertion to accept 5thexecutionContextargumentToolConfigTimeout.test.tsxvi.mockfactory andbeforeEachsoPromise.allresolves correctlyWorkflows.test.tsxcreateWorkflowexpectation to includeexecution_contextin thestepsarrayVerification
ruff check backend/secuscan/workflows.pypasses with no errorsImpact
This unblocks all currently open PRs that are failing
backend-lintandfrontend-checksdue to these pre-existing regressions.