[Atlas] Hypothes.is annotations on SciDEX wiki and hypothesis pages done

← Wiki
Poll Hypothes.is API for scidex.ai annotations; in-page overlay; AT Proto mirror via ai.scidex.annotation.claim; quality-gate signal.

Completion Notes

Auto-completed by supervisor after successful deploy to main

Git Commits (2)

[Atlas] Hypothes.is annotations on SciDEX wiki and hypothesis pages [task:3c70b9b8-0137-437c-a74b-8f5b82b4bbe4] (#865)2026-04-27
[Atlas] Hypothes.is annotations on SciDEX wiki and hypothesis pages [task:3c70b9b8-0137-437c-a74b-8f5b82b4bbe4] (#865)2026-04-27
Spec File

Effort: deep

Goal

Hypothes.is offers a battle-tested W3C-Web-Annotation overlay any
researcher already uses — installing the browser extension makes
every URL annotatable, and the Hypothes.is API exposes
group-scoped public annotations as JSON. SciDEX wiki pages and
hypothesis pages are stable URLs (~17K + ~310 today, headed to
100K + 10K) that researchers will increasingly want to mark up
with cross-references, corrections, and "interesting!" pins.
Surface those annotations in-page so the social trace is visible
to non-extension users, and feed annotation density back into the
quality-gate pipeline.

Acceptance Criteria

Schema migrations/<date>_hypothesis_annotations.sql:

CREATE TABLE hypothesis_is_annotations (
        id TEXT PRIMARY KEY,
        target_url TEXT NOT NULL,
        scidex_artifact_id TEXT REFERENCES artifacts(id),
        author_account TEXT,
        author_display TEXT,
        text TEXT,
        quote TEXT,
        tags JSONB,
        group_id TEXT,
        created_at TIMESTAMP,
        updated_at TIMESTAMP,
        first_seen_at TIMESTAMP DEFAULT NOW()
      );
      CREATE INDEX ix_hypothesis_is_annotations_artifact ON
        hypothesis_is_annotations(scidex_artifact_id);

Poller scidex/atlas/hypothesis_is_poller.py:
hits https://api.hypothes.is/api/search?uri.parts=
scidex.ai&order=desc&sort=updated&limit=200
every 15 min,
pages forward, upserts rows. Uses an etag/cursor (last
updated) so re-poll fetches only deltas.
In-page overlay. Each wiki + hypothesis page renders a
"Public annotations (N)" expander that lists annotations
with quote + author + date. No JS framework — use the
same vanilla pattern as the comments overlay.
Quality-gate signal. Add a new metric
hypothesis_is_annotation_count to
quality_dashboard.py's rollup — high public-annotation
density on a hypothesis is positive evidence of community
engagement; tagged error or wrong annotations downgrade
the quality score.
"Annotate on Hypothes.is" button. Each artifact page
has a one-click button that links to the via-Hypothes.is
proxy https://via.hypothes.is/<page-url> so users without
the extension can still annotate.
Federation back to AT Proto. Each new annotation is also
mirrored as an ai.scidex.annotation.claim AT Protocol
record (lexicon already exists in atproto/lexicons/)
published by a SciDEX-owned bot DID, so the same trace lives
on both surfaces. (Out of scope: full firehose ingest;
simple push-only here.)
Tests tests/test_hypothesis_is_poller.py: stubbed
Hypothes.is response with 5 annotations across 3 URLs;
assert artifact resolution by URL parsing, dedup on
re-poll, AT Proto record emission shape.

Approach

  • Poller first — simpler than embedding the H. extension or
  • mirroring its full firehose.
  • URL → artifact resolver: parse the path components against
  • wiki slug / hypothesis id; fall back to leaving
    scidex_artifact_id NULL.
  • AT Proto mirror runs as a deferred job; failures don't block
  • the poll.
  • Quality-gate signal is bonus — add behind a feature flag so
  • we can validate it doesn't perturb the existing leaderboard.

    Dependencies

    • q-perf-deferred-work-queue — runs AT Proto push as a job.
    • atproto/lexicons/ai.scidex.annotation.claim.json — mirror
    schema.

    Dependents

    • q-integ-bluesky-publish-pipeline — annotations are an
    evidence source for Bluesky-targeted summaries.

    Work Log

    2026-04-27 — Implementation (task:3c70b9b8-0137-437c-a74b-8f5b82b4bbe4)

    • Schema: migrations/20260427_hypothesis_is_annotations.sqlhypothesis_is_annotations
    table with all spec-required columns plus GIN index on tags and target_url/updated_at indexes.
    • Poller: scidex/atlas/hypothesis_is_poller.py — polls
    api.hypothes.is/api/search?uri.parts=scidex.ai, uses system_settings cursor for delta
    fetching, upserts with ON CONFLICT DO UPDATE, resolves /wiki/ /hypothesis/ /artifact/
    /analyses/ URL paths to artifact IDs, mirrors new annotations to AT Proto
    ai.scidex.annotation.claim via env-configured PDS credentials (no-op if absent).
    • In-page overlay: _build_hyp_is_overlay_html() function in api.py; wired into
    wiki_page(), hypothesis_detail(), and artifact_detail() — renders "Public annotations (N)"
    <details> expander with quote/text/author/date/tag badges. Includes "Annotate on Hypothes.is"
    via.hypothes.is link in the expander summary.
    • Quality-gate signal: scidex/senate/quality_dashboard.py — added hypothesis_is_annotation_count,
    hypothesis_is_annotated_pages, hypothesis_is_negative_count, hypothesis_is_new_7d
    to headline and new community_annotations section; graceful fallback if table not yet migrated.
    • Tests: tests/test_hypothesis_is_poller.py — 22 tests covering URL resolver, AT Proto
    record shape, HTTP fetch stubs, upsert dedup, dry-run mode, AT Proto call counts.

    Sibling Tasks in Quest (Wiki) ↗