Release 3.6.4 audit reliability fixes - #2
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements release 3.6.4 audit and reliability fixes, migrating policy discovery jobs from global memory to persistent SQLite storage with atomic run claims, adding safe JSON parsing to prevent server errors, and ensuring transactional QA revalidation rollbacks. It also removes continuous device-motion listeners and corrects Observatory countdowns to use UTC calendar dates. The review comments correctly identify important improvements: adding the missing 'Held' stage to active onboarding stages to prevent duplicate workflows, fixing an edge case where an empty stages array incorrectly marks a batch as failed, and addressing a potential race condition when reading viewport dimensions immediately during orientation changes.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| const ACTIVE_ONBOARDING_STAGES = [ | ||
| 'Proposed', | ||
| 'OfficialReview', | ||
| 'BaselinePending', | ||
| 'QaReview', | ||
| 'Ready', | ||
| ] as const; |
There was a problem hiding this comment.
The 'Held' stage is missing from ACTIVE_ONBOARDING_STAGES. Since an item in the 'Held' stage is still active in the onboarding workflow (and can be published later), omitting it allows bulk onboarding to target the same candidate again, potentially creating duplicate onboarding items and violating data integrity. Adding 'Held' to the active stages list prevents this issue.
| const ACTIVE_ONBOARDING_STAGES = [ | |
| 'Proposed', | |
| 'OfficialReview', | |
| 'BaselinePending', | |
| 'QaReview', | |
| 'Ready', | |
| ] as const; | |
| const ACTIVE_ONBOARDING_STAGES = [ | |
| 'Proposed', | |
| 'OfficialReview', | |
| 'BaselinePending', | |
| 'QaReview', | |
| 'Ready', | |
| 'Held', | |
| ] as const; |
| const status = failedItems === stages.length | ||
| ? 'Failed' | ||
| : terminal && failedItems === 0 | ||
| ? 'Completed' | ||
| : failedItems > 0 | ||
| ? 'Partial' | ||
| : 'Active'; |
There was a problem hiding this comment.
If stages is an empty array, failedItems === stages.length evaluates to 0 === 0 (which is true), causing the function to incorrectly return a status of 'Failed'. Adding a check to ensure stages.length > 0 before matching the failed count prevents this edge case bug.
| const status = failedItems === stages.length | |
| ? 'Failed' | |
| : terminal && failedItems === 0 | |
| ? 'Completed' | |
| : failedItems > 0 | |
| ? 'Partial' | |
| : 'Active'; | |
| const status = stages.length > 0 && failedItems === stages.length | |
| ? 'Failed' | |
| : terminal && failedItems === 0 | |
| ? 'Completed' | |
| : failedItems > 0 | |
| ? 'Partial' | |
| : 'Active'; |
| const handleOrientation = () => { | ||
| if (coarsePointerQuery.matches && window.innerWidth < 920) { | ||
| setOnTheGoMotionSuggested(true); | ||
| } | ||
| }; |
There was a problem hiding this comment.
On mobile browsers (especially iOS Safari), when the orientationchange event fires, window.innerWidth may not have been updated to the new orientation's dimensions yet. Reading it immediately can result in stale values and incorrect layout/suggestion states. Wrapping the check in a short setTimeout ensures the viewport dimensions have fully updated before evaluation.
| const handleOrientation = () => { | |
| if (coarsePointerQuery.matches && window.innerWidth < 920) { | |
| setOnTheGoMotionSuggested(true); | |
| } | |
| }; | |
| const handleOrientation = () => { | |
| setTimeout(() => { | |
| if (coarsePointerQuery.matches && window.innerWidth < 920) { | |
| setOnTheGoMotionSuggested(true); | |
| } | |
| }, 100); | |
| }; |
What changed
Why
This patch closes all six findings raised by the GitHub auditor against the 3.6.3 Guided Evidence Workflows release. The previous discovery status lived in process memory, onboarding could reject legitimate discovered candidates, and two UI/workflow edge cases could expose stale or incorrect state.
Impact
Migration
20260721120000_policy_discovery_jobadds operational discovery-run metadata only. Policy evidence, snapshots, changes, risk analysis, and public-evidence flags are unchanged.Validation
npm cinpm audit --audit-level=high: 0 vulnerabilities