Skip to content

Story 1.7: the Observation, part two, the remaining sections and the readable form - #61

Merged
watchthelight merged 3 commits into
mainfrom
story/1-7-the-observation-part-two-the-remaining-sections-and-the-read
Sep 6, 2026
Merged

Story 1.7: the Observation, part two, the remaining sections and the readable form#61
watchthelight merged 3 commits into
mainfrom
story/1-7-the-observation-part-two-the-remaining-sections-and-the-read

Conversation

@watchthelight

Copy link
Copy Markdown
Owner

Closes #20

Summary

The Observation is now the nine sections of ADR-0005: the hero, the inventory, the journal, the log, the valid Actions and the open Prompt join the header, the map and the actors, under schema version 2.
The Action records of ADR-0014 exist from here (item use split by the shape of its target, MoveTo for a human's click, which the valid set refuses), the actions section sorts them canonically, and the Observation refuses an Action naming what it does not carry: a cell off the map, an item reference the inventory does not list, an answer past the prompt's options.
The readable form is canonical JSON from a JsonWriter the Run log shares, with the hash and the section hashes as fields and no reader anywhere in api; the Belief is an opaque versioned value the harness hashes without reading, and no record of the schema has it as a component.
The one thing to look at: Observation's constructor is where the sections are held to each other (hero in view and alone, header and prompt agreeing, every Action parameter carried), and HeroSection and ItemView are where the new free-form strings enter.

What changed

  • shatterfish/api/src/main/java/org/shatterfish/api/: HeroSection (TalentView, QuickslotView), InventorySection (ItemView, ItemRef), JournalSection (NoteView, KnownAppearance), LogSection (LogLine), ActionsSection over the sealed Action with twenty records, PromptSection; enums HeroSubclass, Hunger, ItemKind, EquipSlot, NoteKind, LogTone; Observation with nine sections, withActions and json(); ObservationCodec at version 2; JsonWriter (sorted keys, no whitespace, integers, the required escapes) and ObservationJson; Belief.
  • Tests: Variants (the schema by reflection, through sealed kinds), CodecReflectionTest (every component reaches the bytes and the JSON; one record per kind), CodecEqualityTest (equality against hash, bytes and JSON over 470 Observations), JsonRenderingTest with StrictJson (the hash field, canonical shape, escapes, writer misuse, no reader in api by ArchUnit), BeliefTest, CodecCanonicalTest (the new set-like and positional lists), SchemaRulesTest (header and prompt agreement, Action parameters, the hero in view, the belongings' order, item and note shapes, the log's bound), ObservationHashTest repinned.
  • Docs: ADR-0005 amendment for story 1.7; ADR-0014 amendment for the Action records; six rule rows in docs/rules/ui.md (status pane and hero window numbers, hunger icon, log retention, quickslots, belongings order, talents pane); docs/architecture.md.

How it was tested

  • ./gradlew build: green, 383 tests across 22 suites, 317 of them in api.
  • Mutation battery of twenty-one on the committed tree, eighteen at the first commit and three added for the review's rules (story file, Evidence): all twenty-one caught.
  • Fairness review: fairness-reviewer on 5731279a0: FINDINGS with none blocking, seven should-fix findings all taken in b89047e0d (story file, The fairness review): the reader test pins the module's class set and scans constructors; UseItemOption dropped, since an item's option window is a Prompt at its own Input wait; the log claim corrected to what the pane does; hero buffs ordered as an actor's; MoveTo refused by the valid set; five cites fixed; lone surrogates escaped.
  • Rig numbers: n/a before E3.
  • Screenshots: n/a.

Docs

  • docs/adr/0005-observation-schema-and-hashing.md: amendment (the six sections' shapes with cites, the two-step construction, the JSON rules, the Belief, version 2).
  • docs/adr/0014-action-schema-and-executor-contract.md: amendment (the records from 1.7, item use as four kinds, MoveTo, ItemRef checked at construction).
  • docs/rules/ui.md: six rows. docs/architecture.md: the api line.
  • Story file _bmad-output/implementation-artifacts/1-7-the-observation-part-two-the-remaining-sections-and-the-read.md.

Upstream files touched

  • none

…readable form

The Observation is now the nine sections of ADR-0005: the hero, the inventory, the journal, the
log, the valid Actions and the open Prompt join the header, the map and the actors, and the
schema version is 2. Each new section cites the view it mirrors: the hero as the status pane,
the hero window, the talents pane, the bag window and the quickslots draw it; the inventory in
the belongings' own order, since an item reference is a position in it; the journal's notes and
the appearances identified this Run; the log's messages with their tones, capped at sixty-four;
the Prompt's kind, title, text and button labels.

The Action records of ADR-0014 exist from here, one per kind with item use split by the shape
of its target, and the actions section sorts them by kind and bytes; the Observation refuses an
Action naming what it does not carry, a cell off the map, an item reference the inventory does
not list, an answer past the prompt's options. The valid set is computed from the rest, so an
Observer builds the record with no Actions and fills them with withActions.

The readable form is canonical JSON from a JsonWriter the Run log shares: sorted keys, no
whitespace, integers only, the required escapes, with the hash and the section hashes as fields
and no reader anywhere in api. The Belief is an opaque versioned value the harness hashes
without reading; it is not a field of the Observation. CodecEqualityTest holds equality to the
hash, the bytes and the JSON over a corpus of every accepted single-component variation of two
Observations, one with the chasm Prompt open.
…he log claim corrected, the reader test pins the module

The fairness review passed on parity and found seven things to fix, all taken. UseItemOption is
gone: the window of options an item opens lists labels that are not known at the Input wait
the item is used from, and since story 1.5 a recognised window in front is an Input wait of its
own, so that window is a Prompt answered at the next wait; ADR-0014's amendment says so. The
actions section refuses MoveTo, which is a human's click and never valid. The hero's buffs are
ordered by name, then timed, then turns, as an actor's are, so one screen has one hash. A lone
surrogate is escaped in the JSON, so the text is the same UTF-8 everywhere.

The log's Javadoc, ADR-0005 and the rule row said every message had been shown; the pane takes
a frame's messages in one batch and trims before drawing, so a burst can lose its oldest lines
unseen. The Observation keeps the raw signal, which non-negotiable 1 names as a source and
which is reproducible where frame timing is not, and the trade-off is recorded. The reader test
now pins the set of classes in api, scans constructors as well as methods, and treats an array,
a collection, an Object or a stream as text; five cites are corrected, the wand's status, both
status panes' exp text, the energy number, the talents pane's tier gates, and the item packages
without a family of their own.
… to review

The story file records the twenty-one-mutation battery on the committed tree, the fairness
review's seven findings and how each was taken, the corpus of the equality test, and the
limitations handed to stories 1.9, 1.10 and 1.12: the talents pane's tier gates, the log
listener that must capture exactly what the pane receives, a Prompt kind for an item's option
window, and the valid set that does not exist until 1.12.
@watchthelight watchthelight added this to the E1 Harness milestone Sep 6, 2026
@watchthelight watchthelight added epic:E1 Harness fairness Touches Observer, ActionExecutor, brain, or information parity area:api The api module: Observation, Action, Decision, run-log records labels Sep 6, 2026
@watchthelight
watchthelight merged commit 73b9ca3 into main Sep 6, 2026
3 checks passed
@watchthelight
watchthelight deleted the story/1-7-the-observation-part-two-the-remaining-sections-and-the-read branch September 6, 2026 01:57
@watchthelight watchthelight mentioned this pull request Sep 6, 2026
21 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:api The api module: Observation, Action, Decision, run-log records epic:E1 Harness fairness Touches Observer, ActionExecutor, brain, or information parity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

E1.7 The Observation, part two: the remaining sections and the readable form

1 participant