Skip to content

feat(storage): validate strict publication inputs - #590

Closed
fishmingyu wants to merge 29 commits into
mainfrom
fix/strict-publication-foundations-v2
Closed

feat(storage): validate strict publication inputs#590
fishmingyu wants to merge 29 commits into
mainfrom
fix/strict-publication-foundations-v2

Conversation

@fishmingyu

Copy link
Copy Markdown
Member

Summary

Add the bounded parsing and strict workspace validation foundations required by the next portable publication layer.

This is a stacked PR based on #588. It intentionally excludes the later static export, BM25, and context publication migrations so those authority-sensitive changes remain independently reviewable.

Changes

  • enforce item, byte, lexical-token, node, and depth limits while framing streamed JSON array elements, before allocating decoded objects
  • reject invalid or oversized reader blocks and credential-shaped URL authorities containing whitespace before userinfo
  • add an explicit strict workspace publication capability preflight
  • return authenticated file records from workspace writes and bind staged and published validators to callback-scoped publication readers
  • add adversarial coverage for oversized readers, pre-decode complexity limits, strict workspace support, validator failures, cancellation cleanup, and credential userinfo variants

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring
  • Performance improvement
  • Tests

Testing

  • Tests pass locally
  • Added new tests for the changes
  • pytest -q test/test_bounded_json.py test/test_captured_directory.py test/test_native_index_authorization.py test/test_source_fingerprint.py test/storage/test_models.py test/storage/test_view_bundle.py --tb=short (312 passed, 5 skipped)
  • Black, isort with the Black profile, flake8, and git diff --check on the changed surface

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Dependency: #588 is published and green but intentionally not merged yet.

Bind portable BM25 and vector validation to bounded ownership inventories and descriptor-authenticated payloads. Align contained source symlink handling across fingerprints, binding, BM25 queries, and MCP reads.

Verified with the artifact/storage/vector/lazy suites, the Python 3.10 unit tier excluding the unavailable Docker-only test file, formatting, flake8, compileall, and the namespace check.
Add canonical per-file ownership records, descriptor-bound readers and owned staging, bounded streaming JSON, process-local native parser authorization, and pinned source fingerprint reads.\n\nVerified with 100 focused unit tests plus flake8 and diff-check.
Bind staged-directory reads and no-replace publication to retained lexical authorities, add authenticated streaming readers and durable Linux commit hooks, and make descriptor/HANDLE cleanup cancellation-safe.\n\nVerified with 141 atomic tests plus independent race, reuse, and durability review.
Publish immutable regular files through retained parent descriptors with no-replace rename, exact authenticated reuse, durable receipts, and retryable cancellation-safe ownership.\n\nVerified with 95 focused tests and the combined atomic publication tier.
Replace hard-link and overwrite fallbacks with owned no-replace publication, pin the preprovisioned lexical shard generation, and replay the full directory durability chain after ambiguous provisioning failures.\n\nVerified with 70 CAS tests, 272 storage tests, and the combined publication tier.
Validate exact workspace plans over caller-provisioned directory authorities, write only planned no-replace files, flush complete trees, and publish Linux generations into caller-owned authenticated receipts.\n\nThe receipt lifecycle retains one authority across validation and consumption and closes cancellation, concurrency, fork, and persistent-cleanup races. Verified with 52 focused tests and two independent reviews.
Bind native vector authorization to the freshly captured tree and semantic contract before constructing embedding models or remote clients. Keep every portable artifact origin parser-inert for eager and lazy loads.

Verified with MCP context, pre-model authority, and cleanup-priority tests.
Require exact captured-tree authorization before native parsing in compiler, agent, pipeline, script, and example call sites. Distinguish missing capabilities from malformed or mismatched capabilities so only absence can select a safe source rebuild.

Keep local administrative minting at explicit source-bound boundaries and preserve cleanup failures without hiding the first exception.
Build vector files, cache state, and update markers through a descriptor-anchored private generation before one owned-directory switch. Reject generation-root replacement without writing through attacker-controlled paths.

Disable live incremental mutation until it can satisfy the same boundary; validated requests take the complete-generation rebuild path and preserve the previous tree under BaseException faults.
Authenticate FAISS payload bytes and canonical metadata without importing native parsers or deserializing pickle. Treat trusted-local as descriptive only and require an exact out-of-band capability for any native normalization.

Bind context staging minting to the verified checkout, persisted config fingerprint, and copied tree while preserving first-primary cleanup failures.
Keep the first entry or body BaseException authoritative when POSIX or Windows lock cleanup also fails. Complete descriptor and registry cleanup, retain secondary diagnostics, and propagate cleanup itself when no earlier fault exists.
Require a resolver for hybrid native views unless the caller explicitly chooses optional sparse fallback. Mint local capabilities outside the registry only under the compiler cache lock after exact manifest, source-fingerprint-v2, and captured-tree checks.

Keep legacy route defaults out of the capability semantic contract and reject wrong-tree or wrong-config tokens before model construction.
Document parser-inert portable validation, descriptor-anchored whole-generation publication, source-bound Web authorization, and the temporary full-rebuild behavior for vector incremental requests.
@github-actions github-actions Bot added the type/test Test-related label Aug 11, 2026

@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: 1d29793249

ℹ️ 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 codenib/_captured_directory.py
Comment thread codenib/_captured_directory.py
Comment thread codenib/_captured_directory.py Outdated
Bound aggregate workspace-plan path metadata before provisioning and make return-record construction participate in the terminal failure transition. Record the provider-neutral publication foundation in the storage roadmap.

Verified with 123 targeted tests plus Black, isort, flake8, py_compile, and git diff --check.
@github-actions github-actions Bot added the type/docs Documentation label Aug 11, 2026
@fishmingyu
fishmingyu marked this pull request as draft August 11, 2026 23:49
@fishmingyu
fishmingyu force-pushed the fix/native-vector-authority-closure-v2 branch from 9f6b535 to f0bfcef Compare August 13, 2026 21:22
Base automatically changed from fix/native-vector-authority-closure-v2 to main August 13, 2026 21:35
@fishmingyu

Copy link
Copy Markdown
Member Author

Superseded by #619. The bounded-JSON and credential-classifier slices landed through #616, and the detached workspace identity foundation landed through #586. #619 forward-ports only the remaining provider-neutral workspace publication gate onto current main. The original branch is intentionally retained while the dependent producer work is restacked.

@fishmingyu fishmingyu closed this Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/docs Documentation type/test Test-related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant