Repository navigation
Conversation
Warp's Markdown viewer drops raw-HTML `<img>` tags, so there is no way to size embedded images (the issue's motivating case: locally-generated SVG dashboards embedded in notes). The Markdown-image renderer also draws every image at a hardcoded default size, ignoring both intrinsic dimensions and any author sizing signal. This adds the product + tech spec for a scoped first slice of warpdotdev#13652: recognize a block-level `<img>` tag and honor its width/height/align, threaded through the existing FormattedImage -> BufferBlockItem::Image -> ImageBlockConfig render path (mirroring the field-threading precedent in specs/GH849). The broader raw-HTML subset (tables, details, anchors, kbd, picture, …) is left as follow-ups under the same issue.
Issue warpdotdev#13652 (bulk raw-HTML-subset request) was closed and split into focused per-tag issues. Move the spec to specs/GH13721/ and update issue references to point at warpdotdev#13721, the focused <img> sizing issue.
Replace the unspecified 'generous cap' placeholder for width-only/ height-only image sizing with the concrete, already-shipped mechanism: mermaid_diagram_size (edit.rs's sibling in mermaid_diagram.rs) already derives ImageBlockConfig height/width from AssetCache's decoded intrinsic size during layout, falling back to a plain default only while the asset is still loading. <img> sizing adopts this pattern verbatim instead of relying on contain()'s runtime scaling, which never updates ImageBlockConfig or document-flow height.
…ecify alignment mechanism Finding 1: the Context section still framed Image::contain() as the aspect-ratio-preservation mechanism, directly contradicting §4's Mermaid-precedent fix (which explicitly says contain()/ layout_using_paint_bounds() 'looks like a shortcut but is not'). Clarify that contain() only fit-scales within whatever box ImageBlockConfig already is, and point to §4 as the single source of truth for how that box becomes aspect-ratio-correct. Finding 2: the alignment plan named only an ImageBlockConfig.align field without specifying how layout carries available content width and displayed image bounds, or how alignment interacts with contain()'s internal centering. Ground the mechanism in the actual code: RenderableImage::layout() constrains the primitive to exactly config.width/height (SizeConstraint with size = config dims), so once those are aspect-ratio-correct, contain() has zero internal slack to center within. Positioned::image() today resolves its x-origin via the generic bounds::content_origin (spacing.left_offset() only, no per-instance offset) -- that's the gap align must close, one level up from the primitive, with the same slack-splitting arithmetic as the align-blocks spec (GH13735).
Invariant 6 stated aspect-ratio derivation as 'the renderer already scales by the smaller of the width/height ratios inside its layout box' -- the same generic contain()-fit claim that f17165e already refuted in the tech spec's §4 (contain() only fit-scales within a box that is already the right shape; it does not derive that shape). f17165e only touched tech.md, so this product.md claim was never swept. Point invariant 6 at the tech spec's actual mechanism (AssetCache intrinsic- size derivation, Mermaid precedent) instead of restating the disproven generic-contain-fit explanation.
Round-3 Oz review found two residual gaps in the img sizing mechanism: round-2's Mermaid-precedent fix derives the missing axis from intrinsic size once decoded, but pre-decode the derived axis still fell back to a plain default box rendered through contain(), which fit-scales by the smaller width/height ratio and can shrink the specified axis below its requested value for that one transient frame. Fix: render the pre-decode fallback frame with stretch() instead of contain() so the specified axis is never touched by fit-scaling in any load state, only the derived axis is ever a guess. Separately, percent width/height had no clamp at all (200% could exceed the pane) while pixel sizing was already clamped, an inconsistency between the two paths. Unify both into one clamp_to_bound() rule shared by pixel and percent, both width and height, with percentages clamped to [0, 100] before the multiply and the result floored at 1px so a zero/negative percent can't yield a blank image box. Sibling sweep: added percentage-height clamping (the width fix's mirror case), width-only vs height-only intrinsic-ratio derivation symmetry, and a zero/near-zero available_width guard against a divide-by-zero or clamp() panic in a pathologically narrow or nested container.
|
I'm starting a first review of this spec-only pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR adds product and technical specs for rendering block-level raw-HTML <img> tags in the Markdown viewer, including width/height sizing, alignment, serialization, sanitization, and validation coverage. The scope is appropriately narrow for GH13721 and the security model mostly reuses the existing Markdown image asset-resolution path.
Concerns
- The tech spec contradicts itself and the product spec on negative dimensions: parsing says negative sizing attributes are ignored, but the layout test plan expects
width="-10%"to resolve and clamp to1px. That ambiguity should be resolved before implementation because it changes both parser behavior and expected tests.
Verdict
Found: 0 critical, 1 important, 0 suggestions
Request changes
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
…sions ignored at parse (GH13721)
…ejection (GH13721)
|
/oz-review |
|
I'm re-reviewing this spec-only pull request in response to a review request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This spec defines product and technical requirements for rendering block-level raw-HTML <img> tags in the Markdown viewer, including width/height parsing, alignment, round-trip serialization, and tests. The scope is aligned with the linked focused image-sizing issue, and the security model generally stays within the existing Markdown image asset-loading path.
Concerns
- The layout algorithm depends on
asset_sourceandAppContextat a point where the current image path has not resolved the asset source yet, so the implementation instructions need to state where that resolution/config computation moves. - The product spec promises that single-dimension images are never distorted, but the tech spec requires
.stretch()for the pre-decode fallback frame, which violates that requirement unless the product invariant is narrowed. - Height percentage semantics should be stated consistently between the product and tech specs.
Verdict
Found: 0 critical, 2 important, 1 suggestions
Request changes
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
Height ruling (Frederic): explicit reasonable pixel heights are honored, not clamped to default_height. Guiding principle "model any reasonable markdown file, not any possible HTML file." - tech §4: pixel height resolves via clamp_to_bound(px, MAX_EXPLICIT_IMAGE_DIMENSION_PX) — honored verbatim, with a sanity cap (not a layout max) grounded in the render model at the GPU single-texture floor (max_texture_dimension_2d, ≥8192px guaranteed; recommend 8192.0). Percent height still resolves against default_height (its reference and cap by design). The height/width asymmetry is now stated with its reason (horizontal space is a hard constraint; vertical space is free/scrolls). Adds explicit boundary test cases (480 honored, 8192 inclusive-cap, 99999999 → cap, 1px floor), each with a justification comment. - product inv 4/5: height honored verbatim with sanity cap (was "treated the same way" as width); percent height reference named explicitly as default_height, NOT the viewport height (Oz finding c). Oz round-2 findings on PR warpdotdev#13971: - (a, tech §4) The AssetCache intrinsic-size query needs both AppContext and a resolved asset_source, but the old path only resolved the source later in into_block_item (edit.rs:886), a phase with no AppContext, after the config was built. Spec now specifies the implementable sequence: resolve the source in from_styled_block (which has `app`), before config construction, threaded onto LayoutTask::Image and reused downstream — resolved once, in the only phase that can perform the query. - (b, product inv 6) "Never distorted" now admits one bounded transient pre-decode frame where the DERIVED axis (never the specified one) is stretched, self-correcting once the asset decodes; points at the layout-math Loading->Loaded transition test. - Sibling sweep of (a): the align offset reads available_width at PAINT time but it's computed at layout time; spec now states it must be stored on ImageBlockConfig (align_available_width) to cross that phase boundary.
|
/oz-review |
|
I'm re-reviewing this spec-only pull request in response to a review request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This spec PR defines product and technical requirements for rendering block-level raw-HTML <img> tags in the Markdown viewer with width, height, and align support. The scope is narrow and the security model is mostly explicit through an attribute allowlist and reuse of the existing image source resolver.
Concerns
- The height-only aspect-ratio path is internally contradictory: the spec says the specified dimension is always honored exactly and the settled image is aspect-ratio-correct, but the tech spec clamps the derived width to
available_widthwithout defining what happens when that clamp would require reducing the specified height or accepting horizontal overflow.
Verdict
Found: 1 critical, 0 important, 0 suggestions
Request changes
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
Oz round-3 critical: in the height-only aspect-ratio path, when derived_width = height * intrinsic_w / intrinsic_h exceeds available_width, clamping only the derived width (the old `min(..., available_width)` formula) leaves the box no longer aspect-ratio-correct — a distortion. Ruling (precedence: aspect ratio > pane-width bound > specified dimension): honor the specified height fully UNLESS the aspect-derived width would exceed the pane; in that case scale the whole box down uniformly so width == available_width and effective_height == available_width * intrinsic_h / intrinsic_w (proportionally reduced below the specified height). Never distort, never overflow horizontally. - tech §4: replaces the min-only formula with the uniform scale-down rule; documents that it mirrors the width side (a too-wide specified width already clamps and derives height down — same principle, opposite trigger) and the deliberate divergence from browsers (they allow horizontal overflow; the pane treats horizontal as a hard constraint). Percent-height sibling case and the test plan updated to match; adds overflow, at-boundary, and percent-neighbor boundary test cases. - product inv 4/6: the specified height yields to the pane bound in this one case; inv 6's "always honored exactly" now carries the pane-fit exception explicitly (a specified width has no analogous case — its derived height is unbounded because vertical space is free).
Two clarifications from Frederic's pre-final-trigger review, plus a framing tighten, all docs-only. - Summary: lead with the actual motivating problem — a raw-HTML <img> currently does not load or render AT ALL (it drops to unrendered text). Sizing/alignment are why authors reach for HTML <img> over , not the feature's essence; the motivating example needs both halves (the tag must render AND its width/height/align honored). A few words, not a rewrite. - srcset non-goal: add an explicit out-of-scope bullet framing srcset as a responsive-image FEATURE deferred to <picture>/<source> (warpdotdev#13736) — on a bare <img>, srcset is ignored and only src is read, matching a srcset-unaware browser's src fallback. Differentiate the allowlist mentions (product inv 13, tech §6) so srcset is no longer listed undifferentiated next to the security-motivated onerror/onload/style drops; it is discarded by the same allowlist mechanically but is a feature deferral, not a security exclusion. - Load-failure visual: document that a well-formed <img> whose src fails to load (FailedToLoad/Evicted) renders as an empty box at the configured size — no placeholder, icon, or alt text — inherited unchanged from the pre-existing Markdown-image path ( behaves identically), distinct from the parse-invalid text fallback and from the oversized-data-URI text placeholder. Documented near the failure-state sizing text in tech.md and referenced from product invariant 1.
|
/oz-review |
|
I'm re-reviewing this spec-only pull request in response to a review request. You can view the conversation on Warp. I reviewed this pull request and requested human review from: Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This spec PR adds product and technical coverage for rendering block-level raw-HTML <img> tags in the Markdown viewer, including width/height/align behavior, parser scope, model threading, layout rules, serialization, testing, and sanitization boundaries.
Concerns
- No blocking completeness, clarity, feasibility, issue-alignment, or design-level security concerns found in the changed spec content.
Verdict
Found: 0 critical, 0 important, 0 suggestions
Approve
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
|
(Just commenting as this is waiting for review). |
## Summary Client half of REMOTE-2548. warp-server PR [#13971](warpdotdev/warp-server#13971) migrates cloud-agent input attachments onto the owner-resolved `ObjectStore`, and the prepare-upload response now returns the standard `upload_target` alongside the deprecated `upload_url`. `upload_url` can only ever describe a presigned `PUT`. Teams whose attachments are mapped to self-hosted S3 storage get a presigned **POST form** instead, so a client that only reads `upload_url` cannot upload their attachments at all. This teaches the client to honor `upload_target`, reusing the upload-target support that already exists in this repo for artifact and snapshot uploads: - `AttachmentUploadInfo` now parses `upload_target`, and `resolve_upload_target()` prefers it — falling back to a synthesized presigned `PUT` built from `upload_url` when the field is absent, so the client keeps working against a server that has not deployed #13971 yet. - `upload_pending_attachments_to_task` (`app/src/terminal/input.rs`) routes through the existing `presigned_upload::upload_to_target` helper instead of a hand-rolled `PUT`. That helper already handles plain-body `PUT`s and multipart `POST` forms, including the CRC32C computation S3 requires. ### Two pre-existing deserialization bugs, also fixed Pinning the tests to the bytes the server actually emits surfaced two mismatches in the shared `UploadTarget` type. Without both fixes the new `upload_target` path could never have worked, and both also affect the **snapshot** upload path, which deserializes the same type: 1. `UploadFieldValue::ContentCrc32C` derived the serde tag `content_crc32_c` under `rename_all = "snake_case"`, but the server's discriminator is `content_crc32c`. Every presigned POST target failed to parse. 2. `UploadTarget.headers` was a non-defaulted `HashMap`. The server marshals an unset header map as `null`, which is exactly what an S3 POST target carries, so the whole target failed to parse. ## Verification `./script/format --check`, `cargo clippy -p warp --all-targets --tests -- -D warnings`, and `cargo clippy --workspace --exclude warp_completer --all-targets --tests -- -D warnings` all pass. Tests for the touched modules (`server::server_api::*`, `terminal::input*`): 272 passed. Three failures are pre-existing and environment-specific — `ambient_agent_headers_for_task_overrides_existing_cloud_agent_header`, `test_histignorespace_support_in_zsh`, `test_decorations_with_multibyte_chars` — confirmed failing identically on a clean checkout of the base branch in the same sandbox. New regression tests (all verified failing before the change, passing after): - `prepare_attachment_uploads_response_parses_s3_form_upload_target` - `prepare_attachment_uploads_response_prefers_upload_target_over_upload_url` - `prepare_attachment_uploads_response_falls_back_to_upload_url` - `s3_form_upload_target_is_uploaded_as_a_multipart_post` — asserts the real multipart POST body over HTTP - `upload_url_fallback_is_uploaded_as_a_put_with_its_content_type` — asserts the real PUT over HTTP - `upload_target_deserializes_null_headers_and_fields_as_empty`, `upload_field_value_deserializes_every_server_kind` ### Cross-repo wire conformance Rather than hand-writing the response fixtures, I checked out warp-server at #13971's head (`b56508cc`) and marshalled the handler's own `PrepareAttachmentUploadsResponse` through `attachmentUploadsFromTargets`, for both a Warp-hosted PUT target and an S3 POST target. The client's fixtures are those bytes verbatim. Both bugs above were found this way — hand-written fixtures had hidden them. (That dump was a throwaway; no warp-server files were changed.) ### What was NOT verified **There is no true end-to-end run behind this PR.** I could not attach a file to a real cloud-agent run against a server carrying #13971: - No Docker in this environment, so no local warp-server stack (`script/oz-local` needs it). - The attachment flow is reached through the Warp GUI, which needs an interactive login this sandbox has no credentials for. - #13971 is not deployed anywhere, so even a logged-in client would only exercise the `upload_url` fallback. The strongest evidence here is the cross-repo wire conformance above plus HTTP-level upload assertions — the client is proven to parse the server's exact bytes and to emit the correct multipart POST / PUT request from them. **A human should still confirm the full flow once #13971 deploys**, ideally with a team mapped to self-hosted S3 storage, since that is the configuration this change exists for. ## Dependency warp-server PR [#13971](warpdotdev/warp-server#13971) is the server-side counterpart and **must deploy before the `upload_target` path goes live**. Until then this client keeps using the `upload_url` fallback, which is the behavior it has today. CHANGELOG-BUG-FIX: Fixed cloud agent attachment uploads for teams using self-hosted S3 storage. Originating thread: https://warpdev.slack.com/archives/C0BDQDW8V5E/p1786023009816349 _Conversation: https://staging.warp.dev/conversation/75b84096-9c7a-44ea-9710-c658392da231_ _Run: https://oz.staging.warp.dev/runs/019fd78d-6472-7e3a-97cc-25b0026d46bc_ _This PR was generated with [Oz](https://warp.dev/oz)._ <!-- factory-agent: {"source":"factory-agent","task_id":"REMOTE-2548","task_source":"linear","task_url":"https://linear.app/warpdotdev/issue/REMOTE-2548/migrate-cloud-agent-input-attachments-to-objectstore-attachments-only","oz_run_id":"019fd78d-6472-7e3a-97cc-25b0026d46bc","repo":"warpdotdev/warp"} --> --------- Co-authored-by: Oz <[email protected]> Co-authored-by: Warp <[email protected]>
|
@bnavetta This PR is still waiting for review. (Just trying to avoid the stale-bot) |
| /// `None` for Markdown `` images, which have no sizing syntax. | ||
| pub width: Option<ImageDimension>, | ||
| pub height: Option<ImageDimension>, | ||
| pub align: ImageAlign, // defaults to Left |
There was a problem hiding this comment.
I believe Markdown images default to center - this should be preserved
Drop percentage-height support, preserve the centered default for Markdown images, switch dimension payloads to OrderedFloat, and specify a real asset-load relayout trigger. Percentage heights are rejected at parse time rather than resolved against the image block's default height. The default height is an internal implementation detail authors cannot reason about, and the viewport height would make document layout depend on window size. Percentage widths and pixel heights are unaffected. ImageAlign defaults to Center, not Left. The Image primitive's image_rect centers the decoded image inside its box, and today's box is always the full available width, so Markdown images narrower than the pane already render centered. Sizing the box to the author's width removes that slack, so the centering is re-established at the block's paint origin. ImageDimension carries OrderedFloat<f32> rather than integers, matching how the codebase carries Eq-able floats. This adds ordered-float to markdown_parser, which does not yet depend on it. repaint_after_load re-paints an already-sized box but does not rebuild ImageBlockConfig: content layout runs only when a PendingLayout is queued, and the asset-load path reaches build_scene without touching pending_edits. The pending_mermaid_asset field intended as this hook has no production reader. The spec now specifies spawning a when_loaded task that queues a block-scoped invalidate_layout_for_range plus add_pending_edit, with dedupe and cancellation guards, and adds tests for the trigger.
What
Spec (product.md + tech.md, per CONTRIBUTING's spec-first workflow for feature requests) for teaching the Markdown viewer to recognize a block-level raw-HTML
<img>tag and honor itswidth/height/alignattributes.Closes #13721 — the focused
<img>-sizing issue split out of #13652 per maintainer guidance there. The other raw-HTML tags are tracked in their own sibling issues (#13725, #13726, #13732, #13733, #13734, #13735, #13736).Why
Markdown image syntax gives authors no sizing control, and the viewer's default layout ignores an image's intrinsic dimensions — so locally generated SVG charts embedded in Markdown notes render at a small fixed size with no author-side remedy. The HTML
widthattribute is the only sizing signal an author can express; today it is silently dropped.Highlights
<img>on its own line renders through the existing Markdown-image pipeline (markdown_parser→BufferBlockItem::Image→RenderableImage), following the field-threading precedent fromspecs/GH849/.width="640"/"640px") and percentage (width="90%"), clamped to pane width; aspect ratio preserved when one dimension is given;align="left|center|right".src/alt/title/width/height/alignare read;onerror,onload,style, and all other attributes are ignored; no script execution or navigation. Malformed tags fall back to today's literal-text rendering — never a panic or a blank box.<img>tags; no change to default sizing when no attributes are present.Process note
#13652 was closed in favor of per-feature issues; this spec now targets #13721 and the files moved to
specs/GH13721/. Keeping this draft open and updated while #13721 awaits triage /ready-to-spec— happy to adjust if you'd rather sequence it differently.