Skip to content

fix(identity-service): resolve @ts-ignore suppressions at Credo-ts framework boundary - #150

Merged
AlexanderShenshin merged 2 commits into
hiero-ledger:mainfrom
cynox-66:fix/credo-boundary-type-suppressions
May 27, 2026
Merged

fix(identity-service): resolve @ts-ignore suppressions at Credo-ts framework boundary#150
AlexanderShenshin merged 2 commits into
hiero-ledger:mainfrom
cynox-66:fix/credo-boundary-type-suppressions

Conversation

@cynox-66

@cynox-66 cynox-66 commented May 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Resolves the remaining @ts-ignore suppressions in core heka-identity-service files by replacing them with typed assertions, runtime validation, and proper ambient type declarations.

This continues the type-safety cleanup started in #127 and focuses on the remaining framework/library boundary cases that required deeper fixes rather than direct @ts-expect-error replacements.

Changes

1. AnonCreds registry runtime validation

  • Added a runtime guard ensuring at least one AnonCreds-capable DID method is configured
  • Replaced @ts-ignore with a narrowed tuple assertion:
    as [AnonCredsRegistry, ...AnonCredsRegistry[]]
  • Preserves Credo-ts type guarantees while keeping the configuration-driven registry setup

2. Typed AnonCreds proof access

  • Replaced @ts-ignore in proof.service.ts
  • Added explicit AnonCredsProof narrowing for requested_proof.revealed_attrs access

3. Dead field cleanup

  • Removed the unused tenantId field and corresponding suppression in did-registrar.service.ts
  • Preserved existing bootstrap behavior by keeping initTenant() execution intact

4. Ambient declarations for @digitalcredentials/bitstring

  • Added local .d.ts declarations for the untyped dependency
  • Removed related @ts-ignore and ESLint suppression boilerplate

Notes

The AnonCreds registry validation now fails fast when no AnonCreds-capable DID method is configured (for example DID_METHODS=key).

Previously this configuration would silently create a broken agent and fail later during credential operations. The new behavior surfaces the configuration issue immediately at startup with a clear error message.

Result

  • Removes the remaining framework-boundary @ts-ignore suppressions in heka-identity-service
  • Improves runtime safety for invalid DID method configurations
  • Preserves existing runtime behavior for valid deployments
  • Keeps Credo-ts integration points fully typed

Summary by CodeRabbit

  • Chores
    • Enhanced TypeScript configuration for development environment setup and improved type definitions for project dependencies.

Review Change Stack

@cynox-66
cynox-66 force-pushed the fix/credo-boundary-type-suppressions branch from 816cf66 to d541b57 Compare May 14, 2026 13:59
Comment thread heka-identity-service/src/common/agent/agent-modules.provider.ts Outdated
Signed-off-by: cynox-66 <devj2311@gmail.com>
@cynox-66
cynox-66 force-pushed the fix/credo-boundary-type-suppressions branch from ef5a47d to ac09dc3 Compare May 26, 2026 13:09
@cynox-66
cynox-66 force-pushed the fix/credo-boundary-type-suppressions branch from ac09dc3 to 8c5f7d1 Compare May 26, 2026 14:04
@cynox-66

Copy link
Copy Markdown
Contributor Author

Tracked down the CI failure , the ambient declaration file was included in tsconfig.src.json but not in tsconfig.test.json, so the test typecheck couldn't resolve the module declaration during transitive imports.

Added the .d.ts include to the test config and re-ran the full typecheck/lint flow locally ...

…type-suppressions

Signed-off-by: cynox-66 <devj2311@gmail.com>

# Conflicts:
#	heka-identity-service/src/common/did-registrar/did-registrar.service.ts
#	heka-identity-service/src/revocation/status-list/status-list.service.ts
@cynox-66
cynox-66 force-pushed the fix/credo-boundary-type-suppressions branch from 8c5f7d1 to 46e4978 Compare May 26, 2026 14:38
@cynox-66

Copy link
Copy Markdown
Contributor Author

Pushed a follow-up fix for the failing typecheck related to the local @digitalcredentials/bitstring declarations.

The issue ended up being that the new .d.ts file wasn’t included in the test typecheck config, even though the source typecheck passed locally. I updated the tsconfig include patterns and re-ran the validation flow locally (check-types, lint, build, and unit tests).

Also cleaned up the ESLint issues in the declaration file while rechecking the CI flow.

Still learning some of the repo/CI edge cases here, so thanks for the patience while I worked through it carefully.

@AlexanderShenshin

Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a1f9feb4-8135-4829-abdb-14e27eacbc2a

📥 Commits

Reviewing files that changed from the base of the PR and between 35818c4 and 46e4978.

📒 Files selected for processing (6)
  • heka-identity-service/src/common/agent/agent-modules.provider.ts
  • heka-identity-service/src/common/did-registrar/did-registrar.service.ts
  • heka-identity-service/src/proof/proof.service.ts
  • heka-identity-service/src/revocation/status-list/status-list.service.ts
  • heka-identity-service/src/types/digitalcredentials-bitstring.d.ts
  • heka-identity-service/tsconfig.test.json
💤 Files with no reviewable changes (2)
  • heka-identity-service/src/proof/proof.service.ts
  • heka-identity-service/src/revocation/status-list/status-list.service.ts

📝 Walkthrough

Walkthrough

This PR improves TypeScript type safety by introducing type declarations for the @digitalcredentials/bitstring dependency, removes or upgrades suppression comments that masked missing types, refactors DidRegistrarService to not store tenant id, and expands test file patterns in TypeScript configuration.

Changes

TypeScript Type Definitions and Service Refactoring

Layer / File(s) Summary
Bitstring type definitions and status-list cleanup
heka-identity-service/src/types/digitalcredentials-bitstring.d.ts, heka-identity-service/src/revocation/status-list/status-list.service.ts
New ambient type declarations for @digitalcredentials/bitstring module define Bitstring class (constructor accepting { length: number } or { buffer: Uint8Array }, instance methods set/get/encodeBits, static decodeBits), enabling removal of ESLint and @ts-expect-error suppressions from status-list.service.ts.
TypeScript error suppression updates in service modules
heka-identity-service/src/common/agent/agent-modules.provider.ts, heka-identity-service/src/proof/proof.service.ts
Agent modules provider replaces @ts-ignore with @ts-expect-error for AnonCredsModule registries field and documents tuple type expectation vs. runtime-conditional population; proof service removes @ts-ignore suppression from revealed_attrs access while keeping logic unchanged.
DidRegistrarService tenant initialization refactoring
heka-identity-service/src/common/did-registrar/did-registrar.service.ts
Removes class-level tenantId field and updates onApplicationBootstrap to call initTenant() for side effects only without storing the returned tenant id; comments document the record is reserved for future DID creation flow changes.
Test TypeScript configuration expansion
heka-identity-service/tsconfig.test.json
Expands include globs to add src/**/*.test.ts and src/**/*.spec.ts patterns for broader test TypeScript project coverage.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related issues

Poem

🐰 Types declared with care and grace,
Suppressions swept from every place,
Bitstring bundled, warnings gone,
Services refactored from dusk to dawn,
Clean code hops merrily along! 🌱

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately reflects the main objective: resolving @ts-ignore suppressions at the Credo-ts framework boundary through typed assertions, runtime validation, and ambient type declarations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@AlexanderShenshin
AlexanderShenshin merged commit bbf9dce into hiero-ledger:main May 27, 2026
8 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