mirror of
https://github.com/stablyai/orca.git
synced 2026-09-28 16:02:45 +00:00
fix(mobile): format emitted RPC foundation artifacts so regeneration cannot leave CI red
`emit` wrote `JSON.stringify(value, null, 2)` while `format:check` runs oxfmt over the same committed bytes, so the short `scope` array failed the gate. The generator now formats what it writes; `--check` compares parsed JSON and is unaffected. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
{
|
||||
"schemaVersion": 2,
|
||||
"scope": [
|
||||
"mobile/src",
|
||||
"mobile/app"
|
||||
],
|
||||
"scope": ["mobile/src", "mobile/app"],
|
||||
"summary": {
|
||||
"callSites": 431,
|
||||
"literalMethod": 387,
|
||||
|
||||
@@ -78,7 +78,7 @@ calls.sort((a, b) => a.file.localeCompare(b.file) || a.line - b.line || a.column
|
||||
const rows = calls.map(
|
||||
(call) => `${call.file}:${call.line}:${call.column} ${call.kind} ${call.method}`
|
||||
)
|
||||
emit('access-inventory', {
|
||||
await emit('access-inventory', {
|
||||
schemaVersion: 2,
|
||||
scope: ['mobile/src', 'mobile/app'],
|
||||
summary: {
|
||||
|
||||
@@ -26,16 +26,25 @@ export async function git(...args: string[]): Promise<string> {
|
||||
}
|
||||
return result.stdout.trimEnd()
|
||||
}
|
||||
export function emit(name: string, value: unknown): void {
|
||||
export async function emit(name: string, value: unknown): Promise<void> {
|
||||
const path = resolve(root, option('output', `mobile/rpc-foundation/${name}.json`))
|
||||
if (process.argv.includes('--check')) {
|
||||
if (!isDeepStrictEqual(JSON.parse(readFileSync(path, 'utf8')), value)) {
|
||||
throw new Error(`Stale artifact: ${path}`)
|
||||
}
|
||||
console.log(`${name}: current`)
|
||||
} else {
|
||||
mkdirSync(dirname(path), { recursive: true })
|
||||
writeFileSync(path, `${JSON.stringify(value, null, 2)}\n`)
|
||||
console.log(`${name}: ${path}`)
|
||||
return
|
||||
}
|
||||
mkdirSync(dirname(path), { recursive: true })
|
||||
writeFileSync(path, `${JSON.stringify(value, null, 2)}\n`)
|
||||
// Committed artifacts are checked by `format:check`; format here so regeneration cannot leave CI red.
|
||||
const formatted = await runProcess({
|
||||
program: resolve(root, 'node_modules/.bin/oxfmt'),
|
||||
args: ['--write', path],
|
||||
cwd: root
|
||||
})
|
||||
if (formatted.code !== 0) {
|
||||
throw new Error(`oxfmt --write ${path}: ${formatted.stderr}`)
|
||||
}
|
||||
console.log(`${name}: ${path}`)
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ const entries = sources.map((file) => {
|
||||
rpcCandidates
|
||||
}
|
||||
})
|
||||
emit('native-rpc-inventory', {
|
||||
await emit('native-rpc-inventory', {
|
||||
schemaVersion: 1,
|
||||
scope: ['mobile/packages', 'mobile/plugins'],
|
||||
extensions: ['swift', 'kt', 'm', 'mm', 'h', 'java'],
|
||||
|
||||
@@ -119,7 +119,7 @@ results.push({
|
||||
for (const result of results) {
|
||||
assert.equal(result.killed, true, `${result.id}: reference no longer exhibits the known defect`)
|
||||
}
|
||||
emit('reference-regressions', {
|
||||
await emit('reference-regressions', {
|
||||
revision,
|
||||
sources,
|
||||
supportingFunctions: ['rankSuggestions', 'buildGithubPrParams', 'githubPrRepoSlugParam'],
|
||||
|
||||
Reference in New Issue
Block a user