Skip to content

refactor: reuse shared result and hashing helpers - #1374

Merged
Astro-Han merged 2 commits into
apache:mainfrom
me2seeks:refactor/1084-core-runtime-mechanical
Jul 24, 2026
Merged

Astro-Han merged 2 commits into
apache:mainfrom
me2seeks:refactor/1084-core-runtime-mechanical

Conversation

@me2seeks

Copy link
Copy Markdown
Contributor

Summary

  • move the generic Result<T> helpers to @maka/core/result, keep @maka/core/settings/result as a compatibility re-export, and migrate all current production consumers
  • reuse stableHash and stableStringify from request-shape.ts in semantic-compact.ts
  • preserve the existing raw-hex semantic compact IDs and digests, with focused tests covering the hash output and legacy Result entry point

This is the core + runtime mechanical batch from #1084. It is behavior- and visually-neutral.

Refs #1084.

Verification

  • npm run lint — passed
  • npm run format:check — passed
  • npm run build — passed
  • npm run typecheck — passed
  • npm --workspace @maka/core test — 1,157 passed, 0 failed
  • npm --workspace @maka/runtime test — 2,376 passed, 0 failed, 3 skipped
  • git diff origin/main...HEAD --check — passed

Visual validation is not applicable because this is a behavior- and visually-neutral utility cleanup.

Review focus

  • stableHash includes a sha256: prefix, while the persisted semantic compact fields currently use raw hex; the small stableHashHex adapter intentionally preserves that existing format
  • the old settings Result subpath stays exported and re-exports the same function identities, so existing external imports remain compatible

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. Result now has one implementation at @maka/core/result, while the old settings path re-exports the same function identities for compatibility. Semantic compact reuses the shared hashing code, and the small adapter preserves the existing raw-hex storage format. I also verified that the digest fixture matches the previous implementation. No findings.

@Astro-Han

Copy link
Copy Markdown
Contributor

A rebase is needed before merging. @me2seeks Would you have a look?

@Astro-Han
Astro-Han merged commit 0aabde9 into apache:main Jul 24, 2026
3 checks passed
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.

2 participants