Skip to content

chore: Merge the insights packages into ordinary layering and delete de… - #4614

Merged
Sinity merged 5 commits into
masterfrom
feature/packet/polylogue-igu99
Sep 3, 2026
Merged

Sinity merged 5 commits into
masterfrom
feature/packet/polylogue-igu99

Conversation

@Sinity

@Sinity Sinity commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Summary

Rebase the insights-to-analysis and storage-insights-to-storage-derived package merge onto current master and preserve the Hermes verification prerequisite.

Problem

The package merge had to be replayed across current master changes, including work-effects and session-profile updates. The rebased tree must retain current master behavior while removing stale package references.

Solution

Resolved the rename-aware conflicts, retained the repository-subdirectory and non-repository work-effects coverage, restored Hermes verification coverage, removed the empty storage test package, and corrected remaining analysis and derived-storage references.

Verification

uv run devtools verify --quick passed. The pre-push quick verification passed all gates, including format, lint, mypy, generated surfaces, layering, patterns, doc commands, schema versioning, oracle integrity, consumer reachability, timestamp doctrine, and schema privacy.

Residual risk

The full test corpus and seeded CLI/MCP/API parity harness were not run in this rebase operation.

@Sinity
Sinity enabled auto-merge (squash) September 3, 2026 19:10
@coderabbitai

coderabbitai Bot commented Sep 3, 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: Organization UI

Review profile: ASSERTIVE

Plan: Team

Run ID: 496ad824-65ae-4203-8454-c14bb0fdc145


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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 3, 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
📝 Code Review ✅ Completed 2026-09-03T19:19:15.927336Z beb6bb2 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.

@Sinity
Sinity merged commit b7d83e1 into master Sep 3, 2026
3 of 4 checks passed
@Sinity
Sinity deleted the feature/packet/polylogue-igu99 branch September 3, 2026 19:15

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

"""Data-driven derived insight system.

P2 Badge Register the renamed analysis package in the root namespace

After this package replacement, code that does import polylogue and then accesses polylogue.analysis receives AttributeError: the root package's lazy-submodule table still contains the now-deleted insights name and has no analysis entry. The stale entry also makes polylogue.insights fail with ModuleNotFoundError, so update the root lazy-submodule registration when adding this replacement package.

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/architecture-spine.md Resolved
Sinity added a commit that referenced this pull request Sep 5, 2026
Status counts read product tables without requiring them to exist. The reads
were unreachable behind the insight_materialization KeyError; removing that
exposed them, so an archive whose derived tables are not built yet raises
"no such table" instead of reporting zero.

Four count descriptors read a product table they did not gate on. Two relations
are query-time views over session_profiles and session_work_events: sqlite_master
lists a view whether or not its body's tables exist, so presence alone never made
them readable. The view dependency cannot be read off a descriptor's query text,
so it is declared once and every gate expands through it.

A descriptor now gates on the set of relations its query reads, and an
import-time check refuses any descriptor whose query names a product table it
does not gate on.

Also repoint two test references at storage.derived, renamed from
storage.insights in #4614; the stale import failed collection on master.

Co-Authored-By: Claude Opus 5 <[email protected]>
Sinity added a commit that referenced this pull request Sep 14, 2026
Triage of the daemon/async share of the 58 corpus failures. **21 of 23
fixed**
across 17 commits — and it uncovered **silent production data loss**
that would
have crippled the from-scratch rebuild.

## The finding that matters

The brief framed the four `test_daemon_resilience` failures as "grouping
or
daemon lifecycle". Raising the module timeout — a 300s wait under a 120s
ceiling
could **never** complete — unmasked the real diagnostics. On an **idle**
machine
`sigkill_recovery` reported *byte-identically* the same "20 messages" as
the
corpus run, proving load was not the cause.

**The daemon ingested one session per root and stopped.**

`FileIntakeAdapter.discover` advanced its cursor past the entire
discovered page
while the dispatcher consumed only its head, and the walk only moves
forward.
Compounding it, adapters charge `estimated_cost` in **bytes** while the
service
budget was `64` — a *count*.

Every session after the lexicographically-first was retained on disk and
never
archived. Introduced by `#4913`, which made the dispatcher the sole
discovery
authority and disabled the watcher's own catch-up.

This is not a test defect. The fresh-start ruling is *"move the six
database
files aside, start the daemon fresh, let ordinary convergence rebuild
everything
from the actual sources"* — so the rebuild **is** this code path.
Building on the
previous head would have produced an archive containing roughly one
session per
source root and reported success.

## Classification of all 23

**PRODUCT-BUG (8)** — the discovery/budget loss above (resilience ×3 +
`large_session_file`); workload probe ×2 (the adapter treated "file
exists" as
"tier bootstrapped", and `inspect` opened a DB to answer an empty
question); MCP
clamp (the CLI clamps `limit=-1`, MCP refused it — the declared clamp
was applied
to the routing probe but not the typed request); daemon SIGTERM
forensics (the
signal handler wrote without the process-wide lease,
`UnleasedWriteError`
swallowed → `(None, 'signal')`).

**STALE-TEST (8)** — the insight cluster ×4 (still calling the facade
#5030
retired); visual ×2, red since #4645's WebUI cutover because
`tests/visual/` is
not in the fast gate; `daemon_status` (`(0 sessions, 1 message)` is
unreachable by
construction post-#5027); demo seed.

**ORDER-DEPENDENT (3)** — `test_daemon_cli.py`. Passed alone *and*
across
`tests/unit/daemon`; the corpus receipt showed a `MagicMock` and a
shut-down
adapter leaking through the process-global `_SHARED_COMPUTE_ADAPTER`.
`reset_daemon_compute_adapter()` already existed and **nothing called
it**.
Verified red→green with a deterministic two-file reproducer.

**TEST-INFRA (3)** — `live_read_amplification` (double drifted from a
keyword-only signature); `resume` (rename debris from #4614, `insights`
vs
`analysis`); `write_path_state_machine`.

**Root verb (1)** — `verification-export` regrew the surface `985e0f9d9`
folded.
The verb was wrong, not the test.

## Two left unfixed, deliberately

- **`test_demo_seed_verify`** — Codex declares `parent_dispatch`
structurally
absent, so `mapping_state:resolved` is unreachable for that fixture
(confirmed
by counterfactual: forcing the origin gate only changes the refusal
reason). A
Claude Code delegation fixture was started; each step revealed another
required
  piece, so it was **reverted cleanly** rather than left half-built.
- **`test_installed_package_smoke`** — diagnosed precisely, then **both
commits
reverted** after three fixes each broke a different legitimate caller.
The third
was rejected by `devtools gate layering`'s own ratchet. That the
architecture
refuses the CLI-layer catch says this needs a deliberate owner decision,
not a
  triage patch. Full rationale is in the revert commit.

## Verification

```
2,976 passed, 0 failed      devtools verify --quick   exit 0, 15/15 gates
```

## Residuals recorded in commits

A pre-existing `_assert_resolved_link` property failure (replayed
against base —
fails there too, no delete involved); an unleased-writer bug in the
daemon
health/cursor-lag path; a whale-pass deadlock against the daemon's own
ownership
flock; and a note that two reds in `tests/unit/sources/` assert FTS
convergence
debt which the inline repair here makes obsolete.

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

https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
  * Updated the verification export command to use `verify export`.
  * Newly ingested sessions become searchable immediately.
  * Improved intake processing so skipped items can be rediscovered.

* **Bug Fixes**
  * Out-of-range session list limits are now handled safely.
  * Improved daemon lifecycle signaling under write-lease enforcement.
* Clearer errors are provided when source databases are missing required
data.
  * Intake processing now uses a byte-based default budget.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

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

Seventeen worker branches, each resolving a theme of small known-fix
beads, integrated into one candidate: 472 files, +20,406 / −12,166, 80
commits (worker commits plus integration merges and eight cross-branch
reconciliations). Every fixed bead carries one regression test that
names its anti-vacuity condition.

## Problem

The reindex campaign's closure held ~150 open beads whose fix was
already known and small, spread across parsers, storage, daemon,
surfaces, devtools and the test harness. Working them one PR at a time
serialised on review and on the pytest slot. Bead status was stale in
both directions: several dozen were already fixed at head, and a handful
of premises were refuted on inspection.

## Solution

Per theme (branch → beads):

- batch3-identity: ig9tt irtix(1) 3ad8j(1,3) vabba zj8ns t1vl6 prwmd
d9t8u asp4b(6) dhkuu(B) l3zva ddvpi m8yd5; 9193q already at head
- batch3-devtools: uy1a5 7o5zj gcy1 8ykm 1bkl g31s zmlcn wbuf v6xh b1vr1
lafc4 d0kj acsmu hohj7 ga8vn c4a1o rxfo c2qsm t4l2q n6gnd 59qy ww6mj
5pv1p; already at head: b0vbz qai7u e4qyw 8errr v0t3r
- batch3-daemon: ia88n(a) c1dx2 s4tkf 7z8do 7viwp 0ye6q jyzfs uwxir
lbsh9 umca4 ji49p 7mkgv 5a6xc dvhe7 8374p o90gu 3zvsd 9z2gy hprg0 s4135
ho6m7 a03p0 6u8do; pinned at head: lr47v 8ifs 3ahdg f7bf9 liwst
- batch4-harness: xbg9e o733y m3018(code half) 016xl(root cause:
schema-closure import walk memoized on disk, 10.4→4.1 s per process);
already at head: 3z1bj yichs csex1(AC1) ehva4
- batch1-parsers: 8t9bj 6d7fx q5j3o 670mf sfu70 foi1h utv49 4mbya w54q3
1wom1 l0cnu gzxhi; pua53 at head
- batch1-surfaces: o6oct g88v4 xtcdz i6p4x onbz3 vgxkk e9y76 nfr2u 4vjfd
45pkf l9u58 zu08l; at head: kjy0a oil1q m1s98 c0ay0 9qpx4
- batch1-storage: nd2tb lyymm 3sic0(a–e) ebjar nszyu h9xx0 pv8xp wr0oe
lezv0 5qrip lyqzg crcst; at head: bl132 4hys5 gzh7n son7n qczu5
- batch4-ingest: f7pdm dznyt 3ijaa swicx(3/4) m5djs av5j1(2) 9k62p roaof
3r36h; l8tdh at head
- batch4-identity2: s9w0h e2e25 8u1p 3vsoj xnk51 31zag ro922 t37k9 07rfc
sqy57 h92sm khkup 8k10u 56jc6
- B6 excision: 14ucm q4f6d aix14 9lrqs p1naz (+ unrecorded otlp_spans
reach); at head: bhhsa si5kj
- B7 vocabulary: z3sv hjvow bwh3h 7k3n0 exxly j1vs ir1wn grdt
mjupn(part) jglh(part); a2jir at head
- B8 daemon: zbzxs tjtua 5lfcr z5bu7 h8l96 w17k1 oa9w8 (+ duplicate
ISOLATED_TIER_WRITE_PROFILE); iwmt at head
- B9 ingest: 0ck6i zxpgj fkqxx(half) payqy xj7ru v85tn sifoy erf3; at
head: h0nor ip0nq re4es
- B10 CLI/API: 1c6j fawr7 lxdwy t83q(residual) lb15e(part) 01fe(origin
class); at head: 1kavq v1mnm i58iu pd63j qwgi mon2f 395j
- B11 tests/devtools: vwdj zphcj p9evo 6ou1q 7ui0g nlush b7c7m 4ayqx
thqg2 8xvlf(part) + one real daemon saturation red; at head: vl7ra mnkfh
7y23g vhelw f3p8c mhy6z
- B12 security: 97o2z xv0pf n61h5 4fbgw tztk 81v76 1oa7o; xtawb refuted
at head
- B13 campaign: k00uq cois9 xrba4 1ifhp; 4x38n at head

Integration reconciliations (own commits on this branch): the shared
SQLite introspection helper moved to
`polylogue/core/sqlite_introspection.py` (its storage home grew the
surface→substrate ratchet for two daemon modules); the hook-drain cursor
read guards on the carriers table instead of swallowing every
`sqlite3.Error`; the audit `principal_surface` CHECK stays hand-written
(durable DDL is not enum-generated) and is pinned to the literal by
value set; the codex record-skip log is a structured event; `--limit`
refuses non-positive and clamps to the ceiling; the raw-discovery sweep
keeps the held-page cursor inside the arrival/sweep lanes; the prefetch
timeout cancels unstarted, discards finished-unread and attaches the
discard to still-running workers; generated surfaces re-rendered;
writer-module census, schema-closure and degradation baselines refreshed
for the deleted and added modules.

Beads skipped by workers are listed in the worker reports and stay open
with their reason noted; none was closed without a fix at head.

## Closure and rebuild

Dozens of files in this candidate are IN the derived-schema identity
closure (parsers, write.py, archive_tiers specs, core enums/timestamps,
sources, excision). The identity moves; this lands before the fresh
rebuild starts and never during one. Content also changes for ChatGPT
thought summaries, Gemini subagent origin, Codex world_state keys,
Hermes profile keys, Grok session identity (content-derived, message-id
namespace `grok`), tool_path/search_text widening for FTS, and the hash
framing in `_hash_bytes` (length-prefixed) — all pre-wipe by design.

## Verification

- `agentctl job start --workspace /realm/worktrees/polylogue-integ
polylogue verify_quick` → job 2459 **succeeded** (all 21 gates ok)
- `agentctl job start --workspace /realm/worktrees/polylogue-integ
polylogue pytest_focused -- <162 touched test files>` → job 2460: 5,795
passed / 13 failed (all cross-batch interactions, reconciled in
5f123c6 and 2da4406); re-test of the 13 files → jobs 2467+2470
**succeeded** (594 and 89 tests, all passed); quick gate re-run after
reconciliation → job 2471 **succeeded**
- Each worker branch additionally ran its own focused selections and,
for most, `devtools verify --quick` green before integration (receipts
in the worker worktrees).

## Residuals

- 15 test failures inherited on master (13 `test_plain_cli_snapshots`
fixtures, 2 `test_click_app` read-view assertions) are owned by the peer
session's 2206 fix and are not touched here.
-
`test_codex_state_live_ingest.py::test_codex_goal_materials_do_not_cross_supersede_source_roots`
fails at base 342cf9e (inherited, unrelated).
- Operator decisions surfaced by workers, left open: b5xfk (contradicts
the #4614 subdirectory contract), bwu75 (member-level disposition row
needs a source migration), 4xhzs (no converger stage resumes accepted
machine requests), om8dh, ew7ti, fxtbj, gzmd4, qut1/l6v61, v8dz.
- pw5jd stays open: its classifier is landed by #5222 (jtrtj) instead.
- Corpus-scale receipts (memory.peak under the pytest slice at width 4,
controller peak ≤600 MiB) were not produced; the width change is
arithmetic plus unit tests.

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

https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw

---------

Co-authored-by: Claude Fable 5.1 <[email protected]>
@Sinity

Sinity commented Sep 29, 2026

Copy link
Copy Markdown
Owner Author

Closing out open Codex review threads on this PR (evidence checked against master at ef10e59):

Resolving the fixed, stale and refuted threads; tracked threads stay open.

This was referenced Sep 30, 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.

1 participant