Skip to content

fix(yearly): preserve actual latest weekly summary under word budgets - #834

Merged
jmservera merged 4 commits into
mainfrom
fix/yearly-final-summary
Oct 12, 2026
Merged

jmservera merged 4 commits into
mainfrom
fix/yearly-final-summary

Conversation

@jmservera

@jmservera jmservera commented Oct 12, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fix the newly exposed chronological-evidence bug reported in #831 (discussion_r4250685368). This is distinct from merged #833.

  • Preserve weekly summaries sorted by source YYYY-WNN headings independently of deduplicated monthly context, append-only backfills, and synthesis fallbacks.
  • Reserve the actual final weekly source before selecting complete-sentence context within unchanged budgets; never label an earlier retained source latest.
  • Keep reserved endpoint prose independent of optional risk/evidence paragraphs during final budget acceptance.
  • Remove unsupported temporal opening/shift/month-closure assertions.
  • Cover budget-dropped final summaries across all prose styles and 45/100-word limits, repeated endpoints, empty/default/short/oversized/incomplete sources, synthesis preference, optional prose overhead, and backfilled older reports in both monthly formats.

Validation

  • Targeted rollups: 49 passed.
  • Full Python suite: 2035 passed, 1 skipped (existing), 2 expected warnings.
  • Repository-wide Ruff lint and formatting passed.
  • Hugo minified build passed with project-local output.
  • In-memory production-source regeneration: 1623 words; June correctly quotes W27 measurable inference/evaluation/security rather than W26.

Source-only PR: no generated pages edited. Owning sync regenerates #831 after independent review/merge. No publishing workflow changes and no merge requested here.

Keep weekly source order independently of deduplicated monthly context and reserve complete-sentence space for its actual final summary. Avoid unsupported opening, shift, and month-closure claims.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ab74df71-7f3c-4a63-a324-7f030dd5e719
Copilot AI balanced review requested due to automatic review settings October 12, 2026 17:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Style-specific paragraph merging can still budget out the reserved latest weekly summary.

1 open finding
What changed in this PR

Fixes yearly narratives so the true latest weekly summary remains distinct from monthly synthesis context.

Changes:

  • Preserves ordered weekly summaries separately.
  • Reserves the latest weekly summary before context budgeting.
  • Removes unsupported temporal assertions and adds regression tests.
File Description
scripts/​generate_yearly_narrative.py Separates weekly endpoints and revises chapter prose.
tests/​test_generate_rollups.py Tests endpoint ordering, budgets, and synthesis fallback.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread scripts/generate_yearly_narrative.py
Keep the endpoint paragraph independent of optional risk and evidence prose so style-specific concatenation cannot budget it out. Add all-style 45-word regression coverage with full risk/evidence context.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ab74df71-7f3c-4a63-a324-7f030dd5e719
Copilot AI balanced review requested due to automatic review settings October 12, 2026 17:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Backfilled older weeks can still be incorrectly labeled as the latest summary.

0 open findings

1 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Medium severity Select latest summary by week, not block order

scripts/​generate_yearly_narrative.py:947

weekly_summaries[-1] assumes the Month Overview blocks are chronological, but merge_sections() preserves existing blocks and only appends missing entries (scripts/generate_rollups.py:496-500). If an older recovered week is added after a newer one, that older week becomes the last block and is again labeled as the “latest” summary. Bind summaries to their week headings and select the maximum week/date (or sort the blocks) before choosing the endpoint; a backfill-order regression would cover this case.

🧠 Review effort: Balanced

Bind ordered summaries to ISO week headings rather than append-only month block positions. Keep non-weekly context out of chronological endpoints and cover backfills in both monthly formats.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ab74df71-7f3c-4a63-a324-7f030dd5e719
@jmservera

Copy link
Copy Markdown
Owner Author

Addressed the valid backfill-order observation from Copilot review 5494339238: weekly endpoints are now bound to their YYYY-WNN headings and sorted by source year/week, independently of append-only block order. Non-weekly context cannot become the endpoint. Added regression coverage for W27 preceding a backfilled W23, in both monthly formats. All 49 targeted tests and 2035 full-suite tests pass (one existing skip). No chronological budget was weakened.

Copilot AI balanced review requested due to automatic review settings October 12, 2026 18:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The implementation addresses the reported chronology bug with focused logic and comprehensive regression coverage.

0 open findings

🧠 Review effort: Balanced

@jmservera

Copy link
Copy Markdown
Owner Author

READYFORINDEPENDENTREVIEW — source head 95e54fc.

Latest-head Copilot review 5494402579 completed 2026-10-12T18:05:21Z: approval recommended, zero open findings. The legitimate paragraph-budget thread is fixed and resolved; the additional backfill-order observation is fixed with regression coverage. All 18 checks succeeded; aggregate CI https://github.com/jmservera/SquadScope/actions/runs/38288340961 succeeded, merge state CLEAN, and source branch contains current main.

Validation: 49 targeted rollup tests; 2035 full-suite passes with one existing skip; repository-wide Ruff lint/format; minified Hugo build. In-memory 2026 generation is 1623 words and cites June W27 rather than W26. Worktree clean; scratch build/test outputs removed.

Not merged. No generated content or workflow edits. Owning sync should regenerate #831 after independent review and merge, then resolve its original generated-page finding when the corrected artifact is visible.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ab74df71-7f3c-4a63-a324-7f030dd5e719

🛠️ - Generated by Copilot
Copilot AI balanced review requested due to automatic review settings October 12, 2026 18:35
@jmservera

Copy link
Copy Markdown
Owner Author

Independent revision by Basher at 9ec3114 addresses Rusty’s rejected-head boundary: chronological extraction now retains an empty slot for a dated week with an empty, whitespace-only, or missing Summary label. A later unusable W27 no longer promotes W26 as latest. Loader-to-chapter regressions cover both monthly formats, chronological and backfill block order, and 45/100-word budgets; direct tuple regressions also cover empty endpoints. The new integration test failed before the fix. Validation: 50 rollup tests passed; full suite 2036 passed/1 pre-existing skipped; repository Ruff lint/format passed. No generated-content changes, merge, or operational-stage work. Awaiting latest-head CI/Copilot before Rusty re-review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The implementation addresses the chronology bug, preserves budget limits, and includes comprehensive regression coverage.

0 open findings

🧠 Review effort: Balanced

@jmservera

Copy link
Copy Markdown
Owner Author

Ready for Rusty’s independent re-review: latest head 9ec3114. All 18 latest-head checks completed successfully. Copilot finished review of this exact SHA at 2026-10-12T18:37:28Z with approval recommended and 0 open findings; all review threads are resolved. Local rollup suite: 50 passed; full suite: 2036 passed, 1 existing skipped; repository Ruff lint/format clean. Working tree clean. Basher did not consult Frank, spawn agents, merge, regenerate data, or undertake W42 operational work.

@jmservera jmservera left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Rusty independent AI re-review verdict: APPROVE exact head 9ec3114. This is an AI-authored approval recommendation, not a human approval or a GitHub APPROVED-state review. GitHub rejected APPROVE because the authenticated account owns this PR; recording the verdict transparently as COMMENTED instead. Read repository instructions, Rusty charter, full replacement diff and loader/chapter context. Independently reproduced the prior 95e54fc W26 promotion when W27 is blank, whitespace-only or missing; 32 loader-to-chapter probes confirm the replacement preserves empty final-week slots and labels valid W27 correctly across both monthly formats, backfill orders and 45/100-word budgets. All 50 rollup tests and targeted Ruff lint/format checks passed locally. Observed all 18 latest-head hosted checks successful, completed exact-head Copilot approval recommendation and zero unresolved review threads. No high-confidence blocking findings. No code edits, delegation or merge performed.

@jmservera
jmservera merged commit 3d3fa0d into main Oct 12, 2026
19 checks passed
@jmservera
jmservera deleted the fix/yearly-final-summary branch October 12, 2026 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants