Skip to content
2 changes: 1 addition & 1 deletion crates/trusted-server-adapter-fastly/src/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ impl PlatformBackend for FastlyPlatformBackend {
// FastlyPlatformHttpClient — helpers
// ---------------------------------------------------------------------------

/// Convert a platform-neutral [`EdgeRequest`] to a [`fastly::Request`].
/// Convert a platform-neutral [`edgezero_core::http::Request`] to a [`fastly::Request`].
///
/// Only `Body::Once` bodies are forwarded; `Body::Stream` bodies are not
/// used on this path (proxy.rs builds bodies from byte slices).
Expand Down
19 changes: 17 additions & 2 deletions crates/trusted-server-core/src/html_processor.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
//! Simplified HTML processor that combines URL replacement and integration injection
//! Simplified HTML processor that combines URL replacement and integration injection.
//!
//! This module provides a `StreamProcessor` implementation for HTML content.
//! This module provides a [`StreamProcessor`] implementation for HTML content.
//! It handles `<script>` tag injection at `<head>`, attribute URL rewriting
//! (`href`, `src`, `action`, `srcset`, `imagesrcset`), and post-processing
//! hooks for enabled integrations.
//!
//! # Platform notes
//!
//! This module is **platform-agnostic** (verified in the content rewriting verification). It has zero
//! `fastly` imports and depends only on `lol_html`, `std`, and crate-internal
//! types. [`create_html_processor`] returns an `impl` [`StreamProcessor`]
//! whose `process_chunk` method operates on `&[u8]` slices with no
//! platform body type involved.
//!
//! Future adapters (subsequent adapter migrations) do not need to implement any content-rewriting
//! interface. See `crate::platform` module doc for the authoritative note.

use std::cell::Cell;
use std::io;
use std::rc::Rc;
Expand Down
17 changes: 17 additions & 0 deletions crates/trusted-server-core/src/platform/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,23 @@
//! - [`PlatformBackend`] — dynamic backend registration
//! - [`PlatformHttpClient`] — outbound HTTP client
//! - [`PlatformGeo`] — geographic information lookup
//!
//! ## Platform-Agnostic Components
//!
//! The following components were evaluated for platform-specific behavior
//! (the content rewriting verification) and found to have a platform-agnostic rewriting pipeline. No
//! platform trait is required; future adapters (subsequent adapter migrations) need not provide
//! any content-rewriting implementation:
//!
//! - **Content rewriting** — `html_processor`, `streaming_processor`,
//! `streaming_replacer`, and `rsc_flight` modules use only standard Rust
//! (`std::io::Read`/`Write`, `lol_html`, `flate2`, `brotli`). The pipeline
//! is accessed via [`StreamingPipeline::process`] which
Comment thread
prk-Jr marked this conversation as resolved.
Outdated
//! accepts any reader, including `fastly::Body` (which implements
//! `std::io::Read`).
//!
//! No `PlatformContentRewriter` trait exists or is needed.
//!

mod error;
mod http;
Expand Down
8 changes: 8 additions & 0 deletions crates/trusted-server-core/src/publisher.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
//! The publisher handler module.
//!
//! **Note on platform coupling:** The `publisher.rs` handler module is currently platform-coupled
//! at its handler layer — it accepts and returns `fastly::Body` in function signatures
//! such as `process_response_streaming`. This is an HTTP-type coupling
//! that will be addressed in the HTTP-type migration alongside all other
//! `fastly::Request`/`Response`/`Body` migrations. It is not a content-rewriting concern.

use error_stack::{Report, ResultExt};
use fastly::http::{header, StatusCode};
use fastly::{Body, Request, Response};
Expand Down
12 changes: 12 additions & 0 deletions crates/trusted-server-core/src/streaming_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@
//! - Pluggable content processors (text replacement, HTML rewriting, etc.)
//! - Memory-efficient streaming
//! - UTF-8 boundary handling
//!
//! # Platform notes
//!
//! This module is **platform-agnostic** (verified in PR 8). It has zero
Comment thread
prk-Jr marked this conversation as resolved.
Outdated
//! `fastly` imports. [`StreamingPipeline::process`] is generic over
//! `R: Read + W: Write` — any reader or writer works, including
//! `fastly::Body` (which implements `std::io::Read`) or standard
//! `std::io::Cursor<&[u8]>`.
//!
//! Future adapters (PR 16/17) do not need to implement any compression or
//! streaming interface. See `crate::platform` module doc for the
//! authoritative note.

use error_stack::{Report, ResultExt};
use std::io::{self, Read, Write};
Expand Down
Loading
Loading