Skip to content

feat: verification flight quality gate#430

Merged
eddycek merged 3 commits intomainfrom
feat/verification-quality-gate
Apr 9, 2026
Merged

feat: verification flight quality gate#430
eddycek merged 3 commits intomainfrom
feat/verification-quality-gate

Conversation

@eddycek
Copy link
Copy Markdown
Owner

@eddycek eddycek commented Apr 9, 2026

Summary

  • When a verification flight has poor or fair data quality (< 60/100), show a warning modal before completing the session
  • Modal displays the overall score, tier, and failing sub-scores (step count, axis coverage, etc.)
  • User can choose "Fly Again" (discard and retry) or "Accept Anyway" (proceed with low-quality data)
  • Previously the app silently accepted any verification data regardless of quality, leading to unreliable convergence detection and tune quality scores

Test plan

  • 6 unit tests for VerificationQualityWarning component (renders, callbacks, sub-scores)
  • Manual: complete a PID tune with a verification flight that has < 8 stick snaps — modal should appear
  • Manual: "Accept Anyway" completes the session normally
  • Manual: "Fly Again" discards verification and shows info toast
  • Verify quality gate does NOT trigger for re-analyze or history record updates

🤖 Generated with Claude Code

When a verification flight has poor or fair data quality (< 60/100),
show a warning modal with failing sub-scores and two options:
- "Fly Again" — discard and let user retry with better stick inputs
- "Accept Anyway" — proceed with low-quality verification data

Previously the app silently accepted any verification data regardless
of quality, which could produce unreliable convergence detection and
tune quality scores.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 9, 2026 09:46
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a “verification flight quality gate” to prevent completing a tuning session with low-quality verification data by showing a warning modal that summarizes overall/sub-score quality and lets the user retry or proceed.

Changes:

  • Introduces VerificationQualityWarning modal to present low verification data quality details and actions.
  • Captures dataQuality from PID/filter verification analysis results and blocks completion on fair/poor until user decision.
  • Adds unit tests for the new warning modal component.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/renderer/components/TuningHistory/VerificationQualityWarning.tsx New modal UI to warn about low verification data quality and show failing sub-scores.
src/renderer/components/TuningHistory/VerificationQualityWarning.test.tsx Unit tests covering rendering, sub-score filtering, callbacks, and dialog role.
src/renderer/App.tsx Adds pending-verification state + commit helper, gates verification completion on dataQuality.tier, and wires the modal into the app flow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +15 to +16
const tierLabel = dataQuality.tier === 'poor' ? 'Poor' : 'Fair';
const tierColor = dataQuality.tier === 'poor' ? '#e74c3c' : '#f39c12';
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

DataQualityScore['tier'] includes 'excellent' and 'good', but this component maps any non-'poor' tier to 'Fair' (and uses the fair color). This would mislabel higher-quality tiers if the component is ever rendered with them; consider deriving the label/color from the actual tier (or asserting/handling unexpected tiers explicitly).

Suggested change
const tierLabel = dataQuality.tier === 'poor' ? 'Poor' : 'Fair';
const tierColor = dataQuality.tier === 'poor' ? '#e74c3c' : '#f39c12';
const tierDisplay: Record<DataQualityScore['tier'], { label: string; color: string }> = {
poor: { label: 'Poor', color: '#e74c3c' },
fair: { label: 'Fair', color: '#f39c12' },
good: { label: 'Good', color: '#27ae60' },
excellent: { label: 'Excellent', color: '#2ecc71' },
};
const { label: tierLabel, color: tierColor } = tierDisplay[dataQuality.tier];

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed — using exhaustive tier→label/color map in 22f0dcf.

Comment thread src/renderer/App.tsx
Comment on lines +522 to +538
const handleQualityGateAccept = async () => {
if (!pendingVerification) return;
try {
setAnalyzingVerification(true);
await commitVerification(
pendingVerification.verificationMetrics,
pendingVerification.verificationPidMetrics,
pendingVerification.verificationTFMetrics,
pendingVerification.historyRecordId,
pendingVerification.isReanalyze
);
} catch (err) {
toast.error(err instanceof Error ? err.message : 'Failed to complete verification');
} finally {
setPendingVerification(null);
setAnalyzingVerification(false);
}
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

handleQualityGateAccept can be triggered multiple times (e.g., double-clicking “Accept Anyway”), which could run commitVerification concurrently and perform duplicate updates. Consider guarding against re-entry (disable modal buttons while accepting, clear pendingVerification before awaiting, or add an in-flight flag).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed — pendingVerification is cleared before await in 22f0dcf.

Comment thread src/renderer/App.tsx Outdated
historyRecordId,
isReanalyze
);
setErasedForPhase(null);
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

commitVerification already calls setErasedForPhase(null), so calling it again after await commitVerification(...) is redundant.

Suggested change
setErasedForPhase(null);

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed — removed redundant call in 22f0dcf.

eddycek and others added 2 commits April 9, 2026 12:35
Address CodePilot feedback:
- Use exhaustive tier→label/color map instead of ternary
- Clear pendingVerification before await to prevent double-click
- Remove redundant setErasedForPhase (already in commitVerification)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@eddycek eddycek merged commit 2422ce5 into main Apr 9, 2026
1 check passed
@eddycek eddycek deleted the feat/verification-quality-gate branch April 9, 2026 10:38
eddycek added a commit that referenced this pull request Apr 9, 2026
3099→3105 tests, 144→145 files after #429/#430. Add new component
to renderer CLAUDE.md and TESTING.md inventory.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

2 participants