Skip to content

laws: TargetingLaws / TargetingTests — the only thing that can catch a resolution mechanism's own mistake #99

Description

@kryptt

Every law cats-eo-laws ships is intrinsic: it relates the optic to itself. That is exactly why none of them could see #95. A .field(_.b) that resolves to the schema's computed column is a perfectly lawful Optional onto the wrong field — get-put, put-get, put-put and modify-fusion all hold, modify(identity) is a no-op, the round-trip round-trips, and the payload it writes is valid Avro. The defect is only visible against an EXTRINSIC reference: "what does this carrier's own accessor say field b is?". A TargetingLaws / TargetingTests ruleset — an optic checked against a reference accessor supplied per carrier — is the only mechanism that can catch a resolution mechanism's own mistake, and the hazard class is carrier-wide, not an avro quirk: eo-circe and eo-jsoniter resolve by the literal Scala name (so a JSON key transform mis-targets the same way), zio.schema's EoAccessorBuilder and kyo's Record.lens[F]("name") are the same shape. PR #98 lands the FIXTURES for the avro half (avro/src/test/scala/dev/constructive/eo/avro/vulcan/DivergentCodecs.scala, plus AvroNominalResolutionSpec / ResolutionResidualSpec / ResolutionFalsePositiveSpec beside it); what is missing is the reusable discipline ruleset in laws/ that every carrier can register.

Evidence that the intrinsic laws are blind, and that an extrinsic check is not: /tmp/claude-1000/-home-rhansen-workspace-constructive-dev-eo/f9d50161-f717-4239-9f84-d7f5c596bbe3/scratchpad/hazard/matrix/evidence/07-laws-hold-on-mistargeted-optic.log (all four law families holding on a mis-targeted optic) and .../hazard/api-evidence/evidence/03-ladder-false-positives.log (a reference-accessor check failing correctly on both residual classes). Decision memo: .../scratchpad/HAZARD-MEMO.md §3.

Filed as a follow-up to #95 / #98.

🤖 Generated with Claude Code

https://claude.ai/code/session_0194EHFR4NamCpTHiqy7B74V

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions