Skip to content

Commit 6c9ce21

Browse files
committed
Add conservative strictness downgrade for micro UI and regression restores
1 parent 8df8899 commit 6c9ce21

File tree

1 file changed

+40
-1
lines changed
  • docusaurus/scripts/strapi-release-analyzer

1 file changed

+40
-1
lines changed

docusaurus/scripts/strapi-release-analyzer/index.js

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,38 @@ function classifyImpact(prAnalysis) {
814814
return { verdict: 'maybe', reason: 'Code changes detected; possible docs impact.' };
815815
}
816816

817+
// Detect micro UI-only changes likely not worth docs
818+
function isMicroUiChange(prAnalysis) {
819+
const title = (prAnalysis.title || '').toLowerCase();
820+
const body = (prAnalysis.body || '').toLowerCase();
821+
const files = prAnalysis.files || [];
822+
823+
const cosmeticKeywords = [
824+
'tooltip', 'tooltips', 'spacing', 'margin', 'padding', 'align', 'alignment',
825+
'border', 'borders', 'icon', 'icons', 'label', 'labels', 'translation', 'translations',
826+
'typo', 'color', 'colors', 'popover', 'menu', 'dropdown', 'ui', 'layout', 'scroll', 'overflow'
827+
];
828+
const frontendOnly = files.length > 0 && files.every(f => {
829+
const name = f.filename.toLowerCase();
830+
const isStyle = /\.(css|scss|less|sass)$/i.test(name) || name.includes('/styles') || name.includes('/style');
831+
const isAdmin = name.includes('/admin') || name.includes('packages/strapi-admin') || name.includes('packages/core/admin');
832+
const isDocsArea = /(api|server|config|routes|controllers|services)/.test(name);
833+
return (isStyle || isAdmin) && !isDocsArea;
834+
});
835+
836+
const text = `${title} ${body}`;
837+
const hasCosmetic = cosmeticKeywords.some(k => text.includes(k));
838+
return hasCosmetic && frontendOnly;
839+
}
840+
841+
// Detect regression/restore-to-expected behavior changes
842+
function isRegressionRestore(prAnalysis) {
843+
const t = (prAnalysis.title || '').toLowerCase();
844+
const b = (prAnalysis.body || '').toLowerCase();
845+
const text = `${t} ${b}`;
846+
return /regression|restore|restored|revert|reverted|align with|parity with|back to expected/.test(text);
847+
}
848+
817849
async function main() {
818850
const rawArgs = process.argv.slice(2);
819851
const { releaseUrl } = parseArgs(rawArgs);
@@ -875,7 +907,7 @@ async function main() {
875907
const candidates = suggestCandidateDocs(llmsIndex, prAnalysis, 5);
876908
// Optional cap: apply limit only to LLM calls
877909
const runLLM = impact.verdict !== 'no' && (!OPTIONS.limit || analyses.filter(a => a.claudeSuggestions).length < OPTIONS.limit);
878-
const claudeSuggestions = runLLM
910+
let claudeSuggestions = runLLM
879911
? await generateDocSuggestionsWithClaude({
880912
...prAnalysis,
881913
_summary: summary,
@@ -884,6 +916,13 @@ async function main() {
884916
})
885917
: null;
886918

919+
// Apply strictness downgrade in conservative mode for micro UI or regression restores
920+
if (OPTIONS.strict === 'conservative' && claudeSuggestions && claudeSuggestions.needsDocs === 'yes') {
921+
if (isMicroUiChange(prAnalysis) || isRegressionRestore(prAnalysis)) {
922+
claudeSuggestions = { ...claudeSuggestions, needsDocs: 'no' };
923+
}
924+
}
925+
887926
analyses.push({
888927
...prAnalysis,
889928
summary,

0 commit comments

Comments
 (0)