fix: auto-download URL-sourced documents on view/crop with notice and progress - #177
Merged
Conversation
… progress A plain `ade view <id>` on a URL-sourced parse reported pages_embedded: 0 unless the user knew to add --download — an empty preview was a worse surprise than an implicit fetch (QA follow-up on the v1.0.2 doc-preview ticket). `view` and `crop` now detect a URL-sourced item with no attached copy and fetch it by default: a stderr notice says why the network is being touched and how to skip it (--no-download), and the download streams behind the guarantee progress line (percent + elapsed on a tty, decade lines piped, silent under --json). The fetch is never load-bearing unless asked: in auto mode an expired pre-signed URL degrades to the existing empty-preview note (payload records downloaded: false + download_error) so yesterday's working view never starts exiting non-zero; explicit --download keeps the strict erroring contract. crop hard-fails on a failed fetch as the no-copy state always did — a crop has no empty-imagery fallback. attach.py's consent contract is restated: a URL fetch is either asked for at parse time (--keep-copy) or said out loud before it starts. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Makes URL-sourced documents download automatically when first viewed or cropped, with notices, progress, opt-out behavior, and graceful view failures.
Changes:
- Adds shared announced download and progress handling.
- Integrates automatic fetching into
viewandcrop. - Updates tests, help, and user documentation.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/ade_cli/attach.py |
Adds shared download notice and progress reporting. |
src/ade_cli/view.py |
Enables automatic fetching with graceful failure handling. |
src/ade_cli/crop.py |
Enables automatic fetching before cropping. |
src/ade_cli/parse.py |
Updates --keep-copy guidance. |
src/ade_cli/help.py |
Updates view payload and artifact documentation. |
tests/test_view.py |
Covers view download modes and failures. |
tests/test_crop.py |
Covers crop download modes and failures. |
tests/test_serve.py |
Prevents unrelated server tests from auto-fetching. |
README.md |
Documents automatic download behavior. |
docs/reference/help.json |
Regenerates command help reference. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…eview) The crop payload reference was missing the new `downloaded` member, and view's description implied `false` covers the already-attached case — auto mode omits the key entirely there; false means a failed automatic fetch or explicit --download finding an existing copy. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
yzld2002
approved these changes
Aug 6, 2026
yuanwen-tian
added a commit
that referenced
this pull request
Aug 6, 2026
Bumps `pyproject.toml` and `uv.lock` to 1.0.4 (minimal two-line diff; the lockfile edit is validated by `uv sync --locked`, full suite green, `ade version` reports 1.0.4). ##⚠️ Merge order **Merge #177 first, then this PR** — v1.0.4 is intended to include: - #177 — fix: auto-download URL-sourced documents on view/crop with notice and progress - #176 — feat: live production integration suite gates the release (already on main) Once both are in, cut the release via **Actions → Release → "Run workflow"** on `main`. The pipeline will run the live integration suite (macOS + Windows, against production) before tagging `v1.0.4` — first exercised green on run [31072130505](https://github.com/landing-ai/ade-cli/actions/runs/31072130505). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
QA follow-up on the v1.0.2 "[STG-PROD][ADE][ADE-CLI] doc preview doesn't load after parsing with document URL" ticket: the
--downloadflag added in #169's follow-up fixed the preview, but only opt-in — a plainade view <id>on a URL-sourced parse still reportedpages_embedded: 0, and a user who didn't know the flag saw an empty preview. Decision: the download becomes the default, said out loud rather than silent.What changes
ade viewauto-fetches: a URL-sourced item with no attached copy downloads on first view — a stderr notice explains why and names the opt-out, and the body streams behind the shared progress line (percent + elapsed rewriting in place on a tty, one line per 10% piped, silent under--json):Failure degrades, never breaks: pre-signed URLs expire, so a failed auto-fetch logs the error (
downloaded: false+download_errorin the payload) and the viewer still builds with the honest empty-preview note — aviewthat worked yesterday never starts exiting non-zero. Explicit--downloadkeeps the strict contract: failed fetch and non-URL items stay errors.--no-downloadsuppresses the fetch on both commands; previews then stay empty with the existing remediation note (reworded as a retry action, since the flag no longer needs discovering).ade cropgets the same flow: detect → notice → fetch before rendering. A failed fetch is the crop's failure (no empty-imagery fallback exists), exactly as the no-copy state already was.Contract restated in
attach.py: a URL fetch is never silent — either asked for at parse time (--keep-copy) or announced before it starts. README,--keep-copy/view/crophelp text, payload reference, and remediation hints updated to match.Verification
--downloadstrictness on both commands); ruff andty check srcclean; help reference regenerated.🤖 Generated with Claude Code