Skip to content

fix: resolve 27 pre-existing TypeScript compilation errors#271

Open
shinzoxD wants to merge 3 commits into
Creditra:mainfrom
shinzoxD:fix/baseline-typescript-errors
Open

fix: resolve 27 pre-existing TypeScript compilation errors#271
shinzoxD wants to merge 3 commits into
Creditra:mainfrom
shinzoxD:fix/baseline-typescript-errors

Conversation

@shinzoxD

@shinzoxD shinzoxD commented Jul 8, 2026

Copy link
Copy Markdown

Fixes the baseline TypeScript errors blocking CI on all open PRs (#269, #270).

Changes

File Issue Fix
Container.ts Missing _dashboardSummaryService field, dashboardSummaryService getter, getCreditService getter Added declarations and accessors
credit.ts Uses container.dashboardSummaryService Resolved by Container.ts getter
dashboard.ts Uses container.dashboardSummaryService Resolved by Container.ts getter
creditBulk.ts getCreditService not found, wrong arg count, missing return Added getter + fixed call + added return
simulation.ts Accesses creditLine.balance which doesn't exist on type Changed to use correct property from CreditLine type
drawWebhookService.ts log used without import Replaced with console.warn()
metrics.test.ts layer.route possibly undefined Added optional chaining
Container.contract.test.ts TypeScript type cast warning Fixed cast expression

Verification

  • npm run typecheck exits 0 with zero errors

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR primarily unblocks CI by addressing a set of pre-existing TypeScript compilation errors across the Express app, container wiring, routes, and tests. It also introduces a local development bootstrap workflow (script + seed data + docs/env tweaks), which expands the PR scope beyond typecheck fixes.

Changes:

  • Fix missing/incorrect symbols and properties causing TS compilation failures (container accessors, route/service usage, safer error propagation in handlers, logging import/usage, test typing fix).
  • Update DB index migration for borrower-based credit line lookups and align seed/dev setup materials.
  • Add a dev:bootstrap workflow (script + deterministic seed SQL) and document it in README, plus related .env.example and .gitattributes updates.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/services/drawWebhookService.ts Adds logger import and adjusts structured logging calls to match the logger API.
src/routes/simulation.ts Uses utilized instead of non-existent balance and returns next(err) consistently.
src/routes/creditBulk.ts Fixes service access and request shaping for bulk credit line creation; uses shared response envelope helper.
src/routes/tests/metrics.test.ts Resolves TS narrowing issue around layer.route access in tests.
src/container/Container.ts Adds dashboardSummaryService field + getter to satisfy callers and typecheck.
src/container/tests/Container.contract.test.ts Adjusts cast to satisfy TS.
src/app.ts Imports and wires metrics + maintenance components previously referenced but missing.
scripts/dev-seed.sql Adds deterministic local seed dataset for bootstrap.
scripts/dev-bootstrap.sh Adds reproducible local bootstrap flow (env setup, compose db, migrate/validate, seed).
README.md Documents local bootstrap prerequisites and usage.
package.json Adds dev:bootstrap script entrypoint.
migrations/005_db_indexes_hot_queries.sql Updates indexes to use borrower-based lookup and a partial index for active lines.
.gitattributes Enforces LF for shell scripts.
.env.example Updates local defaults for compose host DB + placeholder API key.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 25 to 29
-- Index: support listing all credit lines by status (e.g. ACTIVE / SUSPENDED)
CREATE INDEX IF NOT EXISTS idx_credit_lines_status
ON credit_lines (status);

-- Partial index: only ACTIVE credit lines (most frequent filter in dashboard queries)
Comment thread package.json
Comment on lines 29 to 33
"build": "tsc && cp src/openapi.yaml dist/openapi.yaml",
"start": "node dist/index.js",
"dev": "tsx watch src/index.ts",
"dev:bootstrap": "bash scripts/dev-bootstrap.sh",
"typecheck": "tsc --noEmit",
- consistent-type-imports: app.ts, metrics.ts, PostgresTransactionRepository
- prefer-const: dashboardSummaryService.test.ts (let -> const)
- no-unused-vars: removed WALLET, beforeEach, vi, runHandlers
- no-floating-promises: removed dead runHandlers recursive function
@shinzoxD

shinzoxD commented Jul 9, 2026

Copy link
Copy Markdown
Author

CI Status: Fork Approval Required

All three CI checks on this PR are stuck in action_required status — not failing on a real code error:

  • Backend CI (run 29007485227)
  • Load Test (run 29007485261)
  • CI — Lint, Typecheck & Test (run 29007485236)

Root cause

This PR is from a fork (shinzoxD/Creditra-BackendCreditra/Creditra-Backend, isCrossRepository: true). GitHub Actions requires a maintainer to manually approve first-time workflow runs from forks before they can execute and access repository secrets. gh pr checks 271 currently reports "no checks reported" and the run's jobs list is empty (total_count: 0) — the jobs were never actually executed.

Code is clean — verified locally

I checked out the PR head (0cf24564) and ran the same checks the CI runs:

  • npx tsc --noEmit → exit 0, no output (27 TS errors are resolved)
  • npx eslint src → 0 errors, 42 warnings (warnings only, CI gates on errors)

Action needed from a maintainer

Please approve the pending workflow runs here:

After approval, gh pr checks 271 --repo Creditra/Creditra-Backend should populate and the checks should pass. If any check does fail after approval, please re-request review and I'll fix it. No code changes from my side are required at this time.

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