Skip to content

chore: clear the 9 pre-existing CodeQL baseline alerts - #157

Merged
jagguji merged 1 commit into
mainfrom
chore/codeql-baseline-hardening
Jul 22, 2026
Merged

chore: clear the 9 pre-existing CodeQL baseline alerts#157
jagguji merged 1 commit into
mainfrom
chore/codeql-baseline-hardening

Conversation

@jagguji

@jagguji jagguji commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

The repo has 9 open CodeQL alerts on main (visible in the default-branch scan). None come from any feature PR — they get re-attributed onto large-regeneration PRs (#153, #156) by CodeQL's "changes too large" re-scan, showing up as a red aggregate CodeQL check even though the Analyze jobs pass. This clears the root debt so that check goes green.

Fixes

Code — js/file-system-race (high ×3) + js/identity-replacement (medium)

  • test/lib/diff.mjsreaddirSync(dir, { withFileTypes: true }) instead of readdir + a separate statSync (the stat is a check-then-read TOCTOU: the file could vanish between the two syscalls).
  • src/cli.mjsunlink directly inside the existing try/catch instead of existsSync-then-unlink (the check-then-unlink is the race; the catch already handles "already gone").
  • benchmark/run.mjs — read the prior lock-stamp via try/catch instead of existsSync-then-readFileSync; and drop the .replace(/^_/, '_') in slugOf, which was an identity no-op ("@s/p""_s_p" already starts with _).

Workflows — actions/missing-workflow-permissions (medium ×3) + actions/unpinned-tag (medium ×2)

  • ci.yml — add permissions: contents: read to the test / compile / fixture-guard jobs (least-privilege; the preview job already declared its own).
  • benchmark.yml + yama-review.yml — pin marocchino/sticky-pull-request-comment and juspay/yama to their release commit SHAs, with the # v3 / # v2.7.1 version as trailing comments (the CodeQL-recommended form). Note: yama-review.yml is generated by juspay/yama's setup script, so a future regen may need the pin re-applied.

Safety

All behaviour-preserving — verified: 104 goldens match + compile, benchmark byte-identical (the slugOf and lock-stamp changes are proven by the baselines still resolving), and the workflows parse. No src/ runtime logic changed (the cli.mjs edit is the --clean stale-file removal, same effect).

After this merges, the pre-existing alerts clear repo-wide and the red CodeQL check on #156 (and future large-regen PRs) goes green.

🤖 Generated with Claude Code

None are introduced by any feature PR — they surface repo-wide on main and got
re-attributed onto large-regen PRs (#153/#156) by CodeQL's "changes too large"
re-scan. Fixing the root debt so the aggregate CodeQL check goes green.

Code (js/file-system-race + js/identity-replacement):
- test/lib/diff.mjs: readdirSync({withFileTypes}) instead of readdir + separate
  statSync (the stat is a check-then-read TOCTOU).
- src/cli.mjs: unlink directly + catch ENOENT instead of existsSync-then-unlink.
- benchmark/run.mjs: read the prior lock-stamp via try/catch instead of
  existsSync-then-readFileSync; drop the identity `.replace(/^_/, '_')` no-op in slugOf.

Workflows (actions/missing-workflow-permissions + actions/unpinned-tag):
- ci.yml: add `permissions: contents: read` to the test / compile / fixture-guard
  jobs (least privilege; preview already had its own).
- benchmark.yml + yama-review.yml: pin marocchino/sticky-pull-request-comment and
  juspay/yama to their release SHAs (v3 / v2.7.1 kept as trailing comments).

All behaviour-preserving: 104 goldens match + compile, benchmark byte-identical
(slug + stamp changes verified), workflows parse.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Benchmark: ✅ PASS

Package Compile Diff vs baseline usable review broken Verdict
@juspay/blend-design-system@0.0.36 identical 102 5 0 ✅ PASS
@juspay/blend-design-system@0.0.37-beta.8 identical 215 7 0 ✅ PASS
react-day-picker@10.0.1 identical 19 7 0 ✅ PASS
react-tooltip@6.0.7 identical 1 0 0 ✅ PASS
react-markdown@10.1.0 identical 0 2 0 ✅ PASS
@smastrom/react-rating@1.5.0 identical 1 0 0 ✅ PASS
clsx@2.1.1 identical 0 0 0 ✅ PASS
hono@4.12.25 identical 0 0 0 ✅ PASS
@base-ui-components/react@1.0.0-rc.0 identical 174 21 0 ✅ PASS

@pkg-pr-new

pkg-pr-new Bot commented Jul 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@juspay/rescript-bindgen@157

commit: eef7b2d

@jagguji
jagguji merged commit 962d34a into main Jul 22, 2026
12 checks passed
@jagguji
jagguji deleted the chore/codeql-baseline-hardening branch July 22, 2026 13:35

@Tara-ag Tara-ag left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Files reviewed: 6
New issues raised: 0 (CRITICAL: 0, MAJOR: 0, MINOR: 0, SUGGESTION: 0)

This is a behavior-preserving chore PR that clears pre-existing CodeQL baseline alerts:

  • Workflow hardening: permissions: contents: read added to CI jobs; action tags pinned to full commit SHAs with version comments.
  • TOCTOU fixes: existsSync-then-read/write patterns replaced with direct operations inside try/catch in src/cli.mjs, benchmark/run.mjs, and test/lib/diff.mjs.
  • Dead-code removal: the slugOf identity no-op removed; comment correctly notes that a leading @ already becomes _.

No generated ReScript or mapping logic is touched, so the binding-safety and determinism guarantees are unaffected. No hardcoded secrets, unsafe casts, type-variable regressions, or nondeterminism introduced. Approved.

@jagguji jagguji mentioned this pull request Jul 22, 2026
jagguji added a commit that referenced this pull request Jul 22, 2026
First stable (`latest`) release since **v1.2.4**. Bumps `package.json`
1.2.6-beta.10 → **1.3.0** and closes the `[Unreleased]` CHANGELOG
section as `[1.3.0]`.

## What's in it (since 1.2.4)
- **Resolution:** exports-map + `typesVersions` entry resolution (#104);
**subpath binding** `--subpaths` (#147).
- **Chart fidelity (#120):** bare `Function` → `JsFn` opaque module +
`boolean|Config` unions (Part A); `object|Config` → opaque module +
`string|object` → `@unboxed` (Part B).
- **Props modelling:** discriminated-union props keep per-branch
requiredness via `@tag` (`--variant-props`, #65); **record-props is now
the output form for every component** (#155).
- **Fixes:** array-hybrid `...JsxDOM.domProps` (#144), React class
components (#101), the #109 coverage-papercut batches, structural-name
stability across compiler versions (#90), and more.
- **Infra:** CodeQL baseline hardening (#157), `setup-node@v7` (#152).

## ⚠️ Upgrading (the one thing to note)
**JSX call sites are unchanged.** The only output-form change: every
component now binds `type props = {…}` + `external make:
React.component<props>` (#155). A *direct* `Button.make(~label="x")`
labeled-args call becomes `React.createElement(Button.make, {label:
"x"})`. JSX-only consumers just regenerate.

Chosen as a **minor** (1.3.0), not major — the tool's CLI is
backward-compatible and the record-props flip is a one-time regen for
consumers (validated end-to-end against `blend-rescript`: 215/222
usable, all 299 modules compile).

## Release mechanism
After merge, tagging `v1.3.0` on main triggers `publish-npm.yml` → `npm
publish` to the **`latest`** dist-tag (plain version → `latest`).
Verified: 105 goldens match + compile, benchmark equal-metrics.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

2 participants