Skip to content

The create opens a branch session: one vocabulary, applied twice - #152

Merged
brettheap merged 1 commit into
mainfrom
change/create-opens-a-session
Aug 10, 2026
Merged

brettheap merged 1 commit into
mainfrom
change/create-opens-a-session

Conversation

@brettheap

Copy link
Copy Markdown
Contributor

Your first real create landed in the served checkout on main — untracked, no branch session — after I promised repeatedly that it would branch.

One silent vocabulary mismatch

createRequest maps the tile spelling to the session one through SESSION_SCOPE_KINDS (staged → staged-topic). The lens handed it the already-mapped spelling. SESSION_SCOPE_KINDS["staged-topic"] is undefined, so sessionScopeKind returned "", the if (scopeKind && scopeId) guard dropped both fields from the wire, and create-document — seeing no scope at all — took its documented pre-session path and wrote into the served checkout.

Nothing refused. Nothing warned. A create with no scope is a legitimate call, so every layer behaved correctly on the information it was given. The only way to see it was to make a real document and read git status.

Proven on the real plane this time

ok: True   ref: draft/session-probe   path: ideation/staging/session-probe/session-probe.md
branch draft/session-probe + its session worktree exist
the document is ABSENT from the served checkout

The probe's branch and worktree were removed after the check.

The test pins the two spellings against each other — the lens's value must be a key of the map, never one of its values — so the mapping can't be applied twice again.

What this doesn't undo

campaign-marketing.md and its gate record are still untracked in your checkout, where the old path put them. Yours to commit or discard; nothing here moves them.

Verification

  • pytest — 2823 passed, 19 skipped, exit 0.

Brett's first real create landed in the served checkout on main — untracked,
with no branch session — after I had promised repeatedly that it would branch.

ONE SILENT VOCABULARY MISMATCH. `createRequest` maps the TILE spelling to the
session one through `SESSION_SCOPE_KINDS` (`staged` -> `staged-topic`), and
the lens handed it the ALREADY-MAPPED spelling. `SESSION_SCOPE_KINDS
["staged-topic"]` is undefined, so `sessionScopeKind` returned "", the
`if (scopeKind && scopeId)` guard dropped BOTH fields from the wire, and
`create-document` — seeing no scope at all — took its documented pre-session
path and wrote into the served checkout.

Nothing refused. Nothing warned. A create with no scope is a legitimate call,
so every layer behaved correctly on the information it was given, and the only
way to see it was to make a real document and look at `git status`.

PROVEN ON THE REAL PLANE this time, not inferred from the code path:

  ok: True  ref: draft/session-probe  path: ideation/staging/session-probe/...
  branch `draft/session-probe` + its session worktree exist
  the document is ABSENT from the served checkout

The probe's branch and worktree were removed after the check.

The test pins the two spellings against each other — the lens's value must be
a KEY of the map and never one of its values — so the mapping cannot be
applied twice again.

WHAT THIS DOES NOT UNDO: Brett's `campaign-marketing.md` and its gate record
are still untracked in the served checkout, where the old path put them. They
are his to commit or discard; nothing here moves them.

Suites 2823 passed (exit 0).

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI lite review requested due to automatic review settings August 10, 2026 00:49

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @brettheap! 👋

Your private repo does not have access to Sourcery.

Please upgrade to continue using Sourcery ✨

@brettheap
brettheap merged commit f3e69b5 into main Aug 10, 2026
1 check passed
@brettheap
brettheap deleted the change/create-opens-a-session branch August 10, 2026 00:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a subtle “scope kind vocabulary” mismatch that previously caused create-document to omit session scope fields and fall back to the pre-session create path (writing into the served checkout on main). The update aligns the lens seed’s scopeKind with the tile vocabulary expected by the SESSION_SCOPE_KINDS mapping, and adds a regression test to prevent the mapping from being applied twice.

Changes:

  • Update lens.js to emit scopeKind: "staged" (tile vocabulary) and document the failure mode when the already-mapped session spelling is provided.
  • Update existing test expectations to match the lens’s tile-vocabulary spelling.
  • Add a regression test pinning that the lens uses a SESSION_SCOPE_KINDS key and that createRequest applies the mapping exactly once.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/ideation-dashboard/test_bullseye_widget.py Updates assertions for scopeKind and adds a regression test preventing double-mapping of scope vocabulary.
scripts/ideation_dashboard/web/views/lens.js Switches lens seed scopeKind to the tile spelling (staged) and adds explanatory comments about the session-opening behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

assert untagged[field], field


def test_the_lens_names_its_scope_in_the_tile_vocabulary_so_a_session_opens(tmp_path):
brettheap added a commit that referenced this pull request Aug 10, 2026
…ays so (#156)

Two defects behind one report ("i get the same error"), both read out of the
serve log after the console-token repair landed. Neither is the token: no
console refusal has occurred since the page reloaded on the fixed bundle.

THE SESSION VIEW NEVER OPENED. A create from a PROJECT view landed — `200`,
`draft/company-provisioning-…` opened, its snapshot generated — and the page
then asked:

    GET /snapshot.json?repository=xfactory&ref=draft/company-provisioning-…
    -> 404 no such snapshot

`xfactory` is a PROJECT id, not a repository; the session is registered as
`openxFactory @ draft/company-provisioning-…`. So the create succeeded and its
document view could not be loaded.

This is #152's ruling one step later in the flow. The create already asks the
serve which repository it writes to (lens.js `writableRepository`, because
under a composed view the rendered snapshot's `repository` is the project id).
The RE-KEY that follows the create still inferred: it read the view's own key,
and under a composed view `sourceKeyFor(null)` is null, so it fell through to
the project id. `rekeyToSession` now reads the serve's own declaration first.
A session ref can exist ONLY in the repository the serve writes to — a create
naming any other is refused by `refuse_foreign_repository` — so this is the
one authority, and the test pins the wire fact it rests on: a session snapshot
answers to its owning repository and to no other name.

A RUNNING WRITE NOW SAYS SO. Brett pressed create twice, and the log says what
that cost:

    23:51:40  press one opens the session
    23:51:41  document written, committed
    23:51:42  session snapshot regenerated
    23:51:54  press two -> 409 corpus documents are create-only
    23:53:11  press one -> 200

The first answer he read was the refusal of his own duplicate, for work that
had in fact landed — and the create that landed answered 77 seconds later. The
cause is that a create OPENS A BRANCH SESSION (worktree, branch, commit,
regenerated snapshot) and all the button did was grey out: `disabled` says "not
now" and nothing about "working", so a second create dialog was pressed.

The create and the three session verbs now carry a running label while the
request is in flight, restored in `finally` so a refusal is retriable in place
with its own words back on the button — the shape notebook.js already used
("opening NotebookLM…"). The duplicate itself is still refused, and correctly:
the create is create-only inside a session too (FR-018).

Suites: tests/ideation-dashboard + tests/ideation_dashboard — 2831 passed,
19 skipped (exit 0). The stranded-page browser proof re-run against a scratch
checkout: 10/10, zero page errors.

Co-authored-by: brettheap <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants