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
236 changes: 233 additions & 3 deletions app.js

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion docs/design/BEHAVIOR-OVERRIDES.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,17 @@ The handoff shows several demo-only concepts. Production must not fabricate them
| Purchases inside the hero modal | Pricing modal links to Stripe checkout / portal via existing `startCheckout` / `openCustomerPortal`. |
| Connection success animations | Show real connection status; use loading, error, and retry states. |
| Usage breakdown by day/category | Show only the data the backend returns (`used / limit` and current period). |
| Generation history table | Do not add a history table unless the backend endpoint exists and is enabled. |
| Generation history table | Owner-scoped history is implemented under STU-930–933; runtime availability requires the configured authenticated endpoint. See [acceptance boundaries](../generation-history-acceptance.md). |
| Account deletion flow | Do not add account deletion; if unavailable, omit the control or show a disabled / support message. |

## 5. Other production rules

- Keep the brand logomark inline (SVG), not as an external image request.
- Preserve the real copy and labels from the export, but replace any static placeholders with live data equivalents listed above.
- Do not add OpenDesign chrome, preview labels, or design-process annotations to the production UI.

## Generation history (STU-933)

List existing records, including incomplete ones, without new retention or tier restrictions. Empty pages may have continuation cursors. Open restores available artifacts into Results without generation, billing or deployment; Deploy remains a separate explicit action with existing safety gates. Prefer complete generator output, otherwise validated nontruncated review-input generatedBundle. Missing review remains unavailable; generator code never implies reviewer approval. Stored fixedCode merges by artifact identity. Preserve safe raw text for partial records.

Logout/account changes invalidate pending requests and clear history; opening history prevents late generation responses replacing the selection. Delete removes generation content, retaining only an internal owner-bound anti-resurrection marker. Foreign, absent and deleted records share 404. Source acceptance does not establish live endpoint availability.
4 changes: 3 additions & 1 deletion docs/design/TRACEABILITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
| No fabricated purchases | Hero plan/billing dialogs | Stripe checkout/portal only | Use existing `startCheckout` / `openCustomerPortal`. |
| No fabricated connection success | Journey / account connection card | Real connection states only | |
| No usage breakdown | Account usage card | Show `used / limit` only | |
| No generation history | Account history table | Omit unless backend endpoint exists | |
| Owner-scoped generation history (STU-930–933) | Approved generation-history plan | Account list/detail/delete and Results hydration | [Source and delivery boundaries](../generation-history-acceptance.md). |
| No account deletion | Account security section | Omit or show support message | |
| Nine handoff viewports with reflow expectations | `DESIGN-HANDOFF.md` + manifest | Responsive tests | See [RESPONSIVE.md](./RESPONSIVE.md). |
| Fixed 1920×1080 fit scaling is presentation-only | `custom-code-connect-hero.html` `.stage` | Real fluid layout | See [RESPONSIVE.md](./RESPONSIVE.md). |
| Staging FTP isolation (STU-933) | Approved exact ownership amendment | scripts/deploy_ftp.py --target staging | Local mocked guard proof only. |
| Actual staging acceptance (STU-934) | Post-PR delivery gate | Provider routes, auth/CORS, indexes, two-account isolation, FlutterFlow redeploy | Outstanding; requires actual isolated infrastructure. |
29 changes: 29 additions & 0 deletions docs/generation-history-acceptance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generation history source acceptance — STU-933

Candidate starts at frontend c6a7ef1ee5c4219a1fdef9928812f36a2b031a49, in `/Users/home/.t3/worktrees/dreamflowCommandForFlutterFlow/t3-3d283578-bd96247123bf8c0a`. Common Git directory verified as `/Users/home/Projects/dreamflowCommandForFlutterFlow/.git`. The commit containing this document identifies the complete handoff candidate; controller acceptance remains separate.

Backend source evidence is historical and separate from live readiness. [PR 194](https://github.com/sgardoll/buildship/pull/194) merged externally at `00d89badea64a62f8365d9728776d896e0e7bd04`; PR 195 was subsequently reported merged. Source schema repair `4989e9c2ac48030c4ad726047e756f17b293c652` in PR 196 had passing checks, but PR 196 closed unmerged. A later live export renamed the production workflow to `service-generation-history-6f54`, upgraded REST to 2.0.2, and dropped allowedOrigins and response-body mappings. The proposed reconciliation in PR 197 is superseded by Stuart's report that he completed the repair manually and is closing that PR. Neither PR 196 nor PR 197 merge is a prerequisite now. Preserve owner changes and refresh live state before any further backend edit.

The independent frontend review checked the API source at `4989e9c2` against `00d89bad` and found compatible request/response envelopes. This does not verify the manually edited hosted workflow. Hosted editor, HTTP/CORS and two-account staging acceptance remain unproven under STU-934. Expected response mappings are handler.body and HTTP status handler.status; the canonical frontend origin is https://customcode.connectio.com.au.

## Account authentication correction

The earlier compatibility review missed that real sign-in sessions contain email rather than user_id. Its authentication conclusion is withdrawn. See [account identity repair](generation-history-account-auth.md) for the coordinated `/authUserCheck` bootstrap and session lifecycle. Backend repair and current-head acceptance are required before readiness; historical tests below do not prove live account ownership.

## Contract checked against accepted source

Read-only source: `/Users/home/Projects/buildship/workflows/service-generation-history-Hst1/nodes/history-api/main.ts`, plus workflow `triggers.json`. The worker compared these API files at the earlier accepted source. Subsequent backend fallback/schema changes require final controller pairing verification; the endpoint envelope is reported unchanged. Compared with `src/generationHistory.js`, its synthetic unit fixtures, and `e2e/generation-history.spec.js`.

POST `/service/generation-history` (staging `/staging/service/generation-history`) uses bearer application session authentication. Bodies contain action plus optional cursor or id, never owner. List returns `{items,nextCursor}`, at most 20 items scanned within 100 documents; empty continuation pages are valid. Detail returns `{generation,identityMismatch}` with whitelisted stage text, character counts, truncation and finish reason. Delete returns `{deleted:true,id}`; repeat deletion returns 404. Errors use `{error:{code,message}}`; absent, foreign and tombstoned records share NOT_FOUND. Timestamps are seconds/nanoseconds objects or null. Backend rejects extra fields, invalid IDs and invalid signed cursors. Frontend validation is deliberately less restrictive (8192 cursor characters versus backend 6000, character versus byte ID limit); backend validation remains authoritative and normal returned cursors/IDs are compatible. Mock fixtures are synthetic partial response subsets, not captures of live service traffic.

## Staging FTP guard

Use the existing script with `--target staging`. Export all five `STAGING_FTP_HOSTNAME`, `STAGING_FTP_PORT`, `STAGING_FTP_USERNAME`, `STAGING_FTP_PASSWORD`, `STAGING_FTP_HOME_PATH` settings through a secure shell environment. The script does not read .env automatically. No production password/Keychain fallback is allowed. A separate account and explicit absolute non-root path are mandatory; bare web roots, traversal and control characters are rejected. Every managed remote directory must already exist and report its expected absolute PWD before upload/prune. Provider aliases and directory provisioning must be resolved during STU-934. Local symlinks, remote symlinks in managed directories, failed directory listings and unsafe remote file names are rejected. Dry-run does not mkdir, upload or delete, but does connect/read remote metadata when actually invoked. No FTP invocation was made for this task.

Default production target retains existing host/account/password resolution and reproducibility/build guards. Remote listing safety applies to both targets. FTP server PWD behavior and real account confinement still require provider verification; local guards cannot prove server-side isolation or distinguish undisclosed production aliases.

## Evidence and remaining delivery gate

Local evidence directory: `/tmp/stu933-evidence/` (ephemeral machine-local logs). `backend-source.txt` and `backend-contract.txt` retain the source examined; `node.txt`, `ci.log`, command logs and `results.txt` record local verification. No secrets or customer exports were used.

`staging-acceptance` means **local configuration/isolation guard proof only**. STU-934 remains outstanding: actual staging host/certificate/root isolation, deployed routes and result bindings, CORS and session-verifier compatibility, staging collection/index queries, synthetic two-account list/detail/delete, and real explicit FlutterFlow redeploy. No production data was copied/deleted and no provider deployment occurred in frontend source verification. Frontend PR 131 was subsequently created after independent acceptance at d9a4045; later review repairs require their own current-head checks. Recovered worker logs show 428 unit tests, 283 browser tests, build, seven accessibility shells, nine deployment checks, thirty proxy cases, bundle scan and fourteen staging checks passed on Node 22.15.1. Controller added malformed-listing rejection and post-preflight pruning failure propagation; all sixteen staging tests pass.
13 changes: 13 additions & 0 deletions docs/generation-history-account-auth.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Account identity repair

The original history implementation confused an email app-session JWT with a pipeline identity JWT. A live email session was rejected by the history verifier. Earlier synthetic-token source acceptance does not prove this integration.

The frontend now calls the existing POST `/authUserCheck` (staging `/staging/authUserCheck`) with JSON `{sessionToken, identityToken?}`. The session token is the verified sign-in session; the optional identity token is fresh legacy proof obtained from the anonymous resolver, never a submitted owner ID. No Authorization header is required by this resolver contract. The backend owns signature verification and immutable account-to-identity association. It reuses an established account marker; first linkage may adopt only a proven unclaimed/same-account legacy identity, and foreign proof produces a distinct account identity without exposing foreign history.

The resolver returns `{user_id, identity_token, ...}`. The frontend retains the account credentials only in memory and refreshes them before signed-in pipeline calls, including retries/refinements. The backend caps their expiry at the app session expiry. History list/detail/delete send the email app session as JSON `sessionToken` and are sent only after account bootstrap succeeds. Pipeline requests send the scoped account (or signed-out anonymous) identity token as JSON `sessionToken`. Neither request sends Authorization; both use `credentials: omit`. Account bootstrap is unchanged. History never authenticates using the device token. Staging resolver, history and pipeline routes all use `/staging/` and require the backend's isolated collection bindings.

Sign-in/session rotation and sign-out invalidate pending account resolutions. Account changes also cancel an active generation. Late anonymous or account responses cannot replace the current account's identity. Bridge failure blocks signed-in generation/history rather than falling back to anonymous access. Anonymous generation keeps its existing resolver path; the backend must refuse anonymous capabilities for an identity already claimed by an account.

Evidence is synthetic and local: unit tests exercise real email-session-shaped request semantics, owner-field omission, delayed response rejection, logout, malformed responses and retry. Browser tests check email-vs-generation token separation, account A→B switching during a delayed bridge, and fail-closed behavior. Full-suite and independent-review results are recorded with the PR head. Backend source/emulator acceptance, deployment, CORS, real authenticated reads, two-account isolation and editor retest remain separate; no live writes or deployment are authorized by these tests. Preserve Stuart's manual backend workflow changes.

Body-token transition (owner authorized): backend may accept legacy headers but must reject conflicting body/header credentials. JSON Content-Type still triggers a preflight; removing Authorization reduces the requested headers to content-type with credentials omitted. A local cross-origin browser probe observed OPTIONS requesting only content-type and a successful POST with no Authorization/cookies. Production/staging invalid-token list probes returned readable401; these are not valid-session acceptance. The preview browser also allowed the Authorization negative control, so this harness does not establish strict browser CORS enforcement; deployed ordinary-browser acceptance remains required. No valid bootstrap, generation or deletion was performed.
4 changes: 3 additions & 1 deletion e2e/fixtures/apiFixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,9 @@ const VENDORED_SRI_ASSETS = [
*/
export async function applyDefaultRoutes(page, overrides = {}) {
const routes = {
[ENDPOINTS.identity]: guestIdentity(),
[ENDPOINTS.identity]: request => request.postDataJSON()?.sessionToken
? ok({user_id:"account-test-0001",identity_token:"synthetic-account-generation-token",status:"recognized"})
: guestIdentity(),
[ENDPOINTS.authSendMagicLink]: magicLinkSent(),
[ENDPOINTS.authVerifyMagicLink]: signedInSession(),
[ENDPOINTS.authRefreshSession]: signedInSession(),
Expand Down
Loading
Loading