Files
poli0981andClaude Opus 5.5 3e4cf6b431 docs(migration): what poli0981-dev's move found
The guide now opens with the outcome: content on Gitea had been 16 commits behind what
the site pinned; D5 as built (CI's publish job merges with the job token and dispatches
the deploy; a body marker stands in for Gitea's missing auto-merge flag); a dispatched
run writes no commit status, so the publish job records the required check itself —
softharbor's bot PRs will need the same; the runner facts; and the PD2/Qodana notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 09:02:11 +07:00

6.8 KiB

poli0981-dev — migration guide

Written 2026-11-23 against main @ 2ef3045. Profile: web (Astro, Cloudflare Workers) with an admin (admin.poli0981.dev), a widgets Worker and the src/content submodule (poli0981/content). Docs live in poli0981.dev-docs/; there is no CLAUDE.md. Shared decisions: README.

This repo talks to GitHub from its own code, not only from CI. That part is product work: plan it before the session.

Done 2026-11-24. Merged as Gitea #1 (the migration, v2.4.0) and #3 (v2.4.1, the publish fix below); main deploys from the CI deploy job (wrangler deploy, then waits for /api/health), the admin saves and publishes through Gitea with the poli0981-bot token, bug reports are confidential issues on the GitLab mirror, the widget reads Gitea's public feed (it answers anonymously, PD3 verified). What the migration found:

  • content on Gitea was 16 commits behind what the site pinned (98f7692): the import came from a stale clone. It was fast-forwarded from the site's submodule checkout before anything else. Compare git ls-remote with the pinned gitlink before trusting a submodule's forge copy.
  • D5 as built: content-bump.yml opens the PR and dispatches ci.yml through scripts/content-publish.mjs; CI's publish job merges with the job token and dispatches ci.yml on main to deploy (a job-token merge starts no workflow, so merge_when_checks_succeed would merge and never deploy). The PR body marker <!-- publish: auto|review --> stands in for the auto-merge flag Gitea's API lacks.
  • A dispatched run writes no commit status (Gitea 28.4: push and pull_request only), so the bump commit never got the required CI / build (*) and the first publish was refused (405). The publish job (needs: build, if: always()) now records build's result as CI / build (workflow_dispatch) itself, then merges (#3). Any repo whose bot PRs rely on a dispatched check (softharbor) needs the same step.
  • Runner: a server started with & in one step is gone in the next (start it and its tests in one step); astro preview on localhost listened on ::1 only while Node's fetch went to 127.0.0.1 (--host 127.0.0.1); treosh/lighthouse-ci-action cannot be unpacked on the runner (case-colliding paths on the Windows disk), so Lighthouse runs npx --ignore-scripts @lhci/cli; gitleaks needed a .gitleaksignore for four public identifiers (Access AUD, the Analytics site tag, the Sonar key, a forged test JWT).
  • PD2: reports still reach Discord (a degraded 202) while GITLAB_ISSUES_TOKEN is missing. Qodana stayed a local CLI job: the ops tag callers pin (v2026.11.1) has no reusable-qodana.yml.

Decided (2026-11-23)

  • PD1 — the admin's "Publish" (D12): src/lib/admin/github.ts moves to the Gitea API with a token of the bot user poli0981-bot, a collaborator with write access on poli0981-dev and content only (a Worker secret of the admin, never an Actions secret). Dispatching content-bump.yml uses POST …/actions/workflows/content-bump.yml/dispatches with that token (VERIFY that a collaborator's token may dispatch).
  • PD2 — the public bug report (D14): issues on the GitLab mirror through the GitLab API.
  • PD3 — the widgets feed: GET /api/v1/users/poli0981/activities/feeds on Gitea, without a token. VERIFY that it answers anonymously and lists pushes and releases; if it does not, the widget goes.
  • D3 (deploy job with wrangler deploy), D5 (content-bump's PR merges itself with merge_when_checks_succeed), D2 (triage goes), D6 (build is the required check).

Workflows (.github/workflows → .gitea/workflows)

File Today Do
ci.yml build (required), Sonar, upstream artifact actions, wrangler Move; Gitea artifact actions; remove Sonar (D1); deploy job on main with wrangler deploy (D3)
content-bump.yml dispatched by the admin: bump src/content, push content/bump, gh pr create, gh pr merge --auto --squash (or comment and wait when MDX changed), gh workflow run ci.yml Gitea API (README table): create PR, merge with {do:"squash", merge_when_checks_succeed:true}, comment, dispatch ci.yml. permissions: contents: write, pull-requests: write, actions: write. PD1 for the caller
lighthouse.yml advisory perf budget on PRs Move
osv-scanner.yml Google's osv-scanner reusable, SARIF, cron 17 3 * * 1 Delete → security.yml caller (node: true), cron 13 14 * * 3
qodana.yml qodana-action, SARIF to code scanning Caller of reusable-qodana.yml (package-manager: npm, prepare-command: npx astro sync if needed)
triage.yml pull_request_target + scripts/triage.mjs Delete with the script (D2)

.github/dependabot.yml → delete; add renovate.json.

  • .gitmodules: src/content → https://git.poli0981.dev/poli0981/content.git (that repo must be on Gitea; there is a local E:\content).
  • src/lib/admin/github.ts (PD1), src/pages/api/report.ts (PD2), workers/widgets/src/feeds.ts (PD3), src/components/admin/Dashboard.svelte (link), and their tests: tests/api-public.test.ts (5), tests/widgets-worker.test.ts (2), tests/support/github.ts.
  • README.md (6), CONTRIBUTING.md (4), .github/ISSUE_TEMPLATE/config.yml (2), .github/pull_request_template.md (2), ACCESSIBILITY.md (2), public/.well-known/security.txt, poli0981.dev-docs/02_ARCHITECTURE.md, 06_SECURITY.md, 11_WIDGETS_INTEGRATIONS.md, 12_LEGAL/CONTENT_LICENSE.md. CHANGELOG.md keeps its history.
  • src/lib/links.ts (the GitHub profile link → https://git.poli0981.dev/poli0981) and the console note in src/lib/easter.ts.
  • Add a short "Forge & CI" section to the docs (runbook §3.4); a CLAUDE.md would be the place if you add one.

The content submodule (poli0981/content, E:\content)

Checked 2026-11-23 at main @ 9265c94: already on Gitea (origin), no workflows, no secrets, no code. Migrate it in the same session as poli0981-dev:

  • README.md: the link to poli0981/poli0981-dev → Gitea.
  • projects/poli0981-dev.md, projects/frameledger.md: repo: → https://git.poli0981.dev/poli0981/<repo> (the schema is z.url(), any host passes).
  • legal/licenses.md (the EN and the VI paragraph): source on Gitea, issues on the GitLab mirror. A link edit, not a material change, so no consent bump (the ticktune precedent).
  • No renovate.json and no security caller: nothing to scan. The GitLab mirror and branch protection apply as for any repo.
  • The content commit lands first; poli0981-dev's .gitmodules change and the submodule bump follow in its PR.

Secrets

Keep QODANA_TOKEN. Create (user level): CLOUDFLARE_API_TOKEN, CLOUDFLARE_ACCOUNT_ID (D3). Drop SONAR_TOKEN. Outside Actions, as Worker secrets: the poli0981-bot token (PD1, D12) and the GitLab token of the report endpoint (PD2, D14).