---
name: 2026-05-16-paper153-records-api-success
description: 2026-05-16 STEP 1156-followup-2 — Paper 153 v0.1 Zenodo publish SUCCESS via modern /api/records (InvenioRDM). Antipattern
metadata: 
  node_type: memory
  type: project
  originSessionId: 31de7a8f-b68c-479d-b055-229c7945fc2c
---

# Paper 153 v0.1 publish SUCCESS — Antipattern #5 corrective action

## 結果

- **DOI**: `10.5281/zenodo.20207228`
- **URL**: https://zenodo.org/records/20207228
- **Commit**: `ccf98619`
- **Date**: 2026-05-16 (STEP 1156-followup-2)
- **Endpoint**: `/api/records` (modern InvenioRDM)
- **Legacy reject reversal**: 2026-05-15 `/api/deposit/depositions` 500 → 本日 `/api/records` で SUCCESS

## Why this matters (load-bearing)

これは [[antipattern-5-excessive-reject-warning-2026-05-15]] の **operational 実証**. 「Reject 前必須 verify 別 endpoint」 protocol が **abstract 原則でなく実際の publish 成功** に直結.

藤本さん critique「最近、 諦めが多くないでしょうか?」 → 翌日 publish 完遂 = honest 修正 cycle 完了.

## 3-iteration discovery (重要 finding)

「単に modern endpoint に rewrite するだけ」 では不十分だった:

| 反復 | script | 失敗点 | 学習 |
|------|--------|--------|------|
| 1 | `publish-paper-153-zenodo-records.ts` (initial) | step 5 publish 400 `metadata.publisher` 必須 | InvenioRDM 新 schema は publisher field 必須 (legacy にない) |
| 2 | `...finish.ts` → `...finish2.ts` (GET → spread → PUT + 5x backoff) | PUT 200 だが publish 400 `resource_type / creators / related_identifiers[].relation_type` 欠落 | GET response の serialized form ≠ PUT write form |
| 3 | `...finish3.ts` (fresh full metadata) | **PUT 200 → publish 200 → DOI 取得** | 「reuse でなく明示再構築」が write API の正解 |

## 永続原則 (Zenodo InvenioRDM publish protocol)

### 必須 metadata fields (write API)

```typescript
metadata: {
  resource_type: { id: 'publication-workingpaper' },
  title: '...',
  publication_date: 'YYYY-MM-DD',
  publisher: 'Zenodo',  // ★ legacy にない新 field, 忘れると publish 400
  creators: [{
    person_or_org: {
      type: 'personal',
      given_name: '...',
      family_name: '...',
      identifiers: [{ scheme: 'orcid', identifier: '...' }],
    },
    affiliations: [{ name: '...' }],
  }],
  description: '<html>...</html>',
  rights: [{ id: 'cc-by-4.0' }],
  subjects: [{ subject: 'keyword' }],
  version: 'v0.1',
  languages: [{ id: 'eng' }],
  related_identifiers: [{
    identifier: '10.5281/zenodo.XXX',
    relation_type: { id: 'issupplementto' },  // ★ {id:} shape 必須
    resource_type: { id: 'publication-workingpaper' },
    scheme: 'doi',
  }],
}
```

### 5-step workflow

1. **POST /api/records** with `{access, files: {enabled: true}, metadata}` → 201 returns `id`, `links.self`, `links.files`
2. **POST {links.files}** with `[{key: filename}]` → 201 file entry
3. **PUT {links.files}/{filename}/content** with raw bytes → 200
4. **POST {links.files}/{filename}/commit** → 200 finalize
5. **POST /api/records/{id}/draft/actions/publish** → 202 returns `pids.doi.identifier`

### Anti-pattern

- ❌ GET draft → spread → PUT (serialized form mismatch)
- ❌ 単に endpoint だけ rewrite (publisher field 欠落)
- ❌ legacy `/api/deposit/depositions` (Zenodo migration 中, 500 transient)

### Pattern

- ✅ Fresh full metadata 明示再構築 → PUT → publish
- ✅ 500 で 5x backoff retry (transient あり)
- ✅ `scripts/publish-paper-153-zenodo-records.ts` を他 paper の template に利用

## 連結 reference

- [[antipattern-5-excessive-reject-warning-2026-05-15]] (本 record の trigger)
- [[2026-05-15-full-session-summary]] (Paper 153 defer 状態の last 記述)
- Paper 145 v0.7 STEP 1142 (10 platform publish 比較 reference)
- Paper 152 v0.3 STEP 1124 (manual web UI 経由 publish 前例)
