Update cdn app examples#74
Open
godronus wants to merge 14 commits into
Open
Conversation
FastEdge does not currently dispatch proxy_on_log -- neither the edge runtime nor the local debugger (@gcoredev/fastedge-test) invokes it. Examples that implement on_log mislead developers into thinking end-of-request logging works when it doesn't. Removed the on_log trait method from two CDN examples (headers, log_time). The log_time example still demonstrates per-phase timing via on_http_request_headers and on_http_response_headers. Documented the platform gap in two architecture docs so future contributors don't reintroduce on_log: - context/architecture/HOST_SDK_CONTRACT.md (FFI table annotation) - context/architecture/REQUEST_LIFECYCLE.md (lifecycle-diagram note) SDK still leaves the trait method definition in place for forward- compat -- when/if the platform starts dispatching it, no source change is needed. Note: cdn/properties/src/lib.rs was intentionally left untouched per in-session direction; on_log can be removed there in a follow-up.
After #11 fixed the response-phase host check, the Rust headers example still returned HTTP 552 because onResponseHeaders used a strict-equality check (`expected != diff`) that assumed `remove()` left the header present with empty value. On FastEdge, `set_http_response_header(name, None)` actually deletes the header -- the actual response has no `new-header-01` line at all -- so `diff` is a strict subset of `expected` and the != comparison fired on every request. Switch onResponseHeaders to the subset-check pattern already used by onRequestHeaders at line 150 (`!diff.difference(&expected).is_empty()`). Passes when actual response headers are a subset of expected. The two validation patterns are now symmetric within the file. Also fixed a small typo at line 158: the bytes-variant println printed the string-variant `diff` instead of `diff_bytes`. Only visible when the bytes-diff branch fires. Builds clean against wasm32-wasip1. Note: fastedge-test/test-applications/cdn-apps/rust/cdn-headers/src/lib.rs mirrors this file and has the same response-phase bug at line 325/332. Mechanical port pending confirmation.
Apply parity with the fastedge-plugin generate-docs-template.sh. Rejected `claude -p` outputs now persist under docs/.failures/ for prompt-debugging, and the salvage path strips one-line conversational preambles (a known Sonnet update-mode failure) rather than retrying. Tightens OUTPUT CONSTRAINT and existing-content prompt blocks to ban the "outputting verbatim" acknowledgement class explicitly.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the FastEdge SDK Rust plugin source manifest and doc-generation tooling while aligning CDN (proxy-wasm) examples with the platform/runtime behavior (stdout-only capture, proxy_on_log not dispatched) and adding/refreshing live-test fixtures for many examples.
Changes:
- Add
docs/quickstart.mdas a required source infastedge-plugin-source/manifest.jsonand map it to the plugin reference file. - Harden
fastedge-plugin-source/generate-docs.shagainst LLM preamble leakage and preserve failed outputs underdocs/.failures/. - Update multiple CDN examples (and fixtures) for logging/observability consistency and add missing
.live.json/.test.jsonfixtures across examples.
Reviewed changes
Copilot reviewed 100 out of 105 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| fastedge-plugin-source/manifest.json | Adds Quickstart doc to plugin source inputs and reference mapping. |
| fastedge-plugin-source/generate-docs.sh | Improves prompt constraints and salvages markdown output by stripping preamble; preserves failures. |
| examples/http/basic/cache/Cargo.lock | Adds lockfile for the HTTP cache example. |
| examples/cdn/variables_and_secrets/src/lib.rs | Switches logging to stdout; example behavior unchanged otherwise. |
| examples/cdn/variables_and_secrets/fixtures/happy-path.live.json | Adds live expectations for variables/secrets example logs. |
| examples/cdn/properties/src/lib.rs | Renames root/context structs and adjusts extension/asn handling. |
| examples/cdn/properties/README.md | Expands documentation on extracted properties, overrides, and build notes. |
| examples/cdn/properties/fixtures/happy-path.live.json | Adds live expectations for properties example output. |
| examples/cdn/md2html/fixtures/html-passthrough.live.json | Adds live expectations for HTML passthrough scenario. |
| examples/cdn/md2html/fixtures/convert-to-html.live.json | Adds live expectations for markdown-to-HTML conversion scenario. |
| examples/cdn/log_time/src/lib.rs | Removes on_log hook usage. |
| examples/cdn/log_time/fixtures/happy-path.live.json | Adds live expectations for log_time example. |
| examples/cdn/large_env_variable/src/lib.rs | Switches logging to stdout for config size output. |
| examples/cdn/large_env_variable/fixtures/missing-config.live.json | Adds live expectations when LARGE_CONFIG is missing. |
| examples/cdn/large_env_variable/fixtures/happy-path.live.json | Adds live expectations for configured LARGE_CONFIG. |
| examples/cdn/key_value/src/lib.rs | Switches error logging to stdout. |
| examples/cdn/key_value/fixtures/no-query-params.test.json | Adds debugger test fixture for missing query params. |
| examples/cdn/key_value/fixtures/no-query-params.live.json | Adds live expectations for missing query params. |
| examples/cdn/key_value/fixtures/missing-store-param.test.json | Adds debugger test fixture for missing store param. |
| examples/cdn/key_value/fixtures/missing-store-param.live.json | Adds live expectations for missing store param. |
| examples/cdn/key_value/fixtures/kv-get.test.json | Adds debugger test fixture for KV get path. |
| examples/cdn/key_value/fixtures/kv-get.live.json | Adds live expectations for KV get path. |
| examples/cdn/key_value/Cargo.lock | Adds lockfile for the CDN key_value example. |
| examples/cdn/jwt/fixtures/valid-token.test.json | Adds debugger test fixture for valid JWT. |
| examples/cdn/jwt/fixtures/valid-token.live.json | Adds live expectations for valid JWT. |
| examples/cdn/jwt/fixtures/missing-secret.test.json | Adds debugger test fixture for missing secret configuration. |
| examples/cdn/jwt/fixtures/missing-secret.live.json | Adds live expectations for missing secret configuration. |
| examples/cdn/jwt/fixtures/missing-auth-header.test.json | Adds debugger test fixture for missing Authorization header. |
| examples/cdn/jwt/fixtures/missing-auth-header.live.json | Adds live expectations for missing Authorization header. |
| examples/cdn/jwt/fixtures/invalid-token.test.json | Adds debugger test fixture for invalid JWT signature. |
| examples/cdn/jwt/fixtures/invalid-token.live.json | Adds live expectations for invalid JWT signature. |
| examples/cdn/jwt/fixtures/expired-token.test.json | Adds debugger test fixture for expired JWT. |
| examples/cdn/jwt/fixtures/expired-token.live.json | Adds live expectations for expired JWT. |
| examples/cdn/jwt/fixtures/.env | Adds fixture env vars for JWT example. |
| examples/cdn/jwt/Cargo.lock | Adds lockfile for the CDN jwt example. |
| examples/cdn/http_call/src/lib.rs | Simplifies HTTP call response logging and silences unused param warning. |
| examples/cdn/http_call/fixtures/happy-path.live.json | Adds live expectations for http_call example. |
| examples/cdn/hello_world/src/lib.rs | Introduces leading blank lines (formatting change). |
| examples/cdn/hello_world/README.md | Expands documentation with hook list, build steps, and expected output. |
| examples/cdn/hello_world/fixtures/happy-path.live.json | Adds live expectations for hello_world example. |
| examples/cdn/headers/src/lib.rs | Fixes diff logging variable usage; removes on_log. |
| examples/cdn/headers/fixtures/happy-path.live.json | Adds live expectations for headers example. |
| examples/cdn/geoblock/src/lib.rs | Renames root/context structs and fixes time-window logic. |
| examples/cdn/geoblock/fixtures/missing-config.live.json | Adds live expectations for missing config case. |
| examples/cdn/geoblock/fixtures/blocked-country.live.json | Adds live expectations for blocked country case. |
| examples/cdn/geoblock/fixtures/allowed-country.live.json | Adds live expectations for allowed country case. |
| examples/cdn/geo_redirect/src/lib.rs | Switches redirect logging to stdout. |
| examples/cdn/geo_redirect/fixtures/germany.live.json | Adds live expectations for Germany redirect. |
| examples/cdn/geo_redirect/fixtures/default.live.json | Adds live expectations for default redirect. |
| examples/cdn/custom/fixtures/status-403.live.json | Adds live expectations for 403 response scenario. |
| examples/cdn/custom/fixtures/status-200.live.json | Adds live expectations for 200 response scenario. |
| examples/cdn/custom/fixtures/invalid-status.live.json | Adds live expectations for invalid status scenario. |
| examples/cdn/custom_error_pages/fixtures/502-bad-gateway.live.json | Adds live expectations for 502 custom error page. |
| examples/cdn/custom_error_pages/fixtures/500-internal-server-error.live.json | Adds live expectations for 500 custom error page. |
| examples/cdn/custom_error_pages/fixtures/418-fallback.live.json | Adds live expectations for 418 fallback page. |
| examples/cdn/custom_error_pages/fixtures/404-not-found.live.json | Adds live expectations for 404 custom error page. |
| examples/cdn/custom_error_pages/fixtures/400-bad-request.live.json | Adds live expectations for 400 custom error page. |
| examples/cdn/custom_error_pages/fixtures/200-passthrough.live.json | Adds live expectations for passthrough scenario. |
| examples/cdn/cors/fixtures/wildcard/.env | Adds env config for wildcard CORS scenario. |
| examples/cdn/cors/fixtures/wildcard-origins.test.json | Adjusts dotenv path to use wildcard fixture directory. |
| examples/cdn/cors/fixtures/wildcard-origins.live.json | Adds live expectations for wildcard origin scenario. |
| examples/cdn/cors/fixtures/preflight.live.json | Adds live expectations for preflight scenario. |
| examples/cdn/cors/fixtures/no-origin.live.json | Adds live expectations for no-origin scenario. |
| examples/cdn/cors/fixtures/happy-path.live.json | Adds live expectations for normal CORS scenario. |
| examples/cdn/cors/fixtures/disallowed-origin.live.json | Adds live expectations for disallowed origin scenario. |
| examples/cdn/convert_image/src/lib.rs | Renames root/context structs, improves formatting, and adds UA empty guard. |
| examples/cdn/convert_image/fixtures/ua-in-ignore-list.test.json | Adds debugger test fixture for ignored UA behavior. |
| examples/cdn/convert_image/fixtures/ua-in-ignore-list.live.json | Adds live expectations for ignored UA behavior. |
| examples/cdn/convert_image/fixtures/no-extension.test.json | Adds debugger test fixture for missing extension behavior. |
| examples/cdn/convert_image/fixtures/no-extension.live.json | Adds live expectations for missing extension behavior. |
| examples/cdn/convert_image/fixtures/formats-not-set.test.json | Adds debugger test fixture for missing env var scenario. |
| examples/cdn/convert_image/fixtures/formats-not-set.live.json | Marks live run skipped for missing env var scenario. |
| examples/cdn/convert_image/fixtures/extension-not-in-list.test.json | Adds debugger test fixture for extension not in list. |
| examples/cdn/convert_image/fixtures/extension-not-in-list.live.json | Adds live expectations for extension not in list. |
| examples/cdn/convert_image/fixtures/conversion-scheduled.test.json | Adds debugger test fixture for conversion scheduling conditions. |
| examples/cdn/convert_image/fixtures/conversion-scheduled.live.json | Adds live expectations for conversion scheduled path. |
| examples/cdn/convert_image/fixtures/.env | Adds fixture env vars for convert_image example. |
| examples/cdn/convert_image/Cargo.lock | Adds lockfile for the CDN convert_image example. |
| examples/cdn/cache_control/src/lib.rs | Switches cache-control logging to stdout. |
| examples/cdn/cache_control/fixtures/xml-api.live.json | Adds live expectations for XML/API scenario. |
| examples/cdn/cache_control/fixtures/unknown-content-type.test.json | Adjusts debugger fixture to use request headers for content simulation. |
| examples/cdn/cache_control/fixtures/unknown-content-type.live.json | Adds live expectations for unknown content-type scenario. |
| examples/cdn/cache_control/fixtures/static-asset.test.json | Adjusts debugger fixture for static asset scenario. |
| examples/cdn/cache_control/fixtures/static-asset.live.json | Adds live expectations for static asset scenario. |
| examples/cdn/cache_control/fixtures/json-api.live.json | Adds live expectations for JSON API scenario. |
| examples/cdn/cache_control/fixtures/javascript-asset.test.json | Adjusts debugger fixture for JS asset scenario. |
| examples/cdn/cache_control/fixtures/javascript-asset.live.json | Adds live expectations for JS asset scenario. |
| examples/cdn/cache_control/fixtures/happy-path.test.json | Adjusts debugger fixture for happy path. |
| examples/cdn/cache_control/fixtures/happy-path.live.json | Adds live expectations for happy path. |
| examples/cdn/cache_control/fixtures/error-status.live.json | Adds live expectations for error status scenario. |
| examples/cdn/body/fixtures/skip.live.json | Adds live expectations for skip behavior. |
| examples/cdn/body/fixtures/client.live.json | Adds live expectations for redaction behavior. |
| examples/cdn/api_key/src/lib.rs | Switches API-key validation logging to stdout. |
| examples/cdn/api_key/fixtures/missing-secret.live.json | Adds live expectations for missing secret. |
| examples/cdn/api_key/fixtures/missing-header.live.json | Adds live expectations for missing header. |
| examples/cdn/api_key/fixtures/invalid-key.live.json | Adds live expectations for invalid key. |
| examples/cdn/api_key/fixtures/happy-path.live.json | Adds live expectations for successful auth. |
| examples/cdn/ab_testing/src/lib.rs | Switches A/B assignment logging to stdout. |
| examples/cdn/ab_testing/fixtures/new-visitor.live.json | Adds live expectations for new visitor assignment. |
| examples/cdn/ab_testing/fixtures/missing-config.live.json | Adds live expectations for missing config. |
| examples/cdn/ab_testing/fixtures/existing-cookie-b.live.json | Adds live expectations for existing cookie (B). |
| examples/cdn/ab_testing/fixtures/existing-cookie-a.live.json | Adds live expectations for existing cookie (A). |
| context/architecture/REQUEST_LIFECYCLE.md | Documents that proxy_on_log is not dispatched on FastEdge today. |
| context/architecture/HOST_SDK_CONTRACT.md | Documents proxy_on_log non-dispatch and guidance for observability. |
| .gitignore | Ignores wasm build artifacts, certain example lock/config files, and docs/.failures. |
Comments suppressed due to low confidence (1)
fastedge-plugin-source/generate-docs.sh:294
- The salvage/validation logic only treats lines starting with
#(hash + space) as a level-1 heading. The prompt requires output to start with#but does not require a space, so outputs like#Titlewould be incorrectly treated as failure. Consider matching^#(and possibly allowing leading whitespace) for both awk/grep checks to make the generator more robust.
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.
Uh oh!
There was an error while loading. Please reload this page.