Skip to content

refactor: GE-JS-SKILL captureJsImportFacts + scanSkillTextOn tangle (byte-identical) - #708

Merged
joyful-ii-V-I merged 5 commits into
mainfrom
integration/ge-js-skill-r
Nov 20, 2026
Merged

joyful-ii-V-I merged 5 commits into
mainfrom
integration/ge-js-skill-r

Conversation

@joyful-ii-V-I

@joyful-ii-V-I joyful-ii-V-I commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

GE-JS-SKILL: byte-identical tangle refactor of two functions

The tangle census ranked these two functions #10 and #8.

Card 1, captureJsImportFacts (src/ingest_jsimports.h): tangle S 21.6 -> 0, ccx 145 -> 22. One named step per import/export form.

Card 2, scanSkillTextOn (src/skillscan.h): S 23.7 -> 2.4, ccx 194 -> 67. A SkillFenceTracker with named transitions (enterFence / leaveFence), plus named per-line check steps.

Also: const -> non-const fixes (JsBindRecorder::add, SkillFindingSink) and the enterFence / leaveFence rename.

Byte identity: fire321 321/321 identical, md5 6/6, skill identity set 577/577.
Perf flat: hono cold instructions +0.3 % (inside the base spread), vscode +0.05 %, skill scan equal.
Checks: 42 gates pass. qd: 0 gating, both functions credited under improved.

Branch is 5 commits on e71db70; main has since moved (#704, #705, ...) in other files, merge-tree is clean. Not rebased (ci-gate is strict=false).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor
    • Updated the internal organization of JavaScript import/export handling and skill-text scanning. Existing binding rules and scan checks remain unchanged, so no user-facing behavior changes are expected.

joyful-ii-V-I and others added 5 commits November 20, 2026 05:57
…atement form

captureJsImportFacts (tangle S 21.6: nest 6, deep 78, 193 lines, cx 65, ccx 145) walked the
ES import specifiers and every export form inline inside its statement loop. The loop now
reads as one named step per statement form: captureJsImportStatement (the default / named /
namespace specifier walk, L614..L656 of the census), the declaration step (object literals and
CommonJS module aliases, unchanged), and captureJsExportStatement (clause and declaration
forms) with captureJsDefaultExport (`export default …`). The shared `record` lambda becomes
JsBindRecorder::add, which returns the record it appended instead of every caller reaching
for binds.back().

Byte-identical by construction: the same records in the same order with the same fields; only
where the code that fills them lives moved. Tangle after: captureJsImportFacts S 0 (nest 3,
deep 0, cx 15, ccx 22); the new steps S 0 / 0.4 / 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…racker; each line check is a named step

scanSkillTextOn (tangle S 23.7: nest 6, deep 83, steer 3, 402 lines, cx 92, ccx 194) carried
the inFence / inExampleFence steering flags across its line loop and toggled them inline. The
fence state is now detail::SkillFenceTracker with its two named transitions (open, close) and
readLine, which answers a line's membership (SkillLineFence) before its marker toggles it; a
shell script's line is SkillFenceTracker::kScriptLine. The isExampleFenceLang lambda is a
detail:: function. The addFinding / isHit lambdas become SkillFindingSink, and each line check
is a named step: scanFrontmatterLine, scanBodyInjectionLine, appendJoinedBodyLine (the joined-
body feed), scanBodyExfilLine, scanScopeCreepLine. The loop now reads as: fence membership,
then the frontmatter or body checks the line's place calls for.

Byte-identical by construction: the same regex searches in the same order per line, the same
findings pushed in the same order, the same joined body. Tangle after: scanSkillTextOn S 2.4
(nest 4, deep 2, steer 0, 202 lines, cx 38, ccx 67); every new step S 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
add() appends to the binds vector it holds by reference, so a const recorder that writes
was a const-correctness lie (the GE-PREWARM QD-CONST-REF-WRITE smell). The recorder and the
steps that take it are now non-const. No code change: the __text section of the binary is
byte-identical to the previous commit's build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both append findings through the sink's reference member, so the sink and the line steps
that take it are now non-const (the GE-PREWARM QD-CONST-REF-WRITE smell). No code change:
the __text section of the binary is byte-identical to the previous commit's build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… leaveFence

The two transitions were spelled open() and close(); crashsweepcheck's raw-site scan reads
every `open(` in src/ as a file open, so the method counted as a new unregistered opener in
skillscan.h (prereview CI5). The names now say what they change. No behaviour change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review.

Walkthrough

The pull request refactors JavaScript import, export, and shadow binding capture. It also extracts skill text scanning helpers for fence tracking, body accumulation, finding creation, and scan checks.

Changes: JavaScript Binding Capture

Layer / File(s) Summary
Import and export capture
src/ingest_jsimports.h
JsBindRecorder creates RawBind records. Extracted helpers handle import and export statements, and the capture flow delegates to them. Shadow records also use the recorder.

Skill Text Scanning

Layer / File(s) Summary
Fence tracking and scan helpers
src/skillscan.h
Helpers track fence state, accumulate normalized joined-body text, create findings, and run frontmatter, injection, exfiltration, and scope-creep checks.
Scanner integration
src/skillscan.h
scanSkillTextOn uses the extracted tracker and checks. Joined-body findings go through the finding sink.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Suggested reviewers: pollybot13, barefootski

Merge Risk: Minimal · up to 56900

This is a behavior-preserving refactor of JavaScript import capture and skill text scanning. No concrete regression was found, so the merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the two refactored functions, captureJsImportFacts and scanSkillTextOn, and the byte-identical goal. The raw summary and objectives confirm both functions were split into named helpers…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the two refactored functions, captureJsImportFacts and scanSkillTextOn, and the byte-identical goal. The raw summary and objectives confirm both functions were split into named helpers and a SkillFenceTracker, with no behavior change. The title is specific and matches the main change. It is slightly long at 84 characters, and the 'GE-JS-SKILL' ticket prefix adds some noise, but the primary change is clear.

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between ee8d1a5 and 56900e9.

Files selected for processing: 2

  • src/ingest_jsimports.h
  • src/skillscan.h

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

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