MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / counterpart

Function counterpart

libatomic/src/review/viewer.js:229–250  ·  view source on GitHub ↗
(region, side)

Source from the content-addressed store, hash-verified

227 }
228
229 function counterpart(region, side) {
230 if (side === region.side) return { start: region.start_line, end: region.end_line, note: region.start_line ? 'Selected recorded region' : 'File-level context; no source range was reported' };
231 if (viewComparison) {
232 for (const item of regionFindings(region)) {
233 const location=item.comparison?.[side]?.[0];
234 if (location) return {start:location.start_line,end:location.end_line,note:'Matched local observation in the other recorded view'};
235 }
236 }
237 for (const id of [...region.metrics, ...region.context_metrics]) {
238 const node = byId.get(id), value = node?.properties.observation;
239 const location = node?.properties[side + '_location'];
240 if (location && value.before.status === 'measured' && value.after.status === 'measured') {
241 return { start: location.start_line, end: location.end_line, note: region.metrics.length ? 'Matched recorded subject' : 'Matched enclosing function; not an exact branch mapping' };
242 }
243 }
244 for (const impact of region.impact) {
245 if (impact.kind === 'changed_function' && impact.function[side]) {
246 return { start: impact.function[side].start_line, end: impact.function[side].end_line, note: 'Matched function from recorded impact analysis' };
247 }
248 }
249 return { start: null, end: null, note: 'Opposite revision; no reliable matching region was established' };
250 }
251
252 function sourceViewer(region) {
253 const host = el('section');

Callers 1

updateFunction · 0.85

Calls 2

regionFindingsFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected