Skip to content

fix(hygiene): scan schema-varying scratchpad tables - #1342

Draft
wtrlighting-iron wants to merge 1 commit into
mnemosyne-oss:mainfrom
wtrlighting-iron:fix/hygiene-scan-source-pr-1341
Draft

wtrlighting-iron wants to merge 1 commit into
mnemosyne-oss:mainfrom
wtrlighting-iron:fix/hygiene-scan-source-pr-1341

Conversation

@wtrlighting-iron

Copy link
Copy Markdown

Summary

  • Build hygiene scan projections from columns actually present in each table, with safe defaults for omitted fields.
  • Add a regression test for a scratchpad schema without source.

Fixes #1341.

Test plan

  • git diff --check origin/main...HEAD
  • pytest tests/test_hygiene.py (not yet run: pytest is not installed in the current test environment)
  • Independent review

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai

coderabbitai Bot commented Nov 6, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

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

@dplush

dplush commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

Reviewed 6835cde. I reproduced the missing-source error on Main with an explicitly selected scratchpad table. The patch fixes that case; all 180 hygiene tests pass locally. Additional read-only/query-only probes returned all three scratchpad IDs with batch sizes 1, 2 and 10, without changing database bytes. Optional source/timestamp/session/importance defaults also worked for an id/content-only table.

One boundary worth tightening is the minimum audit contract at hygiene.py:419-420. The new projection also defaults missing id and content to empty strings. A three-row table without id then reports only 1 or 2 scanned rows with batch_size=1 or 2, and emits empty candidate IDs. A table without content produces fabricated empty_content candidates with score 1.0 and suggested deletion. Previously those incompatible schemas failed explicitly. Please default only optional metadata, or report/skip a table missing the required identity/text fields.

Those last probes use incompatible synthetic schemas: they are not a failure of the project's normal scratchpad or memory schemas, and scratchpad candidates cannot pass the cleanup table allowlist. The supported-schema fix itself looks sound.

One issue-description clarification: CLI --all scans all rows in its default memory tables; it does not itself add scratchpad. The reproduced scratchpad case uses the explicit tables override in the audit API.

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.

[BUG] Hygiene audit fails on schema-varying scratchpad table

3 participants