Skip to content

fix(surfaces): map the effective_context read view into the projection spec - #4371

Merged
Sinity merged 1 commit into
masterfrom
worktree-agent-aefb2a4b913c65a01
Aug 28, 2026
Merged

Sinity merged 1 commit into
masterfrom
worktree-agent-aefb2a4b913c65a01

Conversation

@Sinity

@Sinity Sinity commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Summary

effective_context was a fully declared read view with no entry in NAMED_PROJECTION_FAMILIES.

Problem

On clean master, tests/unit/cli/test_click_app.py::test_read_views_json_outputs_profile_payload and ::test_read_views_plain_lists_profile_metadata both fail with ValueError: unknown projection view: effective_context (polylogue/surfaces/projection_spec.py:253). The view is declared in polylogue/cli/read_view_registry.py, polylogue/cli/read_view_handlers.py, polylogue/archive/viewport/profiles.py, and served by the daemon HTTP route — every surface except the projection map.

Solution

Add the entry to READ_VIEW_PROJECTION_FAMILIES. Polylogue.get_effective_context returns composed Message models, so it projects MESSAGES, BLOCKS — the same families as the messages view. Not CONTEXT: that family denotes the cross-session context preamble, a different product.

test_executable_read_views_have_projection_mapping now also asserts the metadata-only read-view registry matches the projection map. That registry drives read --views without importing the handlers, so it can drift from the projection map independently of the handler check already there.

Verification

  • devtools test tests/unit/cli/test_click_app.py tests/unit/surfaces/test_projection_spec.py — 97 passed (both named tests red before the change).
  • devtools verify --quick — all gates ok, no out of sync.

Residuals

The view id uses an underscore where every other multi-word view uses a hyphen (file-edits, web-content). That spelling is already load-bearing across the registry, profiles, and the HTTP route; renaming it is a separate user-facing change.

🤖 Generated with Claude Code

https://claude.ai/code/session_014BQsaB1NBY8mTR6yZByfMA

…n spec

The view is declared in the read-view registry, handlers, profiles, and the
daemon HTTP route, but had no NAMED_PROJECTION_FAMILIES entry, so any
projection resolution over it raised "unknown projection view". It returns
composed messages, so it projects the same families as the messages view.

The consistency test now also asserts the metadata-only read-view registry
matches the projection map; that registry drives `read --views` without
importing the handlers, so it can drift independently.

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

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 0e8076e7-c6a3-46e7-8f82-694eafa20f86


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

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

@Sinity
Sinity merged commit c945188 into master Aug 28, 2026
3 checks passed
@Sinity
Sinity deleted the worktree-agent-aefb2a4b913c65a01 branch August 28, 2026 02:24
Sinity added a commit that referenced this pull request Aug 28, 2026
…n spec (#4371)

## Summary

`effective_context` was a fully declared read view with no entry in
`NAMED_PROJECTION_FAMILIES`.

## Problem

On clean master,
`tests/unit/cli/test_click_app.py::test_read_views_json_outputs_profile_payload`
and `::test_read_views_plain_lists_profile_metadata` both fail with
`ValueError: unknown projection view: effective_context`
(`polylogue/surfaces/projection_spec.py:253`). The view is declared in
`polylogue/cli/read_view_registry.py`,
`polylogue/cli/read_view_handlers.py`,
`polylogue/archive/viewport/profiles.py`, and served by the daemon HTTP
route — every surface except the projection map.

## Solution

Add the entry to `READ_VIEW_PROJECTION_FAMILIES`.
`Polylogue.get_effective_context` returns composed `Message` models, so
it projects `MESSAGES, BLOCKS` — the same families as the `messages`
view. Not `CONTEXT`: that family denotes the cross-session context
preamble, a different product.

`test_executable_read_views_have_projection_mapping` now also asserts
the metadata-only read-view registry matches the projection map. That
registry drives `read --views` without importing the handlers, so it can
drift from the projection map independently of the handler check already
there.

## Verification

- `devtools test tests/unit/cli/test_click_app.py
tests/unit/surfaces/test_projection_spec.py` — 97 passed (both named
tests red before the change).
- `devtools verify --quick` — all gates ok, no `out of sync`.

## Residuals

The view id uses an underscore where every other multi-word view uses a
hyphen (`file-edits`, `web-content`). That spelling is already
load-bearing across the registry, profiles, and the HTTP route; renaming
it is a separate user-facing change.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_014BQsaB1NBY8mTR6yZByfMA

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sinity added a commit that referenced this pull request Aug 29, 2026
…es (#4399)

## Summary

Repair four red families across the `cli` and `sources` selections:
browser-capture synthetic-ID normalization, Hermes named-SQLite
admission, Codex unknown response-item preservation, and
`MessageQueryRowPayload` repo parity. Regenerated declarations ship with
them.

## Problem

`legacy_browser_capture_native_id`, its `_UUID_PATTERN`, its `__all__`
entry, and its call site were deleted by #4337 — a two-lane batch
assembly about contract JSON and deployment smoke coverage, unrelated to
browser capture — while all six of its contract tests were left in
place. That is what turned them red (`git show 97cddc4 --
polylogue/browser_capture/identity.py`).

The other three were independent gaps: an uncheckpointed Hermes WAL row
lost at acquisition, a Codex unclassified response item double-counted
by the conservation boundary because it declared no `wire_type`, and
`repo` populated on the substrate row but dropped at the surface because
`_from_row_generic` copies by field name only.

## Solution

Restore the deleted normalization (byte-identical to the deleted body,
minus a redundant wrapper); hoist `hermes_owned_sqlite_name` above the
recognizer guard for `source_only` acquisition; carry the raw provider
token on the unclassified Codex event via `_record_type`, a structural
`record.get("type")` read with no inference; declare `repo` on
`MessageQueryRowPayload`.

## Verification

Each fix was reverted in isolation and the covering test run:

- browser-capture: 6 failed, 44 passed
- Hermes: 2 failed, 141 passed
- Codex: 1 failed, with `assert ['codex_unclassified_response_item'] ==
[...]` naming the mechanism
- repo parity:
`test_generic_row_declarations_have_explicit_field_parity[MessageQueryRowPayload]`
failed, 20 passed

`devtools verify --quick` → exit 0, all 18 gates. `devtools render all
--check` → exit 0, no `out of sync`. `devtools test tests/unit/sources
tests/unit/surfaces` → 2734 passed, 0 failed.

## Residual risk

`native_id` derivation for browser captures reverts to the pre-#4337
rule, which collapses `chatgpt:<uuid>:<hash>` to `<uuid>`. That collapse
is deliberate convergence from #2345 — the extension minted a fresh
synthetic ID per capture, fragmenting one conversation into many
sessions. Blast radius on real data is zero:
`/realm/state/polylogue/source.db` was last written 2026-08-16, before
the regression window opened on 2026-08-27, so no capture was ingested
un-normalized and nothing is re-identified on reindex. Normalization
happens at parse, not in storage, so replay re-derives the same ID from
the same blob.

The Hermes exemption is scoped to `source_only` acquisition of two
filenames and does not relax parser admission; the recognizer still
gates `source_parsing.parse_one_source_path`. Consequence: a named
Hermes SQLite whose schema the recognizer cannot classify is now
acquired as a Hermes raw and may later fail parse with a typed refusal.

The comment at `polylogue/sources/live/batch.py:1972-1975` ("Only the
OriginSpec recognizer may admit a candidate") now sits above a guard
carrying an exemption; filed separately rather than edited here.

Pre-existing and not introduced: the 3-colon-part branch at
`identity.py:27-29` returns `parts[1]` for any `provider:X:Y` where `X`
has no `/`, without requiring `X` to look like a UUID. Shipped since
#2345.

The bead stays open. Its "35 red / 25 remaining" figures are stale — the
five families it names as still red are green on current master (#4371,
#4368, #4375, and the CLI pair), so the remainder must be re-enumerated
rather than restated.
Sinity added a commit that referenced this pull request Sep 1, 2026
…n spec (#4371)

## Summary

`effective_context` was a fully declared read view with no entry in
`NAMED_PROJECTION_FAMILIES`.

## Problem

On clean master,
`tests/unit/cli/test_click_app.py::test_read_views_json_outputs_profile_payload`
and `::test_read_views_plain_lists_profile_metadata` both fail with
`ValueError: unknown projection view: effective_context`
(`polylogue/surfaces/projection_spec.py:253`). The view is declared in
`polylogue/cli/read_view_registry.py`,
`polylogue/cli/read_view_handlers.py`,
`polylogue/archive/viewport/profiles.py`, and served by the daemon HTTP
route — every surface except the projection map.

## Solution

Add the entry to `READ_VIEW_PROJECTION_FAMILIES`.
`Polylogue.get_effective_context` returns composed `Message` models, so
it projects `MESSAGES, BLOCKS` — the same families as the `messages`
view. Not `CONTEXT`: that family denotes the cross-session context
preamble, a different product.

`test_executable_read_views_have_projection_mapping` now also asserts
the metadata-only read-view registry matches the projection map. That
registry drives `read --views` without importing the handlers, so it can
drift from the projection map independently of the handler check already
there.

## Verification

- `devtools test tests/unit/cli/test_click_app.py
tests/unit/surfaces/test_projection_spec.py` — 97 passed (both named
tests red before the change).
- `devtools verify --quick` — all gates ok, no `out of sync`.

## Residuals

The view id uses an underscore where every other multi-word view uses a
hyphen (`file-edits`, `web-content`). That spelling is already
load-bearing across the registry, profiles, and the HTTP route; renaming
it is a separate user-facing change.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_014BQsaB1NBY8mTR6yZByfMA

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sinity added a commit that referenced this pull request Sep 1, 2026
…es (#4399)

## Summary

Repair four red families across the `cli` and `sources` selections:
browser-capture synthetic-ID normalization, Hermes named-SQLite
admission, Codex unknown response-item preservation, and
`MessageQueryRowPayload` repo parity. Regenerated declarations ship with
them.

## Problem

`legacy_browser_capture_native_id`, its `_UUID_PATTERN`, its `__all__`
entry, and its call site were deleted by #4337 — a two-lane batch
assembly about contract JSON and deployment smoke coverage, unrelated to
browser capture — while all six of its contract tests were left in
place. That is what turned them red (`git show 97cddc4 --
polylogue/browser_capture/identity.py`).

The other three were independent gaps: an uncheckpointed Hermes WAL row
lost at acquisition, a Codex unclassified response item double-counted
by the conservation boundary because it declared no `wire_type`, and
`repo` populated on the substrate row but dropped at the surface because
`_from_row_generic` copies by field name only.

## Solution

Restore the deleted normalization (byte-identical to the deleted body,
minus a redundant wrapper); hoist `hermes_owned_sqlite_name` above the
recognizer guard for `source_only` acquisition; carry the raw provider
token on the unclassified Codex event via `_record_type`, a structural
`record.get("type")` read with no inference; declare `repo` on
`MessageQueryRowPayload`.

## Verification

Each fix was reverted in isolation and the covering test run:

- browser-capture: 6 failed, 44 passed
- Hermes: 2 failed, 141 passed
- Codex: 1 failed, with `assert ['codex_unclassified_response_item'] ==
[...]` naming the mechanism
- repo parity:
`test_generic_row_declarations_have_explicit_field_parity[MessageQueryRowPayload]`
failed, 20 passed

`devtools verify --quick` → exit 0, all 18 gates. `devtools render all
--check` → exit 0, no `out of sync`. `devtools test tests/unit/sources
tests/unit/surfaces` → 2734 passed, 0 failed.

## Residual risk

`native_id` derivation for browser captures reverts to the pre-#4337
rule, which collapses `chatgpt:<uuid>:<hash>` to `<uuid>`. That collapse
is deliberate convergence from #2345 — the extension minted a fresh
synthetic ID per capture, fragmenting one conversation into many
sessions. Blast radius on real data is zero:
`/realm/state/polylogue/source.db` was last written 2026-08-16, before
the regression window opened on 2026-08-27, so no capture was ingested
un-normalized and nothing is re-identified on reindex. Normalization
happens at parse, not in storage, so replay re-derives the same ID from
the same blob.

The Hermes exemption is scoped to `source_only` acquisition of two
filenames and does not relax parser admission; the recognizer still
gates `source_parsing.parse_one_source_path`. Consequence: a named
Hermes SQLite whose schema the recognizer cannot classify is now
acquired as a Hermes raw and may later fail parse with a typed refusal.

The comment at `polylogue/sources/live/batch.py:1972-1975` ("Only the
OriginSpec recognizer may admit a candidate") now sits above a guard
carrying an exemption; filed separately rather than edited here.

Pre-existing and not introduced: the 3-colon-part branch at
`identity.py:27-29` returns `parts[1]` for any `provider:X:Y` where `X`
has no `/`, without requiring `X` to look like a UUID. Shipped since
#2345.

The bead stays open. Its "35 red / 25 remaining" figures are stale — the
five families it names as still red are green on current master (#4371,
#4368, #4375, and the CLI pair), so the remainder must be re-enumerated
rather than restated.
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