Give the instance check a name differing in case alone

Every foreign fixture differed from the mind's name in its bytes, so a check
folding case passed both suites. A slug label is `[A-Za-z0-9_-]{1,64}`:
uppercase is legal, `Yggdrasil` and `yggdrasil` are two names a client may
declare and two minds a host may hold, and a comparison that folds case
answers one of them for the other. Soul found the mutant alive.

`CASED_INSTANCE` stands beside the near and prefixed names in the mind
fixtures and `CASED` beside them in the daemon's, and each test asserts the
relation it relies on before using it: the cased name lowercases to the mind's
and is not equal to it.

`D1L5` folds case against the mind suite and `D1DL2` against the daemon suite,
so both fixture sets are load-bearing rather than only the one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-17 01:13:49 +02:00
commit 202e5e3ba6
4 changed files with 39 additions and 6 deletions

View file

@ -90,6 +90,15 @@
Old = ' if declared != self.instance() {'
New = ' if !declared.0.starts_with(&self.instance().0) {'
}
@{
Id = 'D1L5'
Rule = 'It compares the names as written: a slug may carry uppercase, so two names differing in case are two minds.'
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.eq_ignore_ascii_case(&self.instance().0) {'
}
@{
Id = 'D1N'
Rule = 'The refusal names which mind refused, so an agent can act on the field rather than guess.'
@ -126,6 +135,14 @@
Old = ' if declared != self.instance() {'
New = ' if declared.0.len() != self.instance().0.len() {'
}
@{
Id = 'D1DL2'
Rule = 'And case, the daemon''s way: the daemon''s own fixtures carry a name differing from the mind''s in case alone.'
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.eq_ignore_ascii_case(&self.instance().0) {'
}
@{
Id = 'D2'
Rule = 'Rulings 14 and 18 on the wire: the daemon passes the declared instance to the mind as the client sent it.'