Skip to content

Add the offline HERESY API Calculator and GitHub Pages deployment - #3

Merged
EmergentMonk merged 19 commits into
mainfrom
heresy/pr3-offline-calculator
Sep 5, 2026
Merged

EmergentMonk merged 19 commits into
mainfrom
heresy/pr3-offline-calculator

Conversation

@EmergentMonk

@EmergentMonk EmergentMonk commented Sep 5, 2026 •

Copy link
Copy Markdown
Member

Summary

Implements PR #3 — HERESY API CALCULATOR from ROADMAP.md.

HERESY-API now has an offline-first browser exhibit that can perform tiny arithmetic while routing the same intent through a deliberately disproportionate historical or modern interface style. The exact static files that work from local disk are also what GitHub Pages publishes.

Static app contract

The app lives entirely under web/ and uses:

  • plain HTML
  • plain CSS
  • plain JavaScript
  • no framework
  • no backend
  • no package installation
  • no external API
  • no CDN or remote asset
  • no network request at runtime
  • no real API key

Opening web/index.html directly from disk is a supported runtime mode.

Calculator interaction

The user chooses:

  • two signed-32-bit integer operands
  • add, subtract, multiply, or divide
  • one of the eleven API Time Machine interface styles

The result surface reports:

  • exact mathematical result, including rational display for non-integral division
  • useful semantic request such as ADD 2 2
  • fake wire representation
  • useful bytes
  • application payload bytes
  • ceremony bytes
  • deliberately crude approximate tokens (ceil(bytes / 4))
  • Ceremony Ratio
  • era-specific punchline
  • what the ceremony buys
  • engineering caveat
  • synthetic authentication status where appropriate

The Dave protocol

REST, GraphQL, and agent-tool modes retain the synthetic credential tragedy:

API key status: FOUND IN .env.old.backup.final2
Authentication status: 401
Recommended remediation: rewind tape

The emitted fake request uses LOST-IN-.env.old.backup.final2; the app itself has no credential and no network dependency.

GitHub Pages

Adds .github/workflows/pages.yml using the standard Pages artifact/deployment flow.

The deployment uploads only web/. There is no build transform, dependency installation, or server runtime. GitHub Pages is a distribution surface for the same files that work locally.

Validation

Existing Python Time Machine tests remain in the lean CI lane. PR #3 adds:

  • Python static/offline invariants for local asset references and absence of remote runtime dependencies
  • Pages-workflow assertions
  • JavaScript syntax checks
  • executable Node smoke tests against the exact browser protocol core
  • deterministic repeated evaluation across all eleven interface styles
  • signed-int32 boundary handling
  • division-by-zero handling
  • exact fractional division
  • TCP/UDP byte-size checks
  • lost-key / 401 checks
  • agent JSON Schema int32 bounds

Files of interest

  • web/index.html — offline entrypoint
  • web/style.css — responsive industrial museum UI
  • web/heresy-core.js — deterministic calculator and fake protocol engine
  • web/app.js — DOM adapter
  • tests/web_smoke.js — executable core regressions
  • tests/test_web.py — offline/static invariants
  • .github/workflows/pages.yml — static Pages deployment

Curatorial rule preserved

The app does not claim the old mechanisms are universally superior. Each exhibit still has to explain what its ceremony buys and what the comparison omits.

The only universal conclusion is that Dave should not be responsible for the API key.

Summary by Sourcery

Add a dependency-free offline HERESY API calculator and publish the same static application through GitHub Pages.

New Features:

  • Add an offline-first browser calculator supporting four arithmetic operations across eleven historical and modern API interface styles.
  • Provide protocol-specific wire representations, payload metrics, ceremony ratios, explanatory caveats, and synthetic authentication behavior for modern styles.

Bug Fixes:

  • Clear stale calculator output when a subsequent calculation fails.

Enhancements:

  • Keep the calculator dependency-free and runnable directly from local disk using only local static assets.
  • Support signed 32-bit operands, exact fractional division results, boundary validation, and division-by-zero handling.

CI:

  • Extend CI with JavaScript syntax checks and executable browser-core and DOM smoke tests alongside the existing Python test suite.

Deployment:

  • Deploy the exact contents of the web/ directory to GitHub Pages without a build step or runtime server.

Documentation:

  • Document the offline calculator, its local usage and GitHub Pages distribution, measurement model, and updated project roadmap.

Tests:

  • Add static/offline invariants, Pages workflow assertions, deterministic evaluation checks, protocol byte-size checks, authentication checks, int32 boundary tests, and DOM adapter regressions.

Chores:

  • Update GitHub Actions checkout and Python setup action versions.

@sourcery-ai sourcery-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.

Sorry @EmergentMonk, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 3 days and 17 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-05T16:47:18.380029Z 1428ccb Manual request
🔒 Security Review ✅ Completed 2026-09-05T16:25:45.719467Z d0da711 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sourcery-ai

sourcery-ai Bot commented Sep 5, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR adds a plain HTML/CSS/JavaScript HERESY calculator whose deterministic protocol core runs offline from local disk, renders eleven deliberately ceremonial API styles with exact arithmetic and payload metrics, is covered by Python and Node regression tests, and is deployed unchanged from web/ through GitHub Pages.

Sequence diagram for offline calculator evaluation

sequenceDiagram
    actor User
    participant Browser as Browser UI
    participant App as app.js
    participant Core as heresy-core.js

    User->>Browser: Enter operands, operation, and interface style
    Browser->>App: submit or change event
    App->>Core: evaluate(leftValue, rightValue, operationSlug, styleSlug)
    Core->>Core: parseInt32(value, label)
    Core->>Core: exactResult(left, right, operation)
    Core->>Core: buildPayload(styleSlug, operation, left, right, intent)
    Core-->>App: report with result, payload, metrics, and caveats
    App->>Browser: render(report)
Loading

Flow diagram for protocol-style evaluation and metrics

flowchart TD
    Start["User selects operands, operation, and style"] --> Validate["parseInt32 and validate operation/style"]
    Validate --> Result["exactResult"]
    Result --> Payload["buildPayload for selected exhibit"]
    Payload --> Metrics["Calculate payload bytes, ceremony bytes, tokens, and Ceremony Ratio"]
    Metrics --> Auth{Authenticated style?}
    Auth -->|Yes| Tragedy["Report lost key and 401"]
    Auth -->|No| Local["Report no authentication required"]
    Tragedy --> Report["Render result and curatorial explanation"]
    Local --> Report
Loading

File-Level Changes

Change Details Files
Adds a dependency-free offline browser calculator with a shared deterministic protocol engine for arithmetic, payload generation, metrics, and exhibit metadata.
  • Adds signed-int32 parsing and exact arithmetic, including reduced fractional division and division-by-zero errors.
  • Implements eleven historical and modern interface styles with fake wire payloads, byte/token/ceremony metrics, punchlines, values, caveats, and synthetic authentication behavior.
  • Exposes the core for both browser use and Node smoke testing, with a DOM adapter and responsive static museum UI.
  • Uses only relative local assets so the entrypoint works directly from disk without runtime network access.
web/heresy-core.js
web/app.js
web/index.html
web/style.css
Adds automated coverage for the offline application contract and calculator protocol behavior.
  • Checks local asset references, required UI surfaces, absence of remote/network runtime dependencies, and required static files.
  • Exercises all styles deterministically plus int32 boundaries, exact fractions, zero division, binary TCP/UDP sizing, lost-key authentication output, and agent schema bounds.
  • Runs JavaScript syntax checks and the Node smoke suite in the existing lean CI job.
tests/test_web.py
tests/web_smoke.js
.github/workflows/test.yml
Publishes the exact offline web directory through GitHub Pages without a build or server runtime.
  • Adds the standard configure, upload, and deploy Pages actions with the required permissions.
  • Triggers deployment for relevant web/workflow changes and uploads only web/.
.github/workflows/pages.yml
Documents the browser calculator, offline/local-disk contract, deployment model, metrics, and completed roadmap status.
  • Adds local and GitHub Pages usage instructions and calculator capabilities.
  • Clarifies application-level measurement caveats and preserves the curatorial explanation of each abstraction's value and limitations.
  • Updates roadmap and test instructions for the delivered PR.
README.md
ROADMAP.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@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: d0da711b14

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

Comment thread tests/test_web.py Outdated
Comment thread web/app.js
@EmergentMonk

Copy link
Copy Markdown
Member Author

@codex please review

@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: 4f647c742c

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

Comment thread web/heresy-core.js
@EmergentMonk

Copy link
Copy Markdown
Member Author

@codex please review 1428ccb

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 1428ccb99d

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

@EmergentMonk
EmergentMonk merged commit 95edfd3 into main Sep 5, 2026
2 checks passed
@EmergentMonk
EmergentMonk deleted the heresy/pr3-offline-calculator branch September 5, 2026 16:57
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