1.5 KiB
1.5 KiB
Phase 1 — deterministic ingest
Goal
Turn an upstream bundle snapshot into deterministic segment records and a canonical source projection that later phases can diff, name, and replay transforms against.
Script
scripts/ingest-bundle.js
Inputs
--input <bundle.js>--run-id <id>--previous <runs/<id>/manifest.json>optional- optional upstream snapshot metadata for release manifests
Responsibilities
- parse the bundle with Babel
- detect segment or module boundaries deterministically
- for each segment/module:
- capture source slice and AST node type
- generate canonical pretty-printed code
- normalize identifiers for hashing where appropriate
- compute
rawHash,normalizedHash, andshapeHash
- emit:
runs/<run-id>/manifest.jsonruns/<run-id>/segments.jsonlruns/<run-id>/bundle.formatted.jsruns/<run-id>/reports/summary.md
Release-oriented requirements
- manifest must identify the upstream snapshot being ingested
- output must be deterministic so identical upstream snapshots reuse the same run identity inputs
- segment IDs should persist when matching is strong, but minting new IDs is acceptable when reshaping is severe
- ingest output is the base tree for later relabeling and transform replay
Verification
- run ingest against a fixture bundle
- confirm segment count is non-zero
- confirm manifest and JSONL are emitted
- spot-check representative segments for stable formatting