Commit Graph
5 Commits
Author SHA1 Message Date
glm-5.2 f371fe4e94 Add BAST-native validator POC for validate_bytes
Implements the D-BAST-006 validation model as a self-contained module
(`src/bast_poc.rs`) that does not touch the production schema /
materializer / validator paths. Reuses only `data_access`,
`AlkTypeError`, and `Endian` — the BAST parser, packed-mode
materializer, and native validator are all from scratch, which is the
point: prove the model works end-to-end before refactoring.

The POC confirms the hypothesis from the pivot doc: a recursive walker
over the BAST type tree fully replaces the 19 custom keyword
validators on the `validate_bytes` path, recovers the OQ-008 union
variant dispatch, and fixes the enum-membership dead constraint on the
bytes path — all without `jsonschema` custom keywords and without an
external JSON Schema.

Coverage (20 tests, all passing):
- basic: chunk header, int8/uint32 ranges, string/bytes maxLength,
  timestamp, bool, short buffer
- hard: union byte-offset disc + maxLength inside variant (OQ-008),
  union field-name disc + maxLength inside variant, enum index-bounds
  fix, nested struct→union→struct, array of structs with count,
  record, untrusted-schema error-not-panic

Verification:
- cargo test --release (416 tests: 330 lib + 86 integration)
- cargo clippy --all-targets -- -D warnings
- cargo build --target wasm32-unknown-unknown --release
- cargo doc --no-deps

Findings and verdict recorded in docs/research/bast-pivot.md
§"POC Result — BAST-native validator".
2026-08-15 09:29:14 +00:00
glm-5.2 19f8162f1a Refine BAST pivot: validation model, POC scope, resolve open questions
- Rewrite Validator Split around BAST-native validator for
  validate_bytes (walks BAST, checks value-domain constraints, no
  external JSON Schema needed); validate_json uses standard
  jsonschema::Validator from consumer-provided JSON Schema
- Add targeted POC: BAST-native validator replacing 19 custom keyword
  validators on the bytes path, verified via existing test suite
- Fix meta-schema: require count on arrays (variable-element arrays
  deferred per OQ-001), add optional fields array to UnionDef for
  field-name discriminators
- Remove lying no-count array example, replace with deferred note
- Document dead enum constraint (materialized index never matches
  string-membered enum); BAST-native validator fixes it via index
  bounds check
- Resolve all 7 OQs + 3 spec gaps as D-BAST-001 through D-BAST-008
- Update Migration Path, Risks table, Engine internals to reflect
  BAST-native validator
- Clarify 'no pocs needed' was an overcorrection: layout swap needs
  no POC, but the validation model does

Verification: docs-only change, no code affected
2026-08-15 09:05:55 +00:00
deepseek-v4-pro 82bc8f29c0 Clean up BAST pivot: drop POCs, remove recursion, add spec gaps
- Remove the four proposed POCs: they were implementation smoke tests,
  not de-risking probes. The pivot is a backend swap on a proven layout
  engine; byte-identity is already proven and the layout code is
  unchanged, so there is nothing empirical left to de-risk.
- Remove the recursive TreeNode example and the recursion mention in
  design principle 2: recursion is not a binary-layout concern and the
  engine has no cycle detection.
- Add a Spec Gaps section: validate_bytes semantics after keyword
  validator removal (UnionValidator variant dispatch regression),
  arrays of variable-length elements (engine rejects them), and
  field-name discriminator unions (meta-schema cannot express them).
- Reframe the engine change as an accessor-layer refactor: the
  walkers' (kind, field list, annotations) reads change; everything
  beneath them carries over unchanged.
2026-08-15 07:46:03 +00:00
deepseek-v4-pro 37bd5d7b7d Fix BAST pivot: jsonschema remains a direct dependency
Correct the validator split section to clarify that jsonschema is
not removed — it remains the JSON Schema validator for both paths
(BAST meta-schema validation and standard JSON payload validation).
Only the custom keyword registration path is removed. Also fix the
build_validator and validate_json entries in the engine changes
table to reflect that they are repurposed, not removed.
2026-08-14 16:06:26 +00:00
deepseek-v4-pro 004d52d505 Add BAST pivot research document
Proposes replacing custom JSON Schema keywords with a standalone
kind-based JSON format (BAST) using / for composition.
Covers format design, meta-schema, engine changes, validator split,
codegen future, ABI adapter potential, migration path, 7 open
questions, and 4 proposed POCs.
2026-08-14 15:55:17 +00:00