Internal module guide. This module is now part of
@astrology/chart-composer; use the public package README for application setup.
evidence module
Creates deterministic calculation identities and retains distinct contributing source records.
Start with the Composer reading guide for the complete request flow and glossary.
Public imports use @astrology/chart-composer; implementation files are not cross-package APIs.
See the package specification and task plan.
Identity
canonicalizeCalculation sorts object keys, preserves array order, omits undefined object
properties and treats negative zero as zero. Null is distinct from omission. Undefined array
items, holes, non-finite numbers, cycles and non-plain objects are rejected.
hashCalculation hashes that representation with SHA-256. createSnapshotIdentity includes
canonical context, contributing operation declarations, normalizer version/rounding/source,
semantics and Composer versions, and optional rulebook identities. Routing cache-hit state and
other transient decisions stay in the evidence (provenance) ledger but do not change calculation identity.
No timestamp or storage operation is introduced.
collectEvidence removes exact duplicates only. Position and house sources retain their
operation tags even when they share a provider. Hashes contain private calculation inputs and
are not privacy-safe cache keys; cache protection belongs to the host.
Read the implementation
Read canonicalize.ts to see the serialization rules, then identity.ts for hash inputs and collect-evidence.ts for stable deduplication. The calculation hash and evidence ledger deliberately serve different purposes: a routing cache hit remains in the ledger but cannot change the calculation hash.
Run pnpm check:chart-composer and pnpm test:chart-composer from the repository root.