()
| 150 | | { kind: 'fail'; errors: string[] } |
| 151 | |
| 152 | function checkSubblockIdStability(): CheckResult { |
| 153 | const previous = getPreviousIds() |
| 154 | |
| 155 | if (previous.kind === 'skip') { |
| 156 | return { kind: 'skip', message: `${previous.reason} — skipping subblock ID stability check` } |
| 157 | } |
| 158 | if (previous.kind === 'noop') { |
| 159 | return { |
| 160 | kind: 'skip', |
| 161 | message: 'No block definition changes detected — skipping subblock ID stability check', |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | const current = getCurrentIds() |
| 166 | const errors: string[] = [] |
| 167 | |
| 168 | for (const [blockType, prevIds] of Object.entries(previous.map)) { |
| 169 | const currIds = current[blockType] |
| 170 | if (!currIds) continue |
| 171 | |
| 172 | const migrations = SUBBLOCK_ID_MIGRATIONS[blockType] ?? {} |
| 173 | |
| 174 | for (const oldId of prevIds) { |
| 175 | if (currIds.has(oldId)) continue |
| 176 | if (oldId in migrations) continue |
| 177 | |
| 178 | errors.push( |
| 179 | `Block "${blockType}": subblock ID "${oldId}" was removed.\n` + |
| 180 | ` → Add a migration in SUBBLOCK_ID_MIGRATIONS (lib/workflows/migrations/subblock-migrations.ts)\n` + |
| 181 | ` mapping "${oldId}" to its replacement ID.` |
| 182 | ) |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | if (errors.length === 0) { |
| 187 | return { kind: 'pass', message: 'Subblock ID stability check passed' } |
| 188 | } |
| 189 | return { kind: 'fail', errors } |
| 190 | } |
| 191 | |
| 192 | function checkCanonicalIdContract(): CheckResult { |
| 193 | const errors: string[] = [] |
no test coverage detected