You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Closes#164
## Summary
- Deletes `app/scripts/embed-tfstate.mjs` and removes the
`predev`/`prebuild` npm hooks that invoked it — the desktop app reads
tfstate directly at runtime via the AWS SDK, making the embed step
unnecessary
- Removes the `EMBEDDED_TFSTATE` fallback path from `ConfigService`
(including the generated `src/generated/tfstate.ts` artifact and
`.gitignore` entry for it) and updates the associated unit tests
- Cleans up stale references in `CLAUDE.md`, `package.json`,
`.github/workflows/package.yml`, `docs/`, and `scripts/init-parent.ts`
## Changes
```
.github/workflows/package.yml | 8 +-
.gitignore | 4 -
CLAUDE.md | 2 -
app/package.json | 2 -
app/packages/desktop-main/src/main.test.ts | 4 +-
app/packages/desktop-main/src/services/ConfigService.test.ts | 39 ---------
app/packages/desktop-main/src/services/ConfigService.ts | 10 +--
app/scripts/embed-tfstate.mjs | 87 ----------------------
docs/docs/components/management-app.md | 8 +-
docs/docs/guides/submodule.md | 2 +-
package.json | 3 +-
scripts/init-parent.ts | 5 +-
12 files changed, 17 insertions(+), 157 deletions(-)
```
## Test plan
- [ ] `npm run app:test` — all unit tests pass (`ConfigService` tests no
longer exercise the embedded-tfstate path)
- [ ] `npm run app:lint` — 0 errors
- [ ] `app/scripts/embed-tfstate.mjs` no longer exists in the repository
- [ ] `app/package.json` contains no `predev` or `prebuild` scripts
referencing `embed-tfstate`
- [ ] `ConfigService` contains no reference to `EMBEDDED_TFSTATE` or
`src/generated/tfstate.ts`
- [ ] `npm run desktop:dev` starts without the embed step (no
`embed-tfstate.mjs` execution)
- [ ] `npm run desktop:build` completes without the embed step
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CLAUDE.md
-2Lines changed: 0 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -109,8 +109,6 @@ When adding a game, only edit `terraform.tfvars`. Don't hand-write new resources
109
109
110
110
`ConfigService.getTfOutputs()` (in `app/packages/desktop-main/src/services/ConfigService.ts`) parses `terraform.tfstate` as JSON and caches it in-memory. `invalidateCache()` is called on `/api/games` and `/api/status` to pick up new deploys. The app's container mounts `./terraform:/app/terraform:ro` — this path coupling matters if directory structure changes. The parsed `TfOutputs` shape now also exposes `discord_table_name`, `discord_bot_token_secret_arn`, `discord_public_key_secret_arn`, and `interactions_invoke_url` so `DiscordConfigService` can reach the Discord stores without extra env-var plumbing.
111
111
112
-
**Build-time state embedding**: `app/scripts/embed-tfstate.mjs` (runs via `predev`/`prebuild` hooks) writes `app/packages/desktop-main/src/generated/tfstate.ts`; `ConfigService` uses it as a fallback when the runtime `terraform.tfstate` is absent (Docker/CI). The file is committed as `null` and overwritten at dev/build time.
113
-
114
112
### API authentication
115
113
116
114
Every `/api/*` route is gated behind a bearer token via `ApiTokenGuard` in `app/packages/desktop-main/src/guards/api-token.guard.ts`, registered globally in `AppModule` as an `APP_GUARD` provider so it applies to every controller automatically. The token comes from env `API_TOKEN` (wins, even when set to empty to deliberately disable) or `api_token` in `server_config.json`. In production (`NODE_ENV=production`), boot aborts in `main.ts` if no token is configured. In dev, a warning is logged and unauthenticated requests are allowed for convenience. The web client stores the token in `localStorage` under key `apiToken` and sends it as `Authorization: Bearer`. Don't remove the guard or bypass it on individual controllers — Copilot flagged the unauthenticated surface as a security issue and this is the fix.
Copy file name to clipboardExpand all lines: docs/docs/guides/submodule.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -116,7 +116,7 @@ Five targets, no surprises:
116
116
|`make plan`| Copies `terraform.tfvars` into `Hyveon/terraform/terraform.tfvars`, then runs `make -C Hyveon tf-plan` — which itself rebuilds the Lambda bundles before `terraform plan`. |
117
117
|`make apply`| Same as `plan`, but delegates to `tf-apply`. The submodule's `tf-apply` recipe prints a post-deploy checklist with the Discord interactions URL when it finishes. |
118
118
|`make update`| Bumps the submodule to the tip of `main` (`git submodule update --remote --merge`). If the new `setup.sh` differs from the recorded sha, clears `.terraform/` and re-runs `setup.sh` automatically; otherwise leaves it alone. Reminds you to commit the new submodule pointer. |
119
-
|`make dev`| Pulls live tfstate into `.make/tfstate.json` (so the embed step has something to read), wipes stale TS build info under the submodule's `app/packages/*/`, then runs `make -C Hyveon dev`, exporting `API_TOKEN` and `TF_STATE_PATH` to the child make. |
119
+
|`make dev`| Pulls live tfstate into `.make/tfstate.json` (so ConfigService can read it via `TF_STATE_PATH`), wipes stale TS build info under the submodule's `app/packages/*/`, then runs `make -C Hyveon dev`, exporting `API_TOKEN` and `TF_STATE_PATH` to the child make. |
120
120
121
121
The `tfvars` copy is **always fresh** on plan/apply — the recipe `cp`s
122
122
unconditionally, not just when the file is older than the destination. This
0 commit comments