Skip to content

fix: Report a never-derived profile domain as missing, not stale - #5168

Merged
Sinity merged 1 commit into
masterfrom
fix/session-profiles-missing-not-stale
Sep 14, 2026
Merged

Sinity merged 1 commit into
masterfrom
fix/session-profiles-missing-not-stale

Conversation

@Sinity

@Sinity Sinity commented Sep 14, 2026 •

Copy link
Copy Markdown
Owner

Summary

Four test_plain_cli_snapshots.py failures. Two were stale snapshots from additive changes that were never re-recorded. One was a product defect in daemon_status.py — a never-derived profile domain reported as stale, which flipped global ok to false on a pristine archive — fixed here, which is what lets its snapshot be re-recorded honestly. The fourth is a genuine read-path parity defect, filed and left red.

Evidence

Full-corpus verify_all on frozen master (890a2921e), job 1570, receipt .cache/verify/runs/20260914T200510Z-all-4027943-f8bc83ff, 22,524 selected, 147 failures with zero schema skew. Four of them in this file.

Per-failure classification

Failure Classification
test_json_analyze_snapshot Stale snapshot (#5146) — re-recorded
test_json_read_all_snapshot Stale snapshot (#5152) — re-recorded
test_json_status_snapshot Product defect (#5027) — product fixed; snapshot then re-recorded
test_facets_command_json_matches_analyze_facets Product defect (#4867) — not fixed, filed as polylogue-mtxl2, left red

test_json_analyze_snapshot — stale, purely additive

Two fields on ArchiveStats.to_dict() / query_stats: embedding_coverage_measurable: true, embedding_coverage_unmeasurable_reason: null. Added by e991cfa / #5146 ("Read an unloadable vec0 extension as unmeasurable, not zero"), confirmed with git log -S on archive/stats.py and cli/query_stats.py.

Values verified correct rather than merely current: embedding_coverage_measurable is defined as embedding_coverage_unmeasurable_reason is None, and the seeded archive's embeddings tier is inspectable — so embedded_sessions: 0 is a measured zero, not an unknown. That is consistent with the pre-existing embedding_coverage_percent: 0.0, since an unmeasurable tier renders null there. Nothing removed, nothing changed.

test_json_read_all_snapshot — stale, purely additive

outcome: {state: "ok", reason: null, detail: {}} and source: "direct". Added by 8d981b8 / #5152 ("Serve every root query through one declared read operation"), which deleted the local ArchiveStore branch of _execute_archive_query_stdout and routed root queries through operations/daemon_reads.py.

Values verified: the envelope reports total: 2, and decide_outcome(matched=2) is ok — not empty, not degraded — per the surfaces/outcome.py contract. source: "direct" is correct because the test environment has no daemon, matching ops status's own source on the same archive.

test_json_status_snapshot — product defect, fixed

This one was not merely stale: polylogue ops status --format json exited 1 on the seeded archive, so no re-record could have made it green. Root cause:

_session_profile_component (operations/daemon_status.py) collapsed every not-ready shape into STALE. On the seeded archive 0 of 2 profiles had ever been materialized — nothing was computed, so nothing could have gone out of date. That is MISSING, not STALE.

The distinction is load-bearing: _status_ok tolerates a never-converged derived family through the required_missing allowlist, but treats stale as unconditionally not-ok. So on one archive, embeddings (missing) and transforms (unknown) were correctly tolerated as never-converged while session_profiles — equally never-converged — flipped global ok to false. Introduced by 14e1d82 / #5027 ("Rewrite convergence around a domain-owned derivation kernel"), which is when this test went red.

component_from_derived_model, in the same file, already draws exactly this line (source_rows == 0 and materialized_rows == 0 → MISSING; stale rows → STALE). The profile domain was the outlier; it now follows the same rule.

The fix is not a green-washing of the signal. The re-recorded snapshot still reports the domain honestly and the claim guard still refuses to certify:

"session_profiles": { "state": "missing", "summary": "session profiles not derived",
                      "missing_profiles": 2, "repair_hint": "polylogued run" }
"converged": { "value": false, "determinate": true,
               "reason": "session profiles not derived",
               "signal": "derived_domain_readiness.session_profiles" }

ok: true (the archive is usable) and converged: false (a derived family has not run) are different claims, and both are now reported correctly. Note the stored snapshot already expected "ok": true — the product fix restores what the test always asserted.

The snapshot was also independently stale by several PRs, which the re-record picks up. That diff is strictly an improvement: it replaces zeros with the seeded archive's real measurements (raw_artifact_count 0→2, materialized_raw_artifact_count 0→2, archive_session_count 0→2, message_indexed_count 12) and adds the search, session_profiles and session_summary components that did not exist when it was recorded. Removed fields (raw_records, unidentified_artifacts) and the constant next_action / config_path: null are the deliberate shape of the pinned-archive route, which states in its own diagnostic.reason that it excludes CLI first-run diagnostics.

test_facets_command_json_matches_analyze_facets — product defect, left red

Not a snapshot — a real parity assertion between polylogue facets and analyze --facets, and genuinely broken. operations/daemon_reads.py::_facets_payload reimplements the facets envelope while its docstring claims it reuses the API's canonical facets() (api/archive.py:6053); it reuses only _archive_facet_buckets. Measured divergence on the seeded archive:

field facets (operation route) analyze --facets (API)
family_status {} full per-family descriptors
availability null {projection, state: ready, deadline_s, elapsed_s, …}
deadline_s / elapsed_s null / null 2.0 / measured
complete_families ["origins","tags"] ["total_counts","origins","tags"]
deferred_families spurious "omitted" no "omitted"

The direct facets command loses the family-state reporting its own docstring promises ("reports their state explicitly instead of rendering empty buckets as authoritative facts") — it renders exactly the empty buckets that docstring disclaims. Red since 1d901ec / #4867.

Deliberately not fixed here. facets() is async, owns its own archive acquisition, and computes availability / deadline_s / elapsed_s under a deadline from analysis.projection_contracts.facets_availability. Delegating properly means running it over a caller-pinned ArchiveStore without changing its cancellation and deadline semantics — a read-path design decision that owes CLI/API/MCP parity, pagination and cancellation evidence per CLAUDE.md, not a patch at the tail of a test-failure sweep. Filed as polylogue-mtxl2 (P1) with the measured table and the introducing commit. The test stays red and the bead names the wanted outcome; its existing parity assertion is its own anti-vacuity condition.

Verification

devtools test tests/unit/cli/test_plain_cli_snapshots.py -k test_json_status_snapshot --snapshot-update
devtools test: PASSED exit=0 diagnosis=pytest_passed receipt=.cache/verify/runs/20260914T224544Z-focused-test-97274-741f4d02/run.json
devtools test tests/unit/cli/test_plain_cli_snapshots.py
devtools test: FAILED exit=1 receipt=.cache/verify/runs/20260914T231034Z-focused-test-152736-9534a424/run.json
  23 of 24 pass. The single remaining failure is test_facets_command_json_matches_analyze_facets,
  the filed defect above (polylogue-mtxl2), left deliberately red.

devtools gate format / devtools gate lint — clean.

Schema closure

out  polylogue/operations/daemon_status.py
out  tests/unit/cli/__snapshots__/test_plain_cli_snapshots.ambr

Neither is in the derived-schema identity closure; this PR does not gate the archive rebuild.

Residuals

  • test_facets_command_json_matches_analyze_facets remains red, tracked by polylogue-mtxl2.
  • _status_ok still treats stale as unconditionally not-ok while gating missing and unknown through allowlists. This PR fixes the one domain that was mis-stating its state; it does not revisit whether that asymmetry is right in general.
  • The session_profiles state now depends on profile_row_count == 0 and total_sessions > 0. A partially derived set (some profiles present, some missing) is still STALE, which is the intended reading.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK

Summary by CodeRabbit

  • Bug Fixes

    • Session profile status now clearly reports when profiles have not yet been derived, rather than labeling them as incomplete.
  • CLI Improvements

    • Updated JSON analysis output with clearer embedding coverage details and reasons when coverage cannot be measured.
    • Enhanced read-all results with outcome and source information.
    • Refined status output with additional readiness indicators, clearer configuration and claim status details, and more transparent unavailable-data reasons.

_session_profile_component collapsed every not-ready shape into STALE. On
an archive where no session profile had ever been materialized, nothing was
computed, so nothing could have gone out of date -- that is MISSING.

The distinction is load-bearing: _status_ok tolerates a never-converged
derived family through required_missing but treats stale as
unconditionally not-ok. So on one pristine archive, embeddings (missing)
and transforms (unknown) were correctly tolerated while session_profiles,
equally never-converged, flipped global ok to false and made
`polylogue ops status --format json` exit 1. component_from_derived_model
in the same module already draws this line; the profile domain was the
outlier.

The signal is not lost. The component still reports state=missing with
"session profiles not derived" and its repair hint, and the claim guard
still reports converged=false naming that domain. ok (the archive is
usable) and converged (every derived family has run) stay distinct claims.

Three CLI snapshots are re-recorded. test_json_status_snapshot already
expected ok: true, so the product fix is what makes it green; its
remaining diff had also gone stale across several PRs and now carries the
seeded archive's real measurements instead of zeros. The other two are
purely additive fields from #5146 and #5152 that were never re-recorded.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-09-14T23:16:35.290640Z f7197c5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: dd3e80df-fd5e-41ce-b3ad-051151853e92

📥 Commits

Reviewing files that changed from the base of the PR and between 4363ea7 and f7197c5.

📒 Files selected for processing (2)
  • polylogue/operations/daemon_status.py
  • tests/unit/cli/__snapshots__/test_plain_cli_snapshots.ambr

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.

📜 Recent review details
🔇 Additional comments (2)
polylogue/operations/daemon_status.py (1)

676-700: LGTM!

tests/unit/cli/__snapshots__/test_plain_cli_snapshots.ambr (1)

229-231: LGTM!

Also applies to: 545-550, 569-571, 598-600, 649-699, 1078-1078, 1084-1087, 1091-1093, 1099-1099, 1108-1128, 1133-1165, 1170-1188, 1193-1209, 1214-1263, 1267-1268, 1279-1335, 1340-1345, 1371-1381, 1483-1514, 1529-1530


📝 Walkthrough

Walkthrough

The change classifies uninitialized session profiles as missing and updates CLI snapshots for readiness claims, archive tiers, SQLite observations, runtime availability, raw replay data, and diagnostics.

Changes

Status and CLI output

Layer / File(s) Summary
Session readiness classification
polylogue/operations/daemon_status.py, tests/unit/cli/__snapshots__/test_plain_cli_snapshots.ambr
Sessions without derived profile rows now report MISSING. Readiness blocks and claim guards reflect missing session profiles and ready search indexing.
CLI output contract snapshots
tests/unit/cli/__snapshots__/test_plain_cli_snapshots.ambr
Analyze output includes embedding measurability fields. Read-all output includes outcome and source fields. Status output updates configuration and raw materialization fields.
Archive and runtime observation shapes
tests/unit/cli/__snapshots__/test_plain_cli_snapshots.ambr
Snapshots update archive tier counts, file and WAL metadata, audit data, storage fields, runtime not-observed states, bounded raw replay data, and diagnostics.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to f7197

Session profiles that have not yet been derived are reported as missing while convergence remains false. No merge-blocking risk is currently identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: reporting a never-derived profile domain as missing instead of stale.
Description check ✅ Passed The description provides a detailed summary, problem analysis, solution details, verification commands, and residual risks. It does not use every template heading and does not show a CHANGELOG.md entr…
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (1 skipped: 1 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/session-profiles-missing-not-stale

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks the profile rows,
Missing paths now plainly show.
Search is ready, claims align,
Archive fields report in line.
Snapshots hop through status bright.

Comment @coderabbitai help to get the list of available commands.

@Sinity
Sinity merged commit 74d515a into master Sep 14, 2026
3 checks passed
@Sinity
Sinity deleted the fix/session-profiles-missing-not-stale branch September 14, 2026 23:22
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.

1 participant