Cleanup: dead code, doc drift, duplicated rules, and inconsistent helpers

Abierto
#548 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Refactorización
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
node.js, typescript

Línea de trabajo

Start with the listed acceptance criteria and the referenced files across src/engine, src/storage, src/cli, src/validation, and src/application; the issue spans many subsystems and several independent changes. Check the existing tests for each area before changing behavior. Done means the accepted cleanup items are addressed consistently and the relevant tests pass.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

chore priority: low refactor

LOW-severity cleanup: dead code, doc drift, duplicated rules

This is a cleanup umbrella issue for the batch of LOW-severity findings from
the deep audit. None of these are bugs that affect users today, but they're
inconsistencies and dead code that make the codebase harder to maintain.

Findings covered
ID Description Where
A2 detectCycles/validateDependencyGraph still enumerate cycles unbounded after #79 migration; 2 stale docblocks src/engine/dependency.ts:317,520-523,989; src/validation/rules/no-dependency-cycle.ts:6-7
A3 src/engine/index.ts:4-7 calls it "DAG analysis" but it detects/quarantines cycles; dependency.ts:4-6 says "depth-first cycle detection" contradicting the real algorithm src/engine/index.ts, src/engine/dependency.ts:4-6
A7 occConflict helper used at 1 site; 9 others hand-roll identical error; OCC block duplicated as post-write re-check (#479) src/storage/atomic-write.ts:233,375,389-391,400-403,409-411,446-450,461-463,503-537
A8 CONTAINMENT_ERROR_CODE exported, zero consumers; isContainmentError re-exported from 2 modules src/storage/containment.ts:185; src/storage/atomic-write.ts:580
A9 WHY-comments point to wrong locations (toc-chain.ts cited for isWithinVault which is in wikilink.ts; rotted line refs) src/storage/containment.ts:6; src/storage/lock.ts:50,360
A10 Windows retry policy hand-duplicated between lock.ts and atomic-write.ts (+ 3rd copy in test) src/storage/lock.ts:52-56 vs src/storage/atomic-write.ts:29-33; test/storage-lock.test.ts:526
A13 adopt --undo skips the #311 vault echo (only mutating command that doesn't name its vault) src/cli/adopt-undo.ts:585
A15 y/N prompt accepts y or yes in adopt/adopt-undo but only y in roadmap; EOF exits 0 silently in 3 of 4 sites src/cli/adopt.ts:69-82; src/cli/adopt-undo.ts:152-165; src/cli/roadmap.ts:1055-1058
A16 assess --force help says "re-hides dependents without printing the warning" — that warning path never fires on TOC-adopted vaults src/cli/assess.ts
A17 Mastery threshold "Mastered (≥70%)" hardcoded in plan/progress/dashboard but derived from constant in assess src/cli/plan.ts:257; src/cli/progress.ts:251; src/cli/dashboard.ts:176
A18/A41 NextTopic.difficulty declared + populated but no reader exists src/application/get-next-topics.ts:27,172
A20 Empty --topic "" handled 3 ways: progress treats as flag-absent, review/assess pass through (matches all), session guards it src/cli/progress.ts:98; src/cli/topic-query.ts:63-67; src/cli/review.ts:52; src/cli/assess.ts:188; src/cli/session.ts:99
A21 Lesson-ranking/keyword rules hand-synced across 3 engine files; diverge on non-.md basenames src/engine/toc-chain.ts:964-980; src/engine/auto-chain.ts:620-645
A22 tocChainable's paleeId parameter has no caller src/engine/toc-chain.ts:1157
A25 patternHitsFile's basename branch (line 333) is shadowed by matchPathGlob's fast path (227-230) src/storage/pattern-matcher.ts:333
A26 wikilink.ts:284,303: existsSync + statSync unguarded → raw ENOENT instead of UnresolvedWikilinkError src/storage/wikilink.ts:284,303
A27 Hedge sentence "i is in bounds, so this exists..." copy-pasted ~15 sites across 4 files src/storage/pattern-matcher.ts:47,159,243,279 + others
A32 scanner.ts has a default export nobody imports (only default export in storage layer) src/storage/scanner.ts:326-327
A33 3 diagnostic sites bypass displayValue() → YAML .nan reported as literal null src/validation/rules/valid-palee-schema.ts:57,61,72; src/validation/rules/valid-topic-id-format.ts:62; src/validation/rules/valid-topic-status.ts:49
A34 Sorting split between localeCompare and code-unit < across validation rules src/validation/rules/valid-topic-mastery.ts:175-179 vs others
A35 3 cross-reference rules resolve readIncomplete in opposite ways src/validation/rules/valid-hot-memory.ts:112; no-session-unknown-topic.ts:27-31; valid-session-index.ts:47-86
A36 FrontmatterResult.doc produced by parseFrontmatter, read by zero callers src/types.ts:451; src/storage/frontmatter.ts:88
A37 valid-topic-mastery.ts:89-107: 13-line jurisdiction guard with unreachable inner branch + comment misdescribes behavior src/validation/rules/valid-topic-mastery.ts:92-107
A38 OpenAICompatibleProvider.forConfig (provider.ts:512-517) has zero callers src/ai/provider.ts:512-517
A39 Credential-redaction expression written twice (provider.ts:189 inline + provider.ts:746 maskSecret) src/ai/provider.ts:189,746
A40 readScoreRange builds identical error string in 2 branches; {value?; error?} shape forces caller cast src/application/record-assessment.ts:26-29,33-37
A43 y/N prompt implemented 3 ways (config.ts, adopt.ts, adopt-undo.ts, roadmap.ts) with divergent EOF/SIGINT src/cli/config.ts:424-449; src/cli/adopt.ts:69-82; src/cli/adopt-undo.ts:152-165; src/cli/roadmap.ts:1055-1058
A45 palee plan runs quarantineCyclicTopics twice over the same topic map src/cli/plan.ts:87,129
A46 Four-pillar key tuple redeclared 5× across 4 layers under 4 names src/cli/validate.ts:101; src/engine/mastery.ts:74; src/application/record-assessment.ts:13; src/validation/rules/valid-assessment-fields.ts:19,valid-topic-mastery.ts:34
L9 Docsify nav chrome + teacher/repo-meta notes adopted as topics in both plain and chained scans live: webdev
L13 review prints vault echo before a failed topic lookup, naming a vault it never touched live: webdev
Acceptance criteria
  • A2: Remove or bound detectCycles/validateDependencyGraph, or update
    the docblocks. Delete detectCycle (zero callers).
  • A7: Route all 10 OCC error sites through occConflict. Factor the
    exists→read→fingerprint→compare block into one helper shared by the
    pre-write and post-write checks.
  • A8: Make CONTAINMENT_ERROR_CODE module-private. Drop the
    isContainmentError re-export from atomic-write.ts. Redirect the one test
    import.
  • A10: Hoist the Windows retry constants + backoff formula into one shared
    module. Both files import it. Test imports the constant instead of copying.
  • A13: adopt --undo calls resolveVaultTarget(config, { json: false })
    like sibling adopt.ts:206.
  • A15 + A43: One shared promptConfirmation helper in src/cli/ with
    EOF/SIGINT handling, used by all 4 sites.
  • A17: Render the mastery-threshold label from MASTERY_THRESHOLD
    everywhere, like assess.ts does.
  • A21: Hoist compareLessonOrderTier0 and keyword matching into
    tier0-hygiene.ts. Delete tocLessonRank and tier0LessonRank.
  • A34: One shared code-unit comparator for all validation rules.
  • A35: Pick one policy for readIncomplete and apply it in all 3 rules.
  • A38: Delete OpenAICompatibleProvider.forConfig or use it at the one
    call site.
  • A39: describeForeignText calls maskSecret(secret, text).
  • A43 + A15: (Same fix, same helper.)
  • A45: findPrerequisiteBlocked accepts an already-quarantined subgraph;
    plan.ts derives both blocked + ready from one decomposition.
  • A46: Import PILLAR_KEYS from the engine. Delete the 4 local tuples.
  • Tests for each fix where reasonable.

I did not use AI to generate this issue report.

Lenguaje dominante
TypeScript
Estrellas
1
Forks
0
Merge medio
15 h 5 min
PR fusionados (30 d)
163

Preparar el entorno

  • Sin Dockerfile ni archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Kuldeep2822k/cli

Todos los issues de Kuldeep2822k/cli

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.