iter design-md-rolesplit.tidy (DONE 7/7): resolve milestone-close audit drift
Gate-first TDD: widened design_index_pin.rs clause-3 to a hand-rolled
FAITHFUL Sweep-1 superset (case-sensitive digit-anchored line anchors
+ Sweep-1's ^[^/]* path-excluded date + the audit-named
decision-record phrases, case-insensitive); no regex dep; the blanket
iter-detector rejected as unworkable. Sentence-level strip of
faithfully-migrated history/decision-record prose out of 5 contract
files (the audit's 3 spot-checked + roundtrip-invariant.md +
data-model.md the exhaustive scan found) into the decision-record
journal, each replaced by its present-tense contract equivalent;
float-semantics.md stale 'see Str ABI below' -> str-abi.md;
architect_sweeps honesty sweeps re-scoped to design/contracts only
(models/ is the narrative tier) + ailang-architect.md lockstep.
Invariant: clause-3 GREEN => Sweep-1 clean in contracts/.
The prior dispatch correctly BLOCKED on a real plan defect (iso_date
lacked Sweep-1's path-exclusion, over-firing on legit
docs/specs/2026-.. citations); per the two+-defects-in-one-iteration
discipline the audit Resolution mechanism+scope were corrected
upstream in lockstep (f2cdd67) before re-dispatch, not patched a
third time.
Boss-verified independently: cargo test --workspace 646/0,
design_index_pin 4/4 (clause-3 RED->GREEN), architect_sweeps.sh exit
0 'All five sweeps clean' (acceptance criterion 9 met), acceptance
grep CLEAN, 3 docs_honesty_pin pinned runs each exactly 1 contiguous
match. Zero spec/quality re-loops. FINAL design-md-rolesplit
iteration — milestone functionally complete, audited, drift-resolved,
hard gate enforces the honesty spirit.
This commit is contained in:
@@ -129,29 +129,124 @@ fn every_contract_names_a_resolvable_ratifying_test() {
|
||||
|
||||
#[test]
|
||||
fn contracts_carry_no_decision_record_prose() {
|
||||
// clause 3 — the conflation tripwire.
|
||||
// clause 3 — the conflation tripwire, widened (design-md-rolesplit.tidy,
|
||||
// audit Resolution-4) to a FAITHFUL SUPERSET of
|
||||
// bench/architect_sweeps.sh Sweep-1's history-anchor regex over the
|
||||
// design/contracts/ scope, PLUS the audit-named decision-record
|
||||
// phrases (the deliberate widening that closes the case-variance
|
||||
// dodge the 6 literal markers left open).
|
||||
//
|
||||
// Invariant: clause-3 GREEN ⟹ Sweep-1 finds nothing in design/contracts/.
|
||||
//
|
||||
// Sweep-1 = 'Iter [0-9]+[a-z]?(\.[0-9]+)?|Family [0-9]+
|
||||
// |^[^/]*2026-[0-9]{2}-[0-9]{2}|\*\*Status: |pre-[0-9]+[a-z]?
|
||||
// |[0-9]+[a-z]? sketch|21\.g'
|
||||
// Faithfulness, per Sweep-1 alternative:
|
||||
// - Iter / Family / pre- / <n> sketch / 21.g / **Status:
|
||||
// → sweep1_line_anchor() reproduces each verbatim,
|
||||
// case-SENSITIVE (grep -E, no -i) — exactly Sweep-1 here,
|
||||
// never narrower.
|
||||
// - ^[^/]*2026-NN-NN → date_anchor() reproduces Sweep-1's
|
||||
// ^[^/]* PATH-EXCLUSION (only the line prefix before the
|
||||
// first '/' is scanned) and generalises 2026→20NN
|
||||
// (⊇ Sweep-1, never narrower). A `docs/specs/2026-..`
|
||||
// citation has '/' before the date ⇒ NOT flagged — faithful
|
||||
// to Sweep-1, no over-fire on legit present-tense spec
|
||||
// cross-refs (the iter-.1 plan defect this repairs).
|
||||
// - PHRASES: literal decision-record idioms (case-insensitive) —
|
||||
// the deliberate widening that closes the capital-variance
|
||||
// dodge ("An earlier draft" vs "an earlier draft").
|
||||
//
|
||||
// A blanket case-insensitive iter/milestone detector was evaluated
|
||||
// and REJECTED (audit Resolution-4 corrected): it conflates the
|
||||
// memory-model rule-names "Iter A"/"Iter B", and ordinary words
|
||||
// "pre-existing"/"pre-set"/"pre-Boehm"/"pre-tail-call", with
|
||||
// provenance stamps — unworkable. faithful-Sweep-1 (the capital-I,
|
||||
// digit-anchored form) already excludes those by construction and
|
||||
// is confirmed ZERO across every contract file; lowercase
|
||||
// `(iter <code>)` provenance is removed by the strip tasks, not by
|
||||
// a fragile hard-gate regex. The load-bearing invariant
|
||||
// (clause-3 GREEN ⟹ Sweep-1 clean in contracts/) holds with
|
||||
// sweep1_line_anchor + date_anchor + PHRASES alone.
|
||||
let dir = root().join("design/contracts");
|
||||
let markers = [
|
||||
"we rejected",
|
||||
"an earlier draft",
|
||||
"Why not other",
|
||||
"was retired in iter",
|
||||
"rollback plan",
|
||||
"previously all",
|
||||
|
||||
const PHRASES: &[&str] = &[
|
||||
"we rejected", "an earlier draft", "earlier draft committed",
|
||||
"why not other", "was retired", "were retired", "rollback plan",
|
||||
"previously all", "deliberately deferred", "new-baseline decision",
|
||||
"amends the above", "out of scope per",
|
||||
"the journal records when", "unchanged from the original draft",
|
||||
];
|
||||
|
||||
// Sweep-1's non-date alternatives, hand-rolled verbatim, case-SENSITIVE
|
||||
// (grep -E without -i), on the raw physical line.
|
||||
fn sweep1_line_anchor(line: &str) -> Option<&'static str> {
|
||||
let kw_digit = |kw: &str| -> bool {
|
||||
let mut from = 0;
|
||||
while let Some(i) = line[from..].find(kw) {
|
||||
let p = from + i + kw.len();
|
||||
if line[p..].chars().next().map_or(false, |c| c.is_ascii_digit()) {
|
||||
return true;
|
||||
}
|
||||
from = p;
|
||||
}
|
||||
false
|
||||
};
|
||||
if kw_digit("Iter ") { return Some("Iter <n>"); }
|
||||
if kw_digit("Family ") { return Some("Family <n>"); }
|
||||
if kw_digit("pre-") { return Some("pre-<n>"); }
|
||||
if line.contains("**Status: ") { return Some("**Status:"); }
|
||||
if line.contains("21.g") { return Some("21.g"); }
|
||||
if let Some(s) = line.find(" sketch") {
|
||||
let pre = line[..s].as_bytes();
|
||||
if pre.last().map_or(false, u8::is_ascii_alphanumeric)
|
||||
&& pre.iter().rev()
|
||||
.take_while(|c| c.is_ascii_alphanumeric())
|
||||
.any(u8::is_ascii_digit)
|
||||
{
|
||||
return Some("<n> sketch");
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
// Sweep-1's `^[^/]*2026-NN-NN`, generalised to 20NN-NN-NN,
|
||||
// PATH-EXCLUDED: scan only the line prefix BEFORE the first '/'.
|
||||
fn date_anchor(line: &str) -> Option<String> {
|
||||
let prefix = line.split('/').next().unwrap_or(line).as_bytes();
|
||||
for w in prefix.windows(10) {
|
||||
if w[0] == b'2' && w[1] == b'0'
|
||||
&& w[2].is_ascii_digit() && w[3].is_ascii_digit()
|
||||
&& w[4] == b'-' && w[5].is_ascii_digit() && w[6].is_ascii_digit()
|
||||
&& w[7] == b'-' && w[8].is_ascii_digit() && w[9].is_ascii_digit()
|
||||
{
|
||||
return Some(String::from_utf8_lossy(w).into_owned());
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
for entry in fs::read_dir(&dir).expect("design/contracts/ exists") {
|
||||
let p = entry.unwrap().path();
|
||||
if p.extension().and_then(|e| e.to_str()) != Some("md") {
|
||||
continue;
|
||||
}
|
||||
let body = norm(&fs::read_to_string(&p).unwrap());
|
||||
for m in &markers {
|
||||
let raw = fs::read_to_string(&p).unwrap();
|
||||
let fname = p.file_name().unwrap().to_string_lossy().into_owned();
|
||||
let low = norm(&raw).to_lowercase();
|
||||
for ph in PHRASES {
|
||||
assert!(
|
||||
!body.contains(m),
|
||||
"decision-record marker {:?} found in contract {:?} — re-conflation",
|
||||
m,
|
||||
p.file_name().unwrap()
|
||||
!low.contains(ph),
|
||||
"clause-3: history phrase {ph:?} in contract {fname:?}"
|
||||
);
|
||||
}
|
||||
for line in raw.lines() {
|
||||
if let Some(a) = sweep1_line_anchor(line) {
|
||||
panic!("clause-3: Sweep-1 anchor {a:?} in contract {fname:?}: {line:?}");
|
||||
}
|
||||
if let Some(d) = date_anchor(line) {
|
||||
panic!("clause-3: history date {d:?} in contract {fname:?}: {line:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user