Pin the instance check against names that resemble the mind's own
Every fixture pair differed in length, so a comparison of lengths, of first bytes, or one gated on the declared name being the longer passed both suites. The check was pinned by the fixtures' luck, not by the test. Two foreign names now stand beside `thought-cage` in the mind test and the daemon test: `yggdrasix`, which is `yggdrasil`'s own length and differs in its last byte alone, and `yggdrasil-two`, which carries the whole name as its prefix. The near name kills the three comparisons above; the prefixed one kills a `starts_with`. `D1L` is the loosening the brief asked for, comparing lengths, restored to that shape; `D1L2` compares first bytes, `D1L3` runs the gate only when the declared name is longer, `D1L4` asks whether one name begins with the other, and `D1DL` runs the length comparison against the daemon suite so the daemon test's own fixtures are load-bearing. The refusal-naming mutant that had taken `D1L`'s place is kept as `D1N`; it attacks a weaker rule and is no longer standing in for one. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
f0fee0b0ac
commit
4fba6cc6d4
4 changed files with 96 additions and 1 deletions
|
|
@ -50,6 +50,42 @@
|
|||
}
|
||||
@{
|
||||
Id = 'D1L'
|
||||
Rule = 'The instance check compares the names, not their lengths.'
|
||||
Test = 'mind::tests::require_instance_is_the_one_check_admission_and_the_daemon_share'
|
||||
Command = 'cargo test -p huginn-mind --lib'
|
||||
File = 'crates/huginn-mind/src/mind.rs'
|
||||
Old = ' if declared != self.instance() {'
|
||||
New = ' if declared.0.len() != self.instance().0.len() {'
|
||||
}
|
||||
@{
|
||||
Id = 'D1L2'
|
||||
Rule = 'It compares the names whole, not their first byte.'
|
||||
Test = 'mind::tests::require_instance_is_the_one_check_admission_and_the_daemon_share'
|
||||
Command = 'cargo test -p huginn-mind --lib'
|
||||
File = 'crates/huginn-mind/src/mind.rs'
|
||||
Old = ' if declared != self.instance() {'
|
||||
New = ' if declared.0.as_bytes().first() != self.instance().0.as_bytes().first() {'
|
||||
}
|
||||
@{
|
||||
Id = 'D1L3'
|
||||
Rule = 'It runs on every declared name, not only on one long enough to look suspicious.'
|
||||
Test = 'mind::tests::require_instance_is_the_one_check_admission_and_the_daemon_share'
|
||||
Command = 'cargo test -p huginn-mind --lib'
|
||||
File = 'crates/huginn-mind/src/mind.rs'
|
||||
Old = ' if declared != self.instance() {'
|
||||
New = ' if declared.0.len() > self.instance().0.len() && declared != self.instance() {'
|
||||
}
|
||||
@{
|
||||
Id = 'D1L4'
|
||||
Rule = 'It compares the names, not whether one begins with the other.'
|
||||
Test = 'mind::tests::require_instance_is_the_one_check_admission_and_the_daemon_share'
|
||||
Command = 'cargo test -p huginn-mind --lib'
|
||||
File = 'crates/huginn-mind/src/mind.rs'
|
||||
Old = ' if declared != self.instance() {'
|
||||
New = ' if !declared.0.starts_with(&self.instance().0) {'
|
||||
}
|
||||
@{
|
||||
Id = 'D1N'
|
||||
Rule = 'The refusal names which mind refused, so an agent can act on the field rather than guess.'
|
||||
Test = 'mind::tests::require_instance_is_the_one_check_admission_and_the_daemon_share'
|
||||
Command = 'cargo test -p huginn-mind --lib'
|
||||
|
|
@ -76,6 +112,14 @@
|
|||
Ok(())
|
||||
'@
|
||||
}
|
||||
@{
|
||||
Id = 'D1DL'
|
||||
Rule = 'The same comparison, reached the daemon''s way: a read naming a name of the mind''s own length is refused too.'
|
||||
Test = 'daemon::tests::a_read_or_a_write_naming_another_instance_is_refused_by_the_mind_and_writes_nothing'
|
||||
File = 'crates/huginn-mind/src/mind.rs'
|
||||
Old = ' if declared != self.instance() {'
|
||||
New = ' if declared.0.len() != self.instance().0.len() {'
|
||||
}
|
||||
@{
|
||||
Id = 'D2'
|
||||
Rule = 'Rulings 14 and 18 on the wire: the daemon passes the declared instance to the mind as the client sent it.'
|
||||
|
|
|
|||
Loading…
Reference in a new issue