fix(guide,suggest): word agent guidance no stronger than the evidence #2
4 changed files with 31 additions and 4 deletions
fix(guide): count new findings in the markdown summary, as its heading does
The markdown report's summary line counted every finding while its heading and
the severity counts beside it counted only new ones, so a fully baselined run
read "20 findings ({error: 0, warning: 0, info: 0})" above "## Findings (0)".
The summary now counts new findings and notes how many are baselined.
Also: loading-flag-not-reset rendered its flag as `SettingsState`loading``, a
missing `.` that produced two adjacent code spans. It now reads
`SettingsState.loading`.
commit
c666df6a99
|
|
@ -598,9 +598,11 @@ Guidance buildGuidance({
|
||||||
..writeln()
|
..writeln()
|
||||||
..write(coverageLine == null ? '' : '$coverageLine\n\n')
|
..write(coverageLine == null ? '' : '$coverageLine\n\n')
|
||||||
..writeln(
|
..writeln(
|
||||||
|
// New findings only, matching the heading below and countBySeverity,
|
||||||
|
// which already counted only new ones.
|
||||||
'${flow.unions.length} blocs/cubits, ${summary['stateVariants']} state '
|
'${flow.unions.length} blocs/cubits, ${summary['stateVariants']} state '
|
||||||
'variants, ${report.findings.length} findings '
|
'variants, ${report.newFindings.length} new findings '
|
||||||
'(${report.countBySeverity}).',
|
'(${report.countBySeverity})$baselinedNote.',
|
||||||
)
|
)
|
||||||
..writeln()
|
..writeln()
|
||||||
..writeln('## Findings (${ranked.length})');
|
..writeln('## Findings (${ranked.length})');
|
||||||
|
|
|
||||||
|
|
@ -1172,8 +1172,9 @@ class _FlagLoadingCollector extends RecursiveAstVisitor<void> {
|
||||||
severity: PipeSeverity.warning,
|
severity: PipeSeverity.warning,
|
||||||
confidence: setsFlagTrue && !awaitedTrySeen ? 'high' : 'medium',
|
confidence: setsFlagTrue && !awaitedTrySeen ? 'high' : 'medium',
|
||||||
message:
|
message:
|
||||||
'$owner.$member awaits work after putting ${flag.name}`$fieldList` '
|
'$owner.$member awaits work after putting '
|
||||||
'into its loading state, and no catch clause surfaces a failure, so '
|
'`${flag.name}.$fieldList` into its loading state, and no catch '
|
||||||
|
'clause surfaces a failure, so '
|
||||||
'the UI can keep showing its loading state after an error.',
|
'the UI can keep showing its loading state after an error.',
|
||||||
file: project.relative(path),
|
file: project.relative(path),
|
||||||
line: lineInfo.getLocation(body.offset).lineNumber,
|
line: lineInfo.getLocation(body.offset).lineNumber,
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,9 @@ void main() {
|
||||||
expect(hits.single.confidence, 'high');
|
expect(hits.single.confidence, 'high');
|
||||||
expect(hits.single.evidence, isNotEmpty);
|
expect(hits.single.evidence, isNotEmpty);
|
||||||
expect(hits.single.remediation, isNotNull);
|
expect(hits.single.remediation, isNotNull);
|
||||||
|
// The flag reads as one code span, `FlagState.loading`, not as
|
||||||
|
// `FlagState` immediately followed by a second span.
|
||||||
|
expect(hits.single.message, contains('`FlagState.'));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('flag findings carry no false positive for guarded code', () {
|
test('flag findings carry no false positive for guarded code', () {
|
||||||
|
|
|
||||||
|
|
@ -200,6 +200,27 @@ void main() {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('the markdown summary counts the same findings as its heading', () {
|
||||||
|
// The summary counted every finding while the heading (and the severity
|
||||||
|
// counts beside it) counted only new ones, so a fully baselined run read
|
||||||
|
// "20 findings ({error: 0, warning: 0, info: 0})" over "## Findings (0)".
|
||||||
|
final baselined = runChecks(
|
||||||
|
project: analysis.project,
|
||||||
|
outcomes: analysis.run.outcomes,
|
||||||
|
flow: analysis.flow,
|
||||||
|
baseline: {
|
||||||
|
for (final finding in analysis.report.findings) finding.fingerprint,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
final md = buildGuidance(
|
||||||
|
root: analysis.project.root,
|
||||||
|
flow: analysis.flow,
|
||||||
|
report: baselined,
|
||||||
|
).markdown;
|
||||||
|
expect(md, contains(' 0 new findings '));
|
||||||
|
expect(md, contains('## Findings (0)'));
|
||||||
|
});
|
||||||
|
|
||||||
test('json summary exposes counts and suppression notes', () {
|
test('json summary exposes counts and suppression notes', () {
|
||||||
final summary = guidance().summary;
|
final summary = guidance().summary;
|
||||||
expect(summary['findings'], analysis.report.findings.length);
|
expect(summary['findings'], analysis.report.findings.length);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue