Skip to content

refactor: refusals of the page in one module; the range of a new batch decided in the batch layer; the rules of the design - #258

Merged
SimonHeybrock merged 6 commits into
mainfrom
236-refusals-in-one-place
Nov 20, 2026
Merged

SimonHeybrock merged 6 commits into
mainfrom
236-refusals-in-one-place

Conversation

@SimonHeybrock

@SimonHeybrock SimonHeybrock commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

The last two of the pull requests that bring the web layer of the batch page to one set of rules, and the rules written down.

Every refusal of the page is said in one module. Problem (422 with a message), Missing (404) and how an exception of the batch layer reads as a sentence were defined in the module of one batch, though Pages raises them too. A refused write to the definitions read "The change was not kept: …" in three places and "The batch was not made: …" in a fourth, and two methods re-raised it by hand. web/refusals.py now holds all of it, and one context manager says a refused write.

One rule for what code of the application raises. A source, the file source and a drawing are code of the application and may raise anything; the page says it and keeps working. A refusal (ValueError, OSError) reads as its text; anything else is a defect of that code and reads with its type (KeyError: 'run'), where it read as a bare word ("run."). The four requests that run a source, the listing, the step of Follow and the plot use one function for the text.

Which rows a new batch takes is decided in the batch layer. The page decided that a batch that follows has no last row, and that "no row now" takes none. The range is now a value that the manager reads:

manager.create('loki-iofq', title='Afternoon', source='sample-runs',
               choose=Range(first='60339'), follow=True)     # from 60339 on, and what arrives
manager.create(..., choose=Range(later=True), follow=True)   # no row now
manager.create(..., choose=Range(last='60350'), follow=True) # refused with a ValueError: a batch that follows has no last row

choose may still be any function of the rows. The refusal is of a Range with a last row: a function chooses any rows in code, and the filled rows it leaves out are considered, so Follow adds only what arrives later. ADR 0013 said the manager cannot see a last row because choose is code, and now says this. Range replaces source.between, and create takes columns= for the empty parameter columns, so the page passes what the form holds as given.

The rules of the design are a new section of the page's README: who decides, the one lock, the owner of each piece of state, what a request answers, how a change is noticed, where a refusal is said, the queue of the browser, and the settings form as a draft. A reviewer checked each against the code; three were false as first worded and are corrected, one by a fix (below).

Changes a person can see, found by running the code before and after side by side:

  • Load table is refused while the settings form holds a change, as "Make this a column" is. Before, it could drop a column and silently discard the change.
  • A refused write while a batch is made reads "The change was not kept: …", as everywhere else.
  • A defect of a source reads with its type: "The batch was not made: RuntimeError: boom."
  • "Start with the settings of" a label that is no batch reads "there is no batch nope to start from", where it read "nope".
  • Removing a batch shows "Removed <title>."; the route answers a Notice, where it answered {}.

🤖 Generated with Claude Code

SimonHeybrock and others added 5 commits November 20, 2026 14:53
Problem, Missing and why were defined in page.py, yet Pages raised them
too, importing them from the module of one batch. They move to
web/refusals.py, with say (the reason at a field) and kept, one context
manager that says a write the definitions refuse (NotKept) as "The change
was not kept: ...". Page actions, the corrections of runs, removing a
batch and making one all use it, so take and load_table no longer re-raise
NotKept by hand, and Pages.create no longer says it as "The batch was not
made: ...".

Pages.create and Page.take catch what the batch layer refuses (ValueError,
and KeyError for create) instead of every exception: anything else that a
source raises is a defect of its code. Pages.check is the one place that
says "There is no batch X." for Pages.page, Pages.remove and Page._held.
Removing a batch answers a Notice instead of an untyped {}.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
"A batch that follows has no last row" and "no row now takes no row" were
rules of Pages.create and its helper taken, so code and the command did not
get them. source.between becomes source.Range(first, last, later): a
choose that a person picks, which refuses later with an end, and whose last
BatchManager.create can see, so create refuses follow with a last row.
Pages.create passes the range as given and says what the manager refuses.

create takes columns, the parameters that are columns of empty cells:
Pages wrapped choose to add them, which would hide the Range from the
manager. The tests of ranges move to manager_test; the web tests keep that
the refusal reaches the page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every call that runs a source (making a batch, marking a range, offering
and taking rows) goes through refusals.refused: a write the definitions
refuse reads "The change was not kept: ...", and ValueError, KeyError and
OSError read as what was asked plus why. OSError is said since the files a
source is given may fail to list, such as a mount that went away, which is
no defect of the code; anything else a source raises is a defect and is not
turned into a message. rows_of and offered caught every exception before.

ADR 0013 said the manager cannot see a last row since choose is code; the
range is a value the manager reads, and create refuses follow with a last
row. The guide, the ADR, the demo and the toys use Range and columns where
a lambda picked a range or added an empty column.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Who decides, the one lock, the owner of each piece of state, what an action
answers, how a change is noticed, where a refusal is said, the queue of the
browser, and the settings form as a draft. A change that breaks one of them
needs a reason.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@SimonHeybrock SimonHeybrock self-assigned this Nov 20, 2026
… draft

A source, the file source and a drawing are code of the application and
may raise anything. The page says it and keeps working, as it did before
the previous commits narrowed this for sources: refusals.said reads a
ValueError or OSError as its text and anything else, a defect, with its
type ("RuntimeError: boom", "KeyError: 'run'"). refused uses it for the
requests that run a source, and the listing, the step of Follow and the
plot use it for their text. refused wraps kept and adds no second period.

Pages.create checks settings_from and looks up a spec through
BatchManager.spec_named (was _bound), which refuses with ValueError, so a
KeyError inside the block is a defect.

Load table changes which parameters are columns, so it is refused while
the settings form holds a change, as "Make this a column" is; before, it
dropped the draft without a word. It says OSError of reading the file.

The page shows the notice of removing a batch. ADR 0013, Range and
create say that only a Range with a last row is refused with follow: a
function may choose any rows. The rules in the web README say what holds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@SimonHeybrock
SimonHeybrock merged commit d77a185 into main Nov 20, 2026
2 checks passed
@SimonHeybrock
SimonHeybrock deleted the 236-refusals-in-one-place branch November 20, 2026 15:40
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.

1 participant