Skip to content

Refactor: remove dead code, fix stale docstring, tighten server any types - #198

Merged
buzz-code merged 1 commit into
mainfrom
refactor/tech-debt-cleanup
Oct 5, 2026
Merged

buzz-code merged 1 commit into
mainfrom
refactor/tech-debt-cleanup

Conversation

@buzz-code

Copy link
Copy Markdown
Owner

Summary

Small, low-risk technical-debt cleanup pass. No API/route/DTO/response-shape changes.

  • Dead code: removed a commented-out @ManyToOne/@JoinColumn block on StudentByYear view entity (unlike User.entity.ts, nothing references .student as an inverse-side callback, so it wasn't serving any type-checking purpose); removed two commented-out disabled export-header columns (approvedAbsCount/sheetName) in att-report-with-report-month.config.ts that reference fields not present on the view entity; removed a commented-out filter block + its now-unused DateInput import in student-percent-report.jsx; removed unused MichlolPopulatedFileParams import in its spec; removed unused gradeAvg/lessonsCount destructure in michlolPopulatedFile.ts; removed a leftover client console.log.
  • Docs: fixed YemotHandlerService's stale class docstring — it said the service "currently returns a maintenance mode message," but that's only one early-exit path; it actually routes to manager-report-status, seminar-attendance, or transportation-report flows.
  • Type safety: replaced a handful of server-side any with real types where doing so is safe and verified with tsc --noEmit (student-percent-report.config.ts's debug field and fetchAttGradeEffect's viewEntity param; student-by-year.config.ts's header thresholds field using the existing AbsenceThreshold type).
  • DRY: att-report-with-report-month.config.ts's deleteOne now reuses the file's existing getAttReportService() helper instead of duplicating the BaseEntityService construction inline.

Left alone (not safely fixable here)

Most other any in server/src/entity-modules/*.config.ts (CrudRequest<any, any>, doAction/populatePivotData overrides, req.parsed.extra/filter.value) is inherited from the shared nra-server submodule's own base-class method signatures and from @dataui/crud-request's library types. Narrowing those locally isn't possible without changing the submodule (out of scope per task instructions) or risking behavior changes. Confirmed with tsc --noEmit: forcing stricter types on teacher.config.ts's export-header formatter, for instance, fails to compile because BaseEntityModuleOptions.exporter isn't generic over the entity type in the shared lib.

Test plan

  • cd server && yarn test — 119 suites / 1155 tests passed (before and after)
  • cd client && yarn test — 34 suites / 214 tests passed (before and after)
  • cd server && npx tsc --noEmit — clean

🤖 Generated with Claude Code

https://claude.ai/code/session_017mJpVpL5fuvKVhGyMPLeUh


Generated by Claude Code

…ypes

- Remove commented-out unused ManyToOne/JoinColumn block on StudentByYear
  view entity (no inverse-side reference uses it, unlike User.entity.ts's
  intentionally-kept pattern).
- Remove two commented-out disabled export-header columns
  (approvedAbsCount/sheetName) referencing fields that don't exist on
  AttReportWithReportMonth.
- Remove unused DateInput import/commented filters in
  student-percent-report.jsx, unused MichlolPopulatedFileParams import in
  its spec, unused gradeAvg/lessonsCount destructure in
  michlolPopulatedFile.ts, and a leftover client console.log.
- Fix stale YemotHandlerService class docstring: it no longer just
  "returns a maintenance mode message", it routes manager/seminar/
  transportation call flows.
- Replace several server-side `any` types with real types where safe
  (student-percent-report.config.ts's debug field and
  fetchAttGradeEffect's viewEntity param, student-by-year.config.ts's
  header thresholds field) verified with `tsc --noEmit`.
- DRY: att-report-with-report-month.config.ts's deleteOne now reuses the
  existing getAttReportService() helper instead of duplicating the
  BaseEntityService construction.

Left @dataui/crud-tied `any` (CrudRequest<any,any>, doAction/
populatePivotData overrides, req.parsed.extra/filter.value) alone: their
`any` originates in the nra-server shared submodule's own base class
signatures and the crud-request library's types, so narrowing them here
isn't safely possible without changing that submodule.

All existing tests verified passing before and after (server: 119 suites/
1155 tests; client: 34 suites/214 tests), plus a clean `tsc --noEmit`.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017mJpVpL5fuvKVhGyMPLeUh
Copilot AI lite review requested due to automatic review settings September 26, 2026 06:50

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.

Copilot review overview

🟢 Approval recommended

No blocking issues were identified; the remaining feedback is a minor typing nit.

Review effort: Lite
Findings: 1 Low severity

Open (1)
What changed in this PR

Technical-debt cleanup removing dead code, correcting documentation, tightening selected server types, and reusing an existing helper without API changes.

Changes:

  • Removed unused code, imports, variables, comments, and logging.
  • Updated Yemot service documentation.
  • Tightened selected server types and typed absence thresholds.
  • Reused the attendance report service helper.
File Description
server/​src/​yemot-handler.service.ts Corrected service documentation
server/​src/​reports/​michlolPopulatedFile.ts Removed unused values
server/​src/​reports/​__tests__/​michlolPopulatedFile.spec.ts Removed unused import
server/​src/​entity-modules/​student-percent-report.config.ts Added explicit types
server/​src/​entity-modules/​student-by-year.config.ts Typed threshold headers
server/​src/​entity-modules/​att-report-with-report-month.config.ts Removed dead headers and reused helper
server/​src/​db/​view-entities/​StudentByYear.entity.ts Removed dead relation comments
client/​src/​entities/​student-percent-report.jsx Removed dead filters and import
client/​src/​components/​ApprovedAbsencesUpload/​useFileProcessor.js Removed leftover logging

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@buzz-code
buzz-code merged commit 313660e into main Oct 5, 2026
5 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.

3 participants