-
Notifications
You must be signed in to change notification settings - Fork 1
[codex] Preserve weekly freshness selection state #1915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,27 @@ function selectedArtifactsFromSelection(selection = {}) { | |
| return Array.isArray(selection.selected_artifacts) ? selection.selected_artifacts : []; | ||
| } | ||
|
|
||
| function compactSelectionDetails(selection = {}, selectionPath = '') { | ||
| return { | ||
| path: selectionPath, | ||
| schema: cleanString(selection.schema), | ||
| status: cleanString(selection.status || 'pass'), | ||
| selected_count: selectedArtifactsFromSelection(selection).length, | ||
| candidate_count: Number.isFinite(Number(selection.candidate_count)) | ||
| ? Number(selection.candidate_count) | ||
| : 0, | ||
| candidate_family_counts: selection.candidate_family_counts || {}, | ||
| selected_family_counts: selection.selected_family_counts || {}, | ||
| missing_priority_families: Array.isArray(selection.missing_priority_families) | ||
|
Comment on lines
+51
to
+53
|
||
| ? selection.missing_priority_families | ||
| : [], | ||
| priority_family_statuses: Array.isArray(selection.priority_family_statuses) | ||
| ? selection.priority_family_statuses | ||
| : [], | ||
| latest_candidate_by_family: selection.latest_candidate_by_family || {}, | ||
| }; | ||
| } | ||
|
|
||
| function defaultArtifactDir(root, artifact) { | ||
| return path.posix.join(root, safeArtifactPathSegment(artifact.name), String(artifact.id || '')); | ||
| } | ||
|
|
@@ -56,12 +77,7 @@ function buildInitialManifest(selection = {}, options = {}) { | |
| schema: DOWNLOAD_MANIFEST_SCHEMA, | ||
| status: selection.status === 'error' ? 'error' : 'pending', | ||
| generated_at: generatedAt, | ||
| selection: { | ||
| path: selectionPath, | ||
| schema: cleanString(selection.schema), | ||
| status: cleanString(selection.status || 'pass'), | ||
| selected_count: selected.length, | ||
| }, | ||
| selection: compactSelectionDetails(selection, selectionPath), | ||
| stats: { | ||
| selected_count: selected.length, | ||
| download_pass_count: 0, | ||
|
|
@@ -313,6 +329,7 @@ if (require.main === module) { | |
| module.exports = { | ||
| DOWNLOAD_MANIFEST_SCHEMA, | ||
| buildInitialManifest, | ||
| compactSelectionDetails, | ||
| finalizeManifest, | ||
| formatMarkdown, | ||
| safeArtifactPathSegment, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
candidate_family_countsandselected_family_countsare passed through with|| {}, which still allows non-object truthy values (e.g., arrays/strings) to leak into the manifest. Since this is part of a JSON contract, please validate these fields are plain objects (non-null, non-array) and fall back to{}(optionally shallow-clone) when the selector report is malformed; apply the same guard tolatest_candidate_by_family.