Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Quality checks

on:
push:
pull_request:

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 22
- run: node --check app.js && node --check core.js && node --check sw.js
- run: python3 scripts/validate_pwa.py
- run: python3 scripts/validate_release_disclosures.py
- run: python3 scripts/verify_hand_checks.py
- run: npm test
- run: python3 scripts/build_pages.py
- run: python3 scripts/validate_pages_artifact.py
47 changes: 47 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Deploy GitHub Pages

on:
push:
branches: [main]

permissions:
contents: read

concurrency:
group: github-pages
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 22
- uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
- run: node --check app.js && node --check core.js && node --check sw.js
- run: python3 scripts/validate_pwa.py
- run: python3 scripts/validate_release_disclosures.py
- run: python3 scripts/verify_hand_checks.py
- run: npm test
- run: python3 scripts/build_pages.py
- run: python3 scripts/validate_pages_artifact.py
- uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: _site

deploy:
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
.AppleDouble
.LSOverride
_site/
37 changes: 37 additions & 0 deletions CALCULATION_MODEL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Gridshift calculation contract

This document describes the deterministic model in `core.js` (calculation version 1.2). **No independent qualified power-system engineering or climate/accounting review has been completed.** The model is an exploratory planning aid, not approved for utility investment, engineering, or regulatory use.

## Emissions

- Asset annual SF₆ loss is either the entered measured mass (`kg/year`) or nameplate capacity (`kg`) multiplied by the entered annual loss fraction.
- The baseline applies that annual loss in every year of the planning horizon. It assumes the entered annual rate remains constant; it does not age, decay, or otherwise forecast the loss rate.
- Annual CO₂-equivalent emissions are `annual SF₆ loss (kg) × SF₆ GWP₁₀₀` and are reported internally in `kg CO₂e`.
- The default for new projects is 24,300 over 100 years, from IPCC AR6 WGI Supplementary Material Table 7.SM.7 ([official table](https://www.ipcc.ch/report/ar6/wg1/downloads/report/IPCC_AR6_WGI_Chapter07_SM.pdf)). The exact value and source can be changed in project assumptions.
- A replacement is modeled at the start of its assigned year: normal annual SF₆ leakage is omitted in that year, and end-of-life emissions are `remaining SF₆ mass × (1 − recovery efficiency) × GWP`.
- From the replacement year onward, annual alternative equipment emissions are added when a profile value is supplied. Unknown alternative emissions are flagged as incomplete.
- The model does not currently include manufacturing, construction, upstream gas production, grid dispatch effects, or other lifecycle emissions unless a user-entered alternative annual emissions value represents them. Profile fields do not guarantee that it does.

## Costs

- Baseline annual cost is the sum of entered asset operating and maintenance costs.
- In a replacement year, scenario cost adds replacement capital, installation, decommissioning, gas recovery, and the selected technology's annual operating and maintenance costs. Later years use the profile's annual operating and maintenance costs.
- A technology residual value is credited in the final modeled year for a replacement scheduled within the planning horizon.
- Net present cost discounts each year's modeled cost from the base year: `Σ cost(year) / (1 + discount rate)^(year − base year)`. The first modeled year has exponent zero.
- Incremental net present cost is scenario NPC minus continued-operation NPC. The annual budget check compares only replacement capital expenditure with the scenario budget; it does not limit operating cost.
- Blank cost fields remain unknown for new and imported records and cause the result to be flagged partial. This includes replacement technology residual value whenever the technology is scheduled within the modeled horizon. Enter zero when there is no residual value. An entered zero is treated as a deliberate zero. Older versions stored blank costs as zero; Gridshift migrates those project fields to unknown and marks affected saved snapshots for review without changing their stored calculation inputs.

## Scenarios and incomplete data

- A saved scenario stores asset and technology inputs, emissions assumptions, currency, price year, discount rate, planning years, calculation version, and replacement assignments.
- Existing scenarios keep their saved values when shared project assumptions change. The previous Gridshift 25,200 default is migrated to 24,300 at the project level, while saved scenarios with that value keep their number and receive a review warning.
- Missing annual loss, end-of-life recovery, alternative emissions, or cost data is reported as incomplete. Cost per tonne avoided is unavailable when the calculation is incomplete or avoided emissions are not positive. Other partial totals remain visible and must be read with their warnings.
- Technology comparisons and candidate rankings are preliminary data screens; they do not determine equipment compatibility or engineering approval.

## Open review decisions

Before results from this model inform operational, investment, or regulatory decisions, qualified power-system and climate/accounting reviewers must confirm the time convention, emissions boundary, treatment of end-of-life gas and alternative gases, cost categories, residual value, annual budget definition, discounting convention, and the applicability of the selected GWP metric. Jurisdictional reporting requirements and project-specific manufacturer evidence also require review.

The repository's unit tests check arithmetic and selected boundary cases. `scripts/verify_hand_checks.py` separately reproduces the release packet's example arithmetic using Decimal operations. These checks do not replace an independent domain review or validate real asset data.

The current product stores a single-browser workspace in local storage and limits serialized app data to approximately 3 MB. This is a conscious first-release constraint for modest planning workspaces; larger portfolios require IndexedDB or a separately reviewed shared-data architecture.
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ Thanks for your interest in improving Gridshift. Bug reports, thoughtful feature

## Running Gridshift locally

Gridshift is a static web app with no package installation or build step. From the repository root, run:
Gridshift is a static web app with no runtime dependencies or build step. From the repository root, run:

```sh
python3 -m http.server 8000
```

Open [http://localhost:8000](http://localhost:8000). A local server is needed to exercise service-worker installation and offline caching. You can open `index.html` directly for a quick visual check.

With Node.js 22 or later, run `npm test` for calculation, CSV, backup-validation, and service-worker checks. Run `python3 scripts/validate_pwa.py` to verify the manifest and install assets. Browser install, offline, and update behavior still needs a browser smoke check.

Before submitting, review your change in a current browser and check the relevant workflow. If you cannot check a particular browser or workflow, mention that in the pull request.

## Pull request expectations
Expand Down
26 changes: 21 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Gridshift is a local-first planning workspace for electricity teams exploring th

**Build an inventory. Compare alternatives. Shape a transition plan.**

> **Independent review status: not independently reviewed.** No independent qualified power-system engineering or climate/accounting review has been completed. Gridshift is for exploratory estimates only. Verify assumptions and obtain qualified review before operational, investment, or regulatory decisions.

## What you can do

- **Understand the portfolio.** Organize equipment by site and capture ratings, installation and retirement dates, condition, and annual SF₆ loss.
Expand All @@ -21,6 +23,8 @@ Gridshift is a local-first planning workspace for electricity teams exploring th
- **Keep a reviewable record.** Inspect assumptions and calculation notes, export inventory and scenario CSVs, and save or restore a complete JSON backup.
- **Work locally.** Project data stays in this browser. No account or cloud sync is required.

The default SF₆ GWP₁₀₀ assumption is **24,300**, from IPCC AR6 WGI Supplementary Material Table 7.SM.7 ([official source](https://www.ipcc.ch/report/ar6/wg1/downloads/report/IPCC_AR6_WGI_Chapter07_SM.pdf)). New projects use this value. When an older project still has Gridshift’s prior 25,200 default and its matching source label, Gridshift updates the project assumption and marks saved scenario snapshots for review. The old scenario value is retained so its historical calculation remains reproducible; edit and save that scenario to recalculate it.

## A straightforward planning flow

1. Create a project and set its planning horizon, currency, and emissions factor assumptions.
Expand All @@ -47,26 +51,38 @@ The app icon is maintained in `icon.svg`; `assets/gridshift-mark.svg` is the tra

## Try Gridshift

Gridshift is a static web app. For a full local experience, including offline caching, serve the project directory over localhost:
Gridshift is a static web app with no build step or runtime dependencies. For a full local experience, including offline caching, serve the project directory over localhost:

```sh
python3 -m http.server 8000
```

Then open [http://localhost:8000](http://localhost:8000). You can also open `index.html` directly for a quick preview; service-worker installation and offline caching require localhost or HTTPS.

### Release support target

The release target is current and previous major versions of desktop Chrome, Edge, Firefox, and Safari, plus current iOS/iPadOS Safari and Android Chrome. Install and offline behavior must be checked on each supported platform before a production release. The planned public host is GitHub Pages at `https://boredpolymath.github.io/Gridshift/`; local development uses localhost. The app uses relative URLs for the project-site path, which still needs live browser verification.

The repository includes a GitHub Actions Pages workflow. Repository Settings → Pages must select GitHub Actions as the publishing source before deployment. GitHub Pages does not expose arbitrary response-header configuration; see [RELEASE_RUNBOOK.md](RELEASE_RUNBOOK.md) for the accepted header limitation and launch checks.

The service worker caches the current app shell for offline use and checks for a newer version. When an update is ready, choose **Update ready · Reload** to activate it. The app does not synchronize local project data between browsers or devices.

## Designed for transparent planning

Gridshift keeps measured annual losses separate from estimated loss rates, shows incomplete inputs, and preserves key assumptions with saved scenarios. Its estimates can support early planning and comparison; they do not replace engineering studies, manufacturer documentation, regulatory review, or approval by qualified professionals. Manufacturing and construction emissions are not included in the current model.
Gridshift keeps measured annual losses separate from estimated loss rates, shows incomplete inputs, and preserves key assumptions with saved scenarios. See [CALCULATION_MODEL.md](CALCULATION_MODEL.md) for the current equations, boundaries, and open review decisions. Its estimates can support early planning and comparison; they do not replace engineering studies, manufacturer documentation, regulatory review, or approval by qualified professionals. Manufacturing and construction emissions are not included in the current model.

## Your data, in your browser

Gridshift stores project data in browser-local storage. It does not sync project data to a server. Browser storage can be cleared or evicted, so export a JSON backup and store it securely. Local storage is not an enterprise access-control or encryption system; use care on shared devices.
Gridshift stores modest project workspaces in browser-local storage, with a 3 MB serialized-data ceiling to leave room under typical browser quotas. Larger portfolios should be split into smaller workspaces; IndexedDB or a managed data service would be needed for a higher-volume release. It does not sync project data to a server. Browser storage can be cleared or evicted, so export a JSON backup and store it securely. Local storage is not an enterprise access-control or encryption system; use care on shared devices and browser profiles. Browser extensions granted access to this site may read or change site data or page content ([Chrome host permissions](https://developer.chrome.com/docs/extensions/develop/concepts/declare-permissions), [MDN content scripts](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts)). Use only trusted extensions in a profile that holds planning records. Downloaded JSON backups contain readable project data, are not encrypted by Gridshift, and must be protected or deleted separately.

The planned GitHub Pages URL is under `boredpolymath.github.io`. Other pages on that exact host share the browser storage origin even when their URL paths differ. Code on another page served from that host can read, change, or delete Gridshift data if you visit it in the same browser profile. This does not apply to unrelated website origins. Do not store confidential utility records on the planned host unless every publisher and page on that origin is trusted; a dedicated Gridshift hostname is required to isolate the browser storage.

The app code does not send project data to an application server or analytics service. GitHub says it logs and stores visitors' IP addresses for security when a GitHub Pages site is visited ([Pages data collection](https://docs.github.com/en/pages/getting-started-with-github-pages/what-is-github-pages#data-collection)); its documentation does not state a Pages-specific retention period. Review [GitHub's Privacy Statement](https://docs.github.com/en/site-policy/privacy-policies/github-privacy-statement) before using the public site. The app provides local export and deletion controls; deleting browser data does not remove downloaded backup files.

## Project policies

Contributions are welcome; see [CONTRIBUTING.md](CONTRIBUTING.md) and the [Code of Conduct](CODE_OF_CONDUCT.md). For vulnerability reports, follow [SECURITY.md](SECURITY.md). Gridshift is released under the [MIT License](LICENSE).
Gridshift is maintained by **Bored Polymath Studios**. For bugs and product feedback, use the repository's [issue templates](https://github.com/boredpolymath/Gridshift/issues/new/choose); do not include private utility records. No separate support email was provided for this release. For vulnerability reports, follow [SECURITY.md](SECURITY.md). Gridshift is released under the [MIT License](LICENSE).

---

**Gridshift is a planning prototype.** Results depend on the assumptions and source data entered by the user and should be independently reviewed before they inform investment or operational decisions.
**Gridshift is an explicitly unreviewed planning tool.** Results depend on the assumptions and source data entered by the user. No independent qualified power-system engineering or climate/accounting review has been completed; do not use these estimates alone for operational, investment, or regulatory decisions.
Loading
Loading