Repository navigation
Report each binding conflict once, from the gate of the document that holds it - #7235
Merged
Merged
Conversation
…ing it
A widget pair that binds one data source under two contracts, such as
an `lf-num` and an `lf-text-document` both on `source="shared"`, is a
conflict within one document. Several gates read documents that were
not theirs, so an author saw the same conflict more than once, or saw it
blamed on something else:
- `page check` on a page whose sample template held the pair reported
two `contract-conflict` findings: one from the page's own reading,
which descends into samples for the data inventory, and one from the
sample child's gate. A sample nested in a sample gave three.
- A template holding the pair also refused each fixture message in its
`data-sample-events` history with `fixture-markup`, since a fixture's
check read the child's whole document, so the author was told event 2
of the fixture didn't validate when the fault was in the template.
- An agent's message holding any HTML was refused while `index.html` on
disk bound a source twice, since the message's check read the current
source as well as the message.
- A message whose sample held the pair was refused with the finding on
the message itself (`samples` empty) rather than on the sample.
Now every gate reads its own document's bindings and no other's: the
conflict check runs in `instance_errors`, which every gate already runs
on the one document it reads (a page's source, a sample's child, a
message's HTML, a fixture message's HTML, a registry example). A sample
child is a document of its own, so its conflict is reported once, by its
gate, marked with its sample like the child's other findings
(`sample 'practice': source 'shared' is bound to both ...`). A fixture
message is refused only for its own bindings, and an agent's message
only for its own. The page's data inventory still reads its samples'
consumers, which is what `data_document_readings` recurses for.
A gate's finding no longer names its document in each seat ("at
index.html <lf-num> ..." becomes "at <lf-num> ..."), since the gate says
which document it read; the readings of a page's history, which hold
many documents, still name each one, as `leaf data set` reports them.
This removes the readings that existed only to look for conflicts:
`data_binding_errors`, `data_document_errors`,
`initial_data_document_readings`, the `readings` argument of
`authored_document_checks` and the `extra_errors` argument of
`message_markup_findings`. A message's check no longer parses
`index.html` from disk.
A sample child built from `data-sample-threads` no longer rereads the
imported messages' bindings under the page's current registry; each was
checked under the registry it is stored with as it entered, as every
message in a page's own log is.
# Conflicts: # src/leaf/records/authored_checks/admission.py # src/leaf/records/markup_checks/instances.py
…nflicting widget
A sample whose template imports a thread (`data-sample-threads`) copies
the thread's messages into its child, which reads them under its own
registry, the page's current one, whatever registry each was posted
under. Two widgets that shared a contract when a message was posted, and
no longer did after a registry change, passed `page check` and
allocated, and then `page state` on the child raised `DataError` reading
its bindings. The previous commit dropped the child gate's reread of its
log, which had caught this. Now `initial_sample_events`, which both the
check and allocation run, checks each copied message's bindings under
the child's registry as it copies them, and refuses the sample with a
`contract-conflict` naming the sample and the copied message ("sample
'practice': source 'shared' is bound to both contract 'rows' at copied
message 'aabb0011' <lf-test-data id=rows-view> ...").
A conflict's seats now carry the widget's id, so an author sees which
widgets read the source. One `lf-num` and two `lf-text-document`s on
one line, all bound to `shared`, had given two byte-identical findings
since the previous commit; now each names its `lf-text-document`.
Widgets of one tag without ids on one line still read as one seat, and
give one finding.
The docstrings of `declared_data_bindings` and `check_markup` now say
which registry each reader of a message's bindings uses: its gate and
the page's data inventory use the one it is stored with, and a sample's
child its own.
`test_a_message_is_refused_only_for_its_own_bindings` now requires the
command to succeed and the comment to be in the log, since an empty list
of findings also held for a refusal that carried none.
An element declaration's `example` is checked as markup a page could hold, and `invalid-example` tells its author when a page copying it would be refused. The check read only the example's own document, so an example binding one source under two contracts gave `invalid-example`, and the same widgets wrapped in a named sample template (`<template id="practice" data-sample>`) gave nothing, though a page holding it is refused for the sample's child. Now `_example_advice` runs `markup_findings` on each sample's child too, recursively, as `uncaptured_sample_errors` walks a message's, and the refusal it reports carries the sample it was found in.
leaf-agent
approved these changes
Nov 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
leaf page checkreported one data-binding conflict inside a sample twice, and the same cause misreported three other cases. A conflict exists within one document, so each document's gate now checks only the document it reads: the conflict check moves intoinstance_errors(markup_checks/instances.py), which every gate already runs on exactly one document: the page's source, a sample's child, a message's HTML, a fixture message, a registry example. The page's reading still descends into samples, for the data inventory only.What an author sees now:
samples=("practice",)), where it gave two (three for a sample nested in a sample). It no longer also refuses every fixture message in the template'sdata-sample-eventsas "event 2 … doesn't validate".index.htmlholds a conflict, whichcheck_sourcechecks first when a message publishes saved edits.data-sample-threads) is checked once more under the child's registry, atpage checkand at allocation alike, so a contract that changed since the message was posted refuses the sample, naming it and the copied message, rather than creating a child whosepage statefails.<lf-text-document id=more>), so two consumers on one line are two findings an author can tell apart. A conflict's location no longer repeats the document's name, which the gate'ssample '…':prefix already gives.invalid-examplerefused written directly is refused wrapped in a named sample template too.Codex found the double report while reviewing #7218 and reviewed this fix; its findings, among them the copied-thread case, are folded in.
Tests: new regression tests for the root, template and fixture cases on one page, for a message's own bindings, for copied messages under the child's registry, for the widget ids, and for the example's samples, each failing before its fix;
lint-imports, pre-commit, and 679 covering model tests, the bundled-examples check among them.