Repository navigation
feat(metrics): add orphan-file detection via manifest and configured entry points - #207
Merged
Merged
Conversation
Upgrade wit/language.wit and wit/metric.wit to codeint:plugin@0.2.0, adding function name and cognitive-complexity fields, external(string) and builtin resolution variants, declared-dependencies, and entry-points. Bind 0.2.0 in crates/model and crates/plugin-host, detect incompatible WIT contract versions (such as 0.1.0) with an actionable IncompatibleContractVersion error, add compiling 0.2.0 stubs across all five built-in Language plugins, update the sample Wasm Plugin and sandbox probes, add 0.2.0 contract and 0.1.0 rejection tests, and update Plugin documentation. Closes #190
Implement entry_points(repository_paths, manifests) for the TypeScript/JavaScript, Rust, Python, PHP, and Dart built-in Language plugins to extract standard manifest-declared entry files from package.json, Cargo.toml, pyproject.toml, composer.json, and pubspec.yaml. Return only existing repository-relative paths present in repository_paths, deduplicated and sorted deterministically, returning an empty list cleanly when no standard entry points are declared or when a manifest is malformed. Closes #198
…ets, diff, and MCP Implement language-neutral Production reachability in codeint-metrics starting from the union of manifest-discovered entry points and codeint.json entry_points globs, classifying unreachable Production files as unreferenced or test-only, excluding Generated and Vendored Source sets, traversing cross-package monorepo imports, and staying silently inactive when zero entry points exist. Integrate orphan_files independently across TOON, JSON, SARIF, Markdown, per-Source-set Budgets, stable FindingId Regression gating in codeint diff, and codeint mcp, and update schema/codeint.schema.json and docs/reference.md. Closes #199
- Require SourceSet::Production in orphan_files::collect_roots so generated and vendored files do not activate orphan detection. - Reject parent-traversal segments in TS, Rust, PHP, and Python manifest entry points, and reject path separators or parent segments in Rust bin names. - Include src/lib.rs in Rust when autolib = false and an explicit [lib] table omits path. - Subtract null-excluded subpaths from wildcard package.json exports matches in TS.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds language-neutral Orphan files detection across all five built-in Language plugins (TypeScript/JavaScript/Vue/Svelte, Rust, Python, PHP, Dart) and external WebAssembly Plugins: extracts standard manifest entry points (
package.json,Cargo.toml,pyproject.toml,composer.json,pubspec.yaml), supports optionalentry_pointspath globs incodeint.json, computes Production reachability over resolved runtime imports (annotating files reachable only from Test files astest-only, staying silently inactive when zero entry points exist, and excluding Generated/Vendored Source sets), and integrates Budgets,CODEOWNERSattribution,codeint diffRegression gating,codeint config --resolved,codeint report,codeint schema, andcodeint mcp.Closes #175
Closes #198
Closes #199
Tier
Tier 3 from the tier check:
crates/cli/tests/check.rsandcrates/cli/tests/schema.rsupdate existing allowed-key and built-in-metric assertions to includeentry_pointsandorphan_files.Task
Spec #175 and sub-issues #198, #199:
entry-pointsextraction across TS/JS (package.json), Rust (Cargo.toml), Python (pyproject.toml), PHP (composer.json), and Dart (pubspec.yaml) returning deduplicated sorted existing repository paths (Manifestentry-pointsextraction across all five built-in Language plugins #198)unreferencedvstest-onlyclassification, silent no-op when zero entry points exist,entry_pointsconfig globs, monorepo cross-package reachability, Budgets,CODEOWNERS,codeint diffRegressions,report/schema/config --resolved, andcodeint mcp(Orphan-file reachability,test-onlylabeling,entry_pointsconfig globs, Budgets, diff, and MCP #199)Fail-first test
plugins/languages/{ts,rust,python,php,dart}/tests/entry_points.rs,crates/metrics/src/orphan_files/tests.rs(detects_live_unreferenced_and_test_only_production_files), andcrates/cli/tests/orphan_files.rs(ts_check_reports_orphan_files_across_toon_json_sarif_and_markdown_excluding_generated_and_vendored)[], all 5 core reachability tests failed (entry point activates orphan-file detection), and all 5 CLI/MCP integration tests failed (left: Null, right: 2)Checks
cargo test --workspace --lockedcargo clippy --workspace --all-targets -- -D warningscargo fmt --checkcodeint diff f5f6570lefthookpre-commit and commit-msgcargo run --package xtask -- merged-result)Safety proof
entry_pointsglobs experience zero orphan-file Findings (silent no-op), Generated and Vendored Source sets are excluded,LanguagePluginErrorpropagates without swallowing traps, and no combined score is added (ADR 0003).crates/cli/tests/orphan_files.rs(silent_no_op_when_no_entry_points_and_activates_via_config_entry_points_globs,monorepo_cross_package_reachability_and_isolated_package_safety),crates/cli/src/check/tests.rs(LanguagePluginErrorpropagation), andcodeint diff f5f6570passing with 0 regressions.interrogate: Round 1 Independent Review and adversarial verification found 4 issues (Production-only orphan roots, manifest parent-traversal rejection, Rust explicit[lib]withautolib = false, TSexportsnullexclusions), fixed indd9286f. Round 2 clean rerun verified Fixes 1-3 and caught 3 TS nested-package edge cases, fixed inddddcd3alongside mergingmain(f5f6570) at7091b7a. Round 3 clean rerun onddddcd3passed with Verdict: PASS (0 open verified findings).Runtime evidence
End-to-end CLI and MCP integration tests executed the compiled
codeintbinary on revisionddddcd3across TypeScript, Rust, and Python single-package and monorepo fixtures (orphan_files,entry_points,config,report,schema,mcp,referencetest suites all passed, andcodeint diff f5f6570exited 0 with zero regressions).Gaps