Skip to content

fix!: simplify setup and secure auth, storage, and job recovery - #124

Draft
Winter-Soren wants to merge 8 commits into
mainfrom
fix/audit-cleanup-breaking
Draft

Winter-Soren wants to merge 8 commits into
mainfrom
fix/audit-cleanup-breaking

Conversation

@Winter-Soren

@Winter-Soren Winter-Soren commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Problem and result

Local setup had inconsistent environment loading and MongoDB targets, optional integrations could block startup, and browser storage clients used public provider credentials. This change gives each component a documented setup path, moves cloud pinning behind authenticated server routes, and makes authentication failures recoverable.

The existing README's project, research, and integration material is retained. New setup and credential-acquisition guidance explains how to enable optional features without removing their working code when credentials are unavailable.

Scope

  • Unify native/backend configuration and Mongo routing; make Bedrock initialization lazy and chemistry an explicit install extra. Package prompts, sibling modules, and Toju worker assets correctly.
  • Enforce legacy chat/pharma ownership and forward signed identity from run/chat/pharma proxies. Recover from unavailable MongoDB and failed OTP delivery without leaving forms stuck.
  • Keep Pinata/Lighthouse credentials server-side, preserve legacy pin records, and protect shared-provider content from unsafe permanent deletion. Initialize Helia on demand without deleting IndexedDB after timeouts.
  • Offload blocking finance computation, reconcile interrupted jobs belonging to this coordinator, and stop startup scripts from killing port owners or deleting runtime data.
  • Fix frontend lifecycle errors and vault route rendering; complete the existing six-stage landing flow with result collection and accurate payment/provenance descriptions.
  • Move 41 non-README documents into the documentation submodule with a path index and migration guide.

Relative to QMesh's main, this branch also includes three earlier commits: bundled local fonts, restored IPFS exports/Helia-compatible DAG-JSON, and removal of .github/workflows/promote-vercel-production.yml. Reviewers should account for that deployment-automation change; these are part of the branch's eight commits, not new cleanup additions.

BREAKING CHANGE: migration required

Preserve the ! titles and BREAKING CHANGE: notes if squashing.

  • Rename NEXT_PUBLIC_PINATA_JWT to PINATA_JWT and NEXT_PUBLIC_LIGHTHOUSE_KEY to LIGHTHOUSE_API_KEY; rebuild and rotate previously exposed keys. Uploads require sign-in. Permanent deletion returns 409; use the provider dashboard after checking shared ownership.
  • Preserve existing database names explicitly. Backend services now share the selected Mongo target; settings changes do not migrate records. Set frontend MONGODB_DB_NAME explicitly to preserve the auth database.
  • Update anonymous legacy chat/pharma callers and deploy matching frontend/backend auth-bridge configuration. Existing shared/unowned records are not reassigned automatically.
  • Use uv sync --locked instead of the removed dev extra; add --extra pharma for chemistry. Direct prompt paths changed.
  • Review Compose's fixed internal topology and optional storage profiles. run-clean no longer deletes runtime state; busy ports fail safely. Restart recovery fails interrupted attributed jobs and reconciles their holds.
  • Initialize the documentation submodule and update old paths. Relocated AGENTS.md/CLAUDE.md guidance must be loaded explicitly.

Full migration, probable regressions, rollout, and rollback.

Validation at head 9507b6d61

  • Backend: 1,198 passed, 114 skipped in an isolated source copy without private env files; 139 upstream/deprecation warnings.
  • Frontend: 196 passed in separate processes. TypeScript and production build passed. Source lint: 0 errors, 17 existing warnings; only the upstream Mol* bundle is excluded.
  • Toju: 4 passed. Lock validation and Python package/assets smoke checks passed.
  • 98 local documentation links resolved. Private-value and credential-pattern checks passed; historical archive formatting is preserved.
  • GitGuardian and the Vercel preview passed for this same head in the origin PR. Those results do not validate a merge with the current QMesh main or replace this PR's checks.

Dependencies and merge readiness

  • Merge documentation PR #4 first. Preserve pinned commit ac826c6 with a merge commit, or update this branch's submodule pointer if that PR is squash/rebase merged.
  • GitHub currently reports merge conflicts with QMesh main. Main contains the newer SIWE sign-in PR #100, which is not yet integrated into this branch. Reconcile overlapping auth/env/dependency changes while preserving SIWE, then rerun the relevant tests before marking ready.
  • AWS access remains unavailable, blocking hosted-backend deployment and a complete job smoke test. Docker, live storage/wallet/payment integrations, native chemistry, and full production account creation/sign-in remain unverified.

This PR is a draft for contributor review. Back up configuration/data, drain active work, and deploy matching frontend/backend versions after staging validation. Roll back matching artifacts and configuration without restoring exposed credentials or public access. No production source deployment, database migration, release tag, or main-branch merge is performed by opening this PR.

Uncommitted local files are excluded.

Use one native dotenv path and Mongo target across services. Keep optional
Bedrock lazy, move chemistry into an explicit pharma extra, package runtime
assets, and align the Compose topology with the API and peer listeners.

Enforce legacy chat/pharma ownership, offload synchronous finance work,
reconcile this coordinator's interrupted jobs, and preserve runtime data
when startup ports are busy. Keep merged optional integrations available.

Validation: 1,198 backend tests passed, 114 live/optional tests skipped;
Toju 4 tests passed; uv lock check and packaging smoke checks passed.
Docker and the unavailable AWS host were not exercised.

BREAKING CHANGE: Preserve QB2_MONGODB_DATABASE explicitly and configure the
selected Mongo target. Install chemistry with --extra pharma; replace the
removed dev extra with the default dependency group. Legacy chat/pharma
clients must authenticate and own their records. Deploy a matching auth
bridge secret on both servers. Compose uses fixed internal API/peer paths
and optional storage profiles; run-clean no longer deletes runtime data.
See documentations/guides/audit-cleanup-migration.md before upgrading.
Move Pinata and Lighthouse uploads behind authenticated server routes and
forward signed session identity to run, chat, and pharma backends. Preserve
provider choices and legacy pin metadata while preventing shared-account
permanent deletion through the API.

Recover form loading state after auth failures, return bounded JSON errors,
retry rejected Mongo connections, and surface OTP provider failures. Start
Helia on demand without deleting local content after a timeout.

Validation: isolated frontend tests, TypeScript, source lint and synthetic
production build pass. Real provider and wallet calls remain unverified.

BREAKING CHANGE: Rename NEXT_PUBLIC_PINATA_JWT to PINATA_JWT and
NEXT_PUBLIC_LIGHTHOUSE_KEY to LIGHTHOUSE_API_KEY, then rebuild and rotate
previously exposed keys. Uploads require sign-in; permanent deletion now
returns 409 and requires the provider dashboard. Run/chat/pharma proxies
require matching backend ownership and bridge configuration. Preserve the
auth database with MONGODB_DB_NAME. See the migration guide for rollout.
Derive local display state from its inputs, retain bounded pharma history,
reject stale vault enrichment responses, and hydrate provider preferences
without synchronous effect updates. Resolve promised vault route params
with React use instead of unsupported async client components.

Exclude only the upstream Mol* bundle from ESLint; keep source rules active.
Add focused rendering/route tests and preserve existing integration code.

Validation: full source lint has zero errors (17 existing warnings),
TypeScript and production build pass; 196 frontend tests pass in isolated
processes. Browser/WebGL and live integration coverage remain limited.
Connect the existing scroll helper and its reading holds to six architecture
stages, including result collection. Keep the existing plate interaction
and describe gateway authorization and optional provenance accurately.

Validation: architecture sequence and reversible motion tests pass;
TypeScript and the synthetic production build pass.
Preserve the README's project and integration material, add a focused local
setup path and credential-acquisition links, and move non-README guides
into the documentation submodule with an old-to-new index.

Record confirmed compatibility breaks separately from possible regressions,
with rollout/rollback instructions and validation limits. Missing optional
credentials are setup gaps, not grounds for deleting working integrations.

Validation: 98 local documentation links resolve; authored-guide and
application whitespace checks pass. Archived formatting is preserved.

BREAKING CHANGE: Non-README documentation paths now live in the initialized
documentations submodule. Update links/scripts and explicitly load relocated
frontend AGENTS.md/CLAUDE.md guidance. Read
 documentations/guides/audit-cleanup-migration.md before upgrading; this
change does not migrate databases or deploy production source.
@Winter-Soren Winter-Soren added bug Something isn't working documentation Improvements or additions to documentation labels Oct 31, 2026

This branch has not been deployed

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

Labels

bug Something isn't working documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant