Skip to content

test(ledger): give the retention fixtures the agent field #11317 requires - #11441

Closed
pepmach wants to merge 1 commit into
mainfrom
fix/ledger-retention-tests-agent-field
Closed

pepmach wants to merge 1 commit into
mainfrom
fix/ledger-retention-tests-agent-field

Conversation

@pepmach

@pepmach pepmach commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Restores the ledger retention and permanent-delete tests after session-entry write validation made their pre-validation fixture payloads invalid.

Problem / Motivation

#11317 requires every declared session-entry field before Ledger.append writes bytes. The retention fixtures added by #11193 still write the older payload shapes, so main fails before those tests reach the retention behavior they are meant to check.

Why it matters

The merged branch is red on deterministic test failures. Those failures hide the retention and deletion guarantees behind fixture-construction errors.

What changed (motivation → approach → change)

Production validation stays unchanged. The affected test fixtures use test/ledger_type_helpers.py::minimal_data to fill required fields they do not exercise, while keeping the agent, owner, slot, lifecycle state, and tool result values each test does exercise.

The two tests for malformed stored close records first use the validated writer, then replace only the on-disk payload. They still prove the reader handles damaged history without weakening the write boundary.

Change Why it passed alone Why the merged result failed
#11193 (e65ec3ece7) Write validation was not present. Its new fixtures retained pre-validation payloads.
#11317 (039d3e83d7) Its branch migrated every fixture that existed when it was cut. Its required-field declarations merged after #11193 without seeing those new tests.

Tests

  • Before on base 04727ebe0f: test/test_ledger_retention.py test/test_remove_slot_for_history_key.py produced 45 failed, 160 passed.
  • After: the same two-module command produced 205 passed.
  • The requested four-module set produced 542 passed, 1 failed. The remaining test_a_crew_append_is_untouched_by_the_registry failure reproduces on clean base 04727ebe0f and touches neither file in this change.
  • scripts/check_black_formatting.py passed after commit.
  • Black, isort, and flake8 passed on both changed files.

Manual verification

N/A. These are isolated fixture writes and the targeted unit tests exercise the complete change.

Related Issues

Fixes #11439

Pattern harvest

Not generalizable: cross-PR merge race (#11317 tightened write validation; #11193's new tests were cut before it). The validator that caught it is the right guard.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (N/A: test-only fixture migration)
  • No secrets, credentials, or internal references in the diff

…ires

#11317 requires session entries to carry every declared required field.
#11193 added the retention fixtures before that validation branch was cut,
so those fixtures still wrote the older payload shapes.

Each pull request passed alone: #11193 did not include write validation, and
#11317 did not include these new tests. Use the shared minimal-data helper for
test-only writes, while preserving malformed on-disk cases after validation.

Fixes #11439
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 5d9d875f5e28d68bd2774d08132a39616b37d9e1 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 5d9d875

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 5d9d875f5e28d68bd2774d08132a39616b37d9e1: <one-sentence reason>

@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of 5d9d875f5e28d68bd2774d08132a39616b37d9e1 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Verify the pre-existing test_a_crew_append_is_untouched_by_the_registry failure on base has its own tracking issue, since this PR leaves main still partially red.

[DESIGN-REVIEWED] 5d9d875

@github-actions

Copy link
Copy Markdown
Contributor

Opus 4.8 Review — ✅ no blocking findings

Reviewed 5d9d875f5e28d68bd2774d08132a39616b37d9e1 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 5d9d875

Verdict parsed from the review's SHA-scoped output markers for commit 5d9d875f5e28d68bd2774d08132a39616b37d9e1.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 5d9d875f5e28d68bd2774d08132a39616b37d9e1: <one-sentence reason>

@chenmingwei23

Copy link
Copy Markdown
Contributor

Coverage note, measured on origin/main at 3195475.

The #11317 break spans TWO test files, not one:

test/test_ledger_retention.py  ->  data.agent: is required and absent
test/test_ledger_kinds.py      ->  data.actor: is required and absent

test/test_ledger_kinds.py has zero occurrences of actor. Its helper builds
every ledger with owner= and agent= only:

41:  return Ledger.create(lg.KIND_SESSION, unit_id, owner=CREW, agent="kirocrew")

and test_a_session_ledger_may_cite_a_crew_segment_too fails there with
data.actor: is required and absent, raised at
src/kiro_crew/ledger/entry_types.py:616.

This PR touches test_ledger_retention.py and test_remove_slot_for_history_key.py,
so that file is not covered. Its base 04727ebe0 is 3 ahead / 0 behind 039d3e83d,
so the validation IS present on this head -- but two lanes here have not reported
yet, so the current 67 success / 0 failure board is not yet evidence the kinds file
passes: the shard carrying it may be one of the two outstanding.

#11445 covers both files plus test_ledger_types.py. Whichever lands, main stays
red until test_ledger_kinds.py supplies actor.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 17, 2026
@pepmach

pepmach commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

Agreed -- this only covered the two files my shards showed; test_ledger_kinds.py (data.actor) and test_ledger_types.py (crew: domain) are the same break and yours #11445 carries all four. Closing this in favour of #11445. #11439 stays open as the tracking issue until #11445 lands.

@pepmach

pepmach commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #11445 (same fix, all four test files).

@pepmach pepmach closed this Sep 17, 2026
@pepmach
pepmach deleted the fix/ledger-retention-tests-agent-field branch September 17, 2026 04:03
@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Sep 17, 2026
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.

main red: ledger retention tests write session entries without the now-required data.agent (#11317 x #11193)

2 participants