@@ -214,6 +214,67 @@ describe("createAnalysisReport", () => {
214214 expect ( shouldFailForRisk ( report . summary . riskLevel , "high" ) ) . toBe ( true ) ;
215215 } ) ;
216216
217+ it ( "treats runtime config and database changes together as high production risk" , ( ) => {
218+ const report = createAnalysisReport ( {
219+ changedFiles : [
220+ {
221+ path : "next.config.js" ,
222+ status : "modified" ,
223+ additions : 8 ,
224+ deletions : 6 ,
225+ addedLines : [ { line : 2 , content : "const sessionSecret = env.SESSION_SECRET ?? 'dev-secret';" } ]
226+ } ,
227+ {
228+ path : "src/db/schema.js" ,
229+ status : "modified" ,
230+ additions : 4 ,
231+ deletions : 1 ,
232+ addedLines : [ { line : 2 , content : ' role: "admin",' } ]
233+ }
234+ ] ,
235+ analyzerResult : {
236+ impactedAreas : [ ] ,
237+ findings : [
238+ {
239+ ruleId : "risky-config-change" ,
240+ title : "Config area changed" ,
241+ description : "Runtime config changed." ,
242+ severity : "medium" ,
243+ category : "configuration" ,
244+ file : "next.config.js" ,
245+ line : 2
246+ } ,
247+ {
248+ ruleId : "risky-database-change" ,
249+ title : "Database area changed" ,
250+ description : "Database defaults changed." ,
251+ severity : "high" ,
252+ category : "regression" ,
253+ file : "src/db/schema.js" ,
254+ line : 2
255+ } ,
256+ {
257+ ruleId : "missing-nearby-tests" ,
258+ title : "Risky source changes without changed tests" ,
259+ description : "Risky source changed without changed tests." ,
260+ severity : "high" ,
261+ category : "coverage" ,
262+ file : "next.config.js" ,
263+ line : 2
264+ }
265+ ] ,
266+ recommendedTests : [ ]
267+ } ,
268+ generatedAt : "2026-06-22T00:00:00.000Z"
269+ } ) ;
270+
271+ expect ( report . summary . mergeRiskScore ) . toBeGreaterThanOrEqual ( 70 ) ;
272+ expect ( report . summary . riskLevel ) . toBe ( "high" ) ;
273+ expect ( report . summary . mergeRiskBreakdown ?. contributors ) . toEqual (
274+ expect . arrayContaining ( [ expect . objectContaining ( { id : "runtime-persistence-boundary" , points : 8 } ) ] )
275+ ) ;
276+ } ) ;
277+
217278 it ( "caps heuristic-only merge risk below high even with severe findings" , ( ) => {
218279 const changedFiles = createSyntheticChanges ( 6 ) ;
219280 const findings = createSyntheticFindings ( 4 , "high" , "snapshot-only-test" , "coverage" ) ;
0 commit comments