Skip to content

Schema-enforce atlas leaf-dispatch via write-fragment CLI + JSON Schema derivation#105

Open
jpr5 wants to merge 6 commits into
mainfrom
blitz/atlas-leaf-schema-enforcement/integration
Open

Schema-enforce atlas leaf-dispatch via write-fragment CLI + JSON Schema derivation#105
jpr5 wants to merge 6 commits into
mainfrom
blitz/atlas-leaf-schema-enforcement/integration

Conversation

@jpr5

@jpr5 jpr5 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Phase-0 implementation of atlas leaf-schema enforcement (per spec Notion 37d3aa38185281a686bbc46671a63a42, plan at /tmp/specs/2026-06-12-atlas-leaf-schema-enforcement-impl-plan.md).

  • canonicalizeFragment utility for shadow-gate dual-run comparison (recursive key sort, whitespace normalization, numeric canonicalization).
  • EpisodicCandidateFragmentSchema: narrowed schema on top of CandidateFragmentSchema with sensitivity-floor transform (publicinternal) and 4 episodic invariants (needsReview === true, provenance_class === "derived", confidence === "low", validation_status === "unverified").
  • JSON Schema derivation via zod-to-json-schema (CANDIDATE_FRAGMENT_JSON_SCHEMA, EPISODIC_CANDIDATE_FRAGMENT_JSON_SCHEMA, jsonSchemaForFamily()).
  • atlas harvest write-fragment --stdin CLI: spec §4.2.1 0/1/2/3/4 exit-code matrix, --stem filesystem-safe regex gate, mkdir/write try-block split, AND-case precedence on episodic invariant routing.
  • Dual-run scaffold (runDualRun): seed-present strict / no-seed-relaxed / both-malformed-gated branches with shape XOR + both-missing → diverge guards across classification enums, sourcetype, evidence, and text fields.
  • Tests: 7 new test files covering canonicalize, episodic schema, JSON schema, defect-regression corpus (14 alias rows + 12 row mutators), refinement-coverage, dual-run, write-fragment CLI.

Test plan

  • Full vitest: 6176/6176 passing, 338/338 test files
  • TypeScript build clean
  • Prettier clean
  • 7-round cr-loop converged (49 review agent passes; agent-confirmed zero findings on round 7)
  • CI green (pending)

Notes

  • Deferred follow-ups (see /tmp/cr/atlas-leaf-schema-r*-TRIAGE.md for full bundle): Phase-2 dual-run cosine + DI signature; JSON-Schema-layer ajv test hardening (T7/T3/T9); CLI ergonomics (--stem empty-string; --runs-dir env default; --fragment-id spec footer-note); atomic write temp+fsync+rename; README exit-code matrix subtlety; type-design polish.

🤖 Generated with Claude Code

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