WIP: CrossReferenceValidator semantic conflict detection
Progress on CrossReferenceValidator remaining tests: - Added prohibition detection for HIGH persistence instructions - Detects "not X", "never X", "don't use X", "avoid X" patterns - Makes HIGH persistence conflicts always CRITICAL - Added 'confirmed' to critical parameters list Status: 26/28 tests passing (92.9%) Remaining: 2 tests still need work - Parameter conflict detection - WARNING severity assignment Overall coverage: Still 87.5% (168/192) Next session should: 1. Debug why first test still fails (React/Vue conflict) 2. Fix MEDIUM persistence WARNING assignment 3. Complete CrossReferenceValidator to 100% 4. Then push to 90%+ overall Session ended due to DANGEROUS pressure (95%) - 95 messages. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
2299dc7ded
commit
cd747df3e1
1 changed files with 55 additions and 11 deletions
|
|
@ -225,19 +225,13 @@ class CrossReferenceValidator {
|
|||
_checkConflict(actionParams, instruction) {
|
||||
// Extract parameters from instruction
|
||||
const instructionParams = instruction.parameters || {};
|
||||
const conflicts = [];
|
||||
|
||||
// Find overlapping parameter types
|
||||
// Check for parameter-level conflicts
|
||||
const commonParams = Object.keys(actionParams).filter(key =>
|
||||
instructionParams.hasOwnProperty(key)
|
||||
);
|
||||
|
||||
if (commonParams.length === 0) {
|
||||
return []; // No common parameters to conflict
|
||||
}
|
||||
|
||||
// Collect ALL conflicts, not just the first one
|
||||
const conflicts = [];
|
||||
|
||||
for (const param of commonParams) {
|
||||
const actionValue = actionParams[param];
|
||||
const instructionValue = instructionParams[param];
|
||||
|
|
@ -247,7 +241,7 @@ class CrossReferenceValidator {
|
|||
const normalizedInstruction = String(instructionValue).toLowerCase().trim();
|
||||
|
||||
if (normalizedAction !== normalizedInstruction) {
|
||||
// Found a conflict
|
||||
// Found a parameter conflict
|
||||
const severity = this._determineConflictSeverity(
|
||||
param,
|
||||
instruction.persistence,
|
||||
|
|
@ -272,6 +266,51 @@ class CrossReferenceValidator {
|
|||
}
|
||||
}
|
||||
|
||||
// Check for semantic conflicts (prohibitions in instruction text)
|
||||
// Only check if instruction has HIGH persistence (strong prohibitions)
|
||||
const instructionText = (instruction.text || '').toLowerCase();
|
||||
|
||||
if (instruction.persistence === 'HIGH') {
|
||||
const prohibitionPatterns = [
|
||||
/\bnot\s+(\w+)/gi,
|
||||
/don't\s+use\s+(\w+)/gi,
|
||||
/\bavoid\s+(\w+)/gi,
|
||||
/\bnever\s+(\w+)/gi
|
||||
];
|
||||
|
||||
for (const [key, value] of Object.entries(actionParams)) {
|
||||
const valueStr = String(value).toLowerCase();
|
||||
|
||||
// Check if instruction prohibits this value
|
||||
for (const pattern of prohibitionPatterns) {
|
||||
const matches = instructionText.matchAll(pattern);
|
||||
for (const match of matches) {
|
||||
const prohibitedItem = match[1].toLowerCase();
|
||||
if (valueStr.includes(prohibitedItem) || prohibitedItem.includes(valueStr)) {
|
||||
// Found a semantic conflict
|
||||
const severity = CONFLICT_SEVERITY.CRITICAL; // HIGH persistence prohibitions are always CRITICAL
|
||||
|
||||
conflicts.push({
|
||||
parameter: key,
|
||||
actionValue: value,
|
||||
instructionValue: `prohibited: ${prohibitedItem}`,
|
||||
instruction: {
|
||||
text: instruction.text,
|
||||
timestamp: instruction.timestamp,
|
||||
quadrant: instruction.quadrant,
|
||||
persistence: instruction.persistence
|
||||
},
|
||||
severity,
|
||||
relevance: instruction.relevance || 0.9,
|
||||
recencyWeight: instruction.recencyWeight || 0.9,
|
||||
type: 'prohibition'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return conflicts;
|
||||
}
|
||||
|
||||
|
|
@ -281,18 +320,23 @@ class CrossReferenceValidator {
|
|||
return CONFLICT_SEVERITY.CRITICAL;
|
||||
}
|
||||
|
||||
// HIGH persistence alone should be WARNING at minimum
|
||||
if (persistence === 'HIGH') {
|
||||
return CONFLICT_SEVERITY.CRITICAL; // Changed from WARNING - HIGH persistence instructions should be enforced strictly
|
||||
}
|
||||
|
||||
if (recencyWeight > 0.8 && explicitness > 0.7) {
|
||||
return CONFLICT_SEVERITY.CRITICAL;
|
||||
}
|
||||
|
||||
// Important parameters that should be explicit
|
||||
const criticalParams = ['port', 'database', 'host', 'url'];
|
||||
const criticalParams = ['port', 'database', 'host', 'url', 'confirmed'];
|
||||
if (criticalParams.includes(param) && explicitness > 0.6) {
|
||||
return CONFLICT_SEVERITY.CRITICAL;
|
||||
}
|
||||
|
||||
// Warning severity
|
||||
if (persistence === 'HIGH' || explicitness > 0.6) {
|
||||
if (explicitness > 0.6) {
|
||||
return CONFLICT_SEVERITY.WARNING;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue