Skip to content

refactor: reuse canonical digest and formatter helpers - #1571

Merged
ScriptedAlchemy merged 1 commit into
masterfrom
refactor/reuse-canonical-helpers
Sep 18, 2026
Merged

ScriptedAlchemy merged 1 commit into
masterfrom
refactor/reuse-canonical-helpers

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

What

A behavior-preserving simplification pass over the whole codebase, kept to hunks where an existing helper already did the job.

  • Digests: one-shot hex::encode(Sha256::digest(..)) sites in git-correlation, graph generation, quarantine fingerprints, session-memory relation ids, remote-query control suffixes, session-relation watermarks, and temporal schema admission now call tracedecay_domain::canonical_text::sha256_hex / the parent module's digest_bytes. Inputs are byte-identical, so stored digests and watermarks do not move.
  • Dashboard: IndexFreshness uses the code-index progress, phase, blocked-reason, duration, and byte formatters already exported from CodeIndexPipeline.tsx and storageModel.ts. EvidenceSummaries uses the shared envelopePayload. Trust history and the memory oplog use formatMicrosUtc. The local whole-seconds ETA formatter stays so a sub-second ETA still renders as 0s.
  • Hot paths: extract_lines and render_lines slice the lines() iterator instead of collecting every line; collect_method_bodies reuses a source file already read for the same path; non-Rust field and unsafe scans borrow the source instead of cloning it.
  • Dead code: removes the uncalled ContextScoutDurableRuntimeV1::is_current wrapper.

Review

Fable reviewed the diff: every hash cutover hashes the same bytes as before, the two line extractors matched the previous implementations across a 1,152-case differential run (empty file, start past EOF, end before start, end past EOF, CRLF), the method-body source cache cannot serve another file's source, and the dashboard helper swaps are string-identical for the call-site types. No Critical or Important findings.

Verification

  • cargo check on the nine touched crates: clean.
  • cargo fmt --check on touched files: clean.
  • Dashboard tsc: the touched files typecheck. The only error in the run was Cannot find module 'three' from a stale shared node_modules; master still declares three in dashboard/package.json.

Overlap

These same hunks were also swept into the prose commit on #1564 while both were in one checkout. This PR is the standalone, reviewed slice; the punctuation sweep is not in it.

Route one-shot SHA-256 hex encodings through the existing
`sha256_hex` / `digest_bytes` helpers, and let the index-freshness,
observatory, and memory panels call the code-index, envelope, and
UTC-micros formatters that already exist instead of local copies.

Line extraction for body, context, and implementation reads now slices
the `lines()` iterator directly instead of collecting every line first,
implementation method bodies reuse the source file already read for the
same path, and non-Rust field/unsafe scans borrow the source instead of
cloning it. Removes the unused `ContextScoutDurableRuntimeV1::is_current`
wrapper.

Digest inputs and all rendered strings are unchanged.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@changeset-bot

changeset-bot Bot commented Sep 17, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: b33dd50

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ScriptedAlchemy
ScriptedAlchemy merged commit 6f3faca into master Sep 18, 2026
18 of 35 checks passed
@ScriptedAlchemy
ScriptedAlchemy deleted the refactor/reuse-canonical-helpers branch September 18, 2026 00:28
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