MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / boxCheckEntry

Function boxCheckEntry

scripts/fungrim/box-check.ts:66–95  ·  view source on GitHub ↗
(
  ce: ComputeEngine,
  e: Entry,
  knownHeads: Set<string>
)

Source from the content-addressed store, hash-verified

64}
65
66export function boxCheckEntry(
67 ce: ComputeEngine,
68 e: Entry,
69 knownHeads: Set<string>
70): BoxResult {
71 const familyHeads = new Set(e.indexedFamilies ?? []);
72 const unknownHeads = e.heads.filter(
73 (h) => !knownHeads.has(h) && !familyHeads.has(h)
74 );
75 return withEntryScope(ce, e, () => {
76 const errors: string[] = [];
77 try {
78 collectErrors(ce.expr(e.formula as any).canonical, errors);
79 if (e.assumptions != null)
80 collectErrors(ce.expr(e.assumptions as any).canonical, errors);
81 } catch (err: any) {
82 errors.push(`THROW: ${String(err?.message ?? err).slice(0, 200)}`);
83 }
84 if (errors.length === 0) return { id: e.id, topic: e.topic, outcome: 'ok' };
85 if (unknownHeads.length > 0)
86 return {
87 id: e.id,
88 topic: e.topic,
89 outcome: 'unknown-symbol',
90 errors,
91 unknownHeads,
92 };
93 return { id: e.id, topic: e.topic, outcome: 'box-error', errors };
94 });
95}
96
97export type Stage1Report = {
98 total: number;

Callers 1

runStage1Function · 0.85

Calls 5

withEntryScopeFunction · 0.90
collectErrorsFunction · 0.70
hasMethod · 0.65
exprMethod · 0.65
sliceMethod · 0.65

Tested by

no test coverage detected