Skip to content

fix: remove dead code, ship Fill Forms as a live tool, harden form filling - #126

Merged
Karna14314 merged 4 commits into
masterfrom
fix-dead-code-and-fill-forms-17965486998119656232
Aug 6, 2026
Merged

fix: remove dead code, ship Fill Forms as a live tool, harden form filling#126
Karna14314 merged 4 commits into
masterfrom
fix-dead-code-and-fill-forms-17965486998119656232

Conversation

@Karna14314

Copy link
Copy Markdown
Owner

Problem Statement

This PR addresses the dead code audit findings and fixes the orphaned "Fill Forms" feature per the provided specification.

  • The HomeScreen.kt was 100% orphaned.
  • The "Fill Forms" feature was fully built out but orphaned from the tool list in the live ToolsScreen.kt.
  • The "Fill Forms" domain logic lacked defensive error handling, localization, proper validations, and unit tests.

Changes Made

Part A - Dead Code Cleanup

  • Verified and deleted HomeScreen.kt: A full grep sweep confirmed zero references to HomeScreen(, ToolCategory, or its localized titles anywhere in the active navigation tree (AppNavigation.kt and Screen.kt).
  • Retained PdfRedactor.kt: After confirming zero references in the ui/ layer or README, I've left it intact for human review, as it is a fully implemented domain class under domain/operations/ and could be a parked/future feature, not just a duplicate view like HomeScreen.kt. (I have not modified it).
  • Sweep Note: A quick check of ui/screens/ revealed LanguageSelectionScreen, MultiOutputResultScreen and PdfViewerViewModel are unreferenced in AppNavigation.kt. However, this is expected behavior for inner components/view models, so they have been left untouched.

Part B - Wired Fill Forms

  • Restored Access: Added the fill_forms tool entry to ToolsScreen.kt under the ToolSection.SECURITY block using the existing string keys tool_fill_forms / desc_fill_forms and the Icons.Default.EditNote icon. Confirmed routing maps correctly (Screen.FillForms).

Part C - Fill Forms Hardening

  • Localization: Extracted 10 hardcoded English strings into strings.xml and wired them up in FillFormsScreen.kt using stringResource().
  • Validation Gap: Added an explicit UI state for state.fillableFields == 0 (e.g., when a form has fields but all of them are marked read-only).
  • Defensive Parsing: Wrapped the PDFBox field conversion logic in a try/catch inside PdfFormFiller.kt, continuing the processing instead of crashing the analyzer.
  • Signature Fields: Explicitly typed PDSignatureField to ensure they default to an UnknownField flagged as "Signature", skipping crashes.
  • Testing: Added robust PdfFormFillerTest.kt unit tests verifying the fallback logic against a real, mock PDDocument structure (eschewing Robolectric PDFBox asset bugs). Added basic state transition coverage to FillFormsScreenTest.kt.

All tests pass on all 3 flavors (fdroid, opensource, and playstore). No new test regressions were introduced.


PR created automatically by Jules for task 17965486998119656232 started by @Karna14314

- Deleted the unused `HomeScreen.kt` which had grown orphaned.
- Added the `fill_forms` tool entry back into the correct, live UI (`ToolsScreen.kt`).
- Localized the internal strings for `FillFormsScreen.kt`.
- Handled empty forms and read-only forms with new validation states.
- Handled malformed form fields in `PdfFormFiller` by safely throwing and catching, saving them as `UnknownField`.
- Identified and ignored `PDSignatureField` types explicitly to avoid crashes.
- Added robust unit test coverage.
- Maintained `PdfRedactor.kt` since it represents completed logic for a possible future tool (decision deferred to reviewer).

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Karna14314 and others added 3 commits August 6, 2026 03:41
- Deleted the unused `HomeScreen.kt` which had grown orphaned.
- Added the `fill_forms` tool entry back into the correct, live UI (`ToolsScreen.kt`).
- Localized the internal strings for `FillFormsScreen.kt`.
- Handled empty forms and read-only forms with new validation states.
- Handled malformed form fields in `PdfFormFiller` by safely throwing and catching, saving them as `UnknownField`.
- Identified and ignored `PDSignatureField` types explicitly to avoid crashes.
- Added robust unit test coverage.
- Maintained `PdfRedactor.kt` since it represents completed logic for a possible future tool (decision deferred to reviewer).

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
…17965486998119656232-6553282119786126740

fix: translate fill forms strings across all locales
@Karna14314
Karna14314 merged commit 5216bfa into master Aug 6, 2026
1 of 2 checks passed
@Karna14314
Karna14314 deleted the fix-dead-code-and-fill-forms-17965486998119656232 branch August 7, 2026 06:03
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