Skip to content

fix: final gaps — stale docs, FK surfacing test (#820/#852) - #911

Merged
Sinity merged 1 commit into
masterfrom
feature/fix/final-gaps
May 7, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/fix/final-gaps

Conversation

@Sinity

@Sinity Sinity commented May 7, 2026 •

Copy link
Copy Markdown
Owner

#852: fix internals.md. #820: add FK violation surfacing test.

Summary by CodeRabbit

  • Documentation
    • Updated CLI behavior documentation to clarify daemon status checking and archive fallback functionality.

- #852: update internals.md (bare polylogue is fast status, not search)
- #820: add test proving FK violations are surfaced by ON CONFLICT DO NOTHING

Co-Authored-By: Claude Opus 4.7 <[email protected]>
Copilot AI review requested due to automatic review settings May 7, 2026 13:44
@Sinity
Sinity merged commit 35cd4f5 into master May 7, 2026
@Sinity
Sinity deleted the feature/fix/final-gaps branch May 7, 2026 13:44
@coderabbitai

coderabbitai Bot commented May 7, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6a63f27a-8021-45d6-a06f-dcc36d733e58

📥 Commits

Reviewing files that changed from the base of the PR and between c85d130 and d183980.

📒 Files selected for processing (2)
  • docs/internals.md
  • tests/unit/storage/test_backend.py

📝 Walkthrough

Walkthrough

This PR updates documentation for CLI extension guidance and adds a test verifying SQLite foreign key constraint enforcement. The doc change clarifies that bare invocation shows daemon status with archive summary fallback; the test confirms FK violations are raised, not swallowed, when inserting invalid attachment references.

Changes

CLI Documentation and Storage Verification

Layer / File(s) Summary
CLI Documentation Update
docs/internals.md
"Adding a CLI command" guidance updated to describe fast daemon status on bare invocation with fallback to archive summary.
Storage FK Constraint Test
tests/unit/storage/test_backend.py
New test test_attachment_ref_fk_violation_surfaced verifies sqlite3.IntegrityError is raised when inserting attachment_refs with non-existent attachment_id.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

A test and a doc, both small but precise,
One shows how the daemon runs oh so nice,
The other confirms our constraints hold tight—
Two simple guards keeping data just right. 🐰✨

✨ 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 feature/fix/final-gaps

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 and usage tips.

@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

Here are some automated review suggestions for this pull request.

Reviewed commit: d1839807ec

ℹ️ 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 tests/unit/storage/test_backend.py Resolved
Comment thread tests/unit/storage/test_backend.py Resolved

Copilot AI 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.

Pull request overview

This PR addresses two “final gap” items tied to storage integrity and internal documentation accuracy: it adds a regression test meant to ensure attachment-ref FK violations are not silently swallowed, and it updates internals documentation to reflect the daemon-first CLI default behavior.

Changes:

  • Add a unit test intended to assert FK violations are surfaced when inserting attachment_refs (#820).
  • Update docs/internals.md CLI extension-point guidance to reflect bare-invocation status behavior (#852).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
tests/unit/storage/test_backend.py Adds a new regression test around FK violation surfacing for attachment_refs.
docs/internals.md Updates internal docs for CLI behavior on bare invocation (daemon status vs archive summary fallback).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

from polylogue.storage.sqlite.schema_ddl_archive import ARCHIVE_STORAGE_DDL

db = tmp_path / "fk_surface.db"
conn = sqlite3.connect(str(db))
Comment on lines +1607 to +1616
# Try to insert an attachment_ref with a non-existent attachment_id
# ON CONFLICT DO NOTHING only handles ref_id conflicts — FK violations still raise
try:
conn.execute(
"INSERT INTO attachment_refs(ref_id, attachment_id, conversation_id) VALUES(?,?,?)",
("ref-1", "nonexistent-attachment", "c1"),
)
conn.commit()
# If we get here, the FK violation was NOT surfaced — this is a bug
raise AssertionError("FK violation should have raised IntegrityError")
Sinity added a commit that referenced this pull request May 7, 2026
Direct, no-PR. Local repair in
`tests/unit/storage/test_backend.py`: the wave that landed
PRs #882/#903/#911 left two FK-test cases referencing helper
names that had been renamed in the same wave, so
`devtools verify` failed at the test stage even though every
individual PR's CI was green. Realigns the helper names; pure
test-file repair, no production code change.
Sinity added a commit that referenced this pull request May 7, 2026
Direct, no-PR. `tests/unit/storage/test_backend.py` accumulated
regression cases from the FK / quarantine / FTS / blob waves
(PRs #879/#881/#882/#903/#911) and exceeded its previous LOC
budget. Bumps `docs/plans/file-size-budgets.yaml` to 1750 so
`devtools verify-file-budgets` passes; the tests stay grouped
in one place rather than splitting along an arbitrary cut.
Sinity added a commit that referenced this pull request May 7, 2026
Two acceptance-criteria leftovers from the closing wave.

- #820 (storage integrity): adds an FK-violation surfacing test
  in `tests/unit/storage/test_backend.py` that proves the
  attachment-ref `ON CONFLICT(ref_id) DO NOTHING` path from
  PR #881 still surfaces real FK constraint violations rather
  than silently swallowing them.
- #852 (execution graph): refreshes `docs/internals.md` to match
  the daemon-first architecture, removing stale references to
  the removed public `polylogue run` ingestion surface.

#852 is the mass-execution control issue, not the work itself;
the durable change here is the storage test and the docs
refresh.

Refs #820, #852
Sinity added a commit that referenced this pull request May 7, 2026
Direct, no-PR. Local repair in
`tests/unit/storage/test_backend.py`: the wave that landed
PRs #882/#903/#911 left two FK-test cases referencing helper
names that had been renamed in the same wave, so
`devtools verify` failed at the test stage even though every
individual PR's CI was green. Realigns the helper names; pure
test-file repair, no production code change.
Sinity added a commit that referenced this pull request May 7, 2026
Direct, no-PR. `tests/unit/storage/test_backend.py` accumulated
regression cases from the FK / quarantine / FTS / blob waves
(PRs #879/#881/#882/#903/#911) and exceeded its previous LOC
budget. Bumps `docs/plans/file-size-budgets.yaml` to 1750 so
`devtools verify-file-budgets` passes; the tests stay grouped
in one place rather than splitting along an arbitrary cut.
Sinity added a commit that referenced this pull request May 7, 2026
Two acceptance-criteria leftovers from the closing wave.

- #820 (storage integrity): adds an FK-violation surfacing test
  in `tests/unit/storage/test_backend.py` that proves the
  attachment-ref `ON CONFLICT(ref_id) DO NOTHING` path from
  PR #881 still surfaces real FK constraint violations rather
  than silently swallowing them.
- #852 (execution graph): refreshes `docs/internals.md` to match
  the daemon-first architecture, removing stale references to
  the removed public `polylogue run` ingestion surface.

#852 is the mass-execution control issue, not the work itself;
the durable change here is the storage test and the docs
refresh.

Refs #820, #852
@Sinity

Sinity commented Sep 30, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

Only the rows listed above are dispositioned. Held findings remain open.

@Sinity

Sinity commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

Only the rows listed above are dispositioned. Held findings remain open.

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.

2 participants