Apply gate-house's section 11 rulings: four-token validator, emission guarantee, resource.system.
GH-DEC-2026-017: the validator admitted {Staff, Engine, Tooling}, built from
section 4's catalog rows, and rejected Taxonomy, which section 3.1 defines.
railiance-master was conforming; the validator was the divergent artifact.
Now four tokens, ASCII case folded, section 4's spelling canonical, INTENT.md
governing while form disagreements are still reported, and every run states
its scope (section 11 binds section 4; volunteers are not non-conformances).
Also fixes the survey silently dropping audit-core's layer.yaml by decoding
peers into flex-auth's own struct.
GH-DEC-2026-018: flex-auth is a section 4 source of evidence. G2 closes as a
question and reopens as a dated gap (review 2026-10-19). cadence.yaml
publishes the per-event-class inventory: deny, redact, not_applicable and
audit_only rare load-bearing (heartbeat and reconciliation, rate forbidden);
allow volume load-bearing (expected-rate and reconciliation). INTENT.md
declares source_of_evidence and names it; tests assert both. Delivery is
FLEX-WP-0031.
FLEX-DEC-2026-015: resource.system follows the runtime, not the repository,
answering ops-warden's WARDEN-IN-0003.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Assistant: claude-code
Assistant-Model: opus
Assistant-Process: 63291@bnt-lap001
Assistant-Session: 8bd77868-ca68-4f49-bb1e-d539ecc0d703
This commit is contained in:
parent
d6c9e3bad4
commit
80ffe729d4
14 changed files with 1502 additions and 78 deletions
|
|
@ -11,13 +11,46 @@ import (
|
|||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
// Layer vocabulary from the Security Layer Model §3.
|
||||
var validLayers = map[string]bool{
|
||||
"Staff": true,
|
||||
"Engine": true,
|
||||
"Tooling": true,
|
||||
// Layer vocabulary from the Security Layer Model §3, as stated once and closed
|
||||
// by amendment A9 (GH-DEC-2026-017 §2 and §3).
|
||||
//
|
||||
// It has FOUR tokens, not three. The earlier set here admitted
|
||||
// {Staff, Engine, Tooling} and rejected Taxonomy — which §3.1 defines, §4
|
||||
// catalogues twice (info-tech-canon, net-kingdom), and the standard itself is
|
||||
// an instance of. That set was built from §4's role-typed catalog rows rather
|
||||
// than from §3's layer table, so it inherited §4's shape and lost §3's fourth
|
||||
// row. railiance-master's `Taxonomy` was conforming the whole time and this
|
||||
// validator was the divergent artifact; see docs/conformance/boundaries-review.md.
|
||||
//
|
||||
// The spelling below is §4's Layer column form, which GH-DEC-2026-017 §2 makes
|
||||
// canonical. §3's table heading reads `Engines`, plural; the token is `Engine`.
|
||||
// Comparison is ASCII case-insensitive and a run MUST fold case before
|
||||
// comparing (A9): two spellings of Engine do not describe two boundaries, and a
|
||||
// check that reports nine findings about capital letters has buried the one
|
||||
// real disagreement it exists to find.
|
||||
var canonicalLayers = []string{"Taxonomy", "Tooling", "Engine", "Staff"}
|
||||
|
||||
// foldedLayers maps the ASCII-case-folded form of each token to its canonical
|
||||
// §4 spelling.
|
||||
var foldedLayers = func() map[string]string {
|
||||
m := make(map[string]string, len(canonicalLayers))
|
||||
for _, l := range canonicalLayers {
|
||||
m[strings.ToLower(l)] = l
|
||||
}
|
||||
return m
|
||||
}()
|
||||
|
||||
// CanonicalLayer folds ASCII case and returns the §4 column spelling of a
|
||||
// declared layer value, plus whether the value is in the §3 vocabulary at all.
|
||||
// A lowercase declaration is conforming, not tolerated (GH-DEC-2026-017 §2).
|
||||
func CanonicalLayer(declared string) (string, bool) {
|
||||
canon, ok := foldedLayers[strings.ToLower(strings.TrimSpace(declared))]
|
||||
return canon, ok
|
||||
}
|
||||
|
||||
// Vocabulary returns the four §3 tokens in their canonical spelling.
|
||||
func Vocabulary() []string { return append([]string(nil), canonicalLayers...) }
|
||||
|
||||
// Engine roles from §3.3. An Engine declaration must state one.
|
||||
var validEngineRoles = map[string]bool{
|
||||
"PDP": true,
|
||||
|
|
@ -34,11 +67,11 @@ var toolingPatterns = []*regexp.Regexp{
|
|||
|
||||
// Declaration is the machine-readable §11 form carried in INTENT.md frontmatter.
|
||||
type Declaration struct {
|
||||
Layer string `yaml:"layer"`
|
||||
Role string `yaml:"role"`
|
||||
Framework string `yaml:"framework"`
|
||||
DeclaredBy string `yaml:"declared_by"`
|
||||
DeclaredAt string `yaml:"declared_at"`
|
||||
Layer string `yaml:"layer"`
|
||||
Role string `yaml:"role"`
|
||||
Framework string `yaml:"framework"`
|
||||
DeclaredBy string `yaml:"declared_by"`
|
||||
DeclaredAt string `yaml:"declared_at"`
|
||||
// ConformanceRecord points at the derived, version-stamped conformance state.
|
||||
// The declaration itself is a boundary and carries no standard version.
|
||||
ConformanceRecord string `yaml:"conformance_record"`
|
||||
|
|
@ -48,6 +81,18 @@ type Declaration struct {
|
|||
StandardVersion string `yaml:"standard_version"`
|
||||
PepStance any `yaml:"pep_stance"`
|
||||
ToolingContacts []any `yaml:"tooling_contacts"`
|
||||
// SourceOfEvidence records whether §4 marks this repository as a source of
|
||||
// evidence (A10). GH-DEC-2026-018 §2 rules that flex-auth is one: custody is
|
||||
// never source, and the decision record is emitted by the repository that
|
||||
// renders the decision.
|
||||
SourceOfEvidence *bool `yaml:"source_of_evidence"`
|
||||
// EmissionGuarantee names the per-event-class emission declaration §11
|
||||
// requires of a marked source. GH-DEC-2026-018 §3 rules that the declaration
|
||||
// is PER EVENT CLASS, not per repository: one guarantee averaged over a
|
||||
// stream holding both a high-volume allow and a rare deny is not a
|
||||
// declaration, and would be satisfied by rate monitoring that cannot see the
|
||||
// deny go missing.
|
||||
EmissionGuarantee string `yaml:"emission_guarantee"`
|
||||
}
|
||||
|
||||
// Check parses INTENT.md, asserts the Engine/PDP declaration, and scans
|
||||
|
|
@ -60,6 +105,17 @@ func Check(root string) error {
|
|||
if err := ValidateDeclaration(decl); err != nil {
|
||||
return err
|
||||
}
|
||||
for _, named := range []struct{ field, path string }{
|
||||
{"conformance_record", decl.ConformanceRecord},
|
||||
{"emission_guarantee", decl.EmissionGuarantee},
|
||||
} {
|
||||
if strings.TrimSpace(named.path) == "" {
|
||||
continue
|
||||
}
|
||||
if _, err := os.Stat(filepath.Join(root, named.path)); err != nil {
|
||||
return fmt.Errorf("%s names %q, which is not on disk: §11's derived-artifact rule needs the artifact, not the pointer", named.field, named.path)
|
||||
}
|
||||
}
|
||||
hits, err := ScanToolingClients(root)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -95,13 +151,14 @@ func parseDeclarationYAML(doc string) (Declaration, error) {
|
|||
|
||||
// ValidateDeclaration asserts §3 vocabulary and Engine-role presence.
|
||||
func ValidateDeclaration(decl Declaration) error {
|
||||
if !validLayers[decl.Layer] {
|
||||
return fmt.Errorf("layer %q is not in the §3 vocabulary (Staff, Engine, Tooling)", decl.Layer)
|
||||
canon, ok := CanonicalLayer(decl.Layer)
|
||||
if !ok {
|
||||
return fmt.Errorf("layer %q is not in the §3 vocabulary (%s); the vocabulary is closed and a fifth layer arrives by amending §3, not by declaring one", decl.Layer, strings.Join(canonicalLayers, ", "))
|
||||
}
|
||||
if decl.Layer == "Engine" && !validEngineRoles[decl.Role] {
|
||||
if canon == "Engine" && !validEngineRoles[decl.Role] {
|
||||
return fmt.Errorf("Engine declaration must state role PDP or PIP; got %q", decl.Role)
|
||||
}
|
||||
if decl.Layer != "Engine" && strings.TrimSpace(decl.Role) != "" {
|
||||
if canon != "Engine" && strings.TrimSpace(decl.Role) != "" {
|
||||
return fmt.Errorf("layer %q must not state an Engine role", decl.Layer)
|
||||
}
|
||||
if len(decl.ToolingContacts) > 0 {
|
||||
|
|
@ -116,6 +173,15 @@ func ValidateDeclaration(decl Declaration) error {
|
|||
if strings.TrimSpace(decl.ConformanceRecord) == "" {
|
||||
return fmt.Errorf("layer declaration must name a conformance_record: §11 requires a derived artifact to carry the version it was derived at")
|
||||
}
|
||||
if decl.SourceOfEvidence == nil {
|
||||
return fmt.Errorf("layer declaration must state source_of_evidence: §4 marks it (A10) and §11's emission check may not infer it — GH-DEC-2026-018 §5")
|
||||
}
|
||||
if *decl.SourceOfEvidence && strings.TrimSpace(decl.EmissionGuarantee) == "" {
|
||||
return fmt.Errorf("a §4 evidence source must name an emission_guarantee declaration, per event class: §11, GH-DEC-2026-018 §3")
|
||||
}
|
||||
if !*decl.SourceOfEvidence && strings.TrimSpace(decl.EmissionGuarantee) != "" {
|
||||
return fmt.Errorf("emission_guarantee is declared but source_of_evidence is false")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue