Skip to content

Index and delete actions, and remove the admin API #32

Closed

Description

@johnf

Parent

#26

What to build

An admin can index, reindex and delete one crate's indexes (covering the crates under it), and index, reindex or delete all of them, from the crate tree. The admin pages become the only way into admin: the bearer-token admin API is removed.

  • Each action is a POST form that redirects back with a one-time flash message (post/redirect/get), so reloading doesn't repeat it.
  • Delete actions ask for confirmation with confirm() in admin.js; without script they still work.
  • Today's rules stay: indexing an indexed crate needs reindex (force), and indexing during a delete is refused with the reason shown. Also refused, with the reason: indexing while a covered crate is queued or indexing, deleting while a covered crate is queued or indexing, and an unknown crate.
  • Each action, accepted or refused, is logged with the admin's sub.
  • Remove /api/admin, TOKEN_ADMIN and @fastify/bearer-auth (feat!). The admin route tests are rewritten to go through the admin pages, signed in as an admin.

Acceptance criteria

  • Indexing one crate, reindexing an indexed crate, indexing all, deleting one crate and deleting all each work, checked by their effect on the indexes
  • Each action redirects back with a flash message saying what was asked and whether it was accepted
  • A refused action shows the reason
  • Reloading after an action doesn't repeat it
  • Delete actions ask for confirmation
  • A POST with a missing or foreign Origin changes nothing
  • /api/admin is gone, and TOKEN_ADMIN is no longer accepted or required
  • TOKEN_ADMIN removed from the README and .env.example
  • Reindexing all works
  • Deleting a crate also deletes the crates under it
  • Each action is logged with the admin's sub

Blocked by

Set as a native dependency.

Original request

Parent

#26

What to build

An admin can index, reindex and delete one crate's indexes, and index or delete all of them, from the crate tree. The admin pages become the only way into admin: the bearer-token admin API is removed.

  • Each action is a POST form that redirects back with a one-time flash message (post/redirect/get), so reloading doesn't repeat it.
  • Delete actions ask for confirmation with confirm() in admin.js; without script they still work.
  • Today's rules stay: indexing an indexed crate needs reindex (force), and indexing during a delete is refused with the reason shown.
  • Remove /api/admin, TOKEN_ADMIN and @fastify/bearer-auth (feat!). The admin route tests are rewritten to go through the admin pages, signed in as an admin.

Acceptance criteria

  • Indexing one crate, reindexing an indexed crate, indexing all, deleting one crate and deleting all each work, checked by their effect on the indexes
  • Each action redirects back with a flash message saying what was asked and whether it was accepted
  • A refused action shows the reason
  • Reloading after an action doesn't repeat it
  • Delete actions ask for confirmation
  • A POST with a missing or foreign Origin changes nothing
  • /api/admin is gone, and TOKEN_ADMIN is no longer accepted or required
  • TOKEN_ADMIN removed from the README and .env.example

Blocked by

Set as a native dependency.

Activity

  1. johnf commented on Oct 28, 2026

    @johnf
    ContributorAuthor

    Updated to match PR #33; the previous text is kept under Original request. Changes from review: Reindex all is added. Delete on a crate now covers the crates under it, the same as Index. Indexing is refused while another run covers the same crates, and deleting is refused while indexing is in progress. An unknown crate is refused. Every action is logged with the admin's sub. Follow-up: #35.

  2. johnf commented on Oct 28, 2026

    @johnf
    ContributorAuthor

    Shipped in PR #33 (merge e2db8c2). All acceptance criteria met.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentFully specified, ready for an AFK agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions