test(shared-libs): the plan actor reads scheduler parity and unchanged-scope lists

Census 36776104571's question preserved the contract ('behaving exactly like the
scheduler', 'scheduler parity holds by construction') and excluded work with
'Existing copies and helper hardening stay unchanged'. Accept exactly/parity as
preservation (negated forms refuse) and a bare noun list that stays unchanged as
an exclusion for the expansion scan only; verb-led clauses still refuse.
This commit is contained in:
garrytan committed 2026-09-30 22:07:25 +00:00
1 parent 746f9b9cf1
commit 23e3636e4c
3 files changed
+44 -3

No files matched your search

+7 -3
View File
@@ -81,13 +81,17 @@ export function createSharedPlanReuseSelector(): SharedQuestionSelector {
// The supplied PLAN owns the two future caller identities and fixed scope.
// Native questions may refer to them without repeating file names, and an
// option may inherit unchanged semantics from its complete decision brief.
if (/\b(?:not|never|no longer)\s+(?:identical|the same|unchanged|preserv\w*|match\w*)\b/i.test(commitment) ||
!/\b(?:identical|same|unchanged|preserv\w*|match\w*|keep\w*)\b[^.!?\n]{0,120}\b(?:scheduler|semantics|behavior|contract)\b|\b(?:scheduler|semantics|behavior|contract)\b[^.!?\n]{0,120}\b(?:identical|same|unchanged|preserv\w*|match\w*|keep\w*)\b/i.test(affirmativeCommitments(context + '\n' + commitment))) {
if (/\b(?:not|never|no longer)\s+(?:identical|the same|unchanged|preserv\w*|match\w*|exact\w*)\b|\b(?:no|not|without|break\w*|los(?:e|es|ing))\s+(?:\w+\s+){0,2}parity\b/i.test(commitment) ||
!/\b(?:identical|same|unchanged|preserv\w*|match\w*|keep\w*|exactly|parity)\b[^.!?\n]{0,120}\b(?:scheduler|semantics|behavior|contract)\b|\b(?:scheduler|semantics|behavior|contract)\b[^.!?\n]{0,120}\b(?:identical|same|unchanged|preserv\w*|match\w*|keep\w*|exactly|parity)\b/i.test(affirmativeCommitments(context + '\n' + commitment))) {
refuse('the selected option must explicitly preserve the current scheduler contract');
}
// Inspect the question as well as the selected option: a harmless label must
// not authorize an extra commitment hidden in its brief or description.
const proposed = affirmativeCommitments(context + '\n' + commitment);
// "Existing copies and helper hardening stay unchanged" names excluded work.
// Only a bare list of those nouns qualifies; a verb such as "Harden" does not.
const item = String.raw`(?:(?:the|existing|current|its|all|both|helper|parser|lib|shared|caller|scheduler)\s+)*(?:copies|callers|hardening|migrations?|semantics|behaviou?r|contract|helper|parser)`;
const unchangedScope = new RegExp(String.raw`^${item}(?:\s*,\s*${item})*(?:,?\s+and\s+${item})?\s+(?:stays?|remains?)\s+(?:unchanged|untouched)[.!]?$`, 'i');
const proposed = affirmativeCommitments(context + '\n' + commitment).split('\n').filter(clause => !unchangedScope.test(clause.trim())).join('\n');
const expansions = [
/\b(?:harden\w*|tighten\w*|strict(?:er)?|saniti[sz]\w*|coerc\w*)\b/i,
/\b(?:add(?:s|ing)?|insert(?:s|ing)?|introduc(?:e|es|ing)|implement(?:s|ing)?|appl(?:y|ies|ying)|enabl(?:e|es|ing)|creat(?:e|es|ing))\s+(?:(?:a|an|the|one|new|shared|extra|explicit|validation|numeric|malformed|input|parser)\s+)*(?:guard|validator|validation|normalization)\b/i,