Skip to content

docs(adr-102): document the intentional two-validator layering (P6c)#490

Merged
aaronsb merged 1 commit into
mainfrom
docs/adr-102-p6c-document-validator-layering
Jun 1, 2026
Merged

docs(adr-102): document the intentional two-validator layering (P6c)#490
aaronsb merged 1 commit into
mainfrom
docs/adr-102-p6c-document-validator-layering

Conversation

@aaronsb
Copy link
Copy Markdown
Owner

@aaronsb aaronsb commented Jun 1, 2026

ADR-102 P6c — chunk C resolved as document-don't-merge

Chunk C was scoped to "consolidate the two drifting kg-backup/2 validators." Verify-in-code
inverted that premise: they are not duplicates — they validate different layers for
different consumers, and merging them would do harm. So this PR documents the intentional
separation rather than forcing a shared core.

The finding

Validator Layer it checks Consumer Dependency
scripts/development/lint/lint_backup.py RAW interned on-disk structure (index ranges, interning integrity, §6 exclusions, format negotiation) pytest oracle + CI/test/build gate; an independent outside check on the serializer none (standalone by design — ADR-102 Track D)
api/app/lib/backup_integrity.py DE-INTERNED logical graph via KgBackupV2Reader (referential integrity, external deps, stats) runtime gate before stream/archive/restore api package

lint_backup deliberately does not use KgBackupV2Reader — the reader de-interns, which
would hide the very interning bugs the oracle exists to catch. A shared core would force one
layer's representation onto the other and couple the standalone oracle to the api package,
sacrificing the independence that makes it a useful CI/build check. The real overlap
(reference/external-dep checks) is narrow and expressed on incompatible layers.

What changed

Docs only, no behavior change:

  • Cross-reference docstrings added to both files making the layering explicit and warning
    against a future mistaken merge.
  • Supersedes the stale backup_integrity.py note that said consolidation "is tracked for ADR-102 P6".
  • Restamps lint_backup @verified cffa180b → b832d59d (docstring touched).

Tests

  • lint_backup --selftest → PASS
  • test_backup_integrity.py + test_kg_backup_v2.py → 22 passed

🤖 Generated with Claude Code

Chunk C evaluated whether to consolidate the two kg-backup/2 validators. Verify-in-
code showed they are NOT drifting duplicates — they validate different layers for
different consumers, so they are intentionally kept separate:

- scripts/development/lint/lint_backup.py — the independent verification tool: a
  deliberately standalone spec oracle (NO api-package dependency) that doubles as a
  CI/test/build gate and an outside check on the serializer. Validates the RAW
  interned on-disk structure (dictionary index resolution, interning integrity,
  §6 exclusions, format negotiation). It does NOT use KgBackupV2Reader on purpose —
  the reader de-interns, which would mask the interning bugs this oracle exists to catch.
- api/app/lib/backup_integrity.py — the runtime gate: validates the DE-INTERNED
  logical graph via KgBackupV2Reader (referential integrity + external deps + stats)
  before a backup is streamed/archived/restored.

A shared core would force one layer's representation onto the other and couple the
standalone oracle to the api package, sacrificing its Track-D independence; the narrow
overlap doesn't justify it. Decision (with maintainer): document the split, don't merge.

Adds cross-reference docstrings to both files so the layering is explicit and a future
maintainer won't 'consolidate' them by mistake. Supersedes the old backup_integrity
note that said consolidation 'is tracked for ADR-102 P6'. No behavior change.
Restamps lint_backup @verified cffa180 -> b832d59.
@aaronsb aaronsb merged commit 8e6d5c4 into main Jun 1, 2026
4 checks passed
@aaronsb aaronsb deleted the docs/adr-102-p6c-document-validator-layering branch June 1, 2026 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant