Skip to content

fix(api): reject modality inputs that would be silently discarded - #334

Merged
hyperpolymath merged 6 commits into
mainfrom
fix/reject-lossy-octad-input
Oct 31, 2026
Merged

hyperpolymath merged 6 commits into
mainfrom
fix/reject-lossy-octad-input

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

P0/P1 contract-integrity finding

The published nested OctadInput JSON schema does not match the flattened OctadRequest accepted by HTTP POST/PUT. Because serde ignored unknown keys, schema-conforming clients could create a temporal-only entity despite submitting nested document, vector, or other fields. A body-only document request was also silently dropped by to_octad_input.

Fix

  • Reject unknown create/update request keys via #[serde(deny_unknown_fields)].
  • Reject a nonempty or empty body field without title rather than discarding document content.
  • Add HTTP regression tests: nested payload => 422 and body-only => 400. Flat payload success remains covered by existing API tests.

Compatibility and follow-up

This is a deliberate fail-closed validation change; previously silent unknown keys become errors. No data is deleted, and no database migration occurs. OpenAPI and client libraries must be reconciled in a separate versioned contract PR; do not treat their nested schema as an implemented API. Other field-level validation and empty-title policy require review.

Verification

Source and regression tests committed; awaiting CI compilation/test evidence. Keep draft until checks pass and compatibility is reviewed.

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 9 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between 4e2c43e and e48ad3c.

Files selected for processing: 1
  • rust-core/verisim-api/src/lib.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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 Oct 29, 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-10-29T22:16:50.168391Z e48ad3c New commits
ℹ️ 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.

@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: 2e126ca2ff

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


/// Octad create/update request
#[derive(Debug, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve the documented nested Octad input contract

With deny_unknown_fields, schema-conforming POST/PUT payloads containing top-level document, vector, graph, or semantic objects now fail with 422 because those names are absent from OctadRequest. I checked the v1 OpenAPI reference to connectors/shared/json-schema/octad-input.json, the Rust client's nested OctadInput, and the repository smoke scripts, all of which send this nested shape; moreover, the Rust client serializes its unsupported optional fields even when they are None, so its create/update calls will be rejected universally. Accept the published nested fields here, or version and update the schema, clients, documentation, and scripts atomically rather than breaking the existing v1 contract.

Useful? React with 👍 / 👎.

hyperpolymath added a commit that referenced this pull request Oct 29, 2026
The current strict `clippy (all-targets)` job fails on
`rust-core/verisim-octad/src/ram_promotion.rs` even for unrelated PRs
(#333 and #334).

Two diagnostics:
- `HashSet` is imported but never used.
- `PromotedState.modality` is never read; the containing
`PromotionManager.promoted` map already keys entries by `Modality`.

Remove the unused import and redundant private field/initializer. No
storage format, behaviour, or API change. Await CI. This is independent
of the WAL and API integrity changes.

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

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Tests**
* Updated the capability-matching test setup; its matching logic and
expected result remain unchanged.
* **Refactor**
* Simplified internal promotion-state handling and removed an unused
import. No user-facing behaviour changes are reported.

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

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@sonarqubecloud

Copy link
Copy Markdown

@hyperpolymath
hyperpolymath enabled auto-merge (squash) October 30, 2026 15:32
@hyperpolymath
hyperpolymath merged commit 2cf7746 into main Oct 31, 2026
21 of 22 checks passed
@hyperpolymath
hyperpolymath deleted the fix/reject-lossy-octad-input branch October 31, 2026 10:54
hyperpolymath added a commit that referenced this pull request Oct 31, 2026
…tions and v1 consumer contract (#337)

Independent code-grounded reconnaissance as of main
`5876bc67e8962e3b276fb0161664e0b3a420a64c`.

Adds three review documents:
- `docs/reviews/2026-10-29-verisimdb-as-built-recon.adoc` —
source-derived architecture, conceptual ER, eight-modality/persistence
matrix, actual lifecycle, P0/P1/P2 discrepancy register, tests and
formal proof obligations, independent
Mathesis/QuandleDB/JanusKey/Marches reuse, prioritized engineering
programme.
- `docs/consumer-interface-contract-v1-observed.adoc` — actual
flatten-vs-nested HTTP ABI, operations, HTTP statuses,
feature/configuration guarantees and explicit non-guarantees.
- `docs/reviews/2026-10-29-hypatia-verified-handover.adoc` — only
verified downstream integration facts.

No rewrite of the Octad schema; accepted generic term **modality
profile** distinguished from **modality set** and **consonance
subject**. References separate code fixes #333, #334, #335, #336. Makes
no soundness claims beyond observed source/test status. No data
mutation.
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