chore: establish YCode replication baseline and TODO
This commit is contained in:
commit
6dc59f89ba
1118 files changed
+196002
No files matched your search
@@ -0,0 +1,50 @@
|
||||
/** Verify retained REA exports and recovery only; never read original paths. */
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import crypto from 'node:crypto'
|
||||
import assert from 'node:assert/strict'
|
||||
import {parse} from 'yaml'
|
||||
const root='.tmp/rea-algorithm-recovered-20261016'
|
||||
const manifest=JSON.parse(fs.readFileSync(path.join(root,'evidence-manifest.json'),'utf8'))
|
||||
const inventory=JSON.parse(fs.readFileSync('.tmp/rea-algorithm-package-inventory.json','utf8'))
|
||||
const members=inventory.normalized_result.members.filter(x=>x.kind==='file')
|
||||
assert.equal(inventory.normalized_result.root_sha256,manifest.rootSha256)
|
||||
assert.equal(inventory.normalized_result.coverage.status,'complete')
|
||||
assert.deepEqual(manifest.unknown,[])
|
||||
const checked=[]
|
||||
for(const file of manifest.files){
|
||||
assert.ok(!path.isAbsolute(file.path)&&!file.path.split('/').includes('..'))
|
||||
const bytes=fs.readFileSync(path.join(root,...file.path.split('/')))
|
||||
const sha=crypto.createHash('sha256').update(bytes).digest('hex')
|
||||
const entry=members.find(x=>x.path===file.path)
|
||||
assert.equal(sha,file.sha256);assert.equal(sha,entry.sha256)
|
||||
assert.equal(bytes.length,file.bytes);assert.equal(bytes.length,entry.size_bytes)
|
||||
const evidence=JSON.parse(fs.readFileSync(file.retainedExport,'utf8'))
|
||||
assert.equal(evidence.evidence_id,file.evidenceId)
|
||||
assert.equal(evidence.normalized_result.root_sha256,manifest.rootSha256)
|
||||
const exported=evidence.normalized_result.files.find(x=>x.path===file.path)
|
||||
const exportedBytes=exported.encoding==='base64'?Buffer.from(exported.data_base64,'base64'):Buffer.from(exported.text,'utf8')
|
||||
assert.deepEqual(bytes,exportedBytes)
|
||||
checked.push(file.path)
|
||||
}
|
||||
assert.deepEqual(members.map(x=>x.path).sort(),[...checked,...manifest.omittedMarkers].sort())
|
||||
assert.deepEqual(manifest.omittedMarkers,['.downloaded_at'])
|
||||
const read=rel=>fs.readFileSync(path.join(root,...rel.split('/')),'utf8')
|
||||
const plugin=JSON.parse(read('.codebuddy-plugin/plugin.json'))
|
||||
const frontmatter=rel=>parse(read(rel).match(/^---\r?\n([\s\S]*?)\r?\n---/)[1])
|
||||
const agent=frontmatter(plugin.agents[0].replace(/^\.\//,''))
|
||||
const skillRoot=plugin.skills[0].replace(/^\.\//,''),skill=frontmatter(`${skillRoot}/SKILL.md`)
|
||||
assert.equal(agent.name,plugin.agentName)
|
||||
assert.ok(agent.skills.includes(skill.name))
|
||||
assert.equal(agent.maxTurns,100)
|
||||
assert.ok(!Object.hasOwn(agent,'tools'))
|
||||
assert.ok(!Object.hasOwn(plugin,'dependencies')&&!Object.hasOwn(plugin,'mcpServers'))
|
||||
const references=[...read(`${skillRoot}/SKILL.md`).matchAll(/@((?:references|templates)\/[\w./-]+\.md)/g)].map(m=>m[1])
|
||||
for(const rel of references)assert.ok(checked.includes(`${skillRoot}/${rel}`))
|
||||
assert.ok(checked.includes(`${skillRoot}/scripts/verify_shortest_paths.py`))
|
||||
const avatar=fs.readFileSync(path.join(root,plugin.avatar))
|
||||
assert.equal(avatar.subarray(0,8).toString('hex'),'89504e470d0a1a0a')
|
||||
assert.equal(avatar.readUInt32BE(16),512);assert.equal(avatar.readUInt32BE(20),512)
|
||||
const report={result:'PASS',scope:'Retained REA bytes/SHA, complete inventory coverage, JSON/YAML identity and internal skill references; no original script execution or model behavior tested',rootSha256:manifest.rootSha256,files:checked.length,bytes:manifest.files.reduce((n,x)=>n+x.bytes,0),internalMarkdownReferences:references.length,avatar:{width:512,height:512,bytes:avatar.length},omittedMarkers:manifest.omittedMarkers}
|
||||
fs.writeFileSync('.tmp/rea-algorithm-verification.json',JSON.stringify(report,null,2)+'\n')
|
||||
console.log(JSON.stringify(report,null,2))
|
||||
Reference in new issue
Block a user