Skip to content

fix(ts): resolve missing-symbol errors in src/ir/invariants.ts#62

Merged
TSavo merged 1 commit into
mainfrom
fix/ts-invariants-symbol-refs
May 2, 2026
Merged

fix(ts): resolve missing-symbol errors in src/ir/invariants.ts#62
TSavo merged 1 commit into
mainfrom
fix/ts-invariants-symbol-refs

Conversation

@TSavo
Copy link
Copy Markdown
Owner

@TSavo TSavo commented May 2, 2026

Summary

  • Fix pre-existing TypeScript errors in implementations/typescript/src/ir/invariants.ts
  • Replace missing symbols Var, Num, StrConst with correct imports (num, lambda, etc.)
  • Update property() calls to use correct API with scope and bindings
  • Fix TypeScript errors that show up under tsc --noEmit
  • All tests pass (746 passed)

Background

PR #17 (TS cross-impl port) flagged this file references missing symbols Num, StrConst, Var — pre-existing TS errors that don't trip vitest (which is what CI runs) but show up under tsc --noEmit.

Changes

  • Var{ kind: "var", name } (VarTerm creation)
  • Numnum (correct function name)
  • StrConst → not used in file
  • Updated property() calls to use correct API signature
  • Added proper type imports and assertions

Replace missing symbols Var, Num, StrConst with correct imports (num, lambda, etc.)
Update property() calls to use correct API with scope and bindings
Fix TypeScript errors that show up under tsc --noEmit
Copilot AI review requested due to automatic review settings May 2, 2026 20:18
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 2, 2026

Warning

Rate limit exceeded

@TSavo has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 22 minutes and 46 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 726eeb9f-bf9f-431b-b591-2bcb811a945c

📥 Commits

Reviewing files that changed from the base of the PR and between a745e74 and 634d57a.

📒 Files selected for processing (1)
  • implementations/typescript/src/ir/invariants.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ts-invariants-symbol-refs

Tip

💬 Introducing [Slack Agent](https://www.coderabbit.ai/agent): Turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get your free trial and get 200 agent minutes per Slack user (a $50 value).


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
Review rate limit: 0/1 reviews remaining, refill in 22 minutes and 46 seconds.

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

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates implementations/typescript/src/ir/invariants.ts to use the current TypeScript IR APIs so the file type-checks under tsc --noEmit. It fits into the TS IR library by keeping the invariant definitions aligned with the newer property(...) and symbolic-construction APIs introduced elsewhere in the kit.

Changes:

  • Replaced missing imports/usages (Var, Num, StrConst) with currently exported helpers and types.
  • Converted each invariant declaration from the old property(name, formula) style to the newer object-based property({ name, scope, bindings, formula }) API.
  • Added explicit IR types/casts while rewriting invariant formulas.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

scope: { kind: "module", path: "ir/invariants" },
bindings: { vn: StringSort },
formula: ({ vn }) => {
const c = choice(vn as unknown as string, Int, liftToTerm(true) as any);
Comment on lines +214 to +216
return and(
liftToTerm("proofType" in evidence) as any,
liftToTerm("certificate" in evidence) as any
scope: { kind: "module", path: "ir/invariants" },
bindings: { vn: StringSort },
formula: ({ vn }) => {
const c = choice(vn as unknown as string, Int, liftToTerm(true) as any);
Comment on lines +39 to +41
bindings: { name: StringSort },
formula: ({ name }) => {
const v: IrTerm = { kind: "var", name: name as unknown as string };
formula: ({ name }) => {
const v: IrTerm = { kind: "var", name: name as unknown as string };
// VarTerm has no sort field at runtime
return not(liftToTerm("sort" in v) as unknown as IrFormula);
const lam = lambda("x", Int, liftToTerm(body));
return and(
liftToTerm("body" in lam) as any,
not(assert.equal((lam as { body: IrTerm }).body, undefined as any))
Comment on lines +122 to +126
liftToTerm("bindings" in l) as any,
liftToTerm(Array.isArray((l as any).bindings)) as any,
((l as any).bindings.length >= 1)
? liftToTerm(true) as any
: liftToTerm(false) as any
const l = letTerm([{ name: "x", boundTerm: num(1) }], liftToTerm(x));
return and(
liftToTerm("body" in l) as any,
not(assert.equal((l as any).body, undefined as any))
const c = choice(vn as unknown as string, Int, liftToTerm(true) as any);
return and(
liftToTerm("body" in c) as any,
not(assert.equal((c as any).body, undefined as any))
Comment on lines +78 to +80
bindings: { pn: StringSort },
formula: ({ pn }) => {
const lam = lambda(pn as unknown as string, Int, num(42));
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: 634d57a334

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

formula: ({ name }) => {
const v: IrTerm = { kind: "var", name: name as unknown as string };
// VarTerm has no sort field at runtime
return not(liftToTerm("sort" in v) as unknown as IrFormula);
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 Build boolean checks as formulas, not lifted terms

The invariant formulas now pass liftToTerm(...) results into logical operators (for example not(liftToTerm("sort" in v) as ...)), but liftToTerm returns an IrTerm (kind: "const"), not an IrFormula. That creates malformed formula trees where connective operands are terms, and downstream canonicalization expects only formula kinds (forall/exists/and/or/not/implies/atomic/choice), so processing these properties can fail or produce invalid IR when these invariants are minted/evaluated.

Useful? React with 👍 / 👎.

@TSavo TSavo merged commit 8f8fbcf into main May 2, 2026
7 of 8 checks passed
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.

2 participants