COMPO · 5.04 · SCORING / CORRECTIONS / TESTS

Scoring,
corrections
& tests.

Канонический финальный модуль Topic 5: explicit SpaceTarget, four-family composite-first localSpaceFit, correction intents и regression. Без invented channel family и без подмены missing region evidence нулевым количеством regions.

ModuleCompo 5.04
PrimarylocalSpaceFit
Families4 canonical
Channelnot owned
Topic5 · SPACE
Nextclosing audit

Последний файл Topic 5

00 / module api

5.04 оценивает только canonical evidence 5.01–5.03 и только относительно explicit SpaceTarget.

MAIN TITLE

Scoring, corrections и tests.

PRIMARY

space.system.localSpaceFit — один composite vote.

CHANNEL

Не является component family Topic 5.

NO TARGET → N/A. Geometry/relation diagnostics остаются доступными, но scorer не изобретает универсальный whitespace verdict.

Четыре canonical families

01 / SpaceTarget

Target может задавать количество свободного пространства, структуру regions, clearance и figure-ground/active-passive relation.

SpaceTarget {
  targetId,
  domainRef,
  maskPolicyRef,

  freeAmountTarget?,
  regionStructureTarget?,
  clearanceTargets[],
  figureGroundTargets[],

  requiredComponents[],
  optionalComponents[],
  componentWeights{},
  missingEvidencePolicy,
  provenance
}

Никаких silent constraints

02 / target validation

Если target содержит constraints какой-либо family, она обязана быть явно объявлена required или optional.

constrained families MUST equal declared required ∪ optional families Also: required ∩ optional = ∅ weights: only declared families finite > 0 clearance: ShortN OR Px never both for same evidence complement aliases: consistent → one family contradictory → INVALID_TARGET

regionCount=0 не равно отсутствию данных

03 / zero vs missing

Scorer потребляет status 5.02 и не превращает missing regions в пустой массив.

VALID ZERO

Explicit zero regions

regionSetStatus = OK
regions = []

regionCount = 0
can satisfy target [0,0]
MISSING

No region evidence

regionSetStatus = N_A
regions = null

regionCount = N/A
NOT 0

Composite-first

04 / composite families

Компоненты диагностические; наружу идёт один `localSpaceFit`.

ComponentEvidence
freeAmountFit5.01 free/occupied complement family
regionStructureFit5.02 region count/share/interior pockets
clearanceFit5.02 selected-region max clearance
figureGroundFit5.03 enclosure / active-passive / boundary fraction
localSpaceFit = weighted mean of covered explicit target families N/A evidence: excluded never zero-filled

Одна степень свободы — один голос

05 / no double count

Комплементарные представления не увеличивают вес одной и той же геометрии.

freeFraction + occupiedFraction = 1

FREE_AMOUNT family — один vote.

objectBoundaryFraction + domainBoundaryFraction = 1

FIGURE_GROUND numeric subfamily — один vote.

Intent, не mutation

06 / correction requests

Scorer сообщает направление mismatch, но foreign geometry/layout parameters остаются у owners/solver.

SpaceCorrectionRequest {
  targetId,
  component,
  evidenceRefs[],
  requestedEffect,
  candidateOwners[],
  constraints[],
  provenance
}
NO FOREIGN MUTATION. 5.04 не двигает формы, не меняет crop, opacity или mask inclusion напрямую.

Closing barriers перед audit

07 / Topic5 regression

Regression suite проверяет каноническую цепочку после corrective pass.

ModuleBarrier
5.00точная декомпозиция MAIN; support-set state slot
5.01EXPLICIT/PARTIAL/MISSING support set; union/complement
5.02EmptyRegionSet status; zero regions ≠ missing
5.03Figure-ground / active-passive only; FULL_DOMAIN_FREE exact
5.04no silent families; no unit/complement double count; no target→N/A

Target-relative interpretation

08 / visual lab

Та же геометрия может соответствовать одному target и не соответствовать другому.

A · SAME SPACE EVIDENCE free=.60 · regions=2 · max clearance=.12N largest region = ACTIVE_PASSIVE_AMBIGUOUS TARGET X free .5–.7 regions 2 active/passive ambiguous FIT HIGH TARGET Y free .2–.3 regions 0 negative figure FIT LOW localSpaceFit = closeness to explicit target only no channel family · no balance · no hierarchy · no eye-flow

Corrected Topic5 scorer tests

09 / deterministic tests

Проверяем target schema, missing-vs-zero, active/passive targets, composite-first и ownership.

Tests not run yet.

DATA FOR LAYOUT ENGINE

10 / machine contract

Corrected canonical 5.04 contract.

{
  "module": "Compo 5.04",
  "name": "scoring_corrections_and_tests",
  "version": "1.1-corrective",
  "canonical_main_title": "Scoring, corrections и tests",
  "scope": "EXPLICIT_TARGET_TOPIC5_SCORING_CORRECTIONS_AND_CONSOLIDATED_REGRESSION",
  "consumes": [
    "Compo5.00.CompositionSpaceDomain / SpaceMaskPolicyRef",
    "Compo5.01.SpaceMaskPairResult",
    "Compo5.02.EmptyRegionSet",
    "Compo5.03.FigureGroundRelation[] / ActivePassiveSpaceRelation",
    "SpaceTarget"
  ],
  "provides": [
    "SpaceTarget",
    "SpaceRegionSelector",
    "SpaceScoringInput",
    "SpaceTargetComponentResult[]",
    "SpaceTargetScoreResult",
    "MetricResult[space.system.localSpaceFit]",
    "SpaceCorrectionRequest[]",
    "Topic5RegressionSuite"
  ],
  "owns_metrics": [
    "space.system.freeAmountFit",
    "space.system.regionStructureFit",
    "space.system.clearanceFit",
    "space.system.figureGroundFit",
    "space.system.localSpaceFit",
    "space.system.confidence"
  ],
  "descriptors_only": [
    "space.system.targetCoverage",
    "space.system.evidenceCoverage",
    "space.system.componentBreakdown",
    "space.system.missingRequiredComponents[]",
    "space.system.status"
  ],
  "space_scoring_input_schema": {
    "domainRef": "must match target",
    "maskPolicyRef": "must match target",
    "mask": "5.01 result or null if missing",
    "regions": "5.02 regions array; [] is explicit valid zero regions, null/undefined means missing region evidence",
    "regionSetStatus": "OK|PARTIAL|N_A|INVALID; required when region-based target families are declared",
    "figureGround": "5.03 relations array or null if missing",
    "figureGroundStatus": "OK|PARTIAL|N_A|INVALID",
    "evidenceConfidence": "0..1"
  },
  "region_selector_schema": {
    "kind": "BY_REGION_ID|LARGEST_FREE_REGION|LARGEST_INTERIOR_POCKET|LARGEST_BOUNDARY_TOUCHING_REGION",
    "regionId": "required only for BY_REGION_ID",
    "tieBreak": "area desc -> stable regionId lexical",
    "purpose": "target addressing only, not quality ranking"
  },
  "space_target_schema": {
    "targetId": "string",
    "domainRef": "same scored domain",
    "maskPolicyRef": "same 5.01 mask policy",
    "freeAmountTarget": {
      "freeFractionBand": "optional",
      "occupiedFractionBand": "optional complement alternative; if both supplied they must be exact complements and count once"
    },
    "regionStructureTarget": {
      "regionCountBand": "optional",
      "largestRegionShareOfFreeBand": "optional",
      "interiorPocketCountBand": "optional"
    },
    "clearanceTargets": [
      {
        "selector": "SpaceRegionSelector",
        "maxClearanceShortNBand": "preferred OR",
        "maxClearancePxBand": "explicit px-domain alternative; both at once are invalid because they are the same evidence in different units"
      }
    ],
    "figureGroundTargets": [
      {
        "selector": "SpaceRegionSelector",
        "enclosureClass": "optional",
        "activePassiveClass": "optional",
        "objectBoundaryFractionBand": "optional",
        "domainBoundaryFractionBand": "optional complement alternative; consistent pair counts once"
      }
    ],
    "requiredComponents": "subset FREE_AMOUNT|REGION_STRUCTURE|CLEARANCE|FIGURE_GROUND",
    "optionalComponents": "same enum, disjoint from required",
    "componentWeights": "positive finite values only for declared component families",
    "missingEvidencePolicy": "REQUIRE_REQUIRED|DIAGNOSTIC_IF_REQUIRED_MISSING|SCORE_WITH_COVERAGE",
    "provenance": "STYLE_PRESET|EMPIRICAL|INITIAL_HEURISTIC"
  },
  "metric_exports": {
    "primary_vote": {
      "key": "space.system.localSpaceFit",
      "owner": "Compo5.04",
      "scoringGroup": "SPACE_TARGET_FIT",
      "composite": true,
      "componentOf": null,
      "dependsOn": [
        "space.system.freeAmountFit",
        "space.system.regionStructureFit",
        "space.system.clearanceFit",
        "space.system.figureGroundFit"
      ],
      "derivedFrom": [
        "Compo5.01.SpaceMaskPairResult",
        "Compo5.02.EmptyRegionSet",
        "Compo5.03.FigureGroundRelation[]",
        "SpaceTarget"
      ],
      "independentVoteAllowed": false
    },
    "components": [
      {
        "key": "space.system.freeAmountFit",
        "componentOf": "space.system.localSpaceFit",
        "scoringGroup": "SPACE_TARGET_FIT",
        "independentVoteAllowed": false
      },
      {
        "key": "space.system.regionStructureFit",
        "componentOf": "space.system.localSpaceFit",
        "scoringGroup": "SPACE_TARGET_FIT",
        "independentVoteAllowed": false
      },
      {
        "key": "space.system.clearanceFit",
        "componentOf": "space.system.localSpaceFit",
        "scoringGroup": "SPACE_TARGET_FIT",
        "independentVoteAllowed": false
      },
      {
        "key": "space.system.figureGroundFit",
        "componentOf": "space.system.localSpaceFit",
        "scoringGroup": "SPACE_TARGET_FIT",
        "independentVoteAllowed": false
      }
    ]
  },
  "target_validation": {
    "constraint_family_declaration": "every family that has explicit target constraints must appear exactly once in requiredComponents or optionalComponents",
    "declared_without_constraints": "invalid target; prevents empty implicit scoring families",
    "required_optional_overlap": "invalid",
    "weight_for_undeclared_family": "invalid",
    "clearance_unit_alias": "ShortN and Px bands for the same selector cannot both be supplied",
    "complement_conflict": "contradictory free/occupied or object/domain boundary bands are invalid"
  },
  "scoring_policy": {
    "explicit_target_required": true,
    "no_target": "localSpaceFit=N/A",
    "component_families": [
      "FREE_AMOUNT",
      "REGION_STRUCTURE",
      "CLEARANCE",
      "FIGURE_GROUND"
    ],
    "component_fit_domain": "0..1",
    "constraint_level_coverage": "required",
    "N_A": "excluded, never zero-filled",
    "explicit_zero_regions": "regions=[] with regionSetStatus=OK is a valid zero-region observation",
    "missing_regions": "regions=null/undefined or non-OK status is missing evidence, never regionCount=0",
    "primary_score": "weighted mean of covered applicable component families",
    "higher_fit": "closer to explicit target only"
  },
  "complement_double_count_policy": {
    "free_vs_occupied": "one FREE_AMOUNT degree of freedom",
    "object_vs_domain_boundary": "one numeric FIGURE_GROUND degree of freedom",
    "consistent_aliases": "count once",
    "contradictory_aliases": "INVALID_TARGET"
  },
  "correction_routing": {
    "FREE_AMOUNT": "emit bring free amount to explicit band; solver chooses foreign geometry/mask owners",
    "REGION_STRUCTURE": "emit change region-count/share/pocket relation intent; no direct mutation",
    "CLEARANCE": "emit change selected clearance intent; no direct mutation",
    "FIGURE_GROUND": "emit change enclosure/active-passive/boundary relation intent; no direct mutation"
  },
  "hard_constraints": [
    "one metric = one owner",
    "5.04 must not rebuild 5.01 masks, 5.02 regions/clearance, or 5.03 relations",
    "SpaceTarget must match domainRef and maskPolicyRef",
    "no target means localSpaceFit=N/A",
    "component children are diagnostic members of one composite primary vote",
    "every constrained target family must be explicitly declared required or optional",
    "required and optional component lists must be disjoint",
    "componentWeights may only address declared families",
    "missing region evidence is not regionCount=0",
    "ShortN and Px clearance bands for the same selected evidence cannot double count",
    "free/occupied fractions and object/domain boundary fractions cannot double vote",
    "activePassiveClass is target-relative only when explicitly requested",
    "channel/corridor scoring is not part of canonical Topic5 MAIN scope",
    "missing required evidence is never zero-filled",
    "more free space / clearance / enclosure is not universally better",
    "localSpaceFit is not global balance/hierarchy/eye-flow",
    "visual mass remains Topic4",
    "canvas/format normalization remains Topic6",
    "grid occupancy remains Topic8",
    "N/A != 0",
    "no beautyScore"
  ],
  "regression_scope": {
    "covers": [
      "5.00",
      "5.01",
      "5.02",
      "5.03",
      "5.04"
    ],
    "required_barriers": [
      "5.00 exact MAIN topic decomposition",
      "5.01 explicit support-set state and union/complement",
      "5.02 zero-regions vs missing region evidence",
      "5.03 exact MAIN active-passive relation scope",
      "FULL_DOMAIN_FREE requires whole-domain coverage",
      "no channel/corridor ownership in Topic5",
      "5.04 no undeclared constraint families",
      "no clearance unit alias double count",
      "no complement double count",
      "no target -> N/A",
      "no global leakage"
    ]
  },
  "initial_heuristics": {
    "default_component_weight": {
      "value": 1.0,
      "provenance": "INITIAL_HEURISTIC"
    },
    "outside_band_decay_scale_floor": {
      "value": 1.0,
      "provenance": "INITIAL_HEURISTIC"
    }
  },
  "deferred_inputs": [
    "empirical whitespace/free-space target presets",
    "any channel/corridor model pending explicit MAIN allocation",
    "Topic6 canvas/format normalization",
    "Topic8 grid occupancy",
    "future global balance/hierarchy/eye-flow"
  ],
  "recompute_when": [
    "5.01 mask pair changes",
    "5.02 EmptyRegionSet/status/clearance changes",
    "5.03 figure-ground/active-passive relations change",
    "SpaceTarget changes",
    "domainRef or maskPolicyRef changes",
    "component weights/missing-evidence policy changes"
  ],
  "finality": "TOPIC5_SCORING_CORRECTIONS_AND_REGRESSION_ONLY"
}
ARCHITECTURE CHECKPOINT · 5.04 MATCHES MAIN: SCORING, CORRECTIONS AND TESTS FOR CANONICAL TOPIC5 EVIDENCE. FOUR COMPONENT FAMILIES ONLY: FREE_AMOUNT / REGION_STRUCTURE / CLEARANCE / FIGURE_GROUND. EVERY CONSTRAINED FAMILY MUST BE DECLARED. MISSING REGIONS ≠ ZERO REGIONS. CLEARANCE PX/SHORTN ALIASES AND COMPLEMENT FRACTIONS CANNOT DOUBLE VOTE. CHANNEL/CORRIDOR SCORING IS NOT OWNED. NO TARGET → N/A. NO GLOBAL BALANCE/HIERARCHY/EYE-FLOW. NO BEAUTYSCORE.
VISITS / ...