Skip to content

[Remove] unused Git and logging exports - #439

Merged
juanmaguitar merged 1 commit into
trunkfrom
juanmaguitar/cleanup-431
Sep 11, 2026
Merged

juanmaguitar merged 1 commit into
trunkfrom
juanmaguitar/cleanup-431

Conversation

@juanmaguitar

Copy link
Copy Markdown
Collaborator

Why

git-progress.cjs and safe-log.js exposed implementation constants that no caller imports. Keeping their public API limited to consumed helpers prevents consumers from depending on internal details without changing behavior.

What changes

Removes PROGRESS_LINE, CONTROL_CHARACTERS, and MAX_DESCRIPTION_LENGTH from their respective CommonJS export objects. The constants remain module-private and the existing exported behavior, including parseProgressLines, is unchanged.

How to test this

No user-visible surface changed; this is an API-surface cleanup, so manual app testing is not applicable.

Starting state: A checkout with dependencies installed.

  1. Run npm run lint; it exits successfully.
  2. Run npm test; all tests pass, including tests/unit/git-progress.test.cjs and logging refusal behavior exercised by the suite.

What must not have happened: Git progress parsing and bounded, one-line refusal logging must continue to behave identically; no production consumer may need the removed internal exports.

Platforms: any — this only narrows JavaScript module exports.

Risks and limitations

Low risk: this is a deliberate breaking change only for unsupported, unconsumed exports. No user-facing behavior changed and no manual UI path applies.

Related

Fixes #431


Design decisions and alternatives considered

Kept the constants in their original modules rather than deleting or inlining them, preserving implementation behavior and readability. Retained parseProgressLines because its dedicated unit test imports it.

Review outcome (required — see AGENTS.md)

0 [fix here] · 0 [follow-up] — none found. The review checked architecture, security, performance, cross-platform behavior, and test coverage against the two-file diff; no invariants are affected.

Implementation notes

Validation: node --test tests/unit/git-progress.test.cjs, npm run lint, and npm test (1,258 passing). The worktree has a pre-existing unrelated package-lock.json modification, excluded from this commit and PR.

@juanmaguitar juanmaguitar added the audit-code Follow-up work from the codebase audit label Sep 10, 2026
@coderabbitai

coderabbitai Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 37 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 559f3ebd-3715-4df9-a8df-fa9012456e5c

📥 Commits

Reviewing files that changed from the base of the PR and between d1e7f36 and 9ac538c.

📒 Files selected for processing (2)
  • src/git-progress.cjs
  • src/safe-log.js

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.

@juanmaguitar

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

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.

@juanmaguitar

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

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.

@juanmaguitar
juanmaguitar force-pushed the juanmaguitar/cleanup-431 branch 2 times, most recently from 63d32e4 to 53719df Compare September 11, 2026 04:00
@juanmaguitar
juanmaguitar force-pushed the juanmaguitar/cleanup-431 branch from 53719df to 9ac538c Compare September 11, 2026 04:06
@juanmaguitar
juanmaguitar merged commit daa148f into trunk Sep 11, 2026
8 checks passed
@juanmaguitar
juanmaguitar deleted the juanmaguitar/cleanup-431 branch September 11, 2026 04:11
juanmaguitar added a commit that referenced this pull request Sep 11, 2026
## Why

`external-url` duplicated formatter-only coverage through
`describeRefusedUrl()`, even though the shared `safe-log` module owns
the one-line, bounded rendering contract.

## What changes

Removes the forwarding export and calls `describeRefused()` directly at
the URL refusal boundary. Formatter coverage now exercises `safe-log`
directly; `external-url` retains URL normalization and refusal-behavior
coverage.

## How to test this

Platforms: any — this is a internal refactor with no visible UI change.

**Starting state:**

1. Check out this PR branch (targets `trunk`).
2. Install the repository dependencies.

1. Run `node --test tests/unit/external-url.test.cjs
tests/unit/safe-log.test.cjs`.
2. Run `npm run lint` and `npm test`.

**What must not have happened:**

Refused `file:`, custom, malformed, and otherwise non-HTTP(S) URLs must
still not reach `shell.openExternal`; refused values must remain
one-line and bounded. The focused tests cover this directly, and the
full suite covers the integration boundary.

## Risks and limitations

No user-visible behavior changed. Parent PR #436 is merged; this PR now
targets trunk; the review found 0 [fix here] and 0 [follow-up] findings.

## Related

Fixes #429

---

<details>
<summary>Design decisions and alternatives considered</summary>

The formatter belongs to `safe-log`, where it is shared by URL, site,
and editor refusal paths. Keeping a URL-specific wrapper would preserve
a second public surface without adding behavior.

</details>

<details>
<summary>Review outcome (required — see AGENTS.md)</summary>

0 [fix here] · 0 [follow-up] — no findings across architecture,
security, performance, cross-platform, or tests. `npm run lint` and `npm
test` passed (1,252 tests on Node 24.18.0).

</details>

<details>
<summary>Implementation notes</summary>

PR #436 already merged the test-only external URL predicate removal.
Also fixes the integration with #439: the truncation test asserts the
observable 121-character output instead of importing the removed
constant. Before the fix it failed with 121 !== NaN; after the fix all
12 focused tests pass. The URL refusal callback remains covered for
escaping and truncation, and the stale logging comment now names the
shared formatter. Fresh independent self-review: no remaining findings.

</details>
juanmaguitar added a commit to amitraj2203/contributor-toolkit that referenced this pull request Sep 11, 2026
Trunk removed isAllowedExternalUrl from external-url.js (WordPress#436) and moved
describeRefusedUrl to describeRefused in safe-log.js (WordPress#439, WordPress#440) after
this branch was opened. The merge was textually clean, so both symbols
resolved to undefined: the first uncancelled navigation would have thrown
inside will-navigate, and a failed openExternal would have thrown inside
its own catch. window-links.js now asks normalizeExternalUrl, and main.js
imports describeRefused from safe-log once.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0123opUnXoxs1CAN7YQ7q8KU
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

audit-code Follow-up work from the codebase audit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove unused exports from Git progress and safe logging

1 participant