Skip to content
joinery / docs

🔎 Architecture follow-ups across the workspace

1564 words · updated 6 hours agodocs/audits/2026-10-21-monorepo.md

🔎 Architecture follow-ups across the workspace

Context

This audit holds what was left over from a macro architecture review of the whole workspace on 2026-10-21, after the owner's answers removed what was intended. It is not a full read of one project. Every file it cites was read, and so was each project's package.json, README and AGENTS.md, along with the workflows, the hooks and nx.json.

Confirmed means checked against the cited files, and for a missing gate, a grep showing that nothing in .husky/, .github/ or infrastructure/scripts/ runs it. Likely means reasoned about a host or a run that wasn't exercised. Line numbers are as of commit.

Several things are deliberately left out:

  • packages/ui, which is intended boilerplate.
  • The design lab.
  • The Google Cloud move, which is decided and pending.
  • The release flow, which is intended.
  • The boundary model's scope:* and type:integration rework, already under way.
  • Work tracked elsewhere:
    • #280 covers @joinery/observability.
    • #281 covers docs drift.
    • #282 covers naming and folder conventions.
    • The content audit covers @joinery/content.

Bugs

IDWhereWhat goes wrongFixStatus
B1apps/huella-legal/modules/requiredEnv.ts:21, the module's setupLikely. The gate throws only when process.env.CONTEXT === "production", a variable only Netlify sets. On the host 0030 decided on (Cloud Run, node-server), CONTEXT is unset, so a production build with every required variable missing passes without a word, and the first sign is a page failing at runtime. The check also reads the build environment, while the app's README says every variable is read at startup so one artifact runs anywhere; on a container host those are two different environmentsCheck the same lists in a Nitro startup plugin, so the runtime environment is what gets checked on any host, and key the build-time failure to a flag the deploy sets rather than to CONTEXTwont-fix — the gate now keys on NUXT_SITE_ENV, which the deploy sets on any host, and a build-time check is enough on a host that shares build and runtime settings; whether the next host does is tracked in #244

Duplication

IDCopiesConsolidate intoStatus
D1The repo invariants, three times: .claude/hooks/check-invariants.sh (blocking, Claude only), apps/developer-portal/tools/lib/invariants.ts (advisory; its header says it is "Duplicated from .claude/hooks/check-invariants.sh"), and the prose rules in the root AGENTS.md under "Things that look reasonable and are wrong here"One check under infrastructure/scripts (Q1). The hook shells out to it, and the portal reports its resultfixed #405: pnpm invariants:check holds the bans; the hook runs it and the portal reports its --json findings
D2content and i18n repeat toWordChars (packages/content/src/core/contentKey.ts:5, packages/i18n/src/core/translationsKey.ts:5) and rethrowAsUpstreamError (both src/core/adapters/clients/OfetchHttpClient.ts:5). They also repeat rethrowAsHttpError and throwUnavailableError (packages/content/src/nuxt/runtime/server/utils/useContent.ts:37,51, packages/i18n/src/nuxt/runtime/server/translations.get.ts:45,51), registry.ts, the vendor errors with assertConfigured, and the baseURL check (WordpressProvider.ts:17, TranslationProvider.ts:31). Around the copies the contracts disagree: HttpClient.get returns { data, headers } in content and T in i18n, and an upstream 400/404 passes through in content but is always a 502 in i18nFirst align the two contracts in place. Then extract a small vendor kit as a leaf both may depend on: the generic errors, the HttpClient port and ofetch adapter, a registry factory, assertConfigured, the h3 error mapping and the key helper. Each package keeps its own domain errors. The kit needs its own tag rowwont-fix — the contracts were aligned in #283, and the shared kit waits for a third vendor package, per the deferred tables in the content and i18n READMEs
D3The checkout → pnpm/action-setup → actions/setup-node → pnpm install --frozen-lockfile --ignore-scripts sequence in .github/workflows/ci.yml (two jobs), developer-portal-deploy.yml and release.ymlOne composite action under .github/actions/fixed #405: .github/actions/install
D4Ten root package.json scripts (dev, test:coverage, the three issue:*, agents:sync, docs:drift, docs:map, package:check, review:version) each spell out pnpm --dir infrastructure/scripts exec node --disable-warning=ExperimentalWarning src/<name>/index.tsOne entry point in @joinery/scripts that the root scripts call by name, so the Node flags live in one placefixed #405: the scripts package's cli script holds the Node flags

Quality

IDWhereIssueFixStatus
Q1.claude/hooks/check-invariants.sh, .husky/pre-commit, .github/workflows/ci.ymlConfirmed. Only the Claude PostToolUse hook enforces the code bans in the root AGENTS.md: no lifecycle script, no build script in packages/*, no hand-edited version, no real URL. No Git hook or CI job checks them. A Codex or human edit that adds a postinstall passes every gate, and it works locally while doing nothing in CI, which is the failure the ban exists to prevent. docs/concepts/agent-setup.md says these checks also run in scripts and CIPort the bans into an infrastructure/scripts check, run it in pre-commit and ci.yml, and have the hook call it. Docs checks stay advisory, per 0025fixed #405: pnpm invariants:check runs in the Claude hook, pre-commit and ci.yml
Q2infrastructure/scripts/src/package-contracts, the root package:check scriptConfirmed. pnpm package:check validates every manifest's name, version, module type, exports and peers. No hook, CI job or Nx target runs it, so it only catches what someone remembers to run it forRun it beside Q1's check in pre-commit and ci.ymlfixed #405: the package contracts are part of pnpm invariants:check
Q3packages/configs/src/eslint/lib/ (boundaries.ts, coreIsolation.ts, layerIsolation.ts, templateCalls.ts), src/vitest/setup/prepareNuxt.mjs, src/vitest/setup/consoleGuard.ts, src/playwright/server.ts, src/playwright/teardown.tsConfirmed. Every other project's lint, test and e2e gates come from this package, and it has no spec at all. A regression in the boundary table, the custom templateCalls rule or prepareNuxt weakens every project silently: lint and tests still pass, they just check lessAdd RuleTester specs for the custom rules, and a fixture spec proving the boundary config rejects a forbidden edge. Add unit specs for the setup and Playwright helpers, which needs a vitest.config.ts in configsfixed #231/#232: rule and factory specs, and #405 adds boundaries.spec.ts rejecting a forbidden edge
Q4infrastructure/scripts/eslint.config.ts, 0004 lines 111–116Confirmed. 0004 names an import-direction rule for **/domain/** (no fs, no subprocess, no prompts) as its follow-up. It never landed, and the package's ESLint config is the plain node preset. All nine script folders keep to the layout today, by convention onlyAdd a no-restricted-imports block for **/domain/** to configs, shaped like layerIsolation.ts, and apply it in the scripts configfixed #405: eslint.pureDomain, appended by the scripts config
Q5packages/configs/src/eslint/lib/ignores.ts:1, baseIgnoresConfirmed. "*.config.ts" is in the base ignore list, so no project's nuxt.config.ts, vitest.config.ts, eslint.config.ts or playwright.config.ts is ever linted or formatted. Some carry real logic: huella-legal's nuxt.config.ts holds inline modules and pages:extend hooks. The entry came in with da93fcf ("fix: Eslint configs") and no stated reasonLint them with a block that isn't type-checked, or write the reason for excluding them into ignores.tsfixed #405: root config files are linted with the type-aware rules off
Q6apps/huella-legal/nuxt.config.ts:38-44, :89 and :101-102, the requiredEnv blocksConfirmed. The app lists the packages' own runtime keys (NUXT_CONTENT_VENDOR_BASE_URL, NUXT_TRANSLATIONS_VENDOR_*). Which keys a vendor needs is package knowledge. Every new app copies the list, and a key renamed inside a package leaves each app checking the old nameHave each package's Nuxt module declare and check the keys its configured vendor needs, so the app lists only its own. Do it together with B1fixed #252: dropping @joinery/i18n and hardcoding the WordPress root left the app no package keys to list
Q7.github/workflows/developer-portal-deploy.yml:44Likely. Every push to master runs the whole-workspace pnpm test:coverage, with no paths filter, right after ci.yml has tested the affected projects of the same commit. The workflow passes no NX_CLOUD_ACCESS_TOKEN, so unless the remote cache answers anyway, a docs-only merge re-runs every suite in the repoPass the cache token, or path-filter the workflow to what the portal rendersfixed daac93e (#330)
Q8renovate.json, .github/dependabot.ymlConfirmed. Both dependency bots are configured. Renovate has authored no commit in the history; Dependabot has authored 18, and dependabot-auto-merge.yml is built around it. renovate.json reads as active config, and it isn'tDelete renovate.json, or retire Dependabot if Renovate is the intentfixed
Q9apps/huella-legal/package.json:52, idbConfirmed. It is declared as a dependency, and nothing in the app imports itRemove itfixed

Order

  1. Q1, Q2 and D1 together. One gate in scripts makes the bans hold for every author. D1 disappears once the hook and the portal both call it.
  2. Q3 next. It pins the presets every other project's gates depend on. Q4 adds a rule, which should arrive with its spec.
  3. B1 and Q6 before the Cloud Run move. They touch the same module, and Q6 decides where B1's lists come from.
  4. D2 when the next vendor package or a second consumer appears. The contract alignment can go first, on its own.
  5. Q7, D3, Q8, D4, Q5 and Q9 are independent and small, so take them in any order.