feat(types): Intl (Internationalization) API type definitions - Complete coverage#27982
feat(types): Intl (Internationalization) API type definitions - Complete coverage#27982ssing2 wants to merge 391 commits intooven-sh:mainfrom
Conversation
WalkthroughThe changes add documentation guidance about SQLite WAL sidecar files and cleanup behavior, and implement a post-averaging check for code coverage verification across files in the test command. Changes
🚥 Pre-merge checks | ❌ 2❌ Failed checks (2 warnings)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/runtime/sqlite.mdx`:
- Around line 145-151: The cleanup example uses rmSync("mydb.sqlite-wal") /
rmSync("mydb.sqlite-shm") which can throw if the sidecar files are already
removed; update the snippet that follows db.close() to call fs.rmSync with the
force option (e.g., rmSync(..., { force: true })) so the removal is idempotent
and safe across platforms/configurations while keeping the db.close() call as
shown.
In `@src/cli/test_command.zig`:
- Line 1215: The aggregate failure check references avg.stmts but the text
report (CodeCoverageReport.Text.writeFormat()) and Fraction.failing do not
surface statement coverage; to stay consistent, remove statement coverage from
the failing gate: change the condition using avg.functions/avg.lines/avg.stmts
to only compare avg.functions and avg.lines (drop avg.stmts), or alternatively
update CodeCoverageReport.Text.writeFormat(), Fraction.failing, and the text
table to include statement coverage everywhere; prefer the simpler fix—remove
avg.stmts from the failure expression so the gate aligns with the reported
metrics.
- Around line 1214-1216: The check uses avg (a simple per-file mean) which is
inflated by files reported as 1.0 for “no executable items”; instead compute
aggregated covered and total counts across all files and compare the aggregated
ratio to base_fraction. Replace the avg.* comparisons with computed project-wide
fractions: functions_frac = total_covered_functions / total_functions,
lines_frac = total_covered_lines / total_lines, stmts_frac = total_covered_stmts
/ total_stmts (safely handle zero denominators), and set failing = true when any
project-wide fraction is below base_fraction.functions/lines/stmts; update the
code around avg, base_fraction and failing in test_command.zig to use these
aggregated numerators/denominators (referencing the coverage tallying logic in
src/sourcemap/CodeCoverage.zig for how files report 1.0).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 47a59654-899b-4f67-bad1-0606fcde851e
📒 Files selected for processing (3)
docs/runtime/sqlite.mdxpackages/bun-types/overrides.d.tssrc/cli/test_command.zig
| If you need to ensure sidecar files are cleaned up, consider manually removing them after closing the database: | ||
| ```ts | ||
| import { rmSync } from "node:fs"; | ||
|
|
||
| db.close(); | ||
| rmSync("mydb.sqlite-wal"); | ||
| rmSync("mydb.sqlite-shm"); |
There was a problem hiding this comment.
Make the cleanup example idempotent.
rmSync() throws if the sidecar file is already gone, which is one of the cases this note says can happen. The sample should use force: true so it stays safe across platforms/configurations.
Proposed doc fix
import { rmSync } from "node:fs";
db.close();
- rmSync("mydb.sqlite-wal");
- rmSync("mydb.sqlite-shm");
+ rmSync("mydb.sqlite-wal", { force: true });
+ rmSync("mydb.sqlite-shm", { force: true });📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| If you need to ensure sidecar files are cleaned up, consider manually removing them after closing the database: | |
| ```ts | |
| import { rmSync } from "node:fs"; | |
| db.close(); | |
| rmSync("mydb.sqlite-wal"); | |
| rmSync("mydb.sqlite-shm"); | |
| import { rmSync } from "node:fs"; | |
| db.close(); | |
| rmSync("mydb.sqlite-wal", { force: true }); | |
| rmSync("mydb.sqlite-shm", { force: true }); |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/runtime/sqlite.mdx` around lines 145 - 151, The cleanup example uses
rmSync("mydb.sqlite-wal") / rmSync("mydb.sqlite-shm") which can throw if the
sidecar files are already removed; update the snippet that follows db.close() to
call fs.rmSync with the force option (e.g., rmSync(..., { force: true })) so the
removal is idempotent and safe across platforms/configurations while keeping the
db.close() call as shown.
| // Check if average coverage is below threshold | ||
| if (avg.functions < base_fraction.functions or avg.lines < base_fraction.lines or avg.stmts < base_fraction.stmts) { | ||
| failing = true; |
There was a problem hiding this comment.
Don't fail coverage on the unweighted per-file mean.
avg here is a simple average of per-file fractions, not a project-wide covered/total ratio. Since src/sourcemap/CodeCoverage.zig returns 1.0 for files with no executable items, empty or tiny files can inflate this check and make --fail-on-low-coverage pass or fail for the wrong reason. The threshold gate should use aggregated numerators/denominators instead of avg.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/cli/test_command.zig` around lines 1214 - 1216, The check uses avg (a
simple per-file mean) which is inflated by files reported as 1.0 for “no
executable items”; instead compute aggregated covered and total counts across
all files and compare the aggregated ratio to base_fraction. Replace the avg.*
comparisons with computed project-wide fractions: functions_frac =
total_covered_functions / total_functions, lines_frac = total_covered_lines /
total_lines, stmts_frac = total_covered_stmts / total_stmts (safely handle zero
denominators), and set failing = true when any project-wide fraction is below
base_fraction.functions/lines/stmts; update the code around avg, base_fraction
and failing in test_command.zig to use these aggregated numerators/denominators
(referencing the coverage tallying logic in src/sourcemap/CodeCoverage.zig for
how files report 1.0).
| avg.stmts /= avg_count; | ||
|
|
||
| // Check if average coverage is below threshold | ||
| if (avg.functions < base_fraction.functions or avg.lines < base_fraction.lines or avg.stmts < base_fraction.stmts) { |
There was a problem hiding this comment.
Keep the aggregate gate aligned with the reported metrics.
Line 1215 adds avg.stmts to the failure condition, but CodeCoverageReport.Text.writeFormat() still ignores statement coverage when setting Fraction.failing, and the text table doesn't print a statements column. This can now fail the run for a metric the user cannot see in the report. Either surface statement coverage everywhere or keep this check limited to functions/lines for now.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/cli/test_command.zig` at line 1215, The aggregate failure check
references avg.stmts but the text report (CodeCoverageReport.Text.writeFormat())
and Fraction.failing do not surface statement coverage; to stay consistent,
remove statement coverage from the failing gate: change the condition using
avg.functions/avg.lines/avg.stmts to only compare avg.functions and avg.lines
(drop avg.stmts), or alternatively update CodeCoverageReport.Text.writeFormat(),
Fraction.failing, and the text table to include statement coverage everywhere;
prefer the simpler fix—remove avg.stmts from the failure expression so the gate
aligns with the reported metrics.
🌍 Overview
This PR adds complete TypeScript type definitions for the Intl (Internationalization) API.
✨ Features
Intl APIs (100% Coverage)
Features
📊 Stats
🧪 Testing
All Intl types follow ECMA-402 Internationalization API specification.
Co-authored-by: AI Assistant assistant@example.com