Skip to content

enhancement: cora dead-code ~82% false positives on framework-called methods (Phaser/SvelteKit); needs symbol-level skip #452

Closed

Description

@ajianaz

Is your feature request related to a problem?

cora dead-code reports 261 symbols on a SvelteKit + Phaser + Rust/Axum project. Manual triage shows ~82% (213/261) are false positives — methods invoked by frameworks via string/attribute registration, not explicit calls. The current skip mechanism (index_skip_files, added in v0.11.1 via #447) is file-level only and cannot suppress individual lifecycle methods without removing all symbols from the file.

Breakdown (261 total)

Category Count Why flagged Reality
Phaser scene methods (create, init, update, preload, *Scene class methods) 155 no explicit caller called by Phaser Scene registry
Rust route handlers + error mappers (login, me, health_check, submit_progress, bad_request, …) 41 no explicit caller wired in build_router (Axum)
SvelteKit route exports (load, entries, GET/POST in +page.ts/+server.ts) 12 no explicit caller framework-called
Test helpers 4 no explicit caller test runner
Svelte template-only utils (cn) 1 no explicit caller used inside .svelte markup

After removing genuinely dead code, only ~48 candidates remained for review.

Current mitigations (insufficient)

Proposed

Framework-aware "called by framework" detection, plus a symbol-level escape hatch:

  1. Phaser: methods on classes extending Phaser.Scene (create, init, preload, update) → mark as entry points.
  2. SvelteKit: exports of +page.ts / +layout.ts / +server.ts (load, entries, GET, POST, …) → entry points.
  3. Svelte actions: functions used as use:foo in .svelte markup → recognized as called.
  4. Symbol-level suppression marker (parity with the file-level skip in fix: add skip list for index scanners to reduce false positives on entry-point files #447): support // cora: keep / // cora:inline comments, or reuse Rust's #[allow(dead_code)] / TS // eslint-disable style markers that cora already understands.
  5. Config knob in rules_engine, e.g. entry_point_methods: ["Phaser.Scene::create", "Phaser.Scene::init", ...] with sensible framework defaults.

Environment

  • cora 0.11.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestscope:code-intelCode intelligence — indexing, graph, impact analysis

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions