Skip to content

feat(mobile): consume generated Theorem contracts - #209

Open
Travis-Gilbert wants to merge 1 commit into
mainfrom
codex/mobile-contract-distribution
Open

feat(mobile): consume generated Theorem contracts#209
Travis-Gilbert wants to merge 1 commit into
mainfrom
codex/mobile-contract-distribution

Conversation

@Travis-Gilbert

Copy link
Copy Markdown
Owner

Summary

  • add @commonplace/mobile-contracts with generated types and canonical fixtures pinned to Theorem commit 148132430859bdf38ac51738430319826fd98925
  • replace mobile-local contract shapes with generated contract imports and typed gateway/harness methods
  • add deterministic barrel generation and repository-dispatch automation for exact-SHA contract updates
  • remove the duplicated CommonPlace API source and document Theorem as its canonical owner, with Railway as the surviving deployment

Dependency

  • Travis-Gilbert/Theorem#571

Validation

  • mobile-contract package barrel and TypeScript conformance check passed
  • corepack pnpm --filter mobile exec tsc --noEmit
  • mobile Vitest: 8 files, 47 tests passed
  • generated bindings and fixtures are byte-identical to the Theorem source
  • canonical JSON/source-pin checks passed
  • Railway /healthz returned HTTP 200 during implementation validation

Live gates

  • add THEOREM_SOURCE_TOKEN to this repository with read access to the private Theorem source before exercising the update workflow
  • relink the Railway service source from the removed CommonPlace API tree to Travis-Gilbert/Theorem/apps/commonplace-api before the next source build
  • hosted dispatch, PR creation, and authenticated mobile live behavior remain pending

Existing lint debt

expo lint still reports the pre-existing react-hooks/set-state-in-effect finding in apps/mobile/src/lib/waitTier.ts; this PR does not modify that file.

@ecc-tools

ecc-tools Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

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

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b0ac592d-4c68-4542-b232-d090621f8254


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

Comment @coderabbitai help to get the list of available commands.

@Travis-Gilbert
Travis-Gilbert marked this pull request as ready for review August 22, 2026 20:09

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cc11e784ca

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@@ -1,37 +0,0 @@
[package]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Retarget the desktop runtime before deleting the API crate

When apps/desktop is built, apps/desktop/src-tauri/Cargo.toml loads crates/commonplace-desktop-runtime, whose manifest still declares commonplace-api = { path = "../../apps/commonplace-api" }. Deleting this manifest therefore makes Cargo fail before compilation with failed to read .../apps/commonplace-api/Cargo.toml; either retain the crate or retarget the desktop runtime dependency as part of this change.

AGENTS.md reference: AGENTS.md:L31-L32

Useful? React with 👍 / 👎.

Comment on lines +129 to +130
pin.updatedAt = process.env.UPDATED_AT;
fs.writeFileSync(pinPath, `${JSON.stringify(pin, null, 2)}\n`);

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 Badge Preserve the timestamp when the source SHA is unchanged

On a repeated dispatch for a SHA already present on main, UPDATED_AT defaults to the current time and this assignment rewrites the source-pin JSON even though the generated contracts and fixtures are identical. Consequently the later git diff --quiet -- packages/mobile-contracts check can never take its "already current" path for such dispatches and instead creates a timestamp-only update commit/PR; only update this field when the pinned SHA or contract content actually changes.

Useful? React with 👍 / 👎.

Comment on lines +18 to +22
The canonical source tree is `Travis-Gilbert/Theorem/apps/commonplace-api`. Its
surviving deployment is the Railway service at
`https://commonplace-api-production.up.railway.app`; the prior Fly deployment is
undeployed and retired. CommonPlace contains no second `apps/commonplace-api`
source tree. Railway must be relinked to the Theorem source before its next

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 Badge Retarget the remaining API source paths

After establishing that CommonPlace no longer contains apps/commonplace-api, this authoritative map still directs readers to apps/commonplace-api/src/schema.rs on line 45 and proposes emitting apps/commonplace-api/schema.graphql on lines 93–96; the root README likewise continues to describe the deleted local tree. Anyone following these development and schema-drift instructions now reaches nonexistent paths, so these references need to point to the canonical Theorem tree or explicitly describe a sibling checkout.

Useful? React with 👍 / 👎.

Comment on lines +65 to +67
if [ -z "$SOURCE_SHA" ]; then
echo "The dispatch must name an exact source SHA." >&2
exit 1

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 Badge Reject non-SHA source refs before checkout

When a manual or repository dispatch accidentally supplies a branch, tag, or abbreviated hash in source_sha, this check accepts it because it only verifies that the value is nonempty, and actions/checkout then resolves that mutable ref while the workflow records it as the supposedly exact source.sha. This defeats the package's immutable provenance guarantee and can make later regeneration produce different bindings from the same recorded pin; require a full 40-character hexadecimal commit ID before checkout, as the existing RustyRed pin updater does.

Useful? React with 👍 / 👎.

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