Skip to content

refactor: delete orphan declarations flagged by fallow#949

Merged
jrusso1020 merged 2 commits into
mainfrom
cleanup/fallow-delete-orphans
May 19, 2026
Merged

refactor: delete orphan declarations flagged by fallow#949
jrusso1020 merged 2 commits into
mainfrom
cleanup/fallow-delete-orphans

Conversation

@jrusso1020
Copy link
Copy Markdown
Collaborator

@jrusso1020 jrusso1020 commented May 19, 2026

Stacked on #948. Merge that first.

What

After fallow's --auto-fixable pass de-exports symbols with no consumers, oxlint surfaces them as no-unused-vars. This PR deletes those orphan declarations outright — the symbol isn't just over-exported, it's dead.

Why

#944 landed the "drop export from in-file-used symbols" cleanup. That left ~65 declarations that are truly unreferenced — fallow's analysis is right, but the right cleanup is delete, not just unexport.

Highlights

Biggest single cleanup: studio/src/icons/SystemIcons.tsx shrinks from 132 → 57 lines. The studio actively uses ~20 icons; the rest were speculatively wrapped from phosphor-icons. ~33 unused icon wrappers + their imports deleted.

Other targeted deletions across 14 more files:

  • timelineDiscovery.ts — paired getTimelineEditorHintDismissed / setTimelineEditorHintDismissed (storage helpers with no callers)
  • studioHelpers.tsconfirmElementDelete (alert wrapper)
  • manualEditingAvailability.ts — dead env flag constant (STUDIO_TIMELINE_LAYER_INSPECTOR_ENV + variants)
  • manualEditsSnapshot.tscollectStudioManualEditElements
  • TimelineLayerPanel.tsx — dead component shell (keeps getTimelineLayerPanelSummary which is exported and used)
  • useTimelineRangeSelection.ts, useTimelineSyncCallbacks.ts — internal helpers + cascading unused imports
  • aws-lambda/src/s3Transport.tslistFilesInDirectory
  • cli/src/capture/assetCataloger.tsformatAssetCatalog, deriveAssetName
  • cli/src/browser/manager.tssetBrowserPath + its now-unreachable _browserPathOverride storage variable + the dead findFromEnv branch that read it
  • engine/src/services/hdrCapture.tsconvertHdrFrameToRgb48le
  • shader-transitions/src/webgl.tsuploadTexture
  • core/src/parsers/htmlParser.ts — cascading unused import

What I held back

Files where fallow's auto-fix would have cascaded into secondary findings (type re-exports going unused, files becoming fully orphan, etc.). Each needs its own narrow PR that handles the whole barrel/file atomically:

  • producer/services/renderOrchestrator.ts — barrel of captureCost re-exports
  • cli/src/telemetry/index.ts, cli/src/server/portUtils.ts, cli/src/templates/remote.ts — barrel/type cascades
  • producer/services/hyperframeRuntimeLoader.tsResolvedHyperframeRuntime type cascade
  • studio/src/components/editor/studioMotion.ts — function deletion would orphan 6 type re-exports
  • studio/src/components/ui/Button.tsx + ui/index.ts — deletion would orphan the whole file
  • studio/src/utils/studioPreviewHelpers.tsseekStudioPreview, getPreviewPlayer (cascading type re-export)

Result

  • 15 files changed, 8 insertions / 402 deletions (~-400 net)
  • Fallow audit clean (exit 0; all remaining findings inherited)
  • Typecheck clean across 8 packages
  • oxlint + oxfmt clean
  • cli + studio vitest suites pass

Follow-ups

  • Whole-file/barrel cleanups in the "held back" list — likely 1-2 more small PRs
  • Producer renderOrchestratorcaptureHdr* 8-cycle hub (real refactor)
  • File the multi-import-block fallow bug upstream

Copy link
Copy Markdown
Collaborator Author

jrusso1020 commented May 19, 2026

Copy link
Copy Markdown
Collaborator

@miguel-heygen miguel-heygen left a comment

Choose a reason for hiding this comment

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

Verified: all deletions are safe

I grepped every deleted symbol against the ci/fallow-lefthook base branch to confirm fallow's analysis is correct. Methodology: for each deleted export/function/type/component, searched all .ts and .tsx files (excluding .d.ts) for import sites or direct references beyond the definition file itself.

Deletions verified as truly dead (no consumers found)

File Deleted symbol(s) Verdict
aws-lambda/s3Transport.ts listFilesInDirectory + readdirSync/join imports Only definition, zero callers
cli/browser/manager.ts setBrowserPath, _browserPathOverride, findFromEnv override branch Zero callers of setBrowserPath; the findFromEnv branch that read the override was dead code
cli/capture/assetCataloger.ts formatAssetCatalog, deriveAssetName Only definition + internal call, zero external callers
core/parsers/htmlParser.ts export { CANVAS_DIMENSIONS } re-export All consumers import from @hyperframes/core (via index.ts -> core.types.ts), not from htmlParser
engine/services/hdrCapture.ts convertHdrFrameToRgb48le Only definition, zero callers
shader-transitions/webgl.ts uploadTexture Only definition; all callers use uploadTextureSource directly
studio/TimelineLayerPanel.tsx TimelineLayerPanel component + TimelineLayerPanelProps interface Zero import sites (test file only imports getTimelineLayerPanelSummary, which is kept)
studio/domEditingElement.ts export { findClosestByAttribute, getPreferredClassSelector, getSourceFileForElement } re-exports, hasRenderedBox export keyword Re-exports: no consumer imports these from domEditingElement; all use domEditingDom directly. hasRenderedBox: only used within the same file
studio/manualEditingAvailability.ts STUDIO_TIMELINE_LAYER_INSPECTOR_ENV, STUDIO_TIMELINE_LAYER_INSPECTOR_ENABLED, STUDIO_MANUAL_EDITING_ENABLED; de-export 3 env constants All zero consumers outside their file
studio/manualEditsSnapshot.ts collectStudioManualEditElements + cascading STUDIO_MANUAL_EDIT_GESTURE_ATTR/STUDIO_ORIGINAL_TRANSFORM_DISPLAY_ATTR import removals Function has zero callers; those constants are still imported by manualEditsDom.ts which is unaffected
studio/SystemIcons.tsx 33 icon wrappers (AlertCircle through Terminal) Cross-referenced all from.*SystemIcons import sites — every import references a kept icon, none reference a deleted one
studio/useTimelineRangeSelection.ts seekTimeFromScrollX Only definition, zero callers
studio/useTimelineSyncCallbacks.ts mergeTimelineElementsPreservingDowngrades + getTimelineElementIdentity re-exports useTimelinePlayer.ts imports these from ../lib/timelineDOM and ../lib/timelineElementHelpers directly, not via this re-export
studio/studioHelpers.ts confirmElementDelete deleted; normalizeProjectAssetPath, isAbsoluteFilePath, DEFAULT_TIMELINE_ASSET_DURATION de-exported to const confirmElementDelete: zero callers. The three de-exported symbols: zero external import sites
studio/timelineDiscovery.ts getTimelineEditorHintDismissed, setTimelineEditorHintDismissed, TIMELINE_EDITOR_HINT_STORAGE_KEY Zero callers outside definition

Minor note

The PR description lists studioPreviewHelpers.ts (seekStudioPreview, getPreviewPlayer) under "Other targeted deletions" but those deletions are not in the diff. Not blocking — just a description/diff mismatch. Might be held back or staged for a follow-up.

Verdict

Ship it. Every deletion checks out — fallow's analysis was correct across all 15 files. No false positives found.

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com

Copy link
Copy Markdown
Collaborator

@vanceingalls vanceingalls left a comment

Choose a reason for hiding this comment

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

Targeted "delete what fallow flagged as orphan" pass. The careful held-back list is the right call — narrow & verifiable. Two blockers below before this is mergeable; the rest of the deletions audited cleanly.

Calibrated strengths

  • manualEditsSnapshot.ts:13,32: when collectStudioManualEditElements is deleted, the now-unused STUDIO_MANUAL_EDIT_GESTURE_ATTR + STUDIO_ORIGINAL_TRANSFORM_DISPLAY_ATTR imports are pruned in the same hunk — clean atomic deletion. The constants stay in manualEditsTypes.ts for other consumers.
  • manager.ts:16,57: deletion of setBrowserPath correctly cascades to remove the now-dead _browserPathOverride module-level storage AND the unreachable findFromEnv branch that read it. No orphan state left behind.
  • htmlParser.ts:13,901: CANVAS_DIMENSIONS re-export deletion is safe — verified packages/core/src/index.ts:40-41 re-exports it directly from ./core.types, the htmlParser pass-through was redundant.

Findings

  • blockerPreflight CI is red on a real format bug introduced by this PR. oxfmt --check packages/aws-lambda/src/s3Transport.ts fails at PR head (Preflight (lint + format) job 76653555599, log line 1:56:41). Reproduced locally with oxfmt@0.41.0. Run bun run format before re-pushing.

  • blockerTest references the deleted exports — studio vitest will fail. manualEditingAvailability.test.ts at PR head has 4 assertions on availability.STUDIO_TIMELINE_LAYER_INSPECTOR_ENABLED (lines 26, 36, 45, 56), but this PR deletes that export from manualEditingAvailability.ts. The studio vitest will throw on expect(undefined).toBe(true). This PR is stacked on ci/fallow-lefthook (not main), so the main CI workflow — which runs Testdid not fire (workflow branches: [main] filter on pull_request). The PR body's "cli + studio vitest suites pass" claim was a local run against stale state. Either delete the test cases that reference STUDIO_TIMELINE_LAYER_INSPECTOR_ENABLED (the flag is gone) OR keep the export. Also pull the STUDIO_TIMELINE_LAYER_INSPECTOR_ENV constant out of the test imports for the same reason if you choose the first path.

  • importantPR-body claim "Typecheck clean across 8 packages" is unverified by CI. Same root cause as above — none of the main-branch CI jobs ran on this PR. Recommend either (a) rebase off ci/fallow-lefthook once #948 merges so this gets real CI coverage before merge, or (b) run bun run typecheck && bun run test locally on the current PR head and paste the output into the PR body so reviewers can verify.

  • nits3Transport.ts deletes the last function in the file but leaves no trailing newline (likely the oxfmt complaint). Will fix itself once bun run format is run.

Verdict: REQUEST CHANGES
Reasoning: Two real blockers — Preflight format failure is reproducible, and the test file references deleted exports. Both are local-only fixes; should clear in one push.

Review by Vai

@jrusso1020 jrusso1020 force-pushed the ci/fallow-lefthook branch from 79b72c6 to 9b57050 Compare May 19, 2026 02:19
Copy link
Copy Markdown
Collaborator

@miguel-heygen miguel-heygen left a comment

Choose a reason for hiding this comment

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

Updating my earlier approval: Vai correctly caught that manualEditingAvailability.test.ts imports the deleted STUDIO_TIMELINE_LAYER_INSPECTOR_ENABLED — my grep verified source files but missed test consumers. The oxfmt failure on s3Transport.ts also needs a fix. Deferring to Vai's REQUEST CHANGES until both are addressed.

@jrusso1020 jrusso1020 force-pushed the cleanup/fallow-delete-orphans branch from 3c5961a to 0c088b7 Compare May 19, 2026 02:22
@jrusso1020
Copy link
Copy Markdown
Collaborator Author

Thanks @miguel-heygen — appreciate the systematic per-symbol verification.

Fixed

  • 📝 Nit (description/diff drift): removed the studioPreviewHelpers.ts mention from the PR body. Moved those (seekStudioPreview, getPreviewPlayer) into the "What I held back" section since they trigger a cascading type re-export and need a whole-file cleanup pass, not a single-function delete.

Rebase note

No other changes — your per-symbol verification still applies to the diff at 0c088b7f.

@jrusso1020 jrusso1020 force-pushed the cleanup/fallow-delete-orphans branch from 0c088b7 to 521cbd7 Compare May 19, 2026 02:32
Mirrors the same `fallow audit --base ... --fail-on-issues` check that
runs in CI, but locally against HEAD so issues surface at commit time
instead of after the push round-trip.

Scoped to `packages/**` source files via the glob — non-code edits
(README, docs, top-level configs) skip the hook entirely.

Measured locally: ~5s in parallel with the existing lint/format/typecheck
checks. Doesn't extend wall-clock time because typecheck (~11s) is the
long pole, and lefthook runs commands in parallel.

The default `--gate new-only` means inherited findings don't block the
commit — same gate behavior as CI, so local pre-commit and PR audit
agree.
After fallow's auto-fix de-exports unused symbols, oxlint surfaces them
as no-unused-vars. This PR deletes those orphan declarations outright.

Biggest cleanup: studio/src/icons/SystemIcons.tsx shrinks from 132 to 57
lines — 33 unused icon wrappers and their phosphor-icon imports deleted.

Other deletions across 14 more files covering paired getter/setters,
helper functions, dead env constants, internal components with no
callers, and cascading unused imports.

Cascade-causing files held back for follow-up PRs: renderOrchestrator
barrel of captureCost re-exports, telemetry/portUtils/remote barrels,
Button.tsx + ui/index.ts (would orphan whole file), studioMotion
type re-exports.

Test plan: typecheck clean across 8 packages, oxlint + oxfmt clean,
fallow audit exit 0 (remaining findings inherited), cli + studio
vitest suites pass.
@jrusso1020 jrusso1020 force-pushed the ci/fallow-lefthook branch from 9b57050 to a86c3c1 Compare May 19, 2026 02:32
@jrusso1020 jrusso1020 force-pushed the cleanup/fallow-delete-orphans branch from 521cbd7 to e03d038 Compare May 19, 2026 02:32
@jrusso1020
Copy link
Copy Markdown
Collaborator Author

Thanks @vanceingalls — both blockers fixed:

🔧 Blocker 1 — Preflight format failure on s3Transport.ts
Confirmed: deleting listFilesInDirectory left a trailing newline that oxfmt rejected. Ran bun run format. Fix is one-byte (drop the trailing blank line at EOF).

🔧 Blocker 2 — Test file references deleted export
You're right that manualEditingAvailability.test.ts was the missed consumer. Resolved by removing the 4 STUDIO_TIMELINE_LAYER_INSPECTOR_ENABLED assertions:

  • Test 1 (default behavior): dropped just the TIMELINE_LAYER_INSPECTOR_ENABLED assertion, kept the other 4 default-flag assertions
  • Test 2 (explicit truthy): dropped — the test's premise was the deleted flag; the remaining INSPECTOR_PANELS_ENABLED=1 → true is already covered by test 1's default
  • Test 3 (explicit falsy): dropped — purely tested the deleted flag
  • Test 4 (parent off → child off): kept but refocused. The "preview-selection mirrors inspector-panels" behavior is a real invariant worth covering; renamed to "disables preview selection when the inspector panel flag is explicitly off" and dropped the timeline assertion.

Studio vitest now passes 7/7 on the test file, 578/578 across the package.

📝 Important — stacked-PR CI gap
You're 100% right that the main CI workflow's branches: [main] filter means Test/Typecheck/Fallow audit/CLI smoke didn't run on this PR head — that's exactly how blocker 2 escaped local validation. Two options going forward:

  1. Rebase off ci/fallow-lefthook onto main once ci: run fallow audit in lefthook pre-commit #948 lands (this PR will then get full CI coverage)
  2. Loosen the pull_request: branches: filter so the workflow fires on stacked PRs too

Going with (1) for this stack — local validation now includes bun run --filter '*' typecheck + bunx vitest run for studio + cli + engine to back the body claim. If stacked PRs become a regular pattern, (2) is worth a follow-up PR.

Force-pushed @ e03d0386 (whole stack rebased: #948a86c3c1b, #949e03d0386, #954a67436b4).

Copy link
Copy Markdown
Collaborator

@vanceingalls vanceingalls left a comment

Choose a reason for hiding this comment

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

Re-review after James's rebase + pushes. Both round-1 blockers addressed; the stacked-PR CI gap is also moot now because the rebase pulled in the merged Studio Blocks panel, fallow lefthook, and SwiftShader probe fix from main — so the full CI suite has actually fired against this head and 15 jobs are green (only long-running regression-shards still pending).

Round-1 blockers — re-verified

  • ADDRESSEDPreflight format. All three Preflight (lint + format) jobs at e03d038 are SUCCESS (runs 76657027932, 76657079415, 76657014851). s3Transport.ts at PR head reads cleanly — file ends with the documented untarDirectory function, no trailing-newline drift.
  • ADDRESSEDTest references deleted exports. manualEditingAvailability.test.ts:1-109 at PR head no longer references STUDIO_TIMELINE_LAYER_INSPECTOR_ENABLED anywhere. The 4 stale assertions are gone; remaining cases test STUDIO_PREVIEW_MANUAL_EDITING_ENABLED, STUDIO_PREVIEW_SELECTION_ENABLED, STUDIO_INSPECTOR_PANELS_ENABLED, STUDIO_MOTION_PANEL_ENABLED, and the new resolveStudioBooleanEnvFlag helper — all of which exist in manualEditingAvailability.ts:31-58. Net file delta +1/-23 matches the cleanup.
  • ADDRESSED (incidentally)Stacked-PR CI gap. Base is still ci/fallow-lefthook, but the rebase from main picked up #947/#956/#957/#958 so the head now contains main's HEAD as an ancestor. The full main-workflow suite ran on this PR head: Preflight x3, Perf (drift/fps/load/parity/scrub), Preview parity, preview-regression, player-perf, Detect changes x3, WIP — all pass. The previously-local-only claims now have CI evidence.

No new regressions in the rebase

The diff vs the round-1 commit 3c5961a is dominated by main commits (Blocks panel, lefthook, SwiftShader probe). Spot-checked the actual orphan-deletion files at HEAD:

  • manualEditingAvailability.ts:54-58: new STUDIO_BLOCKS_PANEL_ENABLED export added for the Blocks panel — defaults to false, gated on VITE_STUDIO_ENABLE_BLOCKS_PANEL. Not exercised by the test but the test only covers a subset of flags anyway.
  • s3Transport.ts: tail of file is clean, no orphan trailing whitespace.
  • manualEditingAvailability.test.ts: import line is now { resolveStudioBooleanEnvFlag } only — no dead imports left behind.

Pending CI to keep an eye on

  • regression-shards (shard-1..8) — pending, long-running. Should be green before merge but doesn't change the review verdict on the deletions themselves (none touch render pipeline code).
  • Graphite / mergeability_check — pending, external to the code.

Verdict: APPROVE on the deletions — both round-1 blockers are cleanly addressed and CI evidence is now real (not local-only). Holding the formal approve stamp until regression-shards finish per project policy; ping when they're green and this is good to merge.

Review by Vai (re-review)

miguel-heygen
miguel-heygen previously approved these changes May 19, 2026
Copy link
Copy Markdown
Collaborator

@miguel-heygen miguel-heygen left a comment

Choose a reason for hiding this comment

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

Re-reviewed — APPROVE.

Both blockers from Vai's review are resolved:

  1. oxfmt failure: Fixed via base branch (#948) update. Preflight now passes across all 3 workflow runs.
  2. Test file importing deleted export: This was a false finding — manualEditingAvailability.test.ts IS modified in this PR's commit (e03d0386). It removes the STUDIO_TIMELINE_LAYER_INSPECTOR_ENABLED assertion and deletes 3 test cases that referenced it. The test cleanup was already in the original diff.

No new commits were pushed since the last review. Regression shards still running but no failures so far. Ready to merge once #948 lands first.

vanceingalls
vanceingalls previously approved these changes May 19, 2026
Copy link
Copy Markdown
Collaborator

@vanceingalls vanceingalls left a comment

Choose a reason for hiding this comment

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

Re-review at HEAD e03d038. Flipping CHANGES_REQUESTED → APPROVE — both blockers addressed cleanly.

Status of prior findings

  • Blocker 1 (Preflight (lint + format) red on oxfmt --check packages/aws-lambda/src/s3Transport.ts) — ADDRESSED. All 3 Preflight jobs SUCCESS on this head; s3Transport.ts reads clean.
  • Blocker 2 (manualEditingAvailability.test.ts references deleted STUDIO_TIMELINE_LAYER_INSPECTOR_ENABLED) — ADDRESSED. The test at packages/studio/src/components/editor/manualEditingAvailability.test.ts:1-109 no longer references the deleted symbol; all asserted exports exist in manualEditingAvailability.ts:31-58.
  • Important (stacked-PR CI gap) — ADDRESSED incidentally. Rebase pulled main commits (#947, #956, #957, #958) into the head, so the main-branch CI workflow actually runs now. Base ref is still ci/fallow-lefthook cosmetically, but the gap that hid the prior blockers is closed.

The fallow-driven deletions remain audit-clean — the round-1 review verified 14 other deletions were safe (no live consumers across registry/ / docs/ / examples/ / tests). Only the one test-file dependency on STUDIO_TIMELINE_LAYER_INSPECTOR_ENABLED had escaped fallow's scan, and that's now fixed.

CI status (verbatim)

  • Failed: none.
  • Pending: Graphite / mergeability_check, regression-shards (shard-1..8).
  • All required-on-merge non-shard checks SUCCESS.

Verdict: APPROVE. Regression shards still in_progress at review time — non-blocking on the verdict (consistent with this week's approval pattern).

Re-review by Vai

Base automatically changed from ci/fallow-lefthook to main May 19, 2026 02:39
@jrusso1020 jrusso1020 dismissed stale reviews from vanceingalls and miguel-heygen May 19, 2026 02:39

The base branch was changed.

@jrusso1020 jrusso1020 merged commit 2729ee5 into main May 19, 2026
42 checks passed
@jrusso1020 jrusso1020 deleted the cleanup/fallow-delete-orphans branch May 19, 2026 04:11
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.

3 participants