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
1 change: 1 addition & 0 deletions PROGRESS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Full earlier progress and acceptance records are preserved in the [archive](docs

| Date | Change | Evidence | Result and limits |
| --- | --- | --- | --- |
| 2026-11-14 | Keep Wren’s Light, Slice A on `feat/keep-wrens-light-onboarding`: coherent Tide Run journey from landing to repair, a shared keyboard-scroll handler for reading regions, and deterministic browser fixtures that abort and assert unexpected requests | Fresh local run: `bun run typecheck` pass; `bun run test` 522 pass/0 fail/41078 assertions across 72 files; `bun run build` pass (existing large-chunk warning). `bun scripts/test-tide-run-browser.ts` passed 3 of 3 consecutive runs, Chromium and WebKit each time. Also pass: routing (Chromium/WebKit), Tide (412×860, 390×844, 844×390, 1280×800, 1440×900), expedition harbor, Season (390×844, 1440×900), passage (Chromium/WebKit), expedition, compiled expedition QA (`failures: []`), expedition touch and expedition lifecycle. An earlier run of this branch before the keyboard-scroll handler failed WebKit 3 of 3 times in the tide-run guidance keyboard-scroll check. Rust suite not run; `contracts/` unchanged. | The fixture-backed suites call `assertClean`, and it recorded no unexpected requests. Browser emulation only: physical devices, screen readers and player comprehension remain unverified. No push, deployment or live calls; `A-pocket-harbor.png` untouched. |
| 2026-11-14 | Issue [#8](https://github.com/dadadave80/familiar/issues/8): swipe/tap and focused keyboard controls across the current Tide Run, retained courts and Bell/Reed crossings, on local branch `feat/direct-play-controls-current` | Source `782694c`, based on fetched `main` `91b5194` including merged #9; GitHub main rechecked at the same revision. `bun run test`: 491 pass/0 fail/40289 assertions; `cargo test --manifest-path contracts/Cargo.toml --workspace`: 182 pass/0 fail/3 ignored; typecheck/build, `make evidence` (15 canonical hashes/signatures and FINAL receipt graphs), `make break`, all eight gameplay/routing browser suites, records/season/Privy browser checks pass. Tide Run, passages and routing pass Chromium/WebKit; retained courts pass seven viewport journeys plus the complete normal-motion/recovery/save-failure tail; native touch suite passes 20 cases. Compiled QA passes 13 viewport profiles plus cold slow3G/gzip/touch/CPU4, with no failures and an offline local decision. [Logs and SHA256 inventory](/Users/dadadave/.codex/visualizations/2026/11/13/01a1d587-c1b9-7802-967f-8d1cf80455b9/issue-8-controls/logs/inventory.json) | Compact hints follow actual input; the native Button controls disclosure starts closed. Distinct 44px world actions, one-step swipes, free inspection and focused WASD/arrows preserve canonical action histories. Cancellation, multitouch, modal focus, resize/rotation, touch compatibility clicks and resumed hit targets are covered. No engine, save-format, contract, reward or account-authorization change. The full Bun suite needs loopback permission; a restricted repeat refused nine HTTP fixtures, then all 491 passed with it allowed. Mocked dev-harness warm-up emits Invalid hook call warnings; steady assertions and isolated guest/compiled console checks pass. Existing large-chunk build warning remains. No push, deployment or signing; physical-device comfort, pen and native Safari swipes remain unverified (WebKit covers taps/keyboard; Chromium covers native swipe sequences). |
| 2026-11-13 | Audited unused source and superseded reports retired locally | User authorized audited cleanup; independent cross-review of all65 changed/removed/replacement paths | Retired six-file dynamic NPC worker, unused IBM font/license, six redundant contract ignores, old guest/Google helper implementations and dead example settings. Live Google/Privy provider and native pending/recovery validators untouched; exact formatter/type and relevant security tests moved to current owners. Fresh setup omits retired worker settings while exact prior generated tuples validate unchanged. Eight superseded reports/585796 bytes plus old architecture/security descriptions and unused Mochi pose archived outside Git with exact-byte/SHA256 inventories. Archive index preserves historical references; current architecture/threat descriptions refreshed. No ledger/state migration, stored-key rewrite or source-history rewrite. |
| 2026-11-13 | Artwork delivery and cleaned build verified | Full233 Bun tests/15490 assertions,123 Rust passes, build/typecheck/fmt; offline15 signatures/58 receipt graphs | Six generator-only WebPs/1536100 bytes moved outside public delivery; all19 shipped WebPs unchanged; all11 optimized outputs reproduce exact bytes. Original pose1123042 bytes archived. Source and prepared Chromium/WebKit routes preserve intro-first, nine entry URLs and original saves;390px Beacon/Wind/lantern origin/save/art-failure journey and both Bell/Reed/discovery browser routes pass. Prepared574iax has367 static files,370 output files;10 actual local secret values absent and private H1 handler remains SHA256e3cc0335191ce63946bcdf9fe772fed2ee5db2678f7c193a12c86cfb64800e03. Relayer Docker COPY set passes isolated frozen offline production install and runtime bundling; actual Docker daemon unavailable. Existing Phaser size warning persists. User image and protected environment/journals/Wasm untouched. No push or deployment; physical-device sound/full two-device recovery/human enjoyment unverified. |
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

![Familiar: a little adventure with Mochi. A felt-miniature harbor at sunset: Mochi, an orange kitten in a red bandana, leaps between spiral stepping stones past a teal wave and a glowing wind-moth, while the stone-crab Tidekeeper watches and Bram the badger waves from the quay below the lighthouse.](docs/readme-banner.jpg)

A cozy turn-based Phaser puzzle adventure with Mochi and a coastal harbor to restore. The introduction at `/` leads to `/outing/`. Recover the Beacon Lens, route the tide through Wind Gate, help at Bell/Reed Steps, and follow Mochi's later shore-bell discovery. Three story chapters are tide runs: twelve waves on a small board, where Mochi picks up what each wave leaves and banks it at the dock before the water lands. Once the beacon is lit, today's tide run is the daily, played and saved on this device: its three stamps (come home with something, match or beat Bram's guess, keep dry paws) are the day's asks, the first tide each day is the one that counts, and later sails are practice. The Home sheet shows the result, Bram's tide log keeps a page for each day, and Bram shelves the reed and glass Mochi brings home, to trade for Shells toward Mochi's wish. Saved harbors keep the Tidekeeper's three-ask court on Beacon Court, which device harbors can still open from the Chart.
A cozy turn-based Phaser puzzle adventure: guide Mochi as a volunteer harbor helper and restore the light. The introduction at `/` leads to `/outing/`. Three device story chapters recover the Beacon Lens, Signal Vane and wind-moth. Chapter 1 has eight calm waves; the later chapters have twelve. Each step or wait spends one move; a wave lands after every third move. Mochi collects finds by stepping onto them and banks cargo on arrival at the center dock.

The harbor prioritizes an open outing or unfinished filing, then a recovered repair, then the next story chapter. Once the beacon is lit, **Today’s tide · optional** opens daily preparation alongside the remaining story. The first finished daily outing sets that day’s score and stamps, including a zero-score, rescued or tide-turned outing; later sails are practice. Pausing leaves the outing open on its original day. Story outings use no daily result. The Home sheet and Log keep daily results; Bram shelves eligible reed and glass. Bell/Reed Steps, the later shore-bell discovery and optional courts remain on the Chart under their existing discovery requirements. Saved harbors keep the Tidekeeper’s three-ask court; each selected activity teaches its own rules and tools.

**Carried** means in Mochi’s pack; **banked safe** means secured for this outing. Banking does not finish it. **Finish and return** ends it without spending a move, then files the return; **filed in the harbor** means that save succeeded. A filed lens or vane still needs deliberate **installation**. Story prizes add no score. A failed filing keeps the finished outing available for retry, including when the prize write succeeded but closing the outing failed.

## Run

Expand All @@ -11,7 +15,7 @@ bun install --frozen-lockfile
make dev
```

No account is needed for the device preview. On touch screens, swipe once to move or tap a glowing neighboring platform. Tap **Wait** beside Mochi to wait and **Home** at the dock to finish the outing. On desktop, use WASD/arrows, Space to wait, R to finish at the dock and I for the free guide while the game has focus. Tide Run collects finds and banks cargo when Mochi steps onto them; the three-ask courts also use E for nearby objects. Mouse targeting still works; optional **Button controls** expose the same actions. Sound is opt-in; reduced motion keeps the same outcomes. Device saves stay on that browser and never silently merge into a signed-in harbor.
No account is needed for the device preview. On touch screens, swipe once to move or tap a glowing neighboring platform. Tap **Wait** beside Mochi to wait and **Finish** at the Tide Run dock to finish the outing. On desktop, use WASD/arrows, Space to wait, R to finish at the dock and I for the free guide while the game has focus. Tide Run collects finds and banks cargo when Mochi steps onto them; the three-ask courts also use E for nearby objects and retain their Home action. Mouse targeting still works; optional **Button controls** expose the same actions. Sound is opt-in; reduced motion keeps the same outcomes. Device saves stay on that browser and never silently merge into a signed-in harbor.

## Commands

Expand Down
16 changes: 16 additions & 0 deletions scripts/browser-controls.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { expect, test } from "bun:test";
import type { Page } from "@playwright/test";
import { guide } from "./browser-controls";

test("keyboard guidance waits for the new playfield before its first command",async()=>{
const calls:string[]=[];
let ready!:()=>void;
const opening=new Promise<void>(resolve=>{ready=resolve;});
const game={last:()=>game,locator:()=>({waitFor:async()=>{await opening;}}),focus:async()=>{calls.push("focus");}};
const page={locator:()=>game,keyboard:{press:async(key:string)=>{calls.push(key);}}} as unknown as Page;
const command=guide(page,"north");
await Promise.resolve();
expect(calls).toEqual([]);
ready();await command;
expect(calls).toEqual(["focus","ArrowUp"]);
});
7 changes: 7 additions & 0 deletions scripts/browser-controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { Page } from "@playwright/test";
/** Drive the public play surface, leaving command validation and saving to the game. */
export async function guide(page:Page,command:string){
const game=page.locator('[data-testid="expedition-game"],[data-testid="passage-game"],[data-testid="tide-run"]').last();
await game.locator('[data-testid="expedition-world"][data-ready="true"],[data-testid="tide-world"][data-ready="true"]').waitFor();
const key:Record<string,string>={"step:north":"ArrowUp","step:south":"ArrowDown","step:west":"ArrowLeft","step:east":"ArrowRight",north:"ArrowUp",south:"ArrowDown",west:"ArrowLeft",east:"ArrowRight",wait:"Space",return:"r",home:"r"};
if(key[command]){await game.focus();await page.keyboard.press(key[command]);return;}
if(command.startsWith("lure:")){
Expand Down Expand Up @@ -44,3 +45,9 @@ export async function departCourt(page:Page){
await page.locator('.exp-panel[data-surface="chart"] .harbor-routes > li').first().getByRole("button").click();
await page.locator('.exp-panel[data-surface="sail"] .exp-primary').click();
}

/** Story departures are prepared; resuming an existing trace deliberately bypasses this. */
export async function sailStory(page:Page){
await page.getByRole("button",{name:/^Prepare Chapter \d+$/}).click();
await page.getByRole("button",{name:"Sail with Mochi",exact:true}).click();
}
86 changes: 86 additions & 0 deletions scripts/browser-fixtures.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import { expect, test } from "bun:test";
import type { Page, Route } from "@playwright/test";
import { runInNewContext } from "node:vm";
import { BROWSER_DAY, prepareBrowser, seasonRpcFixture } from "./browser-fixtures";

const rpc=(method:string,args:unknown={},receiver="season.familiar-game.testnet")=>JSON.stringify({jsonrpc:"2.0",id:"season",method:"query",params:{request_type:"call_function",finality:"final",account_id:receiver,method_name:method,args_base64:btoa(JSON.stringify(args))}});
test("browser RPC fixtures match endpoint, receiver, method and exact arguments",()=>{
expect(seasonRpcFixture("https://test.rpc.fastnear.com","POST",rpc("get_shelf"),BROWSER_DAY)).toMatchObject({day:BROWSER_DAY});
expect(seasonRpcFixture("https://test.rpc.fastnear.com","POST",rpc("get_today",{account_id:null}),BROWSER_DAY)).toMatchObject({day:BROWSER_DAY,content_version:"first_light_v2"});
for(const [method,args] of [["get_account",{account_id:"alice.familiar-game.testnet"}],["get_wish",{pet:"mochi.familiar-game.testnet"}],["get_postcard",{pet:"mochi.familiar-game.testnet"}]] as const)
expect(seasonRpcFixture("https://test.rpc.fastnear.com","POST",rpc(method,args),BROWSER_DAY)).toBeNull();
for(const [url,verb,body] of [["https://test.rpc.fastnear.com.evil/","POST",rpc("get_shelf")],["https://test.rpc.fastnear.com/other","POST",rpc("get_shelf")],["https://test.rpc.fastnear.com","GET",rpc("get_shelf")],["https://test.rpc.fastnear.com","POST",rpc("get_shelf",{},"other.testnet")],["https://test.rpc.fastnear.com","POST",rpc("unknown")],["https://test.rpc.fastnear.com","POST",rpc("get_shelf",{unexpected:true})],["https://test.rpc.fastnear.com","POST",rpc("get_today",{account_id:null,extra:true})],["https://test.rpc.fastnear.com","POST",rpc("get_today",{account_id:"unknown.testnet"})]])
expect(()=>seasonRpcFixture(url!,verb!,body!,BROWSER_DAY)).toThrow();
});

for(const origin of ["http://localhost:3000","http://127.0.0.1:3000","http://[::1]:3000","https://familiar-two.vercel.app"])
test(`browser preparation shifts only the running wall clock and validates every request at ${origin}`,async()=>{
const calls:unknown[]=[];
let dateScript!:(time:number)=>void;
let handle!:(route:Route)=>Promise<unknown>;
const page={clock:{install:async(value:unknown)=>{calls.push(["install",value]);}},addInitScript:async(callback:typeof dateScript,time:number)=>{dateScript=callback;calls.push(["date",time]);},evaluate:async(callback:typeof dateScript,time:number)=>{dateScript=callback;calls.push(["shift",time]);},route:async(pattern:string,callback:typeof handle)=>{calls.push(["route",pattern]);handle=callback;}} as unknown as Page;
const network=await prepareBrowser(page,origin,BROWSER_DAY);
const noon=BROWSER_DAY*86_400_000+43_200_000;
expect(calls).toEqual([["date",noon],["route","**/*"]]);
let elapsed=10_000;
class WallDate extends Date { static now(){return elapsed;} }
const native={performance:{now:()=>elapsed},setTimeout,requestAnimationFrame:()=>1};
const context={Date:WallDate,...native,time:noon};
runInNewContext(`(${dateScript.toString()})(time)`,context);
expect(context.Date.now()).toBe(noon);
elapsed+=16;
expect(context.Date.now()).toBe(noon+16);
expect(new context.Date().getTime()).toBe(noon+16);
expect(new context.Date(123).getTime()).toBe(123);
expect(new context.Date("2026-11-14T00:00:00Z").getTime()).toBe(BROWSER_DAY*86_400_000);
expect(context.Date.parse("2026-11-14T00:00:00Z")).toBe(BROWSER_DAY*86_400_000);
expect(context.Date.UTC(2026,10,14)).toBe(BROWSER_DAY*86_400_000);
expect((context.Date as unknown as ()=>string)()).toBe(new Date(noon+16).toString());
expect(context.performance).toBe(native.performance);
expect(context.setTimeout).toBe(native.setTimeout);
expect(context.requestAnimationFrame).toBe(native.requestAnimationFrame);
expect(new context.Date()).toBeInstanceOf(WallDate);
runInNewContext(`class SavedDate extends Date {}; globalThis.savedDate = new SavedDate(); globalThis.SavedDate = SavedDate;`,context);
expect((context as any).savedDate).toBeInstanceOf((context as any).SavedDate);
expect((context as any).savedDate.getTime()).toBe(noon+16);
await network.setTime(noon+86_400_000);
context.time=noon+86_400_000;
runInNewContext(`(${dateScript.toString()})(time)`,context);
elapsed+=16;
expect(context.Date.now()).toBe(noon+86_400_000+16);
expect(new context.Date().getTime()).toBe(noon+86_400_000+16);
const request=async(url:string,method="GET",body:string|null=null)=>{
const actions:{kind:string;body?:string}[]=[];
await handle({request:()=>({url:()=>url,method:()=>method,postData:()=>body}),continue:async()=>{actions.push({kind:"continue"});},abort:async()=>{actions.push({kind:"abort"});},fulfill:async(response:{body:string})=>{actions.push({kind:"fulfill",body:response.body});}} as unknown as Route);
return actions;
};
expect(await request(`${origin}/assets/harbor.webp`)).toEqual([{kind:"continue"}]);
const fulfilled=await request("https://test.rpc.fastnear.com/","POST",rpc("get_shelf"));
expect(fulfilled[0]?.kind).toBe("fulfill");
const response=JSON.parse(fulfilled[0]!.body!);
expect(JSON.parse(new TextDecoder().decode(Uint8Array.from(response.result.result)))).toMatchObject({day:BROWSER_DAY});
expect(network.rpc).toEqual(["get_shelf"]);expect(()=>network.assertClean()).not.toThrow();
expect(await request("https://unexpected.example/telemetry")).toEqual([{kind:"abort"}]);
expect(await request(`${origin}/api/player`)).toEqual([{kind:"abort"}]);
expect(await request(`${origin}/npc-api/note`)).toEqual([{kind:"abort"}]);
expect(await request(`${origin}/assets/harbor.webp`,"POST")).toEqual([{kind:"abort"}]);
expect(await request("https://test.rpc.fastnear.com/","POST",rpc("unknown"))).toEqual([{kind:"abort"}]);
expect(()=>network.assertClean()).toThrow("Unexpected browser requests");
});

test("only deliberate timer-control scenarios install Playwright's full clock",async()=>{
const calls:unknown[]=[];
const page={clock:{install:async(value:unknown)=>{calls.push(["manual",value]);}},addInitScript:async()=>{calls.push(["date"]);},route:async()=>{}} as unknown as Page;
const manual=await prepareBrowser(page,"http://localhost:3000",BROWSER_DAY,{clock:"manual"});
expect(calls).toEqual([["manual",{time:new Date(BROWSER_DAY*86_400_000+43_200_000)}]]);
calls.length=0;
const unclocked=await prepareBrowser(page,"http://localhost:3000",BROWSER_DAY,{clock:false});
expect(calls).toEqual([]);
await expect(manual.setTime(0)).rejects.toThrow("Date shifts require");
await expect(unclocked.setTime(0)).rejects.toThrow("Date shifts require");
});

test("browser fixtures reject every hosted origin except the existing QA deployment",async()=>{
for(const origin of ["https://unexpected.example","http://familiar-two.vercel.app","https://familiar-two.vercel.app:444","https://familiar-two.vercel.app.evil"])
await expect(prepareBrowser({} as Page,origin)).rejects.toThrow("Browser fixtures require a local server or the existing hosted QA origin");
});
Loading