Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
310 changes: 310 additions & 0 deletions context/CHANGELOG.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions context/CONTEXT_INDEX.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This index helps you discover relevant documentation without reading thousands o
**Purpose**: Postman-like test runner for debugging proxy-wasm binaries locally
**Tech Stack**: Node.js + Express + TypeScript (backend) | React + Vite + TypeScript + Zustand (frontend)
**WASM Runtime**: Node WebAssembly API with WASI preview1
**Port**: 5179 (auto-increments through 5179-5188 if busy)
**Port**: 5179 (auto-increments through 5179-5228 if busy)

**Current Branch**: See git status
**Philosophy**: Production parity, no over-engineering, type safety, modular architecture
Expand Down Expand Up @@ -44,7 +44,7 @@ This index helps you discover relevant documentation without reading thousands o
- `FASTEDGE_IMPLEMENTATION.md` (645 lines) - FastEdge CDN integration, secrets, env vars
- `PROPERTY_IMPLEMENTATION_COMPLETE.md` (495 lines) - Property system, runtime calculation
- `PRODUCTION_PARITY_HEADERS.md` (421 lines) - Header serialization, G-Core SDK format
- `MULTI_VALUE_HEADERS.md` (~200 lines) - Multi-value header support, internal tuple storage, nginx remove behavior, cdn-headers integration test (AS + Rust)
- `MULTI_VALUE_HEADERS.md` (~230 lines) - Multi-value header support: three type layers (HeaderMap/HeaderTuples/HeaderRecord), lossless tuplesToRecord projection, Set-Cookie / RFC 6265 §3 correctness end-to-end, AS validation app ported in-repo (Apr 2026), cdn-headers + http-responder integration tests across all variants
- `CONFIG_SHARING.md` (281 lines) - fastedge-config.test.json sharing system
- `DOTENV.md` (~210 lines) - Environment variable system, dotenvPath support (CDN + HTTP)
- `CDN_VARIABLES_AND_SECRETS.md` (~120 lines) - ✅ CDN env var/secret integration test (7 tests); requires proxy-wasm-sdk-as@^1.2.2
Expand Down Expand Up @@ -209,7 +209,7 @@ Applies when: tests fail because HTTP apps are run as proxy-wasm (or vice versa)

**Architecture (April 2026)**: `dist/server.js` unconditionally calls `startServer()` on load. This works for both the CLI (`bin/fastedge-debug.js` does `import("../dist/server.js")`) and VSCode extension (`fork()`). Library consumers use `dist/lib/` entry points which do not auto-start.

1. `startServer()` probes ports 5179-5188 via HTTP `/health` check; first available port wins
1. `startServer()` probes ports 5179-5228 via HTTP `/health` check (50 slots, expanded from 10 in April 2026 for Codespaces / multi-session workflows); first available port wins
2. Port file written to `{WORKSPACE_PATH || cwd()}/.fastedge-debug/.debug-port` (WORKSPACE_PATH defaults to `process.cwd()` so CLI users get port files too)
3. Startup messages go to stderr (`console.error()`) so MCP stdio transport is not corrupted
4. **Old pattern removed**: `require.main === module` guard was deleted because it fails in bundled CJS loaded via dynamic `import()`
Expand Down Expand Up @@ -386,4 +386,4 @@ Time: 5-7 minutes of reading

---

**Last Updated**: April 13, 2026
**Last Updated**: April 22, 2026
2 changes: 1 addition & 1 deletion context/VSCODE_BUNDLING.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ npm run package
- **VSCode extension**: `fork(serverPath)` — the forked module starts automatically
- **Library consumers**: Use `dist/lib/` entry points (runner, test framework), which do NOT auto-start

`startServer()` probes ports 5179-5188 via HTTP `/health` check before binding (port auto-increment moved from the VSCode extension's `DebuggerServerManager.resolvePort()` into the server). Port file written to `{WORKSPACE_PATH}/.fastedge-debug/.debug-port`. Both the CLI and VSCode extension resolve `WORKSPACE_PATH` before starting the server using the same priority: existing `.fastedge-debug/` dir > nearest `package.json`/`Cargo.toml` > cwd. Startup messages go to stderr so MCP stdio transport is not corrupted.
`startServer()` probes ports 5179-5228 via HTTP `/health` check before binding (50 slots, expanded from 10 on 2026-04-22; port auto-increment moved from the VSCode extension's `DebuggerServerManager.resolvePort()` into the server). Port file written to `{WORKSPACE_PATH}/.fastedge-debug/.debug-port`. Both the CLI and VSCode extension resolve `WORKSPACE_PATH` before starting the server using the same priority: existing `.fastedge-debug/` dir > nearest `package.json`/`Cargo.toml` > cwd. Startup messages go to stderr so MCP stdio transport is not corrupted.

### Extension Runtime

Expand Down
36 changes: 29 additions & 7 deletions context/architecture/BACKEND_ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -745,20 +745,26 @@ When `dotenvEnabled=false`:

### types.ts

Three header types coexist at different boundaries. See `context/features/MULTI_VALUE_HEADERS.md` for the full architecture.

- **`HeaderMap = Record<string, string>`** — simple input shape (single value per key). Used by `FlowOptions.requestHeaders`, `HttpRequest.headers`, and similar user-supplied maps.
- **`HeaderTuples = [string, string][]`** — canonical internal representation, lossless / ordered / duplicate-preserving. Used by `HostFunctions` as the WASM-visible header maps and by `HeaderManager.serializeTuples` for proxy-wasm binary format.
- **`HeaderRecord = Record<string, string | string[]>`** — wire / hook-result format. Single-valued keys as `string`, multi-valued (notably `Set-Cookie` per RFC 6265 §3) as `string[]`. Matches Node's `IncomingHttpHeaders` projection.

**HookCall:**

```typescript
export type HookCall = {
hook: string;
request: {
headers: HeaderMap;
headers: HeaderRecord; // wire format; accepts HeaderMap (subset) for convenience
body: string;
method?: string;
path?: string;
scheme?: string;
};
response: {
headers: HeaderMap;
headers: HeaderRecord;
body: string;
status?: number;
statusText?: string;
Expand All @@ -775,13 +781,13 @@ export type HookResult = {
returnCode: number | null;
logs: { level: number; message: string }[];
input: {
request: { headers: HeaderMap; body: string };
response: { headers: HeaderMap; body: string };
request: { headers: HeaderRecord; body: string };
response: { headers: HeaderRecord; body: string };
properties?: Record<string, unknown>; // State before hook execution
};
output: {
request: { headers: HeaderMap; body: string };
response: { headers: HeaderMap; body: string };
request: { headers: HeaderRecord; body: string };
response: { headers: HeaderRecord; body: string };
properties?: Record<string, unknown>; // State after hook execution
};
properties: Record<string, unknown>; // Final merged properties
Expand All @@ -796,7 +802,7 @@ export type FullFlowResult = {
finalResponse: {
status: number;
statusText: string;
headers: HeaderMap;
headers: HeaderRecord;
body: string;
contentType: string;
isBase64?: boolean;
Expand All @@ -805,6 +811,22 @@ export type FullFlowResult = {
};
```

**HttpResponse (HTTP-WASM public output):**

```typescript
import type { IncomingHttpHeaders } from "node:http";

export interface HttpResponse {
status: number;
statusText: string;
headers: IncomingHttpHeaders; // set-cookie: string[]; common headers narrowed to string
body: string;
contentType: string | null;
isBase64?: boolean;
logs: Array<{ level: number; message: string }>;
}
```

**Calculated Properties (February 2026):**

The `calculatedProperties` field contains runtime-extracted properties from the target URL:
Expand Down
2 changes: 1 addition & 1 deletion context/features/CROSS_PLATFORM.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ The `exit` event fires for normal exits and unhandled exceptions on all platform

**WORKSPACE_PATH default (April 2026)**: `getPortFilePath()` defaults `WORKSPACE_PATH` to `process.cwd()`, so CLI users get port files and config resolution too (previously only set by the VSCode extension).

**Port auto-increment (April 2026)**: `startServer()` probes ports 5179-5188 via HTTP `/health` check before binding. If a port is busy, tries the next one. This logic was moved from the VSCode extension's `DebuggerServerManager.resolvePort()` into the server itself.
**Port auto-increment (April 2026)**: `startServer()` probes ports 5179-5228 via HTTP `/health` check before binding (50 slots, expanded from 10 on 2026-04-22 for Codespaces / multi-session workflows). If a port is busy, tries the next one. This logic was moved from the VSCode extension's `DebuggerServerManager.resolvePort()` into the server itself.

---

Expand Down
Loading
Loading