Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/scripts/agents_pr_meta_update_body.js
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,9 @@ function buildPreamble(sections) {

// Add reference to source issue if available
if (sections.issueNumber) {
lines.push(`<!-- meta:issue:${sections.issueNumber} -->`);
lines.push(`> **Source:** Issue #${sections.issueNumber}`, '');
lines.push(`Closes #${sections.issueNumber}`, '');
}
Comment on lines 926 to 930

Copilot AI Apr 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

buildPreamble() now injects a Closes #<issue> line (and a <!-- meta:issue:... --> tag) when sections.issueNumber is present, but the existing unit tests for agents_pr_meta_update_body.js don’t cover this new behavior. Please add/extend tests to assert the preamble output so future template syncs don’t unintentionally change issue-closing semantics.

Copilot generated this review using guidance from repository custom instructions.

if (sections.summary && sections.summary.trim()) {
Expand Down
92 changes: 91 additions & 1 deletion .github/scripts/bot_comment_auth_coverage.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ function normalizeRecordBoolean(value) {
return Boolean(value);
}

function normalizeOptionalRecordBoolean(value) {
if (value === null || value === undefined || cleanString(value) === '') return null;
return normalizeRecordBoolean(value);
}

function normalizeMode(value) {
const text = cleanString(value).toLowerCase();
if (['hard-block', 'hard_block', 'hard', 'block', 'blocking', 'enforce'].includes(text)) {
Expand Down Expand Up @@ -134,6 +139,12 @@ function normalizeRecord(raw = {}, sourcePath = '') {
fallback_warning_active: normalizeRecordBoolean(
raw.fallback_warning_active ?? raw.fallbackWarningActive
),
reusable_invocation_expected: normalizeOptionalRecordBoolean(
raw.reusable_invocation_expected ?? raw.reusableInvocationExpected
),
reusable_invocation_reason: cleanString(
raw.reusable_invocation_reason ?? raw.reusableInvocationReason
),
source_path: sourcePath,
};
}
Expand Down Expand Up @@ -216,12 +227,17 @@ function summarizeOrganicEvidence(records = [], options = {}) {
const blockers = organicChecksDisabled
? []
: missingOrganicEvidenceBlockers(components, requiredEvents);
const missingRequirements = organicChecksDisabled
? []
: missingOrganicEvidenceRequirements(components, requiredEvents);
return {
schema: 'workflows-bot-comment-auth-organic-evidence/v1',
required_events: requiredEvents,
required_components: components,
expected_mode: expectedMode === 'unknown' ? '' : expectedMode,
event_counts: eventCounts,
skipped_requirements: [],
missing_requirements: missingRequirements,
blockers,
status: organicChecksDisabled ? 'pass' : 'no-data',
};
Expand All @@ -240,11 +256,35 @@ function summarizeOrganicEvidence(records = [], options = {}) {
}

const blockers = [];
const skippedRequirements = [];
const missingRequirements = [];
for (const component of components) {
for (const eventName of requiredEvents) {
const latest = latestByComponentEvent[`${component}:${eventName}`];
const latestWrapper = latestByComponentEvent[
`agents-bot-comment-handler-wrapper:${eventName}`
];
const reusableWasNotExpected = component === 'reusable-bot-comment-handler' &&
latestWrapper &&
latestWrapper.reusable_invocation_expected === false;
if (!latest && reusableWasNotExpected) {
skippedRequirements.push({
component,
event_name: eventName,
reason: latestWrapper.reusable_invocation_reason || 'wrapper-did-not-call-reusable',
wrapper_run_id: latestWrapper.run_id,
});
continue;
}
if (!latest) {
blockers.push(`missing-organic-${component}-${eventName}`);
const blocker = `missing-organic-${component}-${eventName}`;
blockers.push(blocker);
missingRequirements.push(missingOrganicEvidenceRequirement({
component,
eventName,
blocker,
latestWrapper,
}));
continue;
}
if (latest.fallback_warning_active) {
Expand All @@ -265,6 +305,8 @@ function summarizeOrganicEvidence(records = [], options = {}) {
required_components: components,
expected_mode: expectedMode === 'unknown' ? '' : expectedMode,
event_counts: eventCounts,
skipped_requirements: skippedRequirements,
missing_requirements: missingRequirements,
blockers,
status: blockers.length > 0 ? 'warning' : 'pass',
};
Expand All @@ -276,6 +318,38 @@ function missingOrganicEvidenceBlockers(components = [], requiredEvents = []) {
);
}

function missingOrganicEvidenceRequirements(components = [], requiredEvents = []) {
return components.flatMap((component) =>
requiredEvents.map((eventName) => missingOrganicEvidenceRequirement({
component,
eventName,
blocker: `missing-organic-${component}-${eventName}`,
latestWrapper: null,
}))
);
}

function missingOrganicEvidenceRequirement({
component,
eventName,
blocker,
latestWrapper,
}) {
return {
component,
event_name: eventName,
blocker,
latest_wrapper_run_id: latestWrapper?.run_id || '',
latest_wrapper_reusable_invocation_expected:
latestWrapper?.reusable_invocation_expected ?? null,
latest_wrapper_reusable_invocation_reason:
latestWrapper?.reusable_invocation_reason || '',
latest_wrapper_has_reusable_decision:
latestWrapper?.reusable_invocation_expected !== null &&
latestWrapper?.reusable_invocation_expected !== undefined,
};
}

function componentPolicy(component, options = {}) {
const base = COMPONENT_POLICIES[component] || {
expected_mode: '',
Expand Down Expand Up @@ -555,6 +629,22 @@ function formatBotCommentAuthCoverageMarkdown(report) {
if (report.organic_evidence?.required_events?.length > 0) {
lines.push(`- Required organic events: ${report.organic_evidence.required_events.join(', ')}`);
lines.push(`- Organic evidence status: ${report.organic_evidence.status}`);
const skipped = report.organic_evidence.skipped_requirements || [];
if (skipped.length > 0) {
lines.push(
`- Skipped organic requirements: ${skipped
.map((item) => `${item.component}/${item.event_name}`)
.join(', ')}`
);
}
const missing = report.organic_evidence.missing_requirements || [];
if (missing.length > 0) {
lines.push(
`- Missing organic requirements: ${missing
.map((item) => `${item.component}/${item.event_name}`)
.join(', ')}`
);
}
}
if (report.enforcement.blockers.length > 0) {
lines.push(`- Blockers: ${report.enforcement.blockers.join(', ')}`);
Expand Down
Loading
Loading