Skip to content

refactor(core): inject the SHA-256 digest in local-memory.ts and unify the meta-value sanitizer #1414

Closed

Description

@Astro-Han

Part of #1084 (second-pass sink-file and boundary governance). Blocked on / coordinate with #820, which adds new sha256Hex call sites to this file — please sync with that PR's author before starting.

Scope

  • Replace the embedded hand-rolled SHA-256 in core/local-memory.ts (SHA256_K ~L209, sha256Hex/rotateRight/add32 ~L1000–1080) with the same digest-injection seam oauth-subscription.ts uses (Sha256Digest, ~L203–209 there): stableLocalMemoryEntryId/stableLocalMemoryProposalId (and feat(memory): add measurement foundation and scoped read gates #820's new call sites) take an injected digest. Node crypto produces identical hex, so persisted mem-/proposal- ids are unchanged.
  • Collapse the inline sanitizer in serializeMetaComment (~L831) onto normalizeMetaValue (~L900) — the two are currently byte-identical.

Invariants

Same as #1084: behavior-neutral; persisted id stability is a hard invariant; stable exports; flat PR off main.

Verification

Typecheck/build + a fixed-digest test pinning persisted-id stability.

Activity

  1. added
    enhancement
    on Jul 23, 2026
  2. 1625567290 commented on Aug 17, 2026

    @1625567290
    Contributor

    I'll take this.

    Plan:

    1. Inject Sha256Digest into stableLocalMemoryEntryId / stableLocalMemoryProposalId (same seam as OAuth PKCE).
    2. Collapse serializeMetaComment onto normalizeMetaValue.
    3. Pin persisted mem- / proposal- ids against Node crypto so existing files stay stable.

    #820 is closed, so this is no longer blocked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions