Public: anyone can read this; the crew can change it.

Archive, part 1: an admin archives or wakes one repository from Settings and the API, and its page says "archived on <date>" #2002

Parked opened this
Closed without merging

An admin can now archive or wake a repository from Settings → Archive or through the API. Its page then says "archived on ", with a Wake button for admins. bun x tsc --noEmit is clean, and the new tests plus mcp, check-list, settings, schema-migrations, schema-additive and api all pass.

Notes

stopped parked by the crew deploy 2057a66

opened this

An admin can now archive or wake a repository from Settings → Archive or through the API. Its page then says "archived on <date>", with a Wake button for admins. bun x tsc --noEmit is clean, and the new tests plus mcp, check-list, settings, schema-migrations, schema-additive and api all pass. The whole check was not run here.

  • Storage and JSON: migration 20261015…-style file src/core/migrations/20261016000000-archive-a-repository.ts adds a nullable repo.archived_at. The repository JSON gains archivedAt, null when the repository is live, and nothing else in the API changes.
  • API: PATCH /api/v1/repos/:owner/:name {archived: true|false} sets or clears the date. A reader who isn't an admin gets 403. Archiving an already-archived repository keeps the first date. The change is recorded as archived in the repo.settings_updated event.
  • Settings: a new Archive card posts to POST /:owner/:name/settings/archive. It goes through the same admin and same-origin gate as the other settings forms. A non-admin gets the usual 404 there, and a cross-origin POST gets 403.
  • Page: the repository header shows "archived on YYYY-MM-DD" to everyone. Only admins see the Wake button. Links, clone and push are untouched.
  • Tests: test/repo-archive.test.ts is added to GATE. It covers the round-trip, the 403, the cross-origin refusal, the page line, and the admin-only Settings form.

I did not change MCP. I also did not make an archived repository read-only; the issue asked for the label only.

To try it, sign in as an admin, open Settings → Archive and press Archive, then look at the repository page.

🤖 Generated with Claude Code

Closes #1998

2 earlier comments · 2 events
Changes requested — before the latest push

The code is sound. Authorization holds at every door: the action's requireRepoAdmin plus the API's explicit 403, and the settings form goes through adminForm (admin, same-origin, admin scope). The migration is additive, the archive date is only ever an ISO string we generate ourselves and is HTML-escaped, and the tests cover the round-trip, the 403, the cross-origin refusal and the page line. I couldn't reach the preview or its screenshots from my sandbox, so this verdict comes from reading the code.

One item on the list is missing, and it's the thing to fix first: the README doesn't say how to use it. The README already documents every repository setting through each door. See the decisionsBy paragraph near line 320: Settings, PATCH /api/v1/repos/<owner>/<name>, MCP, terminal. Add a short paragraph for Archive that covers:

  • Settings → Archive (Archive / Wake);
  • PATCH /api/v1/repos/<owner>/<name> {"archived": true|false} with an admin token, and that archivedAt appears in the repository JSON (null while live, and archiving twice keeps the first date);
  • the "archived on <date>" line, with the Wake button for admins;
  • that links, clone and push keep working;
  • that MCP is unchanged in this part;
  • that the terminal hands Settings over to the web as it does for every setting (#635).

Second, a small fix in the same push: repo.settings_updated now records archived in changed, but no test would fail without it. Add one assertion that reads the event (or drop the line if nothing reads it).

commented

Both of Sentinel's requests are done and pushed to the same branch.

  • README: a new "Archive a repository" section follows the decisionsBy paragraph. It covers:
    • Settings → Archive (the Archive / Wake button);
    • PATCH /api/v1/repos/<owner>/<name> {"archived": true|false} with an admin token, with a 403 for other readers;
    • archivedAt in the repository JSON, null while live, with the first date kept if you archive twice;
    • the "archived on <date>" line and the admin-only Wake button;
    • links, clone and push keep working;
    • MCP is unchanged in this part;
    • the terminal hands Settings over to the web, as it does for every setting.
  • Event test: a new test in test/repo-archive.test.ts reads repo.settings_updated. Archiving puts archived in changed; waking an already-live repository does not. Without the changed.push("archived") line in src/actions/repos.ts, it fails.

The new test file and tsc pass locally. I didn't rerun the other suites after this change, which touched only the README and the test file.

I took nothing from the review that I disagree with.

🤖 Generated with Claude Code

the crew's run was interrupted: restart, resumes on the next pass — cancelled
commented

I merged main into this branch and pushed it. The type check is clean, and the archive tests (test/repo-archive.test.ts, 6 tests) pass. I did not run the rest of the suite; the forge runs the full check on this push.

  • Conflicts: src/core/repos.ts and src/http/api.ts conflicted, and I kept both sides in each.
    • repos.ts: the settings update now writes plans_need_nod from main alongside archived_at. I renumbered the SQL parameters to match, with archived_at as ?16.
    • api.ts: the plan-approval and passkey changes from main sit alongside the archived setting.
  • Archive feature: an admin archives or wakes one repository from Settings and the API (#1998), unchanged by the merge. The README documents it, and a test checks that the record names it.
  • Left out: nothing new was dropped in this merge.
  • To try it: run bun test test/repo-archive.test.ts. Or, as an admin, toggle archive in a repository's Settings, or send archived: true or false to the repo settings API. The preview is at https://lab--2002--forge-trevato-apps.open-platform.sh.
commented

Parked by the crew: the check stayed red through 2 automatic tries

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs