Skip to content

Conversation

@dahlia
Copy link
Member

@dahlia dahlia commented Feb 10, 2026

Summary

Closes #561

Adds a new @fedify/debugger package that provides an embedded real-time ActivityPub debug dashboard. It works as a proxy implementing the Federation interface, wrapping the original federation object and serving an SSR-based web UI at /__debug__/ using Hono internally.

Features

  • Traces list page (/__debug__/): Shows recent traces with trace ID, activity types, activity count, and timestamp
  • Trace detail page (/__debug__/traces/:traceId): Shows all activities in a trace with direction, type, actor, signature verification details, expandable JSON, and per-trace log records
  • Per-trace log collection: Injects traceId/spanId into LogTape context via withContext(), enabling logs to be filtered by trace
  • Simplified setup: Single-function createFederationDebugger(federation) overload that auto-configures OTel tracer provider, span exporter, and LogTape sink
  • Authentication: Optional auth option with password protection via cookie-based sessions
  • Dark mode: Follows system prefers-color-scheme preference
  • Polling-based updates: JSON API endpoint with automatic refresh

Screenshots

Login page of the debug dashboard with password authentication Traces list page of the debug dashboard Trace detail page showing activities and logs

Changes to @fedify/fedify

The fetch() and all three processQueuedTask() handlers in packages/fedify/src/federation/middleware.ts now call LogTape's withContext() to inject traceId and spanId from the active OTel span. This enables the debugger (and any LogTape sink) to correlate log records with specific traces.

Usage

import { createFederation } from "@fedify/fedify";
import { createFederationDebugger } from "@fedify/debugger";

const federation = createFederation({ /* ... */ });
const debugger = createFederationDebugger(federation);
// Use `debugger` wherever you'd use `federation`

dahlia and others added 13 commits February 11, 2026 03:27
Add the `@fedify/debugger` package skeleton with build infrastructure:

- Create deno.json, package.json, and tsdown.config.ts
- Add placeholder src/mod.ts
- Register the package in the root deno.json workspace, pnpm-workspace.yaml,
  README.md Packages table, and CONTRIBUTING.md repository structure list
- Add hono as a root-level Deno import for JSR resolution

fedify-dev#561

Co-Authored-By: Claude <noreply@anthropic.com>
Add the core `createFederationDebugger()` function that wraps a
`Federation` object to intercept requests matching a configurable debug
path prefix (default `/__debug__`) and serve them via an internal Hono app.
All other methods and non-debug requests are delegated to the inner
federation object.

Tests cover delegation of all Federation interface methods, debug path
interception, custom path prefix, JSON API, and onNotFound passthrough.

fedify-dev#561

Co-Authored-By: Claude <noreply@anthropic.com>
Replace plain text responses with JSX-based server-side rendered HTML
pages using Hono's JSX engine:

- Layout component with minimal skeleton CSS styling
- Traces list page showing trace IDs, activity types, counts,
  timestamps, and auto-polling via inline script
- Trace detail page showing activity direction, type, actor,
  signature verification details, inbox URL, and expandable
  activity JSON

Rename mod.ts to mod.tsx to support JSX pragma directives.  Add four
new tests verifying HTML content in responses.

fedify-dev#561

Co-Authored-By: Claude <noreply@anthropic.com>
Add docs/manual/debug.md covering installation, setup, configuration
options, dashboard pages, JSON API, and framework integration examples
(Hono, Express).

Also add "Debugging" entry to the Manual sidebar and
"@fedify/debugger" to the References section in VitePress config.

fedify-dev#561

Co-Authored-By: Claude <noreply@anthropic.com>
Document the new @fedify/debugger package under the Version 2.0.0
section, including the createFederationDebugger() API, dashboard
pages, and JSON API endpoint.

fedify-dev#561

Co-Authored-By: Claude <noreply@anthropic.com>
When called without an exporter option, createFederationDebugger()
now automatically sets up OpenTelemetry tracing internally: it
creates a MemoryKvStore, FedifySpanExporter, BasicTracerProvider
with SimpleSpanProcessor, and registers it as the global tracer
provider via trace.setGlobalTracerProvider().  This eliminates the
need for users to manually configure OTel just to use the debug
dashboard.

The return type is always Federation<TContextData> regardless of
which overload is used, avoiding confusion from differing return
types.

The existing overload with an explicit exporter option is preserved
for advanced use cases where users need full control over the OTel
setup.

Documentation updated to show the simplified usage as the primary
example, with the manual OTel setup moved to an "Advanced setup"
section.

fedify-dev#561

Co-Authored-By: Claude <noreply@anthropic.com>
Add optional authentication for the debug dashboard via the new
`auth` option on `createFederationDebugger()`.  Three modes are
supported:

 - `"password"`: login form with a single password field
 - `"usernamePassword"`: login form with username and password
 - `"request"`: authenticate by inspecting the Request object
   (e.g., IP-based filtering), returning 403 on rejection

Each form-based mode accepts either static credentials or an
`authenticate()` callback.  Sessions use HMAC-SHA256 signed
cookies generated with Web Crypto API; the key is randomly created
at startup so sessions do not survive restarts.

Authentication only applies to the debug dashboard routes;
ActivityPub endpoints pass through without any auth check.

fedify-dev#561

Co-Authored-By: Claude <noreply@anthropic.com>
Wrap OTel span callbacks in LogTape's withContext() so that all log
records emitted during request handling and queue processing carry the
traceId and spanId in their properties.  This enables per-trace log
collection by consumers such as @fedify/debugger.

Affected code paths:
- FederationImpl.fetch() HTTP request handling
- FederationImpl.processQueuedTask() for fanout, outbox, and inbox
  message types

fedify-dev#561

Co-Authored-By: Claude <noreply@anthropic.com>
Collect LogTape log records per OTel trace so that the debug dashboard
can display all logs associated with a given trace.

Key changes:
 -  Add LogStore in-memory storage keyed by traceId with eviction
 -  Expose a LogTape Sink via the returned federation.sink property
 -  Simplified overload auto-configures LogTape with contextLocalStorage
 -  Add GET /api/logs/:traceId JSON endpoint
 -  Show logs table in trace detail page with level badges
 -  Update docs and changelog

Note: Logs are stored in-memory and do not survive process restarts,
unlike traces which may be persisted in a KvStore.

fedify-dev#561

Co-Authored-By: Claude <noreply@anthropic.com>
Without a global context manager, parent–child spans each get
independent trace IDs, so logs collected under the HTTP span's
traceId never match the trace stored by FedifySpanExporter.

Register an AsyncLocalStorageContextManager in the simplified
overload of createFederationDebugger() so that child spans
(e.g. activitypub.inbox) inherit the parent trace, and logs
are correctly associated with dashboard traces.

fedify-dev#561

Co-Authored-By: Claude <noreply@anthropic.com>
Without a global propagator, propagation.inject() produces an empty
carrier object, so trace context is lost when activities cross message
queue boundaries.  This caused unrelated activities (e.g., an Accept
response to a Follow) to end up under the wrong trace.

Register W3CTraceContextPropagator in the simplified overload alongside
the context manager and tracer provider, and document the requirement
for advanced setups.

fedify-dev#561

Co-Authored-By: Claude <noreply@anthropic.com>
The existing code appended the debugger sink to every logger entry,
but the fallback block already adds a root-category logger when none
exists.  When a root logger was present, logs were captured both by
the root entry and by each sub-category entry, producing duplicates.

Only append the debugger sink to the root-category logger and leave
sub-category loggers unchanged, since the root logger already
captures all log records.

fedify-dev#561

Co-Authored-By: Claude <noreply@anthropic.com>
Use @media (prefers-color-scheme: dark) to automatically follow the
OS color scheme.  Covers all dashboard pages including traces list,
trace detail, and login form.

fedify-dev#561

Co-Authored-By: Claude <noreply@anthropic.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @dahlia, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a powerful new debugging tool for Fedify applications: an embedded ActivityPub debug dashboard. This dashboard provides real-time visibility into ActivityPub traces and activities, making it significantly easier for developers to understand the flow of federated interactions, verify signatures, and diagnose issues. It integrates seamlessly with existing Fedify setups, offering both simplified and advanced configuration options, and enhances observability by correlating logs with specific traces.

Highlights

  • New Debugger Package: Introduced @fedify/debugger, an embedded real-time ActivityPub debug dashboard. This new package acts as a proxy, wrapping an existing Federation object and serving an SSR-based web UI at a configurable path (default /__debug__/).
  • Comprehensive Tracing and Logging: The debugger provides a traces list page showing recent ActivityPub traces with IDs, activity types, counts, and timestamps. A detailed trace page displays all activities within a trace, including direction, type, actor, signature verification details, expandable JSON, and per-trace log records collected via LogTape.
  • Simplified Setup and Auto-Configuration: A single createFederationDebugger(federation) function overload automatically configures OpenTelemetry tracing (TracerProvider, Span Exporter) and LogTape sink, eliminating the need for manual setup in most cases. It also registers an AsyncLocalStorageContextManager and W3CTraceContextPropagator for proper context propagation.
  • Authentication and Security: Optional authentication with password protection (password-only, username + password, or request-based) is available for the debug dashboard, using cookie-based sessions with HMAC-signed tokens to secure access to sensitive trace data.
  • LogTape Context Injection: The core @fedify/fedify package now injects traceId and spanId into the LogTape context during request handling and queue processing, enabling logs to be correlated and displayed within the debugger's trace detail view.
Changelog
  • CHANGES.md
    • Added a new entry for the @fedify/debugger package, detailing its features and auto-configuration capabilities.
    • Included a changelog entry for the addition of traceId and spanId to LogTape context in federation middleware, supporting per-trace logs in the debugger.
    • Updated issue references to include @fedify/debugger: Embedded ActivityPub debug dashboard #561.
  • CONTRIBUTING.md
    • Added @fedify/debugger to the list of packages in the monorepo description.
  • deno.json
    • Included packages/debugger in the workspace definition.
    • Added new npm dependencies: @opentelemetry/context-async-hooks and hono.
  • deno.lock
    • Updated the lock file to reflect the new dependencies and their versions, including various OpenTelemetry packages and hono.
  • docs/.vitepress/config.mts
    • Added a 'Debugging' link to the manual sidebar navigation.
    • Included @fedify/debugger in the API references section.
  • docs/manual/debug.md
    • Added new documentation for the @fedify/debugger package, covering installation, setup, configuration options (path, authentication), dashboard pages (traces list, trace detail, JSON API), and usage with framework integrations (Hono, Express), as well as advanced setup details.
  • packages/debugger/deno.json
    • Added a new Deno configuration file for the @fedify/debugger package, defining its name, version, license, imports, exports, and tasks.
  • packages/debugger/package.json
    • Added a new Node.js package configuration file for @fedify/debugger, specifying its name, version, description, main entry points, repository, peer dependencies, dependencies (e.g., @logtape/logtape, @opentelemetry/*, hono), dev dependencies, and build/test scripts.
  • packages/debugger/src/mod.test.ts
    • Added a new test file containing comprehensive unit tests for createFederationDebugger, covering delegation, debug path interception, JSON API responses, HTML page content, simplified overload behavior, and all authentication modes (password, username/password, request-based), as well as log collection and display.
  • packages/debugger/src/mod.tsx
    • Added the core implementation of the @fedify/debugger package, including the createFederationDebugger function, LogStore for in-memory log storage, serializeLogRecord and createLogSink for LogTape integration, and createDebugApp which sets up the Hono-based web server for the dashboard, handling routing, authentication, and data retrieval from the OpenTelemetry exporter and log store.
  • packages/debugger/src/views/layout.tsx
    • Added a new React component for the base HTML layout of the debug dashboard, including meta tags, title, and global styling for light and dark modes.
  • packages/debugger/src/views/login.tsx
    • Added a new React component for the login page of the debug dashboard, supporting password-only and username/password authentication forms with error display.
  • packages/debugger/src/views/trace-detail.tsx
    • Added a new React component for the trace detail page, displaying individual ActivityPub activities within a trace, including direction, type, actor, signature verification, and expandable JSON, along with a section for correlated log records.
  • packages/debugger/src/views/traces-list.tsx
    • Added a new React component for the traces list page, showing a summary of recent ActivityPub traces with auto-polling for real-time updates.
  • packages/debugger/tsdown.config.ts
    • Added a new tsdown configuration file for the @fedify/debugger package, specifying build entry points, output formats, platform, external dependencies, and intro code for Temporal polyfill imports.
  • packages/fedify/README.md
    • Updated the package table to include @fedify/debugger with its JSR and npm links.
  • packages/fedify/src/federation/middleware.ts
    • Modified processQueuedTask handlers (fanout, outbox, inbox) to wrap their execution in withContext, injecting the current OpenTelemetry traceId and spanId into the LogTape context for improved log correlation.
    • Modified the fetch method to also wrap its execution in withContext, ensuring HTTP request logs include trace and span IDs.
  • pnpm-lock.yaml
    • Updated the pnpm lock file to include new dependencies for @fedify/debugger and reflect changes in the workspace structure.
  • pnpm-workspace.yaml
    • Added packages/debugger to the list of packages in the pnpm workspace configuration.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces an excellent new feature: the @fedify/debugger package. This embedded debug dashboard will be a great asset for developers working with Fedify, providing valuable real-time insights into ActivityPub traces and activities. The implementation is comprehensive, including tracing, logging, a clean UI, and authentication. The necessary changes to the core @fedify/fedify package are minimal and well-targeted. I've identified a few areas for improvement, mainly concerning dependency management, code duplication, and opportunities to use library helpers for more robust code.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new @fedify/debugger package that wraps a Federation instance and serves an embedded SSR ActivityPub trace/log dashboard under a configurable path prefix, plus correlates LogTape logs with OTel traces by injecting traceId/spanId into logging context.

Changes:

  • Introduces packages/debugger with SSR UI (traces list, trace detail, login) + JSON APIs + optional auth and log sink.
  • Updates @fedify/fedify middleware to enrich LogTape context with active span traceId/spanId during request handling and queued task processing.
  • Wires the new package into workspace/deps/docs/changelog.

Reviewed changes

Copilot reviewed 18 out of 20 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
pnpm-workspace.yaml Adds packages/debugger to workspace and catalogs @opentelemetry/context-async-hooks.
pnpm-lock.yaml Locks new debugger package dependencies.
packages/fedify/src/federation/middleware.ts Injects traceId/spanId into LogTape context around spans.
packages/fedify/README.md Adds @fedify/debugger to package list.
packages/debugger/tsdown.config.ts Build config for the new package (ESM/CJS + DTS).
packages/debugger/src/mod.tsx Core proxy implementation, auth/session handling, OTel/LogTape setup, API routes.
packages/debugger/src/mod.test.ts Unit tests for proxy routing, API, auth modes, and log sink behavior.
packages/debugger/src/views/layout.tsx Shared HTML layout + styles for dashboard pages.
packages/debugger/src/views/traces-list.tsx Traces list SSR page + polling script.
packages/debugger/src/views/trace-detail.tsx Trace detail SSR page including activities and log table.
packages/debugger/src/views/login.tsx Login form SSR page for cookie-based auth modes.
packages/debugger/package.json npm package metadata + dependencies/scripts.
packages/debugger/deno.json JSR metadata/tasks for the new package.
docs/package.json Adds @fedify/debugger to docs workspace deps.
docs/manual/debug.md New manual page documenting the debugger.
docs/.vitepress/config.mts Adds “Debugging” manual link and @fedify/debugger reference.
deno.lock Updates Deno lockfile for new dependencies.
deno.json Adds debugger workspace entry and import mappings (incl. hono + context-async-hooks).
CONTRIBUTING.md Documents the new package in the monorepo structure list.
CHANGES.md Changelog entries for debugger + LogTape context correlation change.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

dahlia and others added 8 commits February 11, 2026 07:57
Replace @fedify/fixture and @std/assert with node:test and
node:assert/strict so that the debugger tests run on Deno, Node.js,
and Bun without requiring the @std/assert JSR dependency, which was
not resolvable in Node.js/Bun environments.

Also import from "@fedify/debugger" instead of "./mod.tsx" so that
each runtime resolves the module through its own package exports
(deno.json for Deno, package.json dist/ for Node.js/Bun).

fedify-dev#561

Co-Authored-By: Claude <noreply@anthropic.com>
The tsdown config injects @js-temporal/polyfill into the build output,
making it a runtime requirement.  Having it in devDependencies causes
MODULE_NOT_FOUND errors for consumers in Node.js environments.

fedify-dev#564 (comment)

Co-Authored-By: Claude <noreply@anthropic.com>
configure() returns a Promise but was called without await, so
use configureSync() instead to match the else branch.

Also move contextLocalStorage after the existingConfig spread
with a ?? fallback so it is not silently overwritten by the
existing configuration.

fedify-dev#564 (comment)
fedify-dev#564 (comment)

Co-Authored-By: Claude <noreply@anthropic.com>
Session cookies for login and logout were missing the Secure
attribute, so cookies could be sent over unencrypted connections.
Now the Secure flag is conditionally added when the request URL
uses the https: protocol.

fedify-dev#564 (comment)
fedify-dev#564 (comment)

Co-Authored-By: Claude <noreply@anthropic.com>
pathPrefix was interpolated directly into a dangerouslySetInnerHTML
script block via a template literal.  A malicious pathPrefix
containing quotes or </script> could enable script injection.

Now the value is JSON-encoded and < is escaped as \u003c so it
cannot break out of the script tag.

fedify-dev#564 (comment)

Co-Authored-By: Claude <noreply@anthropic.com>
FederationImpl previously captured the TracerProvider at
construction time.  When the simplified overload of
createFederationDebugger() registered a global provider AFTER the
federation was already created, the federation still held the old
noop provider and traces were silently lost.

Now the tracerProvider getter falls back to trace.getTracerProvider()
on every access when no explicit provider was passed, so late
registration of a global provider is picked up automatically.

Also remove the now-incorrect NOTE comment from the documentation
that said createFederationDebugger() must be called before
createFederation().

fedify-dev#564 (comment)
fedify-dev#564 (comment)

Co-Authored-By: Claude <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

❌ Patch coverage is 91.88571% with 71 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
packages/debugger/src/views/trace-detail.tsx 81.81% 24 Missing ⚠️
packages/debugger/src/mod.tsx 85.82% 18 Missing ⚠️
packages/debugger/src/auth.ts 85.52% 11 Missing ⚠️
packages/debugger/src/log-store.ts 89.09% 6 Missing ⚠️
packages/debugger/src/routes.tsx 96.12% 5 Missing ⚠️
packages/fedify/src/federation/middleware.ts 96.74% 4 Missing ⚠️
packages/debugger/src/views/traces-list.tsx 92.85% 3 Missing ⚠️
Files with missing lines Coverage Δ
packages/debugger/src/views/layout.tsx 100.00% <100.00%> (ø)
packages/debugger/src/views/login.tsx 100.00% <100.00%> (ø)
packages/debugger/src/views/logo.tsx 100.00% <100.00%> (ø)
packages/debugger/src/views/traces-list.tsx 92.85% <92.85%> (ø)
packages/fedify/src/federation/middleware.ts 95.42% <96.74%> (+0.05%) ⬆️
packages/debugger/src/routes.tsx 96.12% <96.12%> (ø)
packages/debugger/src/log-store.ts 89.09% <89.09%> (ø)
packages/debugger/src/auth.ts 85.52% <85.52%> (ø)
packages/debugger/src/mod.tsx 85.82% <85.82%> (ø)
packages/debugger/src/views/trace-detail.tsx 81.81% <81.81%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

dahlia and others added 7 commits February 11, 2026 22:19
Embed the Fedify mascot logo as an inline SVG component
(FedifyLogo) in the debug dashboard header, displayed at
24px next to the title text.  The header link uses flexbox
for vertical alignment between the logo and text.

fedify-dev#561

Co-Authored-By: Claude <noreply@anthropic.com>
Reject empty strings, paths without leading slash, and paths
containing control characters, semicolons, or commas that are
unsafe in HTTP headers (Set-Cookie, Location).  Trailing
slashes are automatically stripped during normalization.

This prevents misconfigured path prefixes from hijacking
routing or tainting response headers.

fedify-dev#561
fedify-dev#564

Co-Authored-By: Claude <noreply@anthropic.com>
Use a Proxy to dynamically forward all Federation methods
to the inner federation instead of maintaining a hardcoded
list of method names.  Only fetch (for debug interception)
and sink (for log collection) are overridden.

This ensures the debugger wrapper automatically supports
any new methods added to the Federation interface without
requiring manual updates.

fedify-dev#561
fedify-dev#564

Co-Authored-By: Claude <noreply@anthropic.com>
Replace plain === string comparison for static password and
username/password auth with timingSafeEqual from node:crypto
to prevent timing side-channel attacks on credential checks.

Also add tests for the full session lifecycle: logging in
with a valid password, using the cookie to access protected
pages, and verifying that forged cookies are rejected.

fedify-dev#561
fedify-dev#564

Co-Authored-By: Claude <noreply@anthropic.com>
Prevent duplicate OpenTelemetry provider registrations and LogTape
sink configurations when createFederationDebugger() is called multiple
times without an explicit exporter.  A module-level cache reuses the
exporter from the first auto-setup call.

Co-Authored-By: Claude <noreply@anthropic.com>
LogStore.get() now returns a shallow copy so callers cannot mutate the
internal array.  The trace detail page uses a safeISOString helper that
falls back to "(invalid)" for NaN or otherwise unparseable timestamps
instead of throwing a RangeError.

Co-Authored-By: Claude <noreply@anthropic.com>
Replace the in-memory Map-based LogStore with a KvStore-backed
implementation so that logs produced by worker processes are visible
in the debug dashboard served by the web process.

LogStore.add() enqueues writes to a promise chain and exposes a
flush() method; route handlers call flush() before reading to
ensure all pending writes are visible.  This avoids fromAsyncSink()
which was incompatible with configureSync().

The advanced overload now requires a kv option alongside the exporter.
The simplified overload shares the auto-created MemoryKvStore.

Co-Authored-By: Claude <noreply@anthropic.com>
@dahlia dahlia requested a review from Copilot February 11, 2026 15:59
@dahlia
Copy link
Member Author

dahlia commented Feb 11, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new @fedify/debugger package, which is a significant and useful feature for developers using Fedify. The implementation is of high quality, with a well-thought-out design including auto-configuration of OpenTelemetry, a clean proxy-based architecture, and a secure authentication mechanism for the dashboard. The documentation is also excellent. I've found a couple of issues, one related to potential data loss in multi-process environments in the log store, and another minor issue in the LogTape auto-configuration logic. Overall, this is a great addition to the Fedify ecosystem.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 21 changed files in this pull request and generated 3 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Copy link
Contributor

@2chanhaeng 2chanhaeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be very useful! It would be better if mod.ts and mod.test.ts were split to make it easier to read.

dahlia and others added 4 commits February 12, 2026 04:26
Replace the in-memory per-trace sequence counter with a
timestamp + random suffix key strategy.  This eliminates two
problems:

 -  Key collisions when multiple processes share the same KvStore
    (each process had its own counter starting at 0).
 -  Unbounded memory growth from the #seq Map that was never cleared.

fedify-dev#564 (comment)
fedify-dev#564 (comment)

Co-Authored-By: Claude <noreply@anthropic.com>
A single failed KvStore.set() could poison the promise chain,
causing all subsequent writes and flush() to reject.  It could
also trigger an unhandled rejection since the synchronous Sink
never awaits the result.  Catch and discard errors so logging
remains best-effort.

fedify-dev#564 (comment)

Co-Authored-By: Claude <noreply@anthropic.com>
The existing XSS test only checked that the malicious payload was absent
from the response body, but never verified that the debug dashboard HTML
was actually rendered.  Strengthen the assertion by branching on the
Content-Type header: when the response is HTML, confirm the dashboard is
present AND the payload is escaped; otherwise, confirm the delegated
response also does not contain the payload.

Addresses: fedify-dev#564 (comment)

Co-Authored-By: Claude <noreply@anthropic.com>
The ~700-line mod.tsx was doing too many things: log storage, auth
helpers, route definitions, and the public createFederationDebugger API.
Extract cohesive units into their own modules:

 -  log-store.ts: LogStore class, SerializedLogRecord, createLogSink
 -  auth.ts: FederationDebuggerAuth type, session/HMAC helpers, checkAuth
 -  routes.tsx: createDebugApp (Hono route tree with auth middleware)

mod.tsx is now the public entry point that wires the pieces together and
re-exports the public types.

Addresses: fedify-dev#564 (comment)

Co-Authored-By: Claude <noreply@anthropic.com>
@dahlia dahlia requested a review from 2chanhaeng February 11, 2026 19:37
dahlia and others added 2 commits February 12, 2026 04:53
Include screenshots of the traces list page and trace detail page in
the Dashboard pages section so that readers can see what the UI looks
like before setting it up.

Co-Authored-By: Claude <noreply@anthropic.com>
Move all @opentelemetry/* version specifiers into the pnpm catalog
(pnpm-workspace.yaml) and root deno.json workspace imports so that
individual packages no longer duplicate them.  Also bump to the
latest versions:

 - @opentelemetry/context-async-hooks  ^2.0.0 → ^2.5.0
 - @opentelemetry/core                 ^2.0.0 → ^2.5.0
 - @opentelemetry/sdk-trace-base       ^2.0.0 → ^2.5.0
 - @opentelemetry/semantic-conventions  ^1.27.0 → ^1.39.0
 - @opentelemetry/exporter-trace-otlp-proto  (new) ^0.211.0
 - @opentelemetry/sdk-node             (new) ^0.211.0

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Contributor

@sij411 sij411 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debugger UI worked as expected.

@dahlia dahlia merged commit d16cece into fedify-dev:main Feb 12, 2026
16 checks passed
dahlia added a commit that referenced this pull request Feb 12, 2026
The @fedify/debugger package introduced in
#564 was missing a README.
Add one following the same pattern as other packages in the monorepo,
covering package description, usage example, and installation.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

@fedify/debugger: Embedded ActivityPub debug dashboard

3 participants