@shapeshift-labs/frontier-swarm-codex 0.5.117 → 0.5.118
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -3
- package/dist/apply.js +1 -1
- package/dist/apply.js.map +1 -1
- package/dist/calibration-feedback.d.ts.map +1 -1
- package/dist/calibration-feedback.js +57 -2
- package/dist/calibration-feedback.js.map +1 -1
- package/dist/cleanup.js +1 -0
- package/dist/cleanup.js.map +1 -1
- package/dist/cli-args.d.ts +72 -0
- package/dist/cli-args.d.ts.map +1 -0
- package/dist/cli-args.js +296 -0
- package/dist/cli-args.js.map +1 -0
- package/dist/cli-help.d.ts.map +1 -1
- package/dist/cli-help.js +14 -0
- package/dist/cli-help.js.map +1 -1
- package/dist/cli.js +58 -183
- package/dist/cli.js.map +1 -1
- package/dist/codex-adaptive-feedback.d.ts.map +1 -1
- package/dist/codex-adaptive-feedback.js +98 -3
- package/dist/codex-adaptive-feedback.js.map +1 -1
- package/dist/codex-executor.d.ts.map +1 -1
- package/dist/codex-executor.js +30 -3
- package/dist/codex-executor.js.map +1 -1
- package/dist/codex-prompt.d.ts.map +1 -1
- package/dist/codex-prompt.js +58 -0
- package/dist/codex-prompt.js.map +1 -1
- package/dist/codex-run-metadata.d.ts +34 -0
- package/dist/codex-run-metadata.d.ts.map +1 -0
- package/dist/codex-run-metadata.js +29 -0
- package/dist/codex-run-metadata.js.map +1 -0
- package/dist/codex-run-swarm.d.ts +4 -0
- package/dist/codex-run-swarm.d.ts.map +1 -0
- package/dist/codex-run-swarm.js +69 -0
- package/dist/codex-run-swarm.js.map +1 -0
- package/dist/codex-run.d.ts +3 -3
- package/dist/codex-run.d.ts.map +1 -1
- package/dist/codex-run.js +146 -133
- package/dist/codex-run.js.map +1 -1
- package/dist/codex-tournament-strategy.d.ts +10 -0
- package/dist/codex-tournament-strategy.d.ts.map +1 -1
- package/dist/codex-tournament-strategy.js +39 -0
- package/dist/codex-tournament-strategy.js.map +1 -1
- package/dist/codex-workspace-change-paths.d.ts +20 -0
- package/dist/codex-workspace-change-paths.d.ts.map +1 -0
- package/dist/codex-workspace-change-paths.js +215 -0
- package/dist/codex-workspace-change-paths.js.map +1 -0
- package/dist/codex-workspace-changes.d.ts +12 -12
- package/dist/codex-workspace-changes.d.ts.map +1 -1
- package/dist/codex-workspace-changes.js +19 -122
- package/dist/codex-workspace-changes.js.map +1 -1
- package/dist/codex-workspace-restore.d.ts +15 -0
- package/dist/codex-workspace-restore.d.ts.map +1 -0
- package/dist/codex-workspace-restore.js +66 -0
- package/dist/codex-workspace-restore.js.map +1 -0
- package/dist/codex-workspace-write-fence.d.ts +21 -0
- package/dist/codex-workspace-write-fence.d.ts.map +1 -0
- package/dist/codex-workspace-write-fence.js +155 -0
- package/dist/codex-workspace-write-fence.js.map +1 -0
- package/dist/codex-workspace.d.ts +5 -1
- package/dist/codex-workspace.d.ts.map +1 -1
- package/dist/codex-workspace.js +46 -2
- package/dist/codex-workspace.js.map +1 -1
- package/dist/collect-artifact-store.d.ts +14 -0
- package/dist/collect-artifact-store.d.ts.map +1 -0
- package/dist/collect-artifact-store.js +207 -0
- package/dist/collect-artifact-store.js.map +1 -0
- package/dist/collect-bundle-reasons.d.ts +18 -0
- package/dist/collect-bundle-reasons.d.ts.map +1 -0
- package/dist/collect-bundle-reasons.js +222 -0
- package/dist/collect-bundle-reasons.js.map +1 -0
- package/dist/collect-bundle-staleness.d.ts +10 -0
- package/dist/collect-bundle-staleness.d.ts.map +1 -0
- package/dist/collect-bundle-staleness.js +98 -0
- package/dist/collect-bundle-staleness.js.map +1 -0
- package/dist/collect-bundles.d.ts +8 -10
- package/dist/collect-bundles.d.ts.map +1 -1
- package/dist/collect-bundles.js +28 -115
- package/dist/collect-bundles.js.map +1 -1
- package/dist/collect-dashboard-quality.d.ts +5 -0
- package/dist/collect-dashboard-quality.d.ts.map +1 -0
- package/dist/collect-dashboard-quality.js +256 -0
- package/dist/collect-dashboard-quality.js.map +1 -0
- package/dist/collect-dashboard.d.ts +4 -3
- package/dist/collect-dashboard.d.ts.map +1 -1
- package/dist/collect-dashboard.js +37 -3
- package/dist/collect-dashboard.js.map +1 -1
- package/dist/collect-evidence.d.ts.map +1 -1
- package/dist/collect-evidence.js +13 -2
- package/dist/collect-evidence.js.map +1 -1
- package/dist/collect-finalize.d.ts +15 -0
- package/dist/collect-finalize.d.ts.map +1 -0
- package/dist/collect-finalize.js +75 -0
- package/dist/collect-finalize.js.map +1 -0
- package/dist/collect-landed.d.ts +7 -0
- package/dist/collect-landed.d.ts.map +1 -0
- package/dist/collect-landed.js +171 -0
- package/dist/collect-landed.js.map +1 -0
- package/dist/collect-noise.d.ts +6 -0
- package/dist/collect-noise.d.ts.map +1 -0
- package/dist/collect-noise.js +131 -0
- package/dist/collect-noise.js.map +1 -0
- package/dist/collect-overlaps.d.ts +3 -0
- package/dist/collect-overlaps.d.ts.map +1 -0
- package/dist/collect-overlaps.js +8 -0
- package/dist/collect-overlaps.js.map +1 -0
- package/dist/collect-pids.d.ts +4 -0
- package/dist/collect-pids.d.ts.map +1 -0
- package/dist/collect-pids.js +33 -0
- package/dist/collect-pids.js.map +1 -0
- package/dist/collect-setup.d.ts +4 -0
- package/dist/collect-setup.d.ts.map +1 -0
- package/dist/collect-setup.js +20 -0
- package/dist/collect-setup.js.map +1 -0
- package/dist/collect-terminal-state.d.ts +14 -0
- package/dist/collect-terminal-state.d.ts.map +1 -0
- package/dist/collect-terminal-state.js +113 -0
- package/dist/collect-terminal-state.js.map +1 -0
- package/dist/collect-workspace-only.d.ts +10 -0
- package/dist/collect-workspace-only.d.ts.map +1 -0
- package/dist/collect-workspace-only.js +289 -0
- package/dist/collect-workspace-only.js.map +1 -0
- package/dist/collect-workspace-proof.d.ts +3 -0
- package/dist/collect-workspace-proof.d.ts.map +1 -0
- package/dist/collect-workspace-proof.js +24 -0
- package/dist/collect-workspace-proof.js.map +1 -0
- package/dist/collect-workspace-recovery.d.ts +22 -0
- package/dist/collect-workspace-recovery.d.ts.map +1 -0
- package/dist/collect-workspace-recovery.js +94 -0
- package/dist/collect-workspace-recovery.js.map +1 -0
- package/dist/collect.d.ts +1 -2
- package/dist/collect.d.ts.map +1 -1
- package/dist/collect.js +125 -116
- package/dist/collect.js.map +1 -1
- package/dist/common.d.ts +5 -0
- package/dist/common.d.ts.map +1 -1
- package/dist/common.js +54 -1
- package/dist/common.js.map +1 -1
- package/dist/constants.d.ts +6 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +6 -0
- package/dist/constants.js.map +1 -1
- package/dist/context-budget.d.ts.map +1 -1
- package/dist/context-budget.js +49 -6
- package/dist/context-budget.js.map +1 -1
- package/dist/continuation-adaptive-routing.d.ts +7 -0
- package/dist/continuation-adaptive-routing.d.ts.map +1 -0
- package/dist/continuation-adaptive-routing.js +129 -0
- package/dist/continuation-adaptive-routing.js.map +1 -0
- package/dist/continuation-child-backlogs.d.ts +11 -0
- package/dist/continuation-child-backlogs.d.ts.map +1 -0
- package/dist/continuation-child-backlogs.js +48 -0
- package/dist/continuation-child-backlogs.js.map +1 -0
- package/dist/continuation-feedback.d.ts +41 -0
- package/dist/continuation-feedback.d.ts.map +1 -0
- package/dist/continuation-feedback.js +294 -0
- package/dist/continuation-feedback.js.map +1 -0
- package/dist/continuation-human-actions.d.ts +15 -0
- package/dist/continuation-human-actions.d.ts.map +1 -0
- package/dist/continuation-human-actions.js +23 -0
- package/dist/continuation-human-actions.js.map +1 -0
- package/dist/continuation-job-routing-summary.d.ts +4 -0
- package/dist/continuation-job-routing-summary.d.ts.map +1 -0
- package/dist/continuation-job-routing-summary.js +47 -0
- package/dist/continuation-job-routing-summary.js.map +1 -0
- package/dist/continuation-task-source.d.ts +10 -0
- package/dist/continuation-task-source.d.ts.map +1 -0
- package/dist/continuation-task-source.js +11 -0
- package/dist/continuation-task-source.js.map +1 -0
- package/dist/continuation-terminal-outcomes.d.ts +27 -0
- package/dist/continuation-terminal-outcomes.d.ts.map +1 -0
- package/dist/continuation-terminal-outcomes.js +215 -0
- package/dist/continuation-terminal-outcomes.js.map +1 -0
- package/dist/continuation.d.ts +3 -0
- package/dist/continuation.d.ts.map +1 -0
- package/dist/continuation.js +266 -0
- package/dist/continuation.js.map +1 -0
- package/dist/dashboard-ui-constants.d.ts +6 -0
- package/dist/dashboard-ui-constants.d.ts.map +1 -0
- package/dist/dashboard-ui-constants.js +6 -0
- package/dist/dashboard-ui-constants.js.map +1 -0
- package/dist/dashboard-ui-health.d.ts +24 -0
- package/dist/dashboard-ui-health.d.ts.map +1 -0
- package/dist/dashboard-ui-health.js +175 -0
- package/dist/dashboard-ui-health.js.map +1 -0
- package/dist/dashboard-ui-human-actions.d.ts +3 -0
- package/dist/dashboard-ui-human-actions.d.ts.map +1 -0
- package/dist/dashboard-ui-human-actions.js +218 -0
- package/dist/dashboard-ui-human-actions.js.map +1 -0
- package/dist/dashboard-ui-jobs.d.ts +7 -0
- package/dist/dashboard-ui-jobs.d.ts.map +1 -0
- package/dist/dashboard-ui-jobs.js +232 -0
- package/dist/dashboard-ui-jobs.js.map +1 -0
- package/dist/dashboard-ui-lanes.d.ts +3 -0
- package/dist/dashboard-ui-lanes.d.ts.map +1 -0
- package/dist/dashboard-ui-lanes.js +17 -0
- package/dist/dashboard-ui-lanes.js.map +1 -0
- package/dist/dashboard-ui-metric-utils.d.ts +13 -0
- package/dist/dashboard-ui-metric-utils.d.ts.map +1 -0
- package/dist/dashboard-ui-metric-utils.js +52 -0
- package/dist/dashboard-ui-metric-utils.js.map +1 -0
- package/dist/dashboard-ui-quality.d.ts +4 -0
- package/dist/dashboard-ui-quality.d.ts.map +1 -0
- package/dist/dashboard-ui-quality.js +106 -0
- package/dist/dashboard-ui-quality.js.map +1 -0
- package/dist/dashboard-ui-semantic.d.ts +6 -0
- package/dist/dashboard-ui-semantic.d.ts.map +1 -0
- package/dist/dashboard-ui-semantic.js +84 -0
- package/dist/dashboard-ui-semantic.js.map +1 -0
- package/dist/dashboard-ui-sources.d.ts +9 -0
- package/dist/dashboard-ui-sources.d.ts.map +1 -0
- package/dist/dashboard-ui-sources.js +39 -0
- package/dist/dashboard-ui-sources.js.map +1 -0
- package/dist/dashboard-ui-steering.d.ts +4 -0
- package/dist/dashboard-ui-steering.d.ts.map +1 -0
- package/dist/dashboard-ui-steering.js +41 -0
- package/dist/dashboard-ui-steering.js.map +1 -0
- package/dist/dashboard-ui-summary.d.ts +6 -0
- package/dist/dashboard-ui-summary.d.ts.map +1 -0
- package/dist/dashboard-ui-summary.js +64 -0
- package/dist/dashboard-ui-summary.js.map +1 -0
- package/dist/dashboard-ui-time-series.d.ts +6 -0
- package/dist/dashboard-ui-time-series.d.ts.map +1 -0
- package/dist/dashboard-ui-time-series.js +191 -0
- package/dist/dashboard-ui-time-series.js.map +1 -0
- package/dist/dashboard-ui-types.d.ts +21 -0
- package/dist/dashboard-ui-types.d.ts.map +1 -0
- package/dist/dashboard-ui-types.js +2 -0
- package/dist/dashboard-ui-types.js.map +1 -0
- package/dist/dashboard-ui-values.d.ts +13 -0
- package/dist/dashboard-ui-values.d.ts.map +1 -0
- package/dist/dashboard-ui-values.js +57 -0
- package/dist/dashboard-ui-values.js.map +1 -0
- package/dist/dashboard-ui-workspace.d.ts +7 -0
- package/dist/dashboard-ui-workspace.d.ts.map +1 -0
- package/dist/dashboard-ui-workspace.js +131 -0
- package/dist/dashboard-ui-workspace.js.map +1 -0
- package/dist/dashboard-ui.d.ts +4 -0
- package/dist/dashboard-ui.d.ts.map +1 -0
- package/dist/dashboard-ui.js +139 -0
- package/dist/dashboard-ui.js.map +1 -0
- package/dist/dashboard.js +59 -3
- package/dist/dashboard.js.map +1 -1
- package/dist/human-actions.d.ts +46 -0
- package/dist/human-actions.d.ts.map +1 -0
- package/dist/human-actions.js +251 -0
- package/dist/human-actions.js.map +1 -0
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -92
- package/dist/index.js.map +1 -1
- package/dist/model-pricing.d.ts +49 -0
- package/dist/model-pricing.d.ts.map +1 -0
- package/dist/model-pricing.js +159 -0
- package/dist/model-pricing.js.map +1 -0
- package/dist/patch-score-semantic.d.ts.map +1 -1
- package/dist/patch-score-semantic.js +34 -30
- package/dist/patch-score-semantic.js.map +1 -1
- package/dist/plan.d.ts +6 -0
- package/dist/plan.d.ts.map +1 -0
- package/dist/plan.js +191 -0
- package/dist/plan.js.map +1 -0
- package/dist/query-io.d.ts +8 -0
- package/dist/query-io.d.ts.map +1 -0
- package/dist/query-io.js +46 -0
- package/dist/query-io.js.map +1 -0
- package/dist/query-landed.d.ts +20 -0
- package/dist/query-landed.d.ts.map +1 -0
- package/dist/query-landed.js +64 -0
- package/dist/query-landed.js.map +1 -0
- package/dist/query-matchers.d.ts +6 -0
- package/dist/query-matchers.d.ts.map +1 -0
- package/dist/query-matchers.js +160 -0
- package/dist/query-matchers.js.map +1 -0
- package/dist/query-signal-types.d.ts +32 -0
- package/dist/query-signal-types.d.ts.map +1 -0
- package/dist/query-signal-types.js +2 -0
- package/dist/query-signal-types.js.map +1 -0
- package/dist/query-signals.d.ts +12 -0
- package/dist/query-signals.d.ts.map +1 -0
- package/dist/query-signals.js +207 -0
- package/dist/query-signals.js.map +1 -0
- package/dist/query-status.d.ts +10 -0
- package/dist/query-status.d.ts.map +1 -0
- package/dist/query-status.js +115 -0
- package/dist/query-status.js.map +1 -0
- package/dist/query-summaries.d.ts +283 -0
- package/dist/query-summaries.d.ts.map +1 -0
- package/dist/query-summaries.js +195 -0
- package/dist/query-summaries.js.map +1 -0
- package/dist/query-types.d.ts +45 -0
- package/dist/query-types.d.ts.map +1 -0
- package/dist/query-types.js +2 -0
- package/dist/query-types.js.map +1 -0
- package/dist/query-values.d.ts +15 -0
- package/dist/query-values.d.ts.map +1 -0
- package/dist/query-values.js +73 -0
- package/dist/query-values.js.map +1 -0
- package/dist/query.d.ts +344 -41
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +38 -157
- package/dist/query.js.map +1 -1
- package/dist/score-calibration.d.ts.map +1 -1
- package/dist/score-calibration.js +52 -3
- package/dist/score-calibration.js.map +1 -1
- package/dist/score.js +1 -1
- package/dist/score.js.map +1 -1
- package/dist/semantic-edit-admission.d.ts +3 -0
- package/dist/semantic-edit-admission.d.ts.map +1 -1
- package/dist/semantic-edit-admission.js +90 -11
- package/dist/semantic-edit-admission.js.map +1 -1
- package/dist/semantic-edit-clean-eligibility.d.ts.map +1 -1
- package/dist/semantic-edit-clean-eligibility.js +22 -4
- package/dist/semantic-edit-clean-eligibility.js.map +1 -1
- package/dist/semantic-edit-script.d.ts.map +1 -1
- package/dist/semantic-edit-script.js +26 -5
- package/dist/semantic-edit-script.js.map +1 -1
- package/dist/semantic-import-layers.d.ts +1 -1
- package/dist/semantic-import-layers.d.ts.map +1 -1
- package/dist/semantic-import-layers.js +22 -6
- package/dist/semantic-import-layers.js.map +1 -1
- package/dist/semantic-import-lineage-signals.d.ts +12 -0
- package/dist/semantic-import-lineage-signals.d.ts.map +1 -0
- package/dist/semantic-import-lineage-signals.js +126 -0
- package/dist/semantic-import-lineage-signals.js.map +1 -0
- package/dist/semantic-import-lineage.d.ts.map +1 -1
- package/dist/semantic-import-lineage.js +120 -18
- package/dist/semantic-import-lineage.js.map +1 -1
- package/dist/semantic-import-proof.d.ts.map +1 -1
- package/dist/semantic-import-proof.js +16 -0
- package/dist/semantic-import-proof.js.map +1 -1
- package/dist/semantic-import-quality.d.ts.map +1 -1
- package/dist/semantic-import-quality.js +8 -0
- package/dist/semantic-import-quality.js.map +1 -1
- package/dist/semantic-import-readiness.d.ts +15 -0
- package/dist/semantic-import-readiness.d.ts.map +1 -0
- package/dist/semantic-import-readiness.js +214 -0
- package/dist/semantic-import-readiness.js.map +1 -0
- package/dist/semantic-import-sidecar.d.ts.map +1 -1
- package/dist/semantic-import-sidecar.js +6 -37
- package/dist/semantic-import-sidecar.js.map +1 -1
- package/dist/semantic-import.d.ts +4 -2
- package/dist/semantic-import.d.ts.map +1 -1
- package/dist/semantic-import.js +27 -10
- package/dist/semantic-import.js.map +1 -1
- package/dist/tournament-bandit-view.d.ts +16 -13
- package/dist/tournament-bandit-view.d.ts.map +1 -1
- package/dist/tournament-bandit-view.js +23 -3
- package/dist/tournament-bandit-view.js.map +1 -1
- package/dist/tournament-query.d.ts +35 -39
- package/dist/tournament-query.d.ts.map +1 -1
- package/dist/tournament-query.js +32 -6
- package/dist/tournament-query.js.map +1 -1
- package/dist/types-collection-quality.d.ts +112 -0
- package/dist/types-collection-quality.d.ts.map +1 -0
- package/dist/types-collection-quality.js +2 -0
- package/dist/types-collection-quality.js.map +1 -0
- package/dist/types-collection-score.d.ts +112 -0
- package/dist/types-collection-score.d.ts.map +1 -0
- package/dist/types-collection-score.js +2 -0
- package/dist/types-collection-score.js.map +1 -0
- package/dist/types-collection.d.ts +107 -112
- package/dist/types-collection.d.ts.map +1 -1
- package/dist/types-continuation.d.ts +151 -0
- package/dist/types-continuation.d.ts.map +1 -0
- package/dist/types-continuation.js +2 -0
- package/dist/types-continuation.js.map +1 -0
- package/dist/types-dashboard-metrics.d.ts +241 -0
- package/dist/types-dashboard-metrics.d.ts.map +1 -0
- package/dist/types-dashboard-metrics.js +2 -0
- package/dist/types-dashboard-metrics.js.map +1 -0
- package/dist/types-dashboard.d.ts +277 -0
- package/dist/types-dashboard.d.ts.map +1 -0
- package/dist/types-dashboard.js +2 -0
- package/dist/types-dashboard.js.map +1 -0
- package/dist/types-evidence.d.ts +3 -0
- package/dist/types-evidence.d.ts.map +1 -1
- package/dist/types-run.d.ts +54 -1
- package/dist/types-run.d.ts.map +1 -1
- package/dist/types-score-calibration.d.ts +15 -0
- package/dist/types-score-calibration.d.ts.map +1 -1
- package/dist/types-semantic.d.ts +21 -12
- package/dist/types-semantic.d.ts.map +1 -1
- package/dist/types-workspace.d.ts +31 -1
- package/dist/types-workspace.d.ts.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { pathHasIgnoredSegment, uniqueStrings } from './common.js';
|
|
2
|
+
export function collectFailureReasonClasses(reasons, patchStatus) {
|
|
3
|
+
const classes = [];
|
|
4
|
+
if (patchStatus)
|
|
5
|
+
classes.push(`patch-status.${patchStatus}`);
|
|
6
|
+
for (const reason of reasons) {
|
|
7
|
+
const normalized = reason.toLowerCase();
|
|
8
|
+
if (normalized === 'missing patch')
|
|
9
|
+
classes.push('patch.missing');
|
|
10
|
+
if (normalized === 'empty patch')
|
|
11
|
+
classes.push('patch.empty');
|
|
12
|
+
if (normalized.includes('patch applies to working tree'))
|
|
13
|
+
classes.push('patch.applies');
|
|
14
|
+
if (normalized.includes('patch applies to index but not dirty working tree'))
|
|
15
|
+
classes.push('patch.dirty-workspace-conflict');
|
|
16
|
+
if (normalized.includes('stale check disabled'))
|
|
17
|
+
classes.push('stale.check-disabled');
|
|
18
|
+
if (normalized.includes('stale-against-head cleared by patch freshness check'))
|
|
19
|
+
classes.push('stale.cleared-by-freshness-check');
|
|
20
|
+
if (normalized.includes('no patch base hashes available'))
|
|
21
|
+
classes.push('patch.no-base-hashes');
|
|
22
|
+
if (normalized.includes('textual apply failed'))
|
|
23
|
+
classes.push('patch.textual-apply-failed');
|
|
24
|
+
if (normalized.includes('base hash mismatch'))
|
|
25
|
+
classes.push('patch.base-hash-mismatch');
|
|
26
|
+
if (normalized.includes('base hash matches working tree content'))
|
|
27
|
+
classes.push('patch.base-hash-matches-worktree');
|
|
28
|
+
if (invalidGitIndexReason(normalized))
|
|
29
|
+
classes.push('workspace.invalid-git-index');
|
|
30
|
+
if (ownershipViolationReason(normalized))
|
|
31
|
+
classes.push('ownership.violation');
|
|
32
|
+
if (generatedWorkspaceSetupReason(normalized))
|
|
33
|
+
classes.push('generated.workspace-setup');
|
|
34
|
+
if (normalized.includes('source ownership violations present'))
|
|
35
|
+
classes.push('ownership.source-violation');
|
|
36
|
+
if (normalized.includes('ignored workspace noise ownership violations present')) {
|
|
37
|
+
classes.push('workspace.ignored-noise');
|
|
38
|
+
classes.push('workspace.ignored-noise.ownership-violation');
|
|
39
|
+
}
|
|
40
|
+
if (normalized.includes('quarantined-disallowed-changes'))
|
|
41
|
+
classes.push('workspace.quarantine');
|
|
42
|
+
if (normalized.includes('restored-disallowed-changes'))
|
|
43
|
+
classes.push('workspace.restore-disallowed-changes');
|
|
44
|
+
if (normalized.includes('.tsbuildinfo'))
|
|
45
|
+
classes.push('generated.tsbuildinfo-change');
|
|
46
|
+
const missingHeadBlobPath = missingHeadBlobReasonPath(reason);
|
|
47
|
+
if (missingHeadBlobPath) {
|
|
48
|
+
classes.push('patch.missing-head-blob');
|
|
49
|
+
if (ignoredWorkspaceNoisePath(missingHeadBlobPath))
|
|
50
|
+
classes.push('patch.missing-head-blob.generated');
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return uniqueStrings(classes);
|
|
54
|
+
}
|
|
55
|
+
export function compactCollectFailureReasonClasses(reasonClasses) {
|
|
56
|
+
const classes = [];
|
|
57
|
+
const generatedMissingHeadBlob = reasonClasses.includes('patch.missing-head-blob.generated');
|
|
58
|
+
for (const reasonClass of reasonClasses) {
|
|
59
|
+
if (infrastructureNoiseFailureReasonClass(reasonClass))
|
|
60
|
+
classes.push('infrastructure-noise');
|
|
61
|
+
else if (sourceBlockerFailureReasonClass(reasonClass) && !(reasonClass === 'patch.missing-head-blob' && generatedMissingHeadBlob)) {
|
|
62
|
+
classes.push('source-blocker');
|
|
63
|
+
}
|
|
64
|
+
else if (staleFailureReasonClass(reasonClass)) {
|
|
65
|
+
classes.push('stale-state');
|
|
66
|
+
}
|
|
67
|
+
else if (patchPortFailureReasonClass(reasonClass)) {
|
|
68
|
+
classes.push('patch-port-required');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return uniqueStrings(classes);
|
|
72
|
+
}
|
|
73
|
+
export function infrastructureNoiseFailureReasonClass(reasonClass) {
|
|
74
|
+
return reasonClass === 'workspace.invalid-git-index'
|
|
75
|
+
|| reasonClass === 'workspace.ignored-noise'
|
|
76
|
+
|| reasonClass.startsWith('workspace.ignored-noise.')
|
|
77
|
+
|| reasonClass.startsWith('generated.')
|
|
78
|
+
|| reasonClass.endsWith('.generated');
|
|
79
|
+
}
|
|
80
|
+
export function sourceBlockerFailureReasonClass(reasonClass) {
|
|
81
|
+
return reasonClass === 'ownership.source-violation'
|
|
82
|
+
|| reasonClass === 'patch.missing'
|
|
83
|
+
|| reasonClass === 'patch.empty'
|
|
84
|
+
|| reasonClass === 'patch.missing-head-blob'
|
|
85
|
+
|| reasonClass === 'patch.base-hash-mismatch';
|
|
86
|
+
}
|
|
87
|
+
export function ignoredWorkspaceNoisePath(file) {
|
|
88
|
+
const normalized = file.replace(/\\/g, '/').toLowerCase();
|
|
89
|
+
return normalized.endsWith('.tsbuildinfo')
|
|
90
|
+
|| pathHasIgnoredSegment(normalized, [
|
|
91
|
+
'.git',
|
|
92
|
+
'.cache',
|
|
93
|
+
'.turbo',
|
|
94
|
+
'.next',
|
|
95
|
+
'coverage',
|
|
96
|
+
'dist',
|
|
97
|
+
'build',
|
|
98
|
+
'generated',
|
|
99
|
+
'node_modules',
|
|
100
|
+
'.frontier-framework',
|
|
101
|
+
'agent-runs',
|
|
102
|
+
'target'
|
|
103
|
+
]);
|
|
104
|
+
}
|
|
105
|
+
export function sourceOwnershipViolations(paths) {
|
|
106
|
+
return sourceOwnershipViolationsForReasons(paths, []);
|
|
107
|
+
}
|
|
108
|
+
export function ignoredWorkspaceNoiseOwnershipViolations(paths) {
|
|
109
|
+
return ignoredWorkspaceNoiseOwnershipViolationsForReasons(paths, []);
|
|
110
|
+
}
|
|
111
|
+
export function sourceOwnershipViolationsForReasons(paths, reasons) {
|
|
112
|
+
return paths.filter((entry) => !ignoredWorkspaceNoisePath(entry) && !generatedWorkspaceSetupOwnershipPath(entry, reasons));
|
|
113
|
+
}
|
|
114
|
+
export function ignoredWorkspaceNoiseOwnershipViolationsForReasons(paths, reasons) {
|
|
115
|
+
return paths.filter((entry) => ignoredWorkspaceNoisePath(entry) || generatedWorkspaceSetupOwnershipPath(entry, reasons));
|
|
116
|
+
}
|
|
117
|
+
export function ownershipReasonDetails(paths, reasons = []) {
|
|
118
|
+
if (!paths.length)
|
|
119
|
+
return [];
|
|
120
|
+
return [
|
|
121
|
+
...(sourceOwnershipViolationsForReasons(paths, reasons).length ? ['source ownership violations present'] : []),
|
|
122
|
+
...(ignoredWorkspaceNoiseOwnershipViolationsForReasons(paths, reasons).length ? ['ignored workspace noise ownership violations present'] : [])
|
|
123
|
+
];
|
|
124
|
+
}
|
|
125
|
+
export function ignoredWorkspaceNoiseOnlyFailure(bundle) {
|
|
126
|
+
if (bundle.commandsFailed.length > 0)
|
|
127
|
+
return false;
|
|
128
|
+
if (sourceOwnershipViolationsForReasons(bundle.ownershipViolations, bundle.reasons).length > 0)
|
|
129
|
+
return false;
|
|
130
|
+
const reasonClasses = collectFailureReasonClasses(bundle.reasons);
|
|
131
|
+
const compactReasonClasses = compactCollectFailureReasonClasses(reasonClasses);
|
|
132
|
+
const hasInfrastructureNoise = compactReasonClasses.includes('infrastructure-noise')
|
|
133
|
+
|| ignoredWorkspaceNoiseOwnershipViolationsForReasons(bundle.ownershipViolations, bundle.reasons).length > 0;
|
|
134
|
+
if (!hasInfrastructureNoise)
|
|
135
|
+
return false;
|
|
136
|
+
if (compactReasonClasses.includes('source-blocker'))
|
|
137
|
+
return false;
|
|
138
|
+
return bundle.reasons.every((reason) => {
|
|
139
|
+
if (ignoredWorkspaceNoiseFailureReason(reason))
|
|
140
|
+
return true;
|
|
141
|
+
return collectFailureReasonClasses([reason]).some((reasonClass) => infrastructureNoiseFailureReasonClass(reasonClass));
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
export function nonActionableFailedEvidence(bundle, input) {
|
|
145
|
+
if (input.staleAgainstHead || bundle.staleAgainstHead)
|
|
146
|
+
return false;
|
|
147
|
+
if (input.hasActionablePatch ?? Boolean(bundle.patchPath))
|
|
148
|
+
return false;
|
|
149
|
+
if (bundle.changedPaths.length > 0 || bundle.ownershipViolations.length > 0 || bundle.commandsFailed.length > 0)
|
|
150
|
+
return false;
|
|
151
|
+
if (!bundle.reasons.some(nonActionableFailedEvidenceReason))
|
|
152
|
+
return false;
|
|
153
|
+
return bundle.disposition === 'blocked'
|
|
154
|
+
|| bundle.disposition === 'rejected'
|
|
155
|
+
|| bundle.mergeReadiness === 'blocked'
|
|
156
|
+
|| bundle.mergeReadiness === 'rejected'
|
|
157
|
+
|| bundle.status === 'failed'
|
|
158
|
+
|| bundle.status === 'blocked';
|
|
159
|
+
}
|
|
160
|
+
function staleFailureReasonClass(reasonClass) {
|
|
161
|
+
return reasonClass.startsWith('stale.');
|
|
162
|
+
}
|
|
163
|
+
function patchPortFailureReasonClass(reasonClass) {
|
|
164
|
+
return reasonClass === 'patch.no-base-hashes'
|
|
165
|
+
|| reasonClass === 'patch.textual-apply-failed'
|
|
166
|
+
|| reasonClass === 'patch.base-hash-matches-worktree'
|
|
167
|
+
|| reasonClass === 'patch.dirty-workspace-conflict'
|
|
168
|
+
|| reasonClass.startsWith('patch-status.');
|
|
169
|
+
}
|
|
170
|
+
function invalidGitIndexReason(reason) {
|
|
171
|
+
return (reason.includes('.git/index') || reason.includes('.git\\index') || reason.includes('index file'))
|
|
172
|
+
&& (reason.includes('fatal:')
|
|
173
|
+
|| reason.includes('error:')
|
|
174
|
+
|| reason.includes('invalid')
|
|
175
|
+
|| reason.includes('corrupt')
|
|
176
|
+
|| reason.includes('smaller than expected')
|
|
177
|
+
|| reason.includes('unknown index entry'));
|
|
178
|
+
}
|
|
179
|
+
function ownershipViolationReason(reason) {
|
|
180
|
+
return reason === 'ownership-violations'
|
|
181
|
+
|| reason === 'ownership violations present'
|
|
182
|
+
|| reason.includes('ownership violation');
|
|
183
|
+
}
|
|
184
|
+
function missingHeadBlobReasonPath(reason) {
|
|
185
|
+
const match = /^missing HEAD blob for (.+)$/i.exec(reason.trim());
|
|
186
|
+
return match?.[1]?.trim();
|
|
187
|
+
}
|
|
188
|
+
function ignoredWorkspaceNoiseFailureReason(reason) {
|
|
189
|
+
const normalized = reason.toLowerCase();
|
|
190
|
+
return normalized === 'failed'
|
|
191
|
+
|| normalized === 'rejected'
|
|
192
|
+
|| normalized === 'blocked'
|
|
193
|
+
|| normalized === 'ownership-violations'
|
|
194
|
+
|| normalized === 'ownership violations present'
|
|
195
|
+
|| normalized === 'ignored workspace noise ownership violations present'
|
|
196
|
+
|| generatedWorkspaceSetupReason(normalized)
|
|
197
|
+
|| normalized === 'quarantined-disallowed-changes'
|
|
198
|
+
|| normalized === 'restored-disallowed-changes'
|
|
199
|
+
|| normalized === 'stale check disabled'
|
|
200
|
+
|| normalized.startsWith('patch-status.');
|
|
201
|
+
}
|
|
202
|
+
function generatedWorkspaceSetupReason(reason) {
|
|
203
|
+
return reason === 'generated_setup'
|
|
204
|
+
|| reason.includes('generated setup')
|
|
205
|
+
|| reason.includes('generated workspace setup');
|
|
206
|
+
}
|
|
207
|
+
function generatedWorkspaceSetupOwnershipPath(file, reasons) {
|
|
208
|
+
if (!reasons.some((reason) => generatedWorkspaceSetupReason(reason.toLowerCase())))
|
|
209
|
+
return false;
|
|
210
|
+
const normalized = file.replace(/\\/g, '/').toLowerCase();
|
|
211
|
+
return normalized === '.gitignore' || normalized === '.loomignore' || normalized === 'loom.json';
|
|
212
|
+
}
|
|
213
|
+
function nonActionableFailedEvidenceReason(reason) {
|
|
214
|
+
const normalized = reason.toLowerCase();
|
|
215
|
+
return normalized.includes('no-source-changes')
|
|
216
|
+
|| normalized.includes('no source changes')
|
|
217
|
+
|| normalized.includes('non-actionable-worker-output')
|
|
218
|
+
|| normalized.includes('failed-output-recorded')
|
|
219
|
+
|| normalized.includes('blocked-output-recorded')
|
|
220
|
+
|| normalized.includes('generated-failed-evidence');
|
|
221
|
+
}
|
|
222
|
+
//# sourceMappingURL=collect-bundle-reasons.js.map
|
|
@@ -0,0 +1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,CAAC,iBAAiB,CAAC;WAClC,MAAM,CAAC,QAAQ,CAAC,2BAA2B,CAAC,CAAC;AACpD,CAAC;AAED,SAAS,oCAAoC,CAAC,IAAY,EAAE,OAA0B;IACpF,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,6BAA6B,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IACjG,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;IAC1D,OAAO,UAAU,KAAK,YAAY,IAAI,UAAU,KAAK,aAAa,IAAI,UAAU,KAAK,WAAW,CAAC;AACnG,CAAC;AAED,SAAS,iCAAiC,CAAC,MAAc;IACvD,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IACxC,OAAO,UAAU,CAAC,QAAQ,CAAC,mBAAmB,CAAC;WAC1C,UAAU,CAAC,QAAQ,CAAC,mBAAmB,CAAC;WACxC,UAAU,CAAC,QAAQ,CAAC,8BAA8B,CAAC;WACnD,UAAU,CAAC,QAAQ,CAAC,wBAAwB,CAAC;WAC7C,UAAU,CAAC,QAAQ,CAAC,yBAAyB,CAAC;WAC9C,UAAU,CAAC,QAAQ,CAAC,2BAA2B,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FrontierSwarmMergeBundle, FrontierSwarmPatchStatus } from '@shapeshift-labs/frontier-swarm';
|
|
2
|
+
export interface FrontierCodexPatchStaleness {
|
|
3
|
+
stale: boolean;
|
|
4
|
+
patchStatus: FrontierSwarmPatchStatus;
|
|
5
|
+
reasons: string[];
|
|
6
|
+
reasonClasses: string[];
|
|
7
|
+
fresh: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function bundlePatchStaleness(bundle: FrontierSwarmMergeBundle, mergePath: string, cwd: string): Promise<FrontierCodexPatchStaleness>;
|
|
10
|
+
//# sourceMappingURL=collect-bundle-staleness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collect-bundle-staleness.d.ts","sourceRoot":"","sources":["../src/collect-bundle-staleness.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAI1G,MAAM,WAAW,2BAA2B;IAC1C,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,EAAE,wBAAwB,CAAC;IACtC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,wBAAwB,EAChC,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,2BAA2B,CAAC,CAkCtC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { pathExists, resolveBundlePatchPath, runProcess, tail, uniqueStrings } from './common.js';
|
|
4
|
+
import { collectFailureReasonClasses } from './collect-bundle-reasons.js';
|
|
5
|
+
export async function bundlePatchStaleness(bundle, mergePath, cwd) {
|
|
6
|
+
const patchPath = resolveBundlePatchPath(bundle, mergePath);
|
|
7
|
+
if (!patchPath || !await pathExists(patchPath))
|
|
8
|
+
return patchStalenessResult(false, 'missing', ['missing patch'], false);
|
|
9
|
+
const patch = await fs.readFile(patchPath, 'utf8').catch(() => '');
|
|
10
|
+
if (!patch.trim())
|
|
11
|
+
return patchStalenessResult(false, 'missing', ['empty patch'], false);
|
|
12
|
+
const result = await runProcess('git', ['apply', '--check', patchPath], { cwd, allowFailure: true });
|
|
13
|
+
if (result.status === 0)
|
|
14
|
+
return patchStalenessResult(false, 'applies', ['patch applies to working tree'], true);
|
|
15
|
+
const cached = await runProcess('git', ['apply', '--check', '--cached', patchPath], { cwd, allowFailure: true });
|
|
16
|
+
if (cached.status === 0) {
|
|
17
|
+
return patchStalenessResult(false, 'dirty-workspace-conflict', ['patch applies to index but not dirty working tree'], true);
|
|
18
|
+
}
|
|
19
|
+
const baseStatus = await patchBaseHashStatus(patch, cwd);
|
|
20
|
+
if (!baseStatus.known) {
|
|
21
|
+
return patchStalenessResult(false, 'needs-port', ['patch does not expose comparable base hashes; coordinator review must port it', ...baseStatus.reasons, ...tail(result.stderr || result.stdout, 3)], false);
|
|
22
|
+
}
|
|
23
|
+
if (baseStatus.known && baseStatus.mismatched === 0) {
|
|
24
|
+
return patchStalenessResult(false, 'needs-port', ['patch base hashes match HEAD or working tree content but textual apply failed', ...baseStatus.reasons, ...tail(result.stderr || result.stdout, 3)], true);
|
|
25
|
+
}
|
|
26
|
+
return patchStalenessResult(false, 'needs-port', ['patch base hashes differ from HEAD and working tree content; manual port required', ...baseStatus.reasons, ...tail(result.stderr || result.stdout, 3)], false);
|
|
27
|
+
}
|
|
28
|
+
function patchStalenessResult(stale, patchStatus, reasons, fresh) {
|
|
29
|
+
const normalizedReasons = uniqueStrings([...reasons]);
|
|
30
|
+
return {
|
|
31
|
+
stale,
|
|
32
|
+
patchStatus,
|
|
33
|
+
reasons: normalizedReasons,
|
|
34
|
+
reasonClasses: collectFailureReasonClasses(normalizedReasons, patchStatus),
|
|
35
|
+
fresh
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
async function patchBaseHashStatus(patch, cwd) {
|
|
39
|
+
const entries = parsePatchBaseHashes(patch, cwd);
|
|
40
|
+
if (entries.length === 0)
|
|
41
|
+
return { known: false, mismatched: 0, reasons: ['no patch base hashes available'] };
|
|
42
|
+
let mismatched = 0;
|
|
43
|
+
const reasons = [];
|
|
44
|
+
for (const entry of entries) {
|
|
45
|
+
const head = await runProcess('git', ['rev-parse', `HEAD:${entry.path}`], { cwd, allowFailure: true });
|
|
46
|
+
const headHash = head.stdout.trim();
|
|
47
|
+
if (head.status === 0 && headHash.startsWith(entry.oldHash))
|
|
48
|
+
continue;
|
|
49
|
+
const worktree = await runProcess('git', ['hash-object', '--', entry.path], { cwd, allowFailure: true });
|
|
50
|
+
const worktreeHash = worktree.stdout.trim();
|
|
51
|
+
if (worktree.status === 0 && worktreeHash.startsWith(entry.oldHash)) {
|
|
52
|
+
reasons.push(`base hash matches working tree content for ${entry.path}`);
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
mismatched += 1;
|
|
56
|
+
reasons.push(head.status !== 0 ? `missing HEAD blob for ${entry.path}` : `base hash mismatch for ${entry.path}`);
|
|
57
|
+
}
|
|
58
|
+
return { known: true, mismatched, reasons };
|
|
59
|
+
}
|
|
60
|
+
function parsePatchBaseHashes(patch, cwd) {
|
|
61
|
+
const lines = patch.split(/\r?\n/);
|
|
62
|
+
const entries = [];
|
|
63
|
+
let currentPath;
|
|
64
|
+
for (const line of lines) {
|
|
65
|
+
if (line.startsWith('diff --git ')) {
|
|
66
|
+
const parts = line.split(/\s+/);
|
|
67
|
+
currentPath = normalizePatchBasePath(parts[2], cwd) ?? normalizePatchBasePath(parts[3], cwd);
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (!currentPath || !line.startsWith('index '))
|
|
71
|
+
continue;
|
|
72
|
+
const match = /^index\s+([0-9a-f]+)\.\.([0-9a-f]+)/i.exec(line);
|
|
73
|
+
if (match?.[1] && match[1] !== '0000000')
|
|
74
|
+
entries.push({ path: currentPath, oldHash: match[1] });
|
|
75
|
+
}
|
|
76
|
+
return entries;
|
|
77
|
+
}
|
|
78
|
+
function normalizePatchBasePath(token, cwd) {
|
|
79
|
+
if (!token || token === '/dev/null')
|
|
80
|
+
return undefined;
|
|
81
|
+
let value = token;
|
|
82
|
+
if (value.startsWith('a/') || value.startsWith('b/'))
|
|
83
|
+
value = value.slice(2);
|
|
84
|
+
if (value === '/dev/null')
|
|
85
|
+
return undefined;
|
|
86
|
+
if (path.isAbsolute(value)) {
|
|
87
|
+
const relative = path.relative(cwd, value);
|
|
88
|
+
if (relative && !relative.startsWith('..') && !path.isAbsolute(relative))
|
|
89
|
+
return relative.replace(/\\/g, '/');
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
const rootedValue = path.join(path.parse(cwd).root, value);
|
|
93
|
+
const rootedRelative = path.relative(cwd, rootedValue);
|
|
94
|
+
if (rootedRelative && !rootedRelative.startsWith('..') && !path.isAbsolute(rootedRelative))
|
|
95
|
+
return rootedRelative.replace(/\\/g, '/');
|
|
96
|
+
return value.replace(/\\/g, '/');
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=collect-bundle-staleness.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collect-bundle-staleness.js","sourceRoot":"","sources":["../src/collect-bundle-staleness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,UAAU,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAClG,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAU1E,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,MAAgC,EAChC,SAAiB,EACjB,GAAW;IAEX,MAAM,SAAS,GAAG,sBAAsB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC5D,IAAI,CAAC,SAAS,IAAI,CAAC,MAAM,UAAU,CAAC,SAAS,CAAC;QAAE,OAAO,oBAAoB,CAAC,KAAK,EAAE,SAAS,EAAE,CAAC,eAAe,CAAC,EAAE,KAAK,CAAC,CAAC;IACxH,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IACnE,IAAI,CAAC,KAAK,CAAC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,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAC9G,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC3D,MAAM,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;IACvD,IAAI,cAAc,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC;QAAE,OAAO,cAAc,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACtI,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import { type FrontierSwarmMergeBundle
|
|
1
|
+
import { type FrontierSwarmMergeBundle } from '@shapeshift-labs/frontier-swarm';
|
|
2
|
+
import type { FrontierCodexPatchStaleness } from './collect-bundle-staleness.js';
|
|
2
3
|
import type { FrontierCodexCollectBucket } from './index.js';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
fresh: boolean;
|
|
8
|
-
}
|
|
9
|
-
export declare function bundlePatchStaleness(bundle: FrontierSwarmMergeBundle, mergePath: string, cwd: string): Promise<FrontierCodexPatchStaleness>;
|
|
4
|
+
export { bundlePatchStaleness } from './collect-bundle-staleness.js';
|
|
5
|
+
export type { FrontierCodexPatchStaleness } from './collect-bundle-staleness.js';
|
|
6
|
+
export { collectFailureReasonClasses, compactCollectFailureReasonClasses, ignoredWorkspaceNoiseOwnershipViolations, ignoredWorkspaceNoiseOwnershipViolationsForReasons, ignoredWorkspaceNoisePath, infrastructureNoiseFailureReasonClass, nonActionableFailedEvidence, sourceBlockerFailureReasonClass, sourceOwnershipViolations, sourceOwnershipViolationsForReasons } from './collect-bundle-reasons.js';
|
|
7
|
+
export type { FrontierCodexCollectCompactReasonClass } from './collect-bundle-reasons.js';
|
|
10
8
|
export declare function normalizeCollectedMergeBundle(value: unknown, mergePath: string): FrontierSwarmMergeBundle;
|
|
11
9
|
export declare function mergeRecordScore(record: {
|
|
12
10
|
mergePath: string;
|
|
13
11
|
bundle: FrontierSwarmMergeBundle;
|
|
14
12
|
}): number;
|
|
15
|
-
export declare function classifyCodexCollectBucket(bundle: FrontierSwarmMergeBundle, staleAgainstHead: boolean): FrontierCodexCollectBucket;
|
|
13
|
+
export declare function classifyCodexCollectBucket(bundle: FrontierSwarmMergeBundle, staleAgainstHead: boolean, hasActionablePatch?: boolean): FrontierCodexCollectBucket;
|
|
16
14
|
export declare function normalizeCollectedStaleAgainstHead(bundle: FrontierSwarmMergeBundle, staleness: FrontierCodexPatchStaleness, checkStale: boolean): boolean;
|
|
17
|
-
export declare function normalizeCollectedDisposition(bundle: FrontierSwarmMergeBundle, staleAgainstHead: boolean): FrontierSwarmMergeBundle['disposition'];
|
|
15
|
+
export declare function normalizeCollectedDisposition(bundle: FrontierSwarmMergeBundle, staleAgainstHead: boolean, patchExists?: boolean): FrontierSwarmMergeBundle['disposition'];
|
|
18
16
|
//# sourceMappingURL=collect-bundles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collect-bundles.d.ts","sourceRoot":"","sources":["../src/collect-bundles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"collect-bundles.d.ts","sourceRoot":"","sources":["../src/collect-bundles.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,iCAAiC,CAAC;AAOzC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAE7D,OAAO,EACL,oBAAoB,EACrB,MAAM,+BAA+B,CAAC;AACvC,YAAY,EACV,2BAA2B,EAC5B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,2BAA2B,EAC3B,kCAAkC,EAClC,wCAAwC,EACxC,kDAAkD,EAClD,yBAAyB,EACzB,qCAAqC,EACrC,2BAA2B,EAC3B,+BAA+B,EAC/B,yBAAyB,EACzB,mCAAmC,EACpC,MAAM,6BAA6B,CAAC;AACrC,YAAY,EACV,sCAAsC,EACvC,MAAM,6BAA6B,CAAC;AAErC,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,wBAAwB,CAkDzG;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,wBAAwB,CAAA;CAAE,GAAG,MAAM,CAMxG;AAED,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,wBAAwB,EAChC,gBAAgB,EAAE,OAAO,EACzB,kBAAkB,UAA4B,GAC7C,0BAA0B,CAa5B;AAED,wBAAgB,kCAAkC,CAChD,MAAM,EAAE,wBAAwB,EAChC,SAAS,EAAE,2BAA2B,EACtC,UAAU,EAAE,OAAO,GAClB,OAAO,CAMT;AAED,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,wBAAwB,EAChC,gBAAgB,EAAE,OAAO,EACzB,WAAW,UAA4B,GACtC,wBAAwB,CAAC,aAAa,CAAC,CAMzC"}
|
package/dist/collect-bundles.js
CHANGED
|
@@ -1,119 +1,21 @@
|
|
|
1
|
-
import fs from 'node:fs/promises';
|
|
2
1
|
import path from 'node:path';
|
|
3
2
|
import { FRONTIER_SWARM_MERGE_BUNDLE_KIND, FRONTIER_SWARM_MERGE_BUNDLE_VERSION } from '@shapeshift-labs/frontier-swarm';
|
|
4
|
-
import { isObject,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return { stale: false, patchStatus: 'missing', reasons: ['missing patch'], fresh: false };
|
|
9
|
-
const patch = await fs.readFile(patchPath, 'utf8').catch(() => '');
|
|
10
|
-
if (!patch.trim())
|
|
11
|
-
return { stale: false, patchStatus: 'missing', reasons: ['empty patch'], fresh: false };
|
|
12
|
-
const result = await runProcess('git', ['apply', '--check', patchPath], { cwd, allowFailure: true });
|
|
13
|
-
if (result.status === 0)
|
|
14
|
-
return { stale: false, patchStatus: 'applies', reasons: ['patch applies to working tree'], fresh: true };
|
|
15
|
-
const cached = await runProcess('git', ['apply', '--check', '--cached', patchPath], { cwd, allowFailure: true });
|
|
16
|
-
if (cached.status === 0) {
|
|
17
|
-
return {
|
|
18
|
-
stale: false,
|
|
19
|
-
patchStatus: 'dirty-workspace-conflict',
|
|
20
|
-
reasons: ['patch applies to index but not dirty working tree'],
|
|
21
|
-
fresh: true
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
const baseStatus = await patchBaseHashStatus(patch, cwd);
|
|
25
|
-
if (!baseStatus.known) {
|
|
26
|
-
return {
|
|
27
|
-
stale: false,
|
|
28
|
-
patchStatus: 'needs-port',
|
|
29
|
-
reasons: ['patch does not expose comparable base hashes; coordinator review must port it', ...baseStatus.reasons],
|
|
30
|
-
fresh: false
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
if (baseStatus.known && baseStatus.mismatched === 0) {
|
|
34
|
-
return {
|
|
35
|
-
stale: false,
|
|
36
|
-
patchStatus: 'needs-port',
|
|
37
|
-
reasons: ['patch base hashes match HEAD or working tree content but textual apply failed', ...baseStatus.reasons],
|
|
38
|
-
fresh: true
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
return {
|
|
42
|
-
stale: false,
|
|
43
|
-
patchStatus: 'needs-port',
|
|
44
|
-
reasons: uniqueStrings(['patch base hashes differ from HEAD and working tree content; manual port required', ...baseStatus.reasons, ...tail(result.stderr || result.stdout, 3)]),
|
|
45
|
-
fresh: false
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
async function patchBaseHashStatus(patch, cwd) {
|
|
49
|
-
const entries = parsePatchBaseHashes(patch, cwd);
|
|
50
|
-
if (entries.length === 0)
|
|
51
|
-
return { known: false, mismatched: 0, reasons: ['no patch base hashes available'] };
|
|
52
|
-
let mismatched = 0;
|
|
53
|
-
const reasons = [];
|
|
54
|
-
for (const entry of entries) {
|
|
55
|
-
const head = await runProcess('git', ['rev-parse', `HEAD:${entry.path}`], { cwd, allowFailure: true });
|
|
56
|
-
const headHash = head.stdout.trim();
|
|
57
|
-
if (head.status === 0 && headHash.startsWith(entry.oldHash))
|
|
58
|
-
continue;
|
|
59
|
-
const worktree = await runProcess('git', ['hash-object', '--', entry.path], { cwd, allowFailure: true });
|
|
60
|
-
const worktreeHash = worktree.stdout.trim();
|
|
61
|
-
if (worktree.status === 0 && worktreeHash.startsWith(entry.oldHash)) {
|
|
62
|
-
reasons.push(`base hash matches working tree content for ${entry.path}`);
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
mismatched += 1;
|
|
66
|
-
reasons.push(head.status !== 0 ? `missing HEAD blob for ${entry.path}` : `base hash mismatch for ${entry.path}`);
|
|
67
|
-
}
|
|
68
|
-
return { known: true, mismatched, reasons };
|
|
69
|
-
}
|
|
70
|
-
function parsePatchBaseHashes(patch, cwd) {
|
|
71
|
-
const lines = patch.split(/\r?\n/);
|
|
72
|
-
const entries = [];
|
|
73
|
-
let currentPath;
|
|
74
|
-
for (const line of lines) {
|
|
75
|
-
if (line.startsWith('diff --git ')) {
|
|
76
|
-
const parts = line.split(/\s+/);
|
|
77
|
-
currentPath = normalizePatchBasePath(parts[2], cwd) ?? normalizePatchBasePath(parts[3], cwd);
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
if (!currentPath || !line.startsWith('index '))
|
|
81
|
-
continue;
|
|
82
|
-
const match = /^index\s+([0-9a-f]+)\.\.([0-9a-f]+)/i.exec(line);
|
|
83
|
-
if (match?.[1] && match[1] !== '0000000')
|
|
84
|
-
entries.push({ path: currentPath, oldHash: match[1] });
|
|
85
|
-
}
|
|
86
|
-
return entries;
|
|
87
|
-
}
|
|
88
|
-
function normalizePatchBasePath(token, cwd) {
|
|
89
|
-
if (!token || token === '/dev/null')
|
|
90
|
-
return undefined;
|
|
91
|
-
let value = token;
|
|
92
|
-
if (value.startsWith('a/') || value.startsWith('b/'))
|
|
93
|
-
value = value.slice(2);
|
|
94
|
-
if (value === '/dev/null')
|
|
95
|
-
return undefined;
|
|
96
|
-
if (path.isAbsolute(value)) {
|
|
97
|
-
const relative = path.relative(cwd, value);
|
|
98
|
-
if (relative && !relative.startsWith('..') && !path.isAbsolute(relative))
|
|
99
|
-
return relative.replace(/\\/g, '/');
|
|
100
|
-
return undefined;
|
|
101
|
-
}
|
|
102
|
-
const rootedValue = path.join(path.parse(cwd).root, value);
|
|
103
|
-
const rootedRelative = path.relative(cwd, rootedValue);
|
|
104
|
-
if (rootedRelative && !rootedRelative.startsWith('..') && !path.isAbsolute(rootedRelative))
|
|
105
|
-
return rootedRelative.replace(/\\/g, '/');
|
|
106
|
-
return value.replace(/\\/g, '/');
|
|
107
|
-
}
|
|
3
|
+
import { isObject, uniqueStrings } from './common.js';
|
|
4
|
+
import { ignoredWorkspaceNoiseOnlyFailure, nonActionableFailedEvidence, ownershipReasonDetails } from './collect-bundle-reasons.js';
|
|
5
|
+
export { bundlePatchStaleness } from './collect-bundle-staleness.js';
|
|
6
|
+
export { collectFailureReasonClasses, compactCollectFailureReasonClasses, ignoredWorkspaceNoiseOwnershipViolations, ignoredWorkspaceNoiseOwnershipViolationsForReasons, ignoredWorkspaceNoisePath, infrastructureNoiseFailureReasonClass, nonActionableFailedEvidence, sourceBlockerFailureReasonClass, sourceOwnershipViolations, sourceOwnershipViolationsForReasons } from './collect-bundle-reasons.js';
|
|
108
7
|
export function normalizeCollectedMergeBundle(value, mergePath) {
|
|
109
8
|
const input = typeof value === 'object' && value !== null ? value : {};
|
|
110
9
|
const jobId = typeof input.jobId === 'string' && input.jobId ? input.jobId : path.basename(path.dirname(mergePath));
|
|
111
10
|
const changedPaths = stringArray(input.changedPaths);
|
|
11
|
+
const ownershipViolations = stringArray(input.ownershipViolations);
|
|
112
12
|
const status = typeof input.status === 'string' ? input.status : 'completed';
|
|
113
13
|
const autoMergeable = Boolean(input.autoMergeable);
|
|
114
14
|
const disposition = typeof input.disposition === 'string'
|
|
115
15
|
? input.disposition
|
|
116
16
|
: autoMergeable ? 'auto-mergeable' : status === 'failed' ? 'rejected' : 'needs-port';
|
|
17
|
+
const inputReasons = stringArray(input.reasons);
|
|
18
|
+
const reasons = uniqueStrings([...inputReasons, ...ownershipReasonDetails(ownershipViolations, inputReasons)]);
|
|
117
19
|
const bundle = {
|
|
118
20
|
kind: typeof input.kind === 'string' ? input.kind : FRONTIER_SWARM_MERGE_BUNDLE_KIND,
|
|
119
21
|
version: typeof input.version === 'number' ? input.version : FRONTIER_SWARM_MERGE_BUNDLE_VERSION,
|
|
@@ -136,23 +38,21 @@ export function normalizeCollectedMergeBundle(value, mergePath) {
|
|
|
136
38
|
changedRegions: stringArray(input.changedRegions),
|
|
137
39
|
ownedFilesTouched: stringArray(input.ownedFilesTouched),
|
|
138
40
|
allowedWrites: stringArray(input.allowedWrites),
|
|
139
|
-
ownershipViolations
|
|
41
|
+
ownershipViolations,
|
|
140
42
|
...(typeof input.patchPath === 'string' ? { patchPath: input.patchPath } : {}),
|
|
141
43
|
...(typeof input.patchHash === 'string' ? { patchHash: input.patchHash } : {}),
|
|
142
44
|
evidencePaths: stringArray(input.evidencePaths),
|
|
143
45
|
commandsPassed: Array.isArray(input.commandsPassed) ? input.commandsPassed : [],
|
|
144
46
|
commandsFailed: Array.isArray(input.commandsFailed) ? input.commandsFailed : [],
|
|
47
|
+
traceShards: Array.isArray(input.traceShards) ? input.traceShards : [],
|
|
145
48
|
queueItemIds: stringArray(input.queueItemIds),
|
|
146
49
|
...(typeof input.branchName === 'string' ? { branchName: input.branchName } : {}),
|
|
147
50
|
...(typeof input.commit === 'string' ? { commit: input.commit } : {}),
|
|
148
51
|
staleAgainstHead: Boolean(input.staleAgainstHead),
|
|
149
|
-
reasons
|
|
52
|
+
reasons,
|
|
150
53
|
...(isObject(input.semanticImport) ? { semanticImport: input.semanticImport } : {}),
|
|
151
54
|
...(isObject(input.metadata) ? { metadata: input.metadata } : {})
|
|
152
55
|
};
|
|
153
|
-
if (Array.isArray(input.traceShards)) {
|
|
154
|
-
bundle.traceShards = input.traceShards;
|
|
155
|
-
}
|
|
156
56
|
return bundle;
|
|
157
57
|
}
|
|
158
58
|
export function mergeRecordScore(record) {
|
|
@@ -162,13 +62,19 @@ export function mergeRecordScore(record) {
|
|
|
162
62
|
+ record.bundle.commandsPassed.length
|
|
163
63
|
+ record.bundle.commandsFailed.length;
|
|
164
64
|
}
|
|
165
|
-
function
|
|
166
|
-
return Array.isArray(value) ? value.filter((entry) => typeof entry === 'string') : [];
|
|
167
|
-
}
|
|
168
|
-
export function classifyCodexCollectBucket(bundle, staleAgainstHead) {
|
|
65
|
+
export function classifyCodexCollectBucket(bundle, staleAgainstHead, hasActionablePatch = Boolean(bundle.patchPath)) {
|
|
169
66
|
if (staleAgainstHead)
|
|
170
67
|
return 'stale-against-head';
|
|
68
|
+
if (bundle.changedPaths.length > 0 && hasActionablePatch && (bundle.disposition === 'rejected' || bundle.commandsFailed.length > 0 || bundle.status === 'failed')) {
|
|
69
|
+
return 'rerun-work';
|
|
70
|
+
}
|
|
71
|
+
if (bundle.ownershipViolations.length > 0 && bundle.changedPaths.length > 0 && hasActionablePatch)
|
|
72
|
+
return 'rerun-work';
|
|
73
|
+
if (nonActionableFailedEvidence(bundle, { staleAgainstHead, hasActionablePatch }))
|
|
74
|
+
return 'needs-human-port';
|
|
171
75
|
if (bundle.disposition === 'rejected' || bundle.disposition === 'blocked' || bundle.commandsFailed.length > 0 || bundle.status === 'failed') {
|
|
76
|
+
if (ignoredWorkspaceNoiseOnlyFailure(bundle))
|
|
77
|
+
return 'needs-human-port';
|
|
172
78
|
return 'failed-evidence';
|
|
173
79
|
}
|
|
174
80
|
if (bundle.disposition === 'auto-mergeable' && bundle.autoMergeable)
|
|
@@ -185,11 +91,18 @@ export function normalizeCollectedStaleAgainstHead(bundle, staleness, checkStale
|
|
|
185
91
|
return false;
|
|
186
92
|
return inheritedStale;
|
|
187
93
|
}
|
|
188
|
-
export function normalizeCollectedDisposition(bundle, staleAgainstHead) {
|
|
94
|
+
export function normalizeCollectedDisposition(bundle, staleAgainstHead, patchExists = Boolean(bundle.patchPath)) {
|
|
189
95
|
if (staleAgainstHead)
|
|
190
96
|
return 'stale-against-head';
|
|
97
|
+
if (nonActionableFailedEvidence(bundle, { staleAgainstHead, hasActionablePatch: patchExists }))
|
|
98
|
+
return 'needs-port';
|
|
99
|
+
if (ignoredWorkspaceNoiseOnlyFailure(bundle))
|
|
100
|
+
return 'needs-port';
|
|
191
101
|
if (bundle.disposition === 'stale-against-head')
|
|
192
102
|
return 'needs-port';
|
|
193
103
|
return bundle.disposition;
|
|
194
104
|
}
|
|
105
|
+
function stringArray(value) {
|
|
106
|
+
return Array.isArray(value) ? value.filter((entry) => typeof entry === 'string') : [];
|
|
107
|
+
}
|
|
195
108
|
//# sourceMappingURL=collect-bundles.js.map
|