Skip to content

Admin: delegate /.well-known/atproto-did to Atmosphere#170

Open
kraftbj wants to merge 2 commits into
trunkfrom
resolve-fosse-issue-169
Open

Admin: delegate /.well-known/atproto-did to Atmosphere#170
kraftbj wants to merge 2 commits into
trunkfrom
resolve-fosse-issue-169

Conversation

@kraftbj
Copy link
Copy Markdown
Contributor

@kraftbj kraftbj commented May 21, 2026

Summary

  • FOSSE's /.well-known/atproto-did handler has been a mirror of Atmosphere's identity contract since the start, and it has now broken twice — once on the original is_connected() gate (404'd during reauth) and again on the follow-up in PR 166. Atmosphere's bundled handler already gates on has_identity(), validates the DID via get_did(), and returns the same text/plain body, so there's no FOSSE-specific behavior worth maintaining a parallel implementation for.
  • Delete serve_atproto_did_well_known() and the init priority-1 registration in Bluesky_Provider. Atmosphere now owns the route end-to-end at template_redirect priority 10.
  • Keep the template_redirect priority-1 suppression hook so the existing fosse_serve_atproto_did_well_known filter still means "neither plugin responds": when it returns false, the hook clears Atmosphere's atmosphere_wellknown query var and forces a 404.
  • Drop the now-dead well-known response tests; keep the suppression-hook tests.
  • Update sdd/bluesky-handle-setup/implementation-notes.md to record the delegation decision.

Fixes #169.

Behavior change

No user-facing behavior change for the default-on case. Atmosphere's handler already gates on has_identity(), which is the contract PR 166 made FOSSE adopt; the response shape (200 + DID body, 404 otherwise) is identical. Sites that filter fosse_serve_atproto_did_well_known to false continue to get a 404 from neither plugin.

Test Plan

  • ./vendor/bin/phpunit --colors=always --do-not-cache-result tests/php/Admin/Bluesky_ProviderTest.php (96 passing)
  • composer run-script lint-php -- src/Admin/class-bluesky-provider.php tests/php/Admin/Bluesky_ProviderTest.php

FOSSE's own handler kept silently drifting from Atmosphere's identity
contract — the original `is_connected()` gate 404'd during reauth, and
PR 166 was the second time the mirrored gate needed to chase upstream.
Atmosphere's bundled handler already gates on `has_identity()`, validates
the DID, and emits the same `text/plain` body, so there's no FOSSE-shaped
behavior worth maintaining a parallel implementation for.

Delete FOSSE's `serve_atproto_did_well_known()` and the `init` priority-1
hook. Keep the `template_redirect` priority-1 suppression hook so the
existing `fosse_serve_atproto_did_well_known` filter still means "neither
plugin responds": when the filter returns false, clear Atmosphere's query
var and force a 404.

Fixes #169
Copilot AI review requested due to automatic review settings May 21, 2026 13:49
Copy link
Copy Markdown
Contributor

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

Delegates the /.well-known/atproto-did endpoint fully to the bundled Atmosphere plugin to avoid FOSSE maintaining a parallel handler that can drift from Atmosphere’s identity contract, while preserving FOSSE’s existing opt-out behavior via the fosse_serve_atproto_did_well_known filter.

Changes:

  • Removed FOSSE’s init-hooked /.well-known/atproto-did handler and its associated response helper logic.
  • Kept (and documented) the template_redirect priority-1 suppression hook so filtering fosse_serve_atproto_did_well_known to false still results in neither plugin serving the route.
  • Dropped now-dead PHPUnit coverage for FOSSE’s former response helper and updated SDD implementation notes to record the delegation decision.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/Admin/class-bluesky-provider.php Removes the duplicate well-known handler and positions FOSSE as opt-out-only via the existing suppression hook.
tests/php/Admin/Bluesky_ProviderTest.php Removes tests tied to the deleted response helper and updates hook-registration assertions accordingly.
sdd/bluesky-handle-setup/implementation-notes.md Documents that Atmosphere now owns the well-known route and records the rationale for delegation.
Comments suppressed due to low confidence (1)

tests/php/Admin/Bluesky_ProviderTest.php:857

  • With FOSSE delegating /.well-known/atproto-did to Atmosphere, the PHPUnit coverage for the actual well-known response behavior (200 vs 404, body shape, malformed DID handling) was removed. Consider adding an integration/E2E-level test that exercises the real HTTP endpoint (or otherwise validates Atmosphere’s handler contract) so future Atmosphere syncs can’t silently change the public response shape without a failing test.
	/**
	 * The suppression hook is a no-op for unrelated atmosphere_wellknown query vars.
	 */
	public function test_maybe_suppress_atmosphere_well_known_no_op_for_other_query_vars() {
		global $wp_query;

Comment on lines +49 to +51
### Well-known route delegated to Atmosphere (issue #169)
- **Decision**: FOSSE no longer serves `/.well-known/atproto-did` itself. Atmosphere's `serve_wellknown_atproto_did()` owns the route end-to-end; FOSSE only retains a `template_redirect` priority-1 suppression hook that fires when the `fosse_serve_atproto_did_well_known` filter returns false (clearing Atmosphere's query var and forcing a 404 so the opt-out contract still means "neither plugin responds").
- **Reason**: The duplicated handler kept silently drifting from Atmosphere's identity contract (the original `is_connected()` gate broke domain-handle reconnect; PR 166 fixed it by mirroring `has_identity()`). Atmosphere's bundled handler already gates on `has_identity()`, validates the DID via `get_did()`, and emits the same `text/plain` body — there's no FOSSE-specific shape worth maintaining a parallel implementation for. See issue #169.
…otes

Adds a regression test that asserts Atmosphere's bundled
`serve_wellknown_atproto_did` stays hooked on `template_redirect` at a
priority greater than 1. Direct-call suppression tests can't catch the
case where a future bundled resync moves the handler to priority 0 or 1
(or removes it), which would silently break the
`fosse_serve_atproto_did_well_known` opt-out — the tripwire fails at the
registration layer instead.

Also refreshes the SDD docs that PR 170 left stale:
- Status Snapshot and the "default-on with opt-out filter" decision in
  implementation-notes.md still described FOSSE-as-server.
- The "delegated to Atmosphere" decision overstated upstream's
  validation; reworded to make clear that `esc_html(get_did())` is not
  syntax validation and that correctness now rides on Atmosphere
  persisting well-formed DIDs.
- plan.md Task 1 is marked superseded (matching the Task 2/2.5/5
  convention) so the historical Do steps don't read as current.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consolidate /.well-known/atproto-did handler with Atmosphere

2 participants