Repository navigation
fix(ledger): make the test writers satisfy the entry registry - #11445
iamwhatever merged 1 commit into
Conversation
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsFINDING -- test/test_ledger_types.py:480 -- |
Opus 4.8 Review (fork) — ✅ no blocking findingsReviewed Review detailsI've verified the diff against the base files and the production validation logic:
No test edit silently defeats the invariant it names. The candidate file lists no candidates, and Step 2 turned up nothing grounded to the 80+ bar. No findings. [OPUS-REVIEWED] 1408672 |
Design Review (Fable 5, fork) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS Description says the Watch
[DESIGN-REVIEWED] 1408672 |
Give macOS Cmd+W to the native Window menu and use Option+Shift+W for session close. Preserve hide-to-tray for the main window. Confirm every secondary close before renderer teardown: unload probes can discard unsaved work when a renderer accepts or times out. Keep browser pages and their control owners alive until the user confirms closing. Include the Fargate protocol repair from PR kirodotdev#11422 and the ledger test fixture repair from PR kirodotdev#11445 so inherited backend CI failures do not hide regressions in this change. Correct the remaining crew event fixture to use its valid type without changing production validation. Co-authored-by: Stan Tian <273962421+pepmach@users.noreply.github.com> Co-authored-by: Raymond Chen <45910466+chenmingwei23@users.noreply.github.com>
b03365a to
1408672
Compare
|
Attribution of this PR's red board, from run 35178868292. None of the four is this Merge order, measured on both heads rather than assumed: this PR and #11432 block each So neither can reach a green board alone. Landing either one makes the other's board |
|
Re-run concluded on the same head (1408672, no push). The board went from four reds Everything else I attributed earlier cleared on the re-run, so those were flakes rather So this PR now has ZERO ledger failures and ZERO failures of its own. Its single red is Landing either one turns the other fully green on a re-run with no push. This head is |
The append-only per-unit log mechanism is named crew log. Every other thing
in the repo called a ledger keeps its name, including the work ledger, the
session_ledger_read/record tools, ledger-sweep, and the app ledgers.
The package src/kiro_crew/ledger/ becomes src/kiro_crew/crew_log/, and
session_ledger_emit.py moves in as crew_log/emit.py. Moving the emitter into
the package would make importing it execute the package __init__ and pull in
store, schema and lease, so __init__ re-exports lazily (PEP 562) and the
flag-off boot path still imports no storage.
On disk the leaf is <data home>/crew-log/{crews,sessions}/<unit>/log.jsonl.
The security/paths.py fence leaf moves in the same commit as the store leaf,
because that fence is what keeps agent file tools out of the store. The env
flag is KIROCREW_CREW_LOG. No shim, no dual-read, no migration: the flag is
default-off and no user data exists on disk.
The reference pages, the two module specs and the renamed test files follow
the same name. rfc-append-only-ledger.md keeps its file name and title for
external links and gains one paragraph recording the name.
A stray-file test regained its teeth: it wrote ledger.backup.jsonl, which no
longer shares the segment prefix, so segment_paths never saw it and the
assertion held vacuously. It now writes log.backup.jsonl.
The test-writer fixes from kirodotdev#11445 land on files this rename moved, and its
new helper import names the pre-rename module, so the retention test reads
it from crew_log_type_helpers instead.
The append-only per-unit log mechanism is named crew log. Every other thing
in the repo called a ledger keeps its name, including the work ledger, the
session_ledger_read/record tools, ledger-sweep, and the app ledgers.
The package src/kiro_crew/ledger/ becomes src/kiro_crew/crew_log/, and
session_ledger_emit.py moves in as crew_log/emit.py. Moving the emitter into
the package would make importing it execute the package __init__ and pull in
store, schema and lease, so __init__ re-exports lazily (PEP 562) and the
flag-off boot path still imports no storage.
On disk the leaf is <data home>/crew-log/{crews,sessions}/<unit>/log.jsonl.
The security/paths.py fence leaf moves in the same commit as the store leaf,
because that fence is what keeps agent file tools out of the store. The env
flag is KIROCREW_CREW_LOG. No shim, no dual-read, no migration: the flag is
default-off and no user data exists on disk.
The reference pages, the two module specs and the renamed test files follow
the same name. rfc-append-only-ledger.md keeps its file name and title for
external links and gains one paragraph recording the name.
A stray-file test regained its teeth: it wrote ledger.backup.jsonl, which no
longer shares the segment prefix, so segment_paths never saw it and the
assertion held vacuously. It now writes log.backup.jsonl.
The test-writer fixes from kirodotdev#11445 land on files this rename moved, and its
new helper import names the pre-rename module, so the retention test reads
it from crew_log_type_helpers instead.
The append-only per-unit log mechanism is named crew log. Every other thing
in the repo called a ledger keeps its name, including the work ledger, the
session_ledger_read/record tools, ledger-sweep, and the app ledgers.
The package src/kiro_crew/ledger/ becomes src/kiro_crew/crew_log/, and
session_ledger_emit.py moves in as crew_log/emit.py. Moving the emitter into
the package would make importing it execute the package __init__ and pull in
store, schema and lease, so __init__ re-exports lazily (PEP 562) and the
flag-off boot path still imports no storage.
On disk the leaf is <data home>/crew-log/{crews,sessions}/<unit>/log.jsonl.
The security/paths.py fence leaf moves in the same commit as the store leaf,
because that fence is what keeps agent file tools out of the store. The env
flag is KIROCREW_CREW_LOG. No shim, no dual-read, no migration: the flag is
default-off and no user data exists on disk.
The reference pages, the two module specs and the renamed test files follow
the same name. rfc-append-only-ledger.md keeps its file name and title for
external links and gains one paragraph recording the name.
A stray-file test regained its teeth: it wrote ledger.backup.jsonl, which no
longer shares the segment prefix, so segment_paths never saw it and the
assertion held vacuously. It now writes log.backup.jsonl.
The test-writer fixes from kirodotdev#11445 land on files this rename moved, and its
new helper import names the pre-rename module, so the retention test reads
it from crew_log_type_helpers instead.
The append-only per-unit log mechanism is named crew log. Every other thing
in the repo called a ledger keeps its name, including the work ledger, the
session_ledger_read/record tools, ledger-sweep, and the app ledgers.
The package src/kiro_crew/ledger/ becomes src/kiro_crew/crew_log/, and
session_ledger_emit.py moves in as crew_log/emit.py. Moving the emitter into
the package would make importing it execute the package __init__ and pull in
store, schema and lease, so __init__ re-exports lazily (PEP 562) and the
flag-off boot path still imports no storage.
On disk the leaf is <data home>/crew-log/{crews,sessions}/<unit>/log.jsonl.
The security/paths.py fence leaf moves in the same commit as the store leaf,
because that fence is what keeps agent file tools out of the store. The env
flag is KIROCREW_CREW_LOG. No shim, no dual-read, no migration: the flag is
default-off and no user data exists on disk.
The reference pages, the two module specs and the renamed test files follow
the same name. rfc-append-only-ledger.md keeps its file name and title for
external links and gains one paragraph recording the name.
A stray-file test regained its teeth: it wrote ledger.backup.jsonl, which no
longer shares the segment prefix, so segment_paths never saw it and the
assertion held vacuously. It now writes log.backup.jsonl.
The test-writer fixes from kirodotdev#11445 land on files this rename moved, and its
new helper import names the pre-rename module, so the retention test reads
it from crew_log_type_helpers instead.
The append-only per-unit log mechanism is named crew log. Every other thing
in the repo called a ledger keeps its name, including the work ledger, the
session_ledger_read/record tools, ledger-sweep, and the app ledgers.
The package src/kiro_crew/ledger/ becomes src/kiro_crew/crew_log/, and
session_ledger_emit.py moves in as crew_log/emit.py. Moving the emitter into
the package would make importing it execute the package __init__ and pull in
store, schema and lease, so __init__ re-exports lazily (PEP 562) and the
flag-off boot path still imports no storage.
On disk the leaf is <data home>/crew-log/{crews,sessions}/<unit>/log.jsonl.
The security/paths.py fence leaf moves in the same commit as the store leaf,
because that fence is what keeps agent file tools out of the store. The env
flag is KIROCREW_CREW_LOG. No shim, no dual-read, no migration: the flag is
default-off and no user data exists on disk.
The reference pages, the two module specs and the renamed test files follow
the same name. rfc-append-only-ledger.md keeps its file name and title for
external links and gains one paragraph recording the name.
A stray-file test regained its teeth: it wrote ledger.backup.jsonl, which no
longer shares the segment prefix, so segment_paths never saw it and the
assertion held vacuously. It now writes log.backup.jsonl.
The test-writer fixes from kirodotdev#11445 land on files this rename moved, and its
new helper import names the pre-rename module, so the retention test reads
it from crew_log_type_helpers instead.
The append-only per-unit log mechanism is named crew log. Every other thing
in the repo called a ledger keeps its name, including the work ledger, the
session_ledger_read/record tools, ledger-sweep, and the app ledgers.
The package src/kiro_crew/ledger/ becomes src/kiro_crew/crew_log/, and
session_ledger_emit.py moves in as crew_log/emit.py. Moving the emitter into
the package would make importing it execute the package __init__ and pull in
store, schema and lease, so __init__ re-exports lazily (PEP 562) and the
flag-off boot path still imports no storage.
On disk the leaf is <data home>/crew-log/{crews,sessions}/<unit>/log.jsonl.
The security/paths.py fence leaf moves in the same commit as the store leaf,
because that fence is what keeps agent file tools out of the store. The env
flag is KIROCREW_CREW_LOG. No shim, no dual-read, no migration: the flag is
default-off and no user data exists on disk.
The reference pages, the two module specs and the renamed test files follow
the same name. rfc-append-only-ledger.md keeps its file name and title for
external links and gains one paragraph recording the name.
A stray-file test regained its teeth: it wrote ledger.backup.jsonl, which no
longer shares the segment prefix, so segment_paths never saw it and the
assertion held vacuously. It now writes log.backup.jsonl.
The test-writer fixes from #11445 land on files this rename moved, and its
new helper import names the pre-rename module, so the retention test reads
it from crew_log_type_helpers instead.
The append-only per-unit log mechanism is named crew log. Every other thing
in the repo called a ledger keeps its name, including the work ledger, the
session_ledger_read/record tools, ledger-sweep, and the app ledgers.
The package src/kiro_crew/ledger/ becomes src/kiro_crew/crew_log/, and
session_ledger_emit.py moves in as crew_log/emit.py. Moving the emitter into
the package would make importing it execute the package __init__ and pull in
store, schema and lease, so __init__ re-exports lazily (PEP 562) and the
flag-off boot path still imports no storage.
On disk the leaf is <data home>/crew-log/{crews,sessions}/<unit>/log.jsonl.
The security/paths.py fence leaf moves in the same commit as the store leaf,
because that fence is what keeps agent file tools out of the store. The env
flag is KIROCREW_CREW_LOG. No shim, no dual-read, no migration: the flag is
default-off and no user data exists on disk.
The reference pages, the two module specs and the renamed test files follow
the same name. rfc-append-only-ledger.md keeps its file name and title for
external links and gains one paragraph recording the name.
A stray-file test regained its teeth: it wrote ledger.backup.jsonl, which no
longer shares the segment prefix, so segment_paths never saw it and the
assertion held vacuously. It now writes log.backup.jsonl.
The test-writer fixes from #11445 land on files this rename moved, and its
new helper import names the pre-rename module, so the retention test reads
it from crew_log_type_helpers instead.
The append-only per-unit log mechanism is named crew log. Every other thing
in the repo called a ledger keeps its name, including the work ledger, the
session_ledger_read/record tools, ledger-sweep, and the app ledgers.
The package src/kiro_crew/ledger/ becomes src/kiro_crew/crew_log/, and
session_ledger_emit.py moves in as crew_log/emit.py. Moving the emitter into
the package would make importing it execute the package __init__ and pull in
store, schema and lease, so __init__ re-exports lazily (PEP 562) and the
flag-off boot path still imports no storage.
On disk the leaf is <data home>/crew-log/{crews,sessions}/<unit>/log.jsonl.
The security/paths.py fence leaf moves in the same commit as the store leaf,
because that fence is what keeps agent file tools out of the store. The env
flag is KIROCREW_CREW_LOG. No shim, no dual-read, no migration: the flag is
default-off and no user data exists on disk.
The reference pages, the two module specs and the renamed test files follow
the same name. rfc-append-only-ledger.md keeps its file name and title for
external links and gains one paragraph recording the name.
A stray-file test regained its teeth: it wrote ledger.backup.jsonl, which no
longer shares the segment prefix, so segment_paths never saw it and the
assertion held vacuously. It now writes log.backup.jsonl.
The test-writer fixes from #11445 land on files this rename moved, and its
new helper import names the pre-rename module, so the retention test reads
it from crew_log_type_helpers instead.
The append-only per-unit log mechanism is named crew log. Every other thing
in the repo called a ledger keeps its name, including the work ledger, the
session_ledger_read/record tools, ledger-sweep, and the app ledgers.
The package src/kiro_crew/ledger/ becomes src/kiro_crew/crew_log/, and
session_ledger_emit.py moves in as crew_log/emit.py. Moving the emitter into
the package would make importing it execute the package __init__ and pull in
store, schema and lease, so __init__ re-exports lazily (PEP 562) and the
flag-off boot path still imports no storage.
On disk the leaf is <data home>/crew-log/{crews,sessions}/<unit>/log.jsonl.
The security/paths.py fence leaf moves in the same commit as the store leaf,
because that fence is what keeps agent file tools out of the store. The env
flag is KIROCREW_CREW_LOG. No shim, no dual-read, no migration: the flag is
default-off and no user data exists on disk.
The reference pages, the two module specs and the renamed test files follow
the same name. rfc-append-only-ledger.md keeps its file name and title for
external links and gains one paragraph recording the name.
A stray-file test regained its teeth: it wrote ledger.backup.jsonl, which no
longer shares the segment prefix, so segment_paths never saw it and the
assertion held vacuously. It now writes log.backup.jsonl.
The test-writer fixes from #11445 land on files this rename moved, and its
new helper import names the pre-rename module, so the retention test reads
it from crew_log_type_helpers instead.
The append-only per-unit log mechanism is named crew log. Every other thing
in the repo called a ledger keeps its name, including the work ledger, the
session_ledger_read/record tools, ledger-sweep, and the app ledgers.
The package src/kiro_crew/ledger/ becomes src/kiro_crew/crew_log/, and
session_ledger_emit.py moves in as crew_log/emit.py. Moving the emitter into
the package would make importing it execute the package __init__ and pull in
store, schema and lease, so __init__ re-exports lazily (PEP 562) and the
flag-off boot path still imports no storage.
On disk the leaf is <data home>/crew-log/{crews,sessions}/<unit>/log.jsonl.
The security/paths.py fence leaf moves in the same commit as the store leaf,
because that fence is what keeps agent file tools out of the store. The env
flag is KIROCREW_CREW_LOG. No shim, no dual-read, no migration: the flag is
default-off and no user data exists on disk.
The reference pages, the two module specs and the renamed test files follow
the same name. rfc-append-only-ledger.md keeps its file name and title for
external links and gains one paragraph recording the name.
A stray-file test regained its teeth: it wrote ledger.backup.jsonl, which no
longer shares the segment prefix, so segment_paths never saw it and the
assertion held vacuously. It now writes log.backup.jsonl.
The test-writer fixes from #11445 land on files this rename moved, and its
new helper import names the pre-rename module, so the retention test reads
it from crew_log_type_helpers instead.
The append-only per-unit log mechanism is named crew log. Every other thing
in the repo called a ledger keeps its name, including the work ledger, the
session_ledger_read/record tools, ledger-sweep, and the app ledgers.
The package src/kiro_crew/ledger/ becomes src/kiro_crew/crew_log/, and
session_ledger_emit.py moves in as crew_log/emit.py. Moving the emitter into
the package would make importing it execute the package __init__ and pull in
store, schema and lease, so __init__ re-exports lazily (PEP 562) and the
flag-off boot path still imports no storage.
On disk the leaf is <data home>/crew-log/{crews,sessions}/<unit>/log.jsonl.
The security/paths.py fence leaf moves in the same commit as the store leaf,
because that fence is what keeps agent file tools out of the store. The env
flag is KIROCREW_CREW_LOG. No shim, no dual-read, no migration: the flag is
default-off and no user data exists on disk.
The reference pages, the two module specs and the renamed test files follow
the same name. rfc-append-only-ledger.md keeps its file name and title for
external links and gains one paragraph recording the name.
A stray-file test regained its teeth: it wrote ledger.backup.jsonl, which no
longer shares the segment prefix, so segment_paths never saw it and the
assertion held vacuously. It now writes log.backup.jsonl.
The test-writer fixes from #11445 land on files this rename moved, and its
new helper import names the pre-rename module, so the retention test reads
it from crew_log_type_helpers instead.
…tdev#11549) The append-only per-unit log mechanism is named crew log. Every other thing in the repo called a ledger keeps its name, including the work ledger, the session_ledger_read/record tools, ledger-sweep, and the app ledgers. The package src/kiro_crew/ledger/ becomes src/kiro_crew/crew_log/, and session_ledger_emit.py moves in as crew_log/emit.py. Moving the emitter into the package would make importing it execute the package __init__ and pull in store, schema and lease, so __init__ re-exports lazily (PEP 562) and the flag-off boot path still imports no storage. On disk the leaf is <data home>/crew-log/{crews,sessions}/<unit>/log.jsonl. The security/paths.py fence leaf moves in the same commit as the store leaf, because that fence is what keeps agent file tools out of the store. The env flag is KIROCREW_CREW_LOG. No shim, no dual-read, no migration: the flag is default-off and no user data exists on disk. The reference pages, the two module specs and the renamed test files follow the same name. rfc-append-only-ledger.md keeps its file name and title for external links and gains one paragraph recording the name. A stray-file test regained its teeth: it wrote ledger.backup.jsonl, which no longer shares the segment prefix, so segment_paths never saw it and the assertion held vacuously. It now writes log.backup.jsonl. The test-writer fixes from kirodotdev#11445 land on files this rename moved, and its new helper import names the pre-rename module, so the retention test reads it from crew_log_type_helpers instead.
Problem / Motivation
What is the problem?
Backend Tests are red on
mainand on every open PR. The four ledger test files fail 12+ tests withLedgerError: data.agent: is required and absent(anddata.actor,data.name,data.depthvariants). The failures come from two ledger PRs that merged 50 minutes apart and were never run together: #11193 (e65ec3ece) added the retention sweep and thesession/closedteardown marker, and #11317 (039d3e83d7) addedsrc/kiro_crew/ledger/entry_types.py, which declares the required fields of each session entry type and validatesdataon every append.main's own CI never completed a run for the merge that first combined them -- each new push cancels the previous run -- so nobody saw the break.Why it matters
A red Backend Tests lane blocks the merge queue for everyone. Until it clears, no PR that touches this repository can land, whatever its own content, because the required check is failing on a base condition none of those PRs introduced.
What changed
How the fix solves it -- symptom to root cause
The
data.agent/data.actor/data.namerefusals all trace to the same cause: the retention and kinds test files hand-write entry payloads by hand, and #11317's registry now refuses a payload that omits a required field. The production emitters are correct --session_ledger_emit.on_session_openedwrites all six requiredsession/openedfields, andon_session_closedwrites the requiredreason-- so the fix is confined to the test writers, which is where the two designs actually disagree.session/openedwriters that named only{"resumed": ...}now carry every required header field. A small_opened(resumed=...)builder intest_ledger_retention.pyfills the rest fromledger_type_helpers.minimal_data, so the fixtures stay one line each and never hold a payload the format refuses. The one emitter-independent site intest_remove_slot_for_history_key.pyspells the full valid payload inline.turn/startedgains its requiredactoranddepth;tool/completedgains its requirednameandserver.session/closedline the append path must refuse -- one with noreason, one with a non-stringreason-- to prove the sweep's own reader rejects them. Those go through a valid append and then overwrite the on-diskdatavia a newplant=argument on the existing_append_athelper, so the line keeps a well-formed envelope while carrying the malformed payload the reader test needs.Tests
What tests we did
Isolated
KIROCREW_HOME,-n 2, on the fix branch offorigin/main04727ebe0f:test_ledger_retention.py,test_ledger_kinds.py,test_remove_slot_for_history_key.py,test_ledger_core.py: 423 passed (was 46 failed / 377 passed before the fix).test_ledger_types.py,test_session_ledger_emit.py,test_docs_ledger_reference.py: 540 passed, 1 failed. The single failure --test_a_crew_append_is_untouched_by_the_registry,LedgerError: entry type domain must be a plain name or app:<name>: 'crew:qa/report',CODE_BAD_TYPEfromschema.py:247-- reproduces byte-identically on a clean detached checkout oforigin/main. It is a separate, pre-existing break in the guest-namespace type check, not adata-field refusal, and is out of scope for this fix.flake8andblack --checkclean on all three touched files.mypy --follow-imports=silentreports only the test suite's established monkeypatching errors (method assignment, attribute-on-callable); none reference the changed lines.Any other suggestions
The guest-type failure above (
crew:qa/reportrefused as a bad type) warrants its own investigation -- it looks like a second, independent regression in the same window.Pattern harvest
Rule candidate: when two open PRs touch one contract (a writer and its validator), run their branches together on CI or land them in one merge window before merging either -- a required lane on main was red for 50 minutes because #11193 and #11317 were only ever tested apart.
Two PRs that both touch one contract -- here the ledger's entry shape, split across the writer (#11193) and the validator (#11317) -- must be run together before the second merges. The break was invisible because
main's CI is cancel-superseded, so the merge that first combined the two designs never produced a verdict. Either re-run the second PR's full suite against a base that already contains the first, or stopmain's CI from cancel-superseding itself so a red on the combined tree is observed onmainrather than inherited by the next unrelated PR.