Skip to content

D3-CR-F7 — Accept comments adjacent to re-export from - #59

Closed
LogicDuke wants to merge 1 commit into
repair/d3-cr-f2-f3-scanner-residualsfrom
repair/d3-cr-f7-reexport-comment-separator
Closed

D3-CR-F7 — Accept comments adjacent to re-export from#59
LogicDuke wants to merge 1 commit into
repair/d3-cr-f2-f3-scanner-residualsfrom
repair/d3-cr-f7-reexport-comment-separator

Conversation

@LogicDuke

@LogicDuke LogicDuke commented Aug 26, 2026

Copy link
Copy Markdown
Owner

Purpose

Stacked validation PR repairing D3-CR-F7 (CURRENT / P3).

Parent affected HEAD: 24efb0a7b5e553e7e025fed748f65c037f5ddf13 (PR #58).

Defect

The Cockpit host purity scanner's re-export pattern required whitespace immediately after from (\bfrom\s+), so valid static re-exports with a block comment abutting from were missed — letting a forbidden dependency bypass forbiddenIn():

  • export { x } from/* note */'../domain/foo.js';
  • export * from/* note */'../domain/foo.js'; (star)
  • export type { T } from/* note */'../domain/foo.js'; (type)

The F6 whitespace form (from /* note */ '...') was already handled and remains so.

Repair

Changed file exactly: tests/cockpit-host/purity.test.ts

Smallest repair — in the re-export scanner only:

\bfrom\s+   →   \bfrom\s*

Explicitly:

  • no static-import regex change;
  • no dynamic-import regex change;
  • no allow-predicate change;
  • no forbidden-predicate change;
  • no production code change;
  • no dependency change;
  • no parser/AST.

Regression coverage

  • named re-export with comment immediately after from;
  • star re-export;
  • type re-export;
  • F6 whitespace form preservation;
  • single/double quotes;
  • multiline block comment;
  • multiple consecutive comments;
  • identifier continuation safety (fromValues/from_foo/from1 not mis-read as the from clause);
  • statement-boundary safety;
  • duplicate-extraction safety;
  • F1–F6 preservation.

Independent validation

PASS_UNCOMMITTED_F7_REPAIR_CANDIDATE

  • focused purity: 44/44 PASS
  • full suite: 1723/1723 PASS (26 files)
  • typecheck: PASS
  • lint: PASS
  • build: PASS
  • git diff --check: PASS
  • adversarial validation: PASS
  • CURRENT second-order findings: NONE

Exact identity

  • Base SHA: 24efb0a7b5e553e7e025fed748f65c037f5ddf13
  • Head SHA: 95e2ab2fc2b9a373995acb441a593db7b1c397d7
  • Commit message: test(cockpit): accept comments adjacent to re-export from
  • Validated/committed parent→HEAD binary patch:
    • SHA256: 5AF211E399479F0C2C3E0620965C6D7AA39C31FAF591EA89E9F9C0BEAAFD8F9E
    • bytes: 4843

Explicitly separate finding

CX-1 remains a separate CURRENT P3 finding concerning catastrophic/exponential scanner regex backtracking in the overlapping pre-from alternatives. It is NOT repaired by this PR and is not implied to be fixed.

Authority

This Draft child is quarantine evidence/proposal only. Passing CI or AI review does not authorize integration. PR #58 remains protected and merge-blocked. PR #55 remains Draft and untouched. Human merge authority is preserved.

Summary by CodeRabbit

  • Bug Fixes

    • Improved detection of re-export statements across varied formatting styles, including adjacent comments or module quotes, multiline syntax, and whitespace variations.
    • Preserved correct handling of identifiers, statement boundaries, duplicate references, and existing valid cases.
  • Tests

    • Expanded coverage for named, wildcard, type-only, quoted, multiline, and boundary-sensitive re-export patterns.

@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d4130dd4-41fa-4d5b-b272-771ab841e41f

📥 Commits

Reviewing files that changed from the base of the PR and between 24efb0a and 95e2ab2.

📒 Files selected for processing (1)
  • tests/cockpit-host/purity.test.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The re-export scanner now detects block comments and module strings that directly follow from. Regression tests cover named, star, type, quoted, multiline, boundary, duplicate, and exclusion cases.

Changes

Re-export scanner

Layer / File(s) Summary
Scanner pattern and regression coverage
tests/cockpit-host/purity.test.ts
The extraction pattern accepts zero or more characters after from. Tests cover abutting comments and module strings while preserving existing import boundaries, duplicate handling, and exclusions.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 95e2a

This localized test-only change broadens re-export detection for comments adjacent to from without changing production behavior, dependencies, or permissions; no actionable merge-blocking risk remains after normal checks and review.

Poem

A rabbit checks the from trail,
Where comments meet the quoted sail.
Named and star paths now appear,
Boundaries stay crisp and clear.
Tests hop after every clue.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the main change: accepting comments adjacent to the re-export from keyword.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch repair/d3-cr-f7-reexport-comment-separator

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@LogicDuke
LogicDuke marked this pull request as ready for review August 26, 2026 15:02

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 95e2ab2fc2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// optional whitespace and/or block comments between `from` and the module
// string. The separator after `from` is `\s*`, not `\s+`, so a block comment
// (or the quote itself) may abut `from` directly, e.g. `from/* c */'S'`.
/\bexport\b(?:\/\*[\s\S]*?\*\/|[^'"])*?\bfrom\s*(?:\/\*[\s\S]*?\*\/\s*)*['"]([^'"]+)['"]/g,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restrict the match to an actual re-export clause

When any exported declaration is followed by a comment containing compact example text such as export const safe = true; // docs: from'../domain/example.js', the new \s* branch treats that comment text as a re-export and reports the example path as a real dependency. The prefix can scan across statement and comment boundaries, so this newly produces false purity failures for otherwise valid host source; ensure from belongs to the export clause or lexically exclude comments before accepting the adjacent quote.

Useful? React with 👍 / 👎.

@LogicDuke

Copy link
Copy Markdown
Owner Author

@codex review

@LogicDuke

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 95e2ab2fc2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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