Skip to content

Audit/simplify dead code#14

Open
jR4dh3y wants to merge 3 commits into
masterfrom
audit/simplify-dead-code
Open

Audit/simplify dead code#14
jR4dh3y wants to merge 3 commits into
masterfrom
audit/simplify-dead-code

Conversation

@jR4dh3y

@jR4dh3y jR4dh3y commented Jun 12, 2026

Copy link
Copy Markdown
Owner

This pull request contains several updates to both backend and documentation, focusing on backend handler refactoring, improved upload validation, and project documentation cleanup. The most significant changes include stricter file upload and naming validation, removal of deprecated frontend references, and simplification of error handling in the backend.

Backend improvements and refactoring:

  • The StreamHandler now enforces the configured maximum upload size, validates chunk sizes, and returns appropriate HTTP status codes for oversized uploads or mismatched session metadata. This includes using http.MaxBytesReader to strictly limit chunk size and returning 413 Request Entity Too Large where appropriate. [1] [2] [3]
  • File and directory name validation in FileHandler is now delegated to a shared validator.IsValidFileName function, ensuring consistent and centralized checks.
  • The backend error response logic is simplified: error response struct definitions and redundant error helpers are removed from handler/response.go, with responses now using the canonical struct from model. [1] [2]
  • The server initialization and shutdown logic is cleaned up: unused parameters and handlers are removed, constants are used for configuration defaults, and job worker count is now set via a config constant. [1] [2] [3] [4] [5] [6] [7] [8] [9]
  • The deprecated HandleServiceErrorWithLog function is removed from the backend error handler.

Frontend and documentation cleanup:

  • All references to the old /test demo route and its components are removed from the project context documentation, reflecting its deletion from the codebase. [1] [2] [3] [4]
  • The legacy UploadManager helper class is removed, and documentation is updated to clarify that upload queue management is now handled in upload.svelte.ts. [1] [2]
  • The project context file is updated to reflect the current state of the codebase, including the latest update date and the removal of deprecated frontend components. [1] [2]

These changes collectively improve backend robustness and maintainability, while ensuring the documentation accurately describes the current state of the project.

@jR4dh3y jR4dh3y requested a review from Copilot June 12, 2026 18:29
@jR4dh3y jR4dh3y self-assigned this Jun 12, 2026
@vercel

vercel Bot commented Jun 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
box-box Ready Ready Preview, Comment Jun 12, 2026 6:30pm

@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: 93d572df44

ℹ️ 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".

Comment on lines +96 to +97
if (file.size > checksumLimit) {
return undefined;

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 Preserve checksum verification for large uploads

For uploads larger than the checksum limit (20 MiB with the default 10 MiB chunks), this returns undefined, so uploadChunk omits the final X-Checksum header and the backend skips its only content-integrity check because assembleChunks verifies checksums only when a value is provided. Large uploads can therefore be assembled and accepted without detecting a corrupted/mismatched chunk, regressing the documented chunked-upload checksum verification path.

Useful? React with 👍 / 👎.

Copilot AI 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.

Pull request overview

This PR removes deprecated frontend/demo surface area, centralizes a few configuration/constants, and tightens upload/session validation in the Go backend while refreshing project/docs metadata to match the current codebase.

Changes:

  • Removed legacy/demo UI routes/components and updated docs/context to reflect their removal.
  • Improved backend streaming upload validation (max upload size enforcement, chunk-size/body validation, session metadata mismatch handling).
  • Added local wallpaper persistence + “saving” UX improvements (progress button, local IndexedDB wallpaper storage, richer file-type handling).

Reviewed changes

Copilot reviewed 57 out of 57 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
website/src/styles/global.css Removes unused feature-card hover styling.
website/src/lib/docs.ts Simplifies docs nav metadata handling.
website/src/layouts/DocsLayout.astro Removes unused icon import.
website/src/components/FeaturesBento.astro Removes unused icon import.
website/src/components/FeatureCard.astro Deletes unused website component.
website/src/components/AppInterfaceDemo.astro Scroll animation update for the website demo UI.
scripts/local-test.ts Simplifies port selection logic by removing ss-based check.
PROJECT_CONTEXT.md Updates project context to remove stale frontend references.
frontend/src/routes/test/+page.svelte Deletes deprecated /test demo route.
frontend/src/routes/settings/+page.svelte Adds save progress UX + local wallpaper persistence/cleanup logic.
frontend/src/routes/browse/+page.svelte Updates Sidebar props and enables hidden-path suggestions in Toolbar.
frontend/src/routes/+layout.svelte Removes /test from public routes and switches to resolved wallpaper URL store.
frontend/src/lib/utils/wallpaperStorage.ts New IndexedDB-backed local wallpaper storage utilities.
frontend/src/lib/utils/wallpaper.ts Adds progress reporting to readFileAsDataUrl.
frontend/src/lib/utils/upload.ts Limits checksum calculation for large files and removes UploadManager.
frontend/src/lib/utils/fileTypes.ts Improves dotfile/special-filename detection, icons, and Monaco language mapping.
frontend/src/lib/stores/websocket.ts Moves websocket backoff/ping timings into CONFIG.
frontend/src/lib/stores/settings.ts Adds local wallpaper migration + derived resolved wallpaper URL store.
frontend/src/lib/stores/jobs.ts Removes unused store helpers/exports.
frontend/src/lib/stores/files.ts Removes unused query/selection helpers and uses CONFIG for default page size.
frontend/src/lib/components/UploadDropzone.svelte Deletes unused upload dropzone component.
frontend/src/lib/components/ui/Toast.svelte Refactors icon rendering and adjusts layout classes.
frontend/src/lib/components/ui/Select.svelte Adds chevron icon + wrapper for custom select styling.
frontend/src/lib/components/ui/ProgressButton.svelte New button component supporting busy/progress states.
frontend/src/lib/components/ui/index.ts Exports ProgressButton; removes Card export.
frontend/src/lib/components/ui/ContextMenu.svelte Minor cleanup/formatting and event handler formatting.
frontend/src/lib/components/ui/Card.svelte Deletes unused Card component.
frontend/src/lib/components/Toolbar.svelte Adds editable path input + folder suggestion/autocomplete logic.
frontend/src/lib/components/Sidebar.svelte Removes unused roots prop/type import.
frontend/src/lib/components/settings/wallpaper/WallpaperSettings.svelte Uses normalized background checks and passes frostedGlass into modal.
frontend/src/lib/components/settings/wallpaper/WallpaperPickerModal.svelte Adds local wallpaper upload progress UI and frosted-glass preview styling.
frontend/src/lib/components/settings/SettingsSection.svelte Deletes unused settings section component.
frontend/src/lib/components/settings/SettingsRow.svelte Deletes unused settings row component.
frontend/src/lib/components/settings/index.ts Deletes unused settings barrel exports.
frontend/src/lib/components/preview/VideoPreview.svelte Adds accessible label/title including optional file size.
frontend/src/lib/components/preview/OfficePreview.svelte Adds lint suppression for required DOM manipulation; optimizes sheet header loop.
frontend/src/lib/components/preview/CodePreview.svelte Improves Monaco typing and model-language update safety.
frontend/src/lib/components/PicoLogo.svelte Deletes unused branding component.
frontend/src/lib/components/JobMonitor.svelte Deletes unused job monitor component.
frontend/src/lib/components/DriveCard.svelte Deletes unused drive card component.
frontend/src/lib/components/Breadcrumb.svelte Deletes unused breadcrumb component.
backend/internal/service/job.go Removes unused fields; uses config constants for workers/queue sizing.
backend/internal/service/auth.go Removes unused credentials struct; uses config constants for token expiries.
backend/internal/pkg/validator/path.go Removes unused helpers; formatting/cleanup.
backend/internal/pkg/filesystem/fs.go Removes unused constructors/helpers and copy helpers.
backend/internal/model/job.go Removes unused JobError struct.
backend/internal/model/error.go Removes unused ErrorResponse helper constructors.
backend/internal/model/config.go Removes unused default config/helpers.
backend/internal/middleware/auth.go Removes unused context helper.
backend/internal/handler/stream.go Enforces max upload size, validates chunk/body sizes, checks session metadata match.
backend/internal/handler/stream_property_test.go Adds tests for new upload validation and fixes chunk-count logic.
backend/internal/handler/response.go Uses canonical model.ErrorResponse and removes redundant helpers.
backend/internal/handler/file.go Centralizes filename validation via validator.IsValidFileName.
backend/internal/handler/errors.go Removes deprecated HandleServiceErrorWithLog.
backend/internal/config/constants.go Adds DefaultMaxUploadMB constant.
backend/internal/config/config.go Uses DefaultMaxUploadMB in config defaults.
backend/cmd/server/main.go Simplifies init/shutdown wiring; uses config constants for worker count and shutdown timeout.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +247 to +270
let page = 1;
let loadedCount = 0;
let totalCount = Number.POSITIVE_INFINITY;
const directories: Array<{ name: string }> = [];

while (loadedCount < totalCount) {
const response = await listDirectory(parentPath, {
page,
pageSize: suggestionPageSize,
sortBy: 'name',
sortDir: 'asc',
includeHidden: includeHiddenSuggestions || prefix.startsWith('.'),
filter: prefix || undefined
});

directories.push(...response.items.filter((item) => item.isDir));
loadedCount += response.items.length;
totalCount = response.totalCount;

if (response.items.length === 0) break;
page += 1;
}

return filterSuggestions(directories, parentPath, prefix);
Comment on lines +84 to +86
let suggestionTimer: ReturnType<typeof setTimeout> | undefined;
let blurTimer: ReturnType<typeof setTimeout> | undefined;
let suggestionRequestId = 0;
Comment on lines +568 to +570
aria-label="Location"
aria-autocomplete="list"
/>
Comment on lines 91 to +96
export async function calculateChecksumStreaming(
file: File,
chunkSize: number = DEFAULT_CHUNK_SIZE
): Promise<string> {
// For smaller files, use the simple method
if (file.size <= chunkSize * 2) {
return calculateChecksum(file);
): Promise<string | undefined> {
const checksumLimit = Math.max(chunkSize * 2, MAX_CHECKSUM_BYTES);
if (file.size > checksumLimit) {
Comment on lines 545 to 546
// Checksum is optional but required on final chunk for verification
checksum := r.Header.Get("X-Checksum")
Comment thread PROJECT_CONTEXT.md
- Design tokens are defined in `src/routes/layout.css`.
- `src/lib/components/ui/` exists with base components including `Button`, `Input`, `Select`, `Toggle`, `Card`, `Modal`, `Spinner`, `Badge`, `ProgressBar`, `ContextMenu`, `Toast`, and `InlineRename`.
- `src/lib/components/ui/` exists with base components including `Button`, `Input`, `Select`, `Toggle`, `Modal`, `Spinner`, `Badge`, `ProgressBar`, `ContextMenu`, `Toast`, and `InlineRename`.
- No `<style>` blocks were found under `frontend/src` during this audit.
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