Skip to content

test(artifacts): gate the protected-file refusal test on security-module - #8561

Merged
senamakel merged 2 commits into
tinyhumansai:mainfrom
M3gA-Mind:fix/ts-e2e-029-gate-protected-file-test
Nov 6, 2026
Merged

senamakel merged 2 commits into
tinyhumansai:mainfrom
M3gA-Mind:fix/ts-e2e-029-gate-protected-file-test

Conversation

@M3gA-Mind

@M3gA-Mind M3gA-Mind commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #8560. Merge #8560 first; this PR then carries one commit (6786d69b07). Draft until #8560 lands.

Summary

  • artifacts::tiny_store::tests::…::a_protected_file_inside_the_working_folder_is_refused fails in a build without security-module. It asserts TinySecurity's protected-path floor, and that floor does not exist when security is disabled.
  • This PR gates the test on security-module, like its sibling the_guarded_roots_refuse_to_read_a_protected_file.

Base: stacked on #8560 (the tiny_store_tests.rs split), because the test lives in that PR's new tiny_store_guard_tests.rs. On main it is still in tiny_store_tests.rs, so a PR off main would conflict with #8560. Merge #8560 first; this then carries one commit.

Problem

Solution

  • #[cfg(feature = "security-module")] on the test, with a comment naming the floor.

Submission Checklist

  • N/A: no test added; an existing test is gated to the build where its contract holds.
  • N/A: diff coverage — no product lines change.
  • N/A: no feature row added, removed or renamed in docs/TEST-COVERAGE-MATRIX.md.
  • N/A: no matrix feature IDs affected.
  • No new external network dependencies introduced.
  • N/A: no release-cut surface changes (docs/RELEASE-MANUAL-SMOKE.md).
  • N/A: no GitHub issue tracks this. It is TinySecurity E2E review finding TS-E2E-029.

Validation (cuttlefish, CF-W1-fix-029-1)

Check This PR (6786d69) Without the cfg (CF-W1-fix-layout-1, 93a9a96)
cargo fmt --check green green
pnpm rust:layout red only on main's core-hosted-free check (security_mode.rs:93), pre-existing same
cargo check --locked, core ± security-module green / green green / green
artifacts::tiny_store::tests:: with security-module 24 passed, 0 failed (5 under guard_tests::) 24 passed, 0 failed
artifacts::tiny_store::tests:: without security-module 17 passed, 0 failed; the gated test is not compiled in 17 passed, 1 failed (this test, :68)
clippy (head) 19, same as main 19, same as main

Impact

  • None at runtime.

Related


AI Authored PR Metadata (required for Codex/Linear PRs)

Linear Issue

  • Key: N/A
  • URL: N/A

Commit & Branch

  • Branch: fix/ts-e2e-029-gate-protected-file-test
  • Commit SHA: 6786d69b0729325e93494935697d78d4f4ffb8e2

Validation Run

  • N/A: pnpm --filter openhuman-app format:check, no frontend change
  • N/A: pnpm typecheck, no TypeScript change
  • Focused tests: on cuttlefish (see table)
  • Rust fmt/check (if changed): on cuttlefish (see table)
  • N/A: Tauri fmt/check, no shell change

Validation Blocked

  • command: N/A
  • error: N/A
  • impact: N/A

Behavior Changes

  • Intended behavior change: none; test gating only.
  • User-visible effect: none.

Parity Contract

  • Legacy behavior preserved: the test still runs in every security-module build.
  • Guard/fallback/dispatch parity checks: N/A

Duplicate / Superseded PR Handling

  • Duplicate PR(s): none
  • Canonical PR: this
  • Resolution (closed/superseded/updated): N/A

Summary by CodeRabbit

  • Tests
    • Expanded automated coverage for artifact revisions, access to protected files, trusted folder selection, and file-path resolution.
    • Reorganized existing test coverage for these scenarios.

tiny_store_tests.rs had grown to 784 lines, over rust:layout's 750-line
limit. The trailing file-root and protected-file tests move unchanged into
tiny_store_guard_tests.rs, a child module of the same tests module, so they
keep the shared helpers through super::*.
a_protected_file_inside_the_working_folder_is_refused asserts TinySecurity's
protected-path floor. Without security-module, security is disabled and
there is no floor, so the create succeeds and the test failed in that
build. It now runs only where the floor exists, like its sibling
the_guarded_roots_refuse_to_read_a_protected_file.
@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The pull request moves artifact file-guard tests into a dedicated test module and registers it in the existing test module. The tests cover protected-file handling, trusted file roots, artifact revision, and stored file-key resolution.

Changes: Artifact file-guard tests

Layer / File(s) Summary
Guard test coverage
crates/openhuman-core/src/artifacts/tiny_store_guard_tests.rs, crates/openhuman-core/src/artifacts/tiny_store_tests.rs
The dedicated module contains tests for protected-file rejection, guarded-root reads, trusted-root selection, artifact revision, and stored file-key resolution. The existing test module registers the new module and removes the prior test definitions.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Possibly related PRs

  • tinyhumansai/openhuman#8560: Moves guarded-file tests without changing their bodies; this PR includes the test relocation.
  • tinyhumansai/openhuman#7888: Introduces the versioned artifact service and file-root integration, including artifact revision tests moved here.
  • tinyhumansai/openhuman#8115: Adds stored_file_path and a test for relative and absolute FileRef keys, which this PR moves into the guarded-file test module.

Suggested labels: rust-core

Suggested reviewers: senamakel

Merge Risk: Minimal · up to 6786d

The change preserves the moved tests and limits the protected-path assertion to builds that provide that protection. No actionable merge-blocking issue remains, subject to normal checks.

Pre-merge checks: Passed 5

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the feature gate added to the protected-file refusal test.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks each guarded way,
And tests where trusted files may stay.
A key path lands beneath its home,
While absolute paths still roam.
The test files hop to a new burrow.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: dae87b53-2f05-4797-9d5b-3841b3494127
Commits

Reviewing files that changed from the base of the PR and between 6043171 and 6786d69.

Files selected for processing: 2

  • crates/openhuman-core/src/artifacts/tiny_store_guard_tests.rs
  • crates/openhuman-core/src/artifacts/tiny_store_tests.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@M3gA-Mind
M3gA-Mind marked this pull request as ready for review November 6, 2026 08:52
@tinysweeper

tinysweeper Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Tiny Sweeper review

Reviewed head: 6786d69b0729325e93494935697d78d4f4ffb8e2

Verdict: Ready for maintainer review · Priority: none
Coverage: Reviewed 2 of 2 files.
Pull request purpose (title): test(artifacts): gat…

Diagnostics and supporting details

Full summary

Pull request purpose (title): test(artifacts): gate the protected-file refusal test on security-module. This PR gates the artifacts protected-file refusal test on the `security-module` feature, matching its sibling test, because TinySecurity's protected-path floor does not exist when security is disabled. The change is test-only: it moves five existing tests into a new `tiny_store_guard_tests.rs` module declared via `#[path]` from `tiny_store_tests.rs`, and widens `a_protected_file_inside_the_working_folder_is_refused` to `#[cfg(feature = "security-module")]` with an explanatory comment. No push delta was available for review.

Review snapshot

Change surface Files Review signal Count
Production 0 Active findings 0
Tests 2 Noted findings 0
Documentation 0 Resolved findings 0
Configuration 0 Pending checks/questions 0

Completeness: Complete
Test assessment: Test coverage is assessed from changed tests and lane evidence; execution is not claimed without trusted check data.

What changed

The pull-request diff adds `crates/openhuman-core/src/artifacts/tiny_store_guard_tests.rs` containing five tests relocated from `tiny_store_tests.rs`, and registers it in `crates/openhuman-core/src/artifacts/tiny_store_tests.rs` via `#[path = "tiny_store_guard_tests.rs"] mod guard_tests;`. The protected-file refusal test now carries `#[cfg(feature = "security-module")]`, joined by a comment explaining that the refusal is TinySecurity's protected-path floor and that a build without the security module has no floor. Test bodies and assertions are otherwise carried over unchanged, so there is no runtime behavior change.

Features

  • Internal refactor — Guard tests split into a dedicated sibling test module: Five existing tiny_store tests (create/revise under an earlier trusted files folder, protected-path refusal at create, guarded-root read refusal, working-folder containment, stored-key resolution) now live in `tiny_store_guard_tests.rs`, declared from `tiny_store_tests.rs` with `#[path]` and beginning with `use super::*;`, matching the repository's sibling-test-file layout rule. Assertions are preserved. (crates/openhuman-core/src/artifacts/tiny_store_guard_tests.rs, crates/openhuman-core/src/artifacts/tiny_store_tests.rs use tiny_artifacts::{)

Tests

  • moved_unit_tests — The four other relocated tests continue to exercise create/revise against an earlier trusted files folder, refusal to read a protected file via guarded roots while still reading an ordinary file, non-trust of a working folder containing the workspace, and stored-key resolution under the version files folder versus an absolute key.: The tests lane states the test bodies are unchanged apart from the widened attribute and that they still exercise these paths; no findings were raised. (crates/openhuman-core/src/artifacts/tiny_store_guard_tests.rs, crates/openhuman-core/src/artifacts/tiny_store_tests.rs)

Findings

No active actionable findings.

Before merge

None.

Agent review details

critique

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: Critique lane answered, covering both changed files, with zero findings.
  • Lane summary: Reviewed 2 files; 0 findings. _The code index is behind this pull request (indexed at `90c5199a04d5`), so retrieved context may be out of date._

security

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: Security lane answered with zero findings; the change is test-only and does not alter the protected-path enforcement itself.
  • Lane summary: Reviewed 2 files; 0 findings. _The code index is behind this pull request (indexed at `90c5199a04d5`), so retrieved context may be out of date._

tests

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Lane summary: This change only reorganises existing tests: it moves five already-written tests out of `tiny_store_tests.rs` into a new `tiny_store_guard_tests.rs` module declared via `#[path]`, which is exactly the layout the repository's test-file rules require (`use super::*;` on the first line, no inline `#[cfg(test)] mod tests`, no `_test.rs` suffix). The test bodies are unchanged apart from one attribute being widened to `#[cfg(feature = "security-module")]`, and that widening is consistent with the test's own comment. No production behaviour changes, so no new behavioural test is owed; the moved tests retain their assertions and still exercise create/revise, protected-path refusal, root containment, and stored-key resolution. _The code index is behind this pull request (indexed at `90c5199a04d5`), so retrieved context may be out of date._

commits

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: Commits lane reports no sensitive content in committed files.
  • Lane summary: No sensitive content in committed files. _The code index is behind this pull request (indexed at `90c5199a04d5`), so retrieved context may be out of date._

description

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: Description lane confirms the diff matches the stated intent: the attribute widens to `security-module` to match its sibling, and the comment naming TinySecurity's protected-path floor explains why.
  • Lane summary: The diff does what the description says: the protected-file refusal test now carries `#[cfg(feature = "security-module")]`, matching its sibling, and the comment naming TinySecurity's protected-path floor explains why. The test move into `tiny_store_guard_tests.rs` comes from the stacked base and matches the repository's sibling-test-file rule. No defects found. _The code index is behind this pull request (indexed at `90c5199a04d5`), so retrieved context may be out of date._
Evidence and run details
  • Models: ladder/vectors-oai3, deepseek-v4.1-flash
  • Spend: $0.000085
  • Tokens: 181969 input · 3564 output · 24064 cached · 280 embedding
  • Updated: 2026-11-06T08:53:53Z
Head State Pass summary
6786d69b0729 ready for maintainer review 0 active finding(s), 0 resolved finding(s) (at 2026-11-06T08:53:53Z)

tinysweeper 0.1.2

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 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-11-06T08:54:40.785841Z 6786d69 Draft marked ready
ℹ️ 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.

@tinysweeper tinysweeper 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.

tinysweeper found nothing blocking. Approving.

Diagnostics

Total spend: $0.0001

@tinysweeper tinysweeper Bot added the priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect. label Nov 6, 2026
@coderabbitai coderabbitai Bot added the rust-core Core Rust runtime in src/: CLI, core_server, shared infrastructure. label Nov 6, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Nov 6, 2026
@M3gA-Mind
M3gA-Mind dismissed coderabbitai[bot]’s stale review November 6, 2026 08:59

The merge-base changed after approval.

@senamakel
senamakel merged commit 1095e41 into tinyhumansai:main Nov 6, 2026
27 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect. rust-core Core Rust runtime in src/: CLI, core_server, shared infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants