Skip to content

refactor: Centralize Admin authenticated JSON transport - #29

Open
sidneyswift wants to merge 2 commits into
mainfrom
codex/untangle-frontend-2026-11-09
Open

sidneyswift wants to merge 2 commits into
mainfrom
codex/untangle-frontend-2026-11-09

Conversation

@sidneyswift

@sidneyswift sidneyswift commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Share HTTP/Bearer/JSON error policy across 11 resource adapters while preserving each response shape, query and historical error precedence. Move sandbox fetcher into the owning recoup domain.

Verification

25 original parity checks pass against old/new adapters; the expanded 27-test suite passes after review; typecheck and production build pass. Test harness requires Node 24; application behavior unchanged. Independent review completed.

Scope and review

Part of the user-requested Recoup monorepo untangle-codebase workflow. Audit and decision log preceded implementation. Changes stay in this owning repository; no production deployment or main-branch merge requested. No broad comment/test-pruning sweep. Existing local work and retired checkouts preserved.

Each repository PR is independently reviewable; the Mono report will collect the coordinated audit, retained cases and check limitations.

Review follow-up

Error JSON is now typed as unknown and narrowed before field access. Malformed top-level null/primitive/array responses get the HTTP fallback. Tests preserve error/message ordering and coercion of zero, false and empty strings. This is the only intentional malformed-response behavior correction; typecheck and focused lint pass.

@vercel

vercel Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
admin Ready Ready Preview Nov 9, 2026 4:19am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f8d98f4c-f7f9-46f9-adac-ce5fafb61003
  • 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

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 17 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="tests/adminRequests.test.mjs">

<violation number="1" location="tests/adminRequests.test.mjs:1">
P2: Custom agent: **Enforce Clear Code Style and Maintainability Practices**

This new file is 209 lines, more than double the 100-line cap in the style guideline, and it bundles three distinct test concerns into one file: request-shape assertions for all 11 adapters, error-precedence/fallback assertions, and standalone edge-case tests. Split the edge-case tests and part of the adapter cases into separate files so each file stays under 100 lines.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

@@ -0,0 +1,209 @@
import assert from "node:assert/strict";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: Custom agent: Enforce Clear Code Style and Maintainability Practices

This new file is 209 lines, more than double the 100-line cap in the style guideline, and it bundles three distinct test concerns into one file: request-shape assertions for all 11 adapters, error-precedence/fallback assertions, and standalone edge-case tests. Split the edge-case tests and part of the adapter cases into separate files so each file stays under 100 lines.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At tests/adminRequests.test.mjs, line 1:

<comment>This new file is 209 lines, more than double the 100-line cap in the style guideline, and it bundles three distinct test concerns into one file: request-shape assertions for all 11 adapters, error-precedence/fallback assertions, and standalone edge-case tests. Split the edge-case tests and part of the adapter cases into separate files so each file stays under 100 lines.</comment>

<file context>
@@ -0,0 +1,209 @@
+import assert from "node:assert/strict";
+import { afterEach, test } from "node:test";
+import { API_BASE_URL } from "../lib/consts.ts";
</file context>

Comment thread lib/recoup/requestAdminJson.ts Resolved

This branch was successfully deployed

1 active deployment
Preview — dd78e78f Deployed Nov 9, 2026 by vercel[bot]
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.

1 participant