docs(parity): regenerate runtime-parity-gaps from a committed generator#5204
docs(parity): regenerate runtime-parity-gaps from a committed generator#5204TheHypnoo wants to merge 2 commits into
Conversation
The previous gap doc was produced by an ad-hoc, uncommitted script whose matcher never parsed crates/perry-api-manifest/src/entries.rs. As a result nearly every manifest-covered API was counted as a gap: the doc claimed ~1922 gaps when the real figure is ~296 across node:* modules. Add scripts/gen_parity_gaps.py, which reconciles docs/runtime-parity.md (the API inventory) against four coverage sources - manifest method/property rows, compound Expr::* HIR variants, js_* FFI exports, and module-gated dispatch literals - and regenerate docs/runtime-parity-gaps.md from it. Examples of corrected counts: - node:crypto: 124 -> 5 real gaps (X509Certificate, KeyObject.from, setEngine, fips) - node:dns / dns/promises / v8 / inspector / string_decoder: were listed as "zero coverage" but are implemented - node:http: 89 -> 1; node:zlib: ~75 -> 1
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds ChangesParity Gap Report Generator
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
scripts/gen_parity_gaps.py (2)
37-40: 💤 Low valueConsider iterable unpacking for cleaner list construction.
Using
[*static, *dynamic]unpacking is more idiomatic than list concatenation.♻️ Suggested refactor
-SRC_DIRS = [ - ROOT / "crates" / "perry-runtime" / "src", - ROOT / "crates" / "perry-stdlib" / "src", -] + sorted((ROOT / "crates").glob("perry-ext-*/src")) +SRC_DIRS = [ + ROOT / "crates" / "perry-runtime" / "src", + ROOT / "crates" / "perry-stdlib" / "src", + *sorted((ROOT / "crates").glob("perry-ext-*/src")), +]🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/gen_parity_gaps.py` around lines 37 - 40, The SRC_DIRS list construction uses the concatenation operator (+) to combine a static list with dynamically sorted glob results. Refactor this to use iterable unpacking syntax instead by moving the sorted((ROOT / "crates").glob("perry-ext-*/src")) expression inside the list literal and unpacking it with the * operator, making the code more idiomatic and readable.Source: Linters/SAST tools
136-152: 💤 Low valueUnused
literalscollection.
scan_ffi_and_dispatch()collects dispatch literals (line 150-151), but this return value is discarded incompute()(assigned to_literalsand never used). Thecovered()function re-scans files with its own patterns instead.Either remove the unused collection or, if it was intended to optimize the dispatch-literal check in
covered(), consider passingliteralstocovered()to avoid repeated regex searches over the same files.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/gen_parity_gaps.py` around lines 136 - 152, The `scan_ffi_and_dispatch()` function collects dispatch literals via regex pattern matching, but the returned literals are discarded (assigned to `_literals`) in the `compute()` function and never used. Meanwhile, the `covered()` function performs its own regex searches instead of reusing the pre-collected literals. Either remove the literal collection logic from `scan_ffi_and_dispatch()` and its return value, or refactor to pass the literals set to the `covered()` function and update it to use the pre-collected literals instead of rescanning files with its own regex patterns.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/gen_parity_gaps.py`:
- Around line 79-82: In the node module path extraction logic where the regex
search result is processed, line 81 contains a conditional assignment to cur
that is immediately overwritten by line 82. The conditional logic on line 81
checking whether "/" is in title and conditionally splitting the path has no
effect since line 82 unconditionally assigns nm.group(1) to cur. Remove the dead
code on line 81 entirely, keeping only line 82 which correctly assigns the full
path (e.g., fs/promises) as indicated by the comment.
---
Nitpick comments:
In `@scripts/gen_parity_gaps.py`:
- Around line 37-40: The SRC_DIRS list construction uses the concatenation
operator (+) to combine a static list with dynamically sorted glob results.
Refactor this to use iterable unpacking syntax instead by moving the
sorted((ROOT / "crates").glob("perry-ext-*/src")) expression inside the list
literal and unpacking it with the * operator, making the code more idiomatic and
readable.
- Around line 136-152: The `scan_ffi_and_dispatch()` function collects dispatch
literals via regex pattern matching, but the returned literals are discarded
(assigned to `_literals`) in the `compute()` function and never used. Meanwhile,
the `covered()` function performs its own regex searches instead of reusing the
pre-collected literals. Either remove the literal collection logic from
`scan_ffi_and_dispatch()` and its return value, or refactor to pass the literals
set to the `covered()` function and update it to use the pre-collected literals
instead of rescanning files with its own regex patterns.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: b18b4e46-9f13-4404-b703-5940d1320043
📒 Files selected for processing (2)
docs/runtime-parity-gaps.mdscripts/gen_parity_gaps.py
Line was immediately overwritten by the unconditional assignment on the next line; the split-on-slash branch never took effect. Behavior-neutral (regenerated doc is byte-identical).
What
Replaces the hand-rolled, badly inaccurate
docs/runtime-parity-gaps.mdwith a doc regenerated from a committed, reproducible generator (scripts/gen_parity_gaps.py).Why
The old doc's generator was never committed and never parsed the API manifest (
crates/perry-api-manifest/src/entries.rs). Since that manifest is the authoritative set of compile-time-dispatched APIs (a CI test asserts it mirrorsNATIVE_MODULE_TABLE), missing it meant counting almost everything as a gap.node:*modules (2222 covered / 296 gap) — a ~6x over-count.node:dns,node:dns/promises,node:v8,node:inspector,node:string_decoder), though all are implemented.node:crypto: doc said 14 covered / 124 gap; reality is 133 / 5 (the 5 matchtest-parity/node-suite/crypto/README.md:X509Certificate,KeyObject.from/CryptoKey identity,setEngine,fips).How
gen_parity_gaps.pyderives coverage from four sources: manifestmethod/propertyrows, compoundExpr::*HIR variants,js_*FFI exports, and module-gated dispatch literals. Re-run withpython3 scripts/gen_parity_gaps.py --emit.The matcher is conservative and self-documents its caveats (module-gated dispatch to avoid stub false-positives; an audited
MANUAL_COVERAGEtable for APIs dispatched in generic, non-module-named files such asKeyObjectaccess inperry-runtime/src/object/field_get_set.rs).Summary by CodeRabbit
runtime-parity-gapsmarkdown report in one step.