Skip to content

fix: package --doc corpus for crates.io + CEL doc examples + v3.0.2#16

Merged
ffedoroff merged 4 commits into
mainfrom
fix/doc-corpus-packaging-and-cel-examples
Jun 22, 2026
Merged

fix: package --doc corpus for crates.io + CEL doc examples + v3.0.2#16
ffedoroff merged 4 commits into
mainfrom
fix/doc-corpus-packaging-and-cel-examples

Conversation

@ffedoroff

Copy link
Copy Markdown
Owner

Summary

Three logical changes, bundled (release-prep + doc fixes surfaced in one session):

  1. Package the --doc corpus into the crates.io tarball (build.rs + crates-io.yml)

    • --doc HK etc. is embedded at build time by build.rs walking the repo-root languages/ tree. That tree lives outside the crate, so it never reached the crates.io tarball — cargo install code-ranker from crates.io produced a binary with an empty corpus and --doc reported not embedded.
    • Fix mirrors the existing per-crate README copy: the publish workflow now copies languages/ into a package-local crates/code-ranker-cli/languages/ right before cargo publish (--allow-dirty tolerates it), and build.rs prefers that package-local copy, falling back to the repo-root tree for workspace/dev builds. No symlinks; the copy is materialized only at publish time.
    • Verified: cargo package --list includes all 66 corpus .md files; a build from the package-local copy serves --doc HK.
  2. CEL reference doc fixes (docs/customization/cel-reference.md)

    • The wide_hub example was titled "list macros" but used no macro — deps.size() > 20 is just fan_out > 20. Replaced with a real filter macro (wide_ext_hub) plus a parallel metrics-context macro over a literal list (graph lists are checks-only).
    • Added a worked dense-complexity example: size-normalized metrics (cognitive/cyclomatic per 100 SLOC) + a check flagging short-but-dense files relative to the repo's own distribution (both densities > p90, sloc < median). Every snippet verified against the repo before documenting.
  3. Release v3.0.2 — version bump across the 5 crates + synced doc version refs.

Validation

  • make all: PASS — build/test/clippy PASS, lychee 0 errors, markdownlint 0 errors (95 files), self-check clean, coverage 96.18% (> 90% floor).
  • make e2e: PASS — 52 passed, 0 failed.

https://claude.ai/code/session_013R7NfedZh9uEkUQrSRGWR7

The doc corpus (`--doc HK` etc.) is embedded at build time by build.rs walking
the repo-root `languages/` tree. That tree lives outside the crate, so it is not
in the crates.io tarball — `cargo install code-ranker` from crates.io produced a
binary with an EMPTY corpus and `--doc` reported "not embedded".

Mirror the existing per-crate README copy: the publish workflow now copies
`languages/` into a package-local `crates/code-ranker-cli/languages/` right before
`cargo publish` (--allow-dirty tolerates it), and build.rs prefers that
package-local copy, falling back to the repo-root tree for workspace/dev builds.
No symlinks; the package-local copy is materialized only at publish time.

Verified: `cargo package --list` includes all 66 corpus .md files; a build from
the package-local copy serves `--doc HK`.

Claude-Session: https://claude.ai/code/session_013R7NfedZh9uEkUQrSRGWR7
…mplexity

The `wide_hub` example in cel-reference.md was titled "list macros" but used no
macro — `deps.size() > 20` is just `fan_out > 20`. Replace it with a real
`filter` macro (`wide_ext_hub`, counts external crates) and add a parallel
metrics-context macro over a literal list, noting graph lists are checks-only.

Add a worked "dense complexity" example: size-normalized metrics
(cognitive/cyclomatic per 100 SLOC) plus a check that flags short-but-dense files
relative to the repo's own distribution (both densities > p90, sloc < median).
All snippets verified against the repo before documenting.

Claude-Session: https://claude.ai/code/session_013R7NfedZh9uEkUQrSRGWR7
@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown

code-ranker

Verdict vs main: ➖ neutral

No new violations vs the baseline. 🎉

📦 Full HTML report: see the code-ranker-report artifact on this run.

@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.68%. Comparing base (063921b) to head (32e9586).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #16   +/-   ##
=======================================
  Coverage   97.68%   97.68%           
=======================================
  Files         121      121           
  Lines       13971    13971           
=======================================
  Hits        13648    13648           
  Misses        323      323           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Replace GitHub's default CodeQL setup (which re-analyzed every language on every
PR) with an advanced workflow that scans a language only when that language's
source actually changed. A `changes` job classifies the diff by file extension
via dorny/paths-filter and emits a matrix of just the affected languages:

  - docs/golden-only PR (*.md, *.json, *.sarif, …) → analyze job skipped entirely
  - any *.rs change → rust (whole product) + actions
  - a *.cs fixture change → only csharp

Keying on extension (not folder) is deliberate: golden snapshots and a plugin's
own Rust files (e.g. languages/csharp/dialect.rs) don't trigger a pointless
re-scan of that fixture language, while real code outside the fixtures stays
covered (rust spans all *.rs, javascript-typescript includes the viewer assets,
python includes .github/scripts). go uses build-mode autobuild (no buildless
mode); all others use build-mode none. A weekly schedule forces a full scan.

Requires default setup to be turned off (done via the
code-scanning/default-setup API) so the two don't conflict.

Claude-Session: https://claude.ai/code/session_013R7NfedZh9uEkUQrSRGWR7
@ffedoroff ffedoroff merged commit 26d43fc into main Jun 22, 2026
12 checks passed
@ffedoroff ffedoroff deleted the fix/doc-corpus-packaging-and-cel-examples branch June 22, 2026 12:02
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.

1 participant