Skip to content

test(docs): pin the gated content route, route limiters and fail-closed tier defaults - #39

Open
SaulBuilds wants to merge 2 commits into
mainfrom
dgx/docs-gap-pins
Open

SaulBuilds wants to merge 2 commits into
mainfrom
dgx/docs-gap-pins

Conversation

@SaulBuilds

Copy link
Copy Markdown
Contributor

Tests only. This adds three test files that pin access-control guards on the routes and on the content pipeline. Before this PR, removing any one of these guards left the suite green.

What is pinned

  • /api/content, commercial/academic branch: the entitlement gate, the org scope, entitlement expiry, the embargo (423), the disclosure acknowledgement (412), and the 503 that withholds a body when the read cannot be access-logged.
  • The route-level limiter on /api/chat and /api/sandbox/relay. Memory and the model provider are mocked. With no relay URL the relay fails closed, so no test request leaves the process.
  • Repo-tier resolution: a partial MEMORY_REPO_TIERS override is merged over the declared map. This is only visible with MEM_DEFAULT_TIER=public, so the test sets it. An unlisted repo with no default resolves to confidential.
  • Principal lookup: a gated tier is never granted to a non-verified KYC status. A verified control keeps its tier.
  • Content generator: the real scripts/build-content.mjs runs against a temp-dir fixture corpus. Gated bodies stay out of content.ts and go into the server-only content-bodies.ts, and no "use client" module imports the bodies. A fixture is needed because the committed corpus has no gated pages today.
  • Mermaid initialises with securityLevel: "strict".

Standard: met

  • Revert check: each guard was reverted on its own (13 single-line mutations) with the full suite run each time. Every mutation turned at least one of the new tests red on an assertion, and each passes again once the guard is restored.
  • Counts: vitest run went from 124 to 145 passing (4 skipped, unchanged). tsc --noEmit is clean.
  • Host safety: the generator test writes only to an os.tmpdir() dir that it removes. No network calls.
  • Commands: npx vitest run --maxWorkers=2, npx tsc --noEmit.
  • Open: in production, the access-log sink is still the in-memory default, because setAccessSink is never called. Durable persistence is a separate change and is not part of this PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KGMeatV8UjtCB4CTbWuAv4

…ed tier defaults

- /api/content commercial/academic branch: entitlement gate, org scope, expiry, embargo,
  disclosure acknowledgement and the 503 when a read cannot be logged.
- Route-level limiter on /api/chat and /api/sandbox/relay (memory/provider mocked; relay
  fails closed with no URL, so no request leaves the process).
- Repo-tier override merges over the declared map (visible with MEM_DEFAULT_TIER=public);
  an unlisted repo defaults to confidential.
- Principal lookup refuses a gated tier for a non-verified KYC status.
- The content generator, run on a temp-dir fixture corpus, keeps gated bodies out of the
  client module and in the server-only module; no client component imports the bodies.
- Mermaid initialises with securityLevel "strict".

Each guard was reverted on its own and the matching test went red; 124 -> 145 passing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KGMeatV8UjtCB4CTbWuAv4

@BerryManifold BerryManifold left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Automated Codex static review of 106dd4831ed98382a43259c1b04e45459fa07e7a is complete. Result: clean; details retained privately. Details and coverage limits are recorded in the project's private review log. No tests were executed by this reviewer. Both account submissions represent the same Codex review, not independent reviews.

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

Automated Codex static review of 106dd4831ed98382a43259c1b04e45459fa07e7a is complete. Result: clean; details retained privately. Details and coverage limits are recorded in the project's private review log. No tests were executed by this reviewer. Both account submissions represent the same Codex review, not independent reviews.

@BerryManifold BerryManifold left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Automated Codex static review of 6986c2062c9216a4ba41be3316733b25ce98e839 is complete. Result: clean; details retained privately. Details and coverage limits are recorded in the project's private review log. No tests were executed by this reviewer. Both account submissions represent the same Codex review, not independent reviews.

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

Automated Codex static review of 6986c2062c9216a4ba41be3316733b25ce98e839 is complete. Result: clean; details retained privately. Details and coverage limits are recorded in the project's private review log. No tests were executed by this reviewer. Both account submissions represent the same Codex review, not independent reviews.

@BerryManifold BerryManifold left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Automated Codex static review of 6986c2062c9216a4ba41be3316733b25ce98e839 is complete. Result: clean; details retained privately. Details and coverage limits are recorded in the project's private review log. No tests were executed by this reviewer. Both account submissions represent the same Codex review, not independent reviews.

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

Automated Codex static review of 6986c2062c9216a4ba41be3316733b25ce98e839 is complete. Result: clean; details retained privately. Details and coverage limits are recorded in the project's private review log. No tests were executed by this reviewer. Both account submissions represent the same Codex review, not independent reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

betanet Betanet → mainnet program (board #5)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants