Repository navigation
fix(vault): open Markdown files in the Encrypted Vault reader - #448
Conversation
Adds a MarkdownReady state and loads the decrypted bytes as UTF-8 text via VaultFileReader.readAt, mirroring the existing EPUB/PDF branches. Rendering wiring follows in subsequent commits. Part of #442.
…roid) Adds VaultMarkdownReaderScreen, a v1-scoped Vault-local Markdown renderer (whole-document Markdown() call, VaultReaderSettings-driven typography), and wires it into VaultReaderScreen's format dispatch. Deliberately adds the multiplatform-markdown-renderer-m3 dependency directly to feature:vault (matching the existing Readium/PDF precedent of pulling third-party renderers in per-module) rather than depending on feature:reader, per this module's established "duplicate rather than share" convention (see VaultReaderTopBar's and VaultReaderSettings' doc comments) - see the PR description for the full rationale on this deviating from one detail of the issue's hand-scoped plan. No TOC/mermaid/relative-image support yet - explicitly out of scope for v1 per the issue. Closes #442
Adds a markdownReady state to VaultReaderViewModel, decoding the decrypted content as UTF-8 text and parsing it with the existing MarkdownDocumentParser (already shared with the non-vault reader, since iOS has no per-module Gradle-style boundary to work around). VaultReaderView renders it via the existing MarkdownReaderContent, with fixed v1 typography defaults (no theme/font-size controls exist for the Vault reader on iOS yet) and no image loading/TOC/position persistence, matching Android's equivalent v1 scope for this issue. Part of #442
de65ae2 to
80a6cd4
Compare
|
The dev agent's run failed (crashed or exhausted its turn budget) while producing this PR — routed to a human instead of silently advancing an unconfirmed fix to QA. See the workflow run log for what happened. |
|
Principal-dev-lead read-through (the automated run that produced this diff crashed/ran out of budget before reaching QA, per the bot comment above — not a design or code problem, so re-routing rather than reworking). Traced every symbol this diff touches back to its real definition rather than trusting the diff at face value:
No issues found. Relabeling to |
QA verification — PR #448 vs issue #442Environment note: this run is on a Linux CI runner with no Xcode/ Acceptance criteria (per issue #442 + the maintainer's hand-scoped plan/decision comments)
Regression checkConfirmed the pre-fix code path (commit The iOS test ( Tests run
AGENTS.md conventions
Minor, non-blocking noteThe PR description's own "Test plan" checklist boxes are left unchecked ( QA verdict: PASS |
|
This PR's branch is stale relative to |
|
Rebased onto current dev (clean merge, no conflicts — genuinely stale, not a self-touching case). Compiles clean. Re-labeling to retry principal review; QA already passed. |
📱 iOS Build Status: PASSED✅ iOS Simulator Build & Unit Tests - success iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those. |
Principal review — verdict:
|
Summary
.mdfiles stored in an Encrypted Vault fail to open with "Unsupported format: markdown" on both Android and iOS, even though the non-vault reader already has full Markdown support. This wires the Vault reader's format dispatch to render Markdown too.Closes #442
Approach
Following the hand-scoped implementation plan a maintainer posted on the issue (after an earlier triage pass on this same issue correctly flagged a real module-boundary ambiguity and stopped at
status:needs-info):MarkdownReady/.markdownReadystate parallel to the existingEpubReady/PdfReady, on both platforms.VaultFileReader.readAton Android,VaultStore.readFullContenton iOS — both already used for EPUB/PDF) and decode as UTF-8 text.feature:reader(Android) — see "Risky/uncertain" below for why this deviates from one detail of the literal plan text.Risky / uncertain — flagging explicitly
The issue's own triage comment identified 3 open questions and asked a human to decide. The maintainer's follow-up plan answered (1) plain-render-first is fine for v1, and (3) relative images are unsupported for v1 (safe no-op fallback). For (2) — whether shared Markdown code should move to a
core:markdown-style module orfeature:vaultshould take a direct dependency onfeature:reader— the plan's code sample referencedfeature:reader'sCoilMarkdownImageTransformer/rememberMarkdownTypographydirectly, which would require the latter.I did not do that.
feature:vaulthas multiple recent, explicit doc comments (VaultReaderTopBar,VaultReaderSettings, andVaultReaderViewModel's ownAppReadingTheme/ReadingThememapper, the last of which landed ondevafter the plan comment was written) all independently re-affirming "duplicated per module rather than a new cross-module dependency" as this module's live, current convention — and the original triage comment flagged the direct-dependency route as pulling in Readium x3/pdf-viewer/jsoup/webkit/room/tts intofeature:vault's graph. Given the full-parity items the shared code would have bought (TOC, mermaid, image loading) are all separately marked out-of-scope for v1 in the same plan, I added the renderer's external library dependency directly (matching the low-ambiguity EPUB/PDF precedent already in this module) and wrote a small local typography adapter fromVaultReaderSettings, rather than adding thefeature:vault→feature:readerdependency implied by the snippet. This is a judgment call on an already-flagged architectural fork — please double check it's the one you wanted before merging.Explicitly out of scope for v1 (matches the plan)
DocumentFiletree exists inside an encrypted vault; images just don't render (no crash).Test plan
VaultReaderViewModelTest— MARKDOWN entry reachesMarkdownReadywith the decoded text; regression test that a genuinely unhandled format still surfacesError.VaultReaderViewModelTests—"markdown"entry reaches.markdownReady../gradlew testDebugUnitTestlocally before marking ready.