Skip to content

feat(language): a call reads a property of a dimension or a set, written subject[property] - #2

Draft
FBumann wants to merge 4 commits into
claude/sets-properties-prototype-9m3zu6from
claude/sets-properties-prototype-9m3zu6-2-calls
Draft

FBumann wants to merge 4 commits into
claude/sets-properties-prototype-9m3zu6from
claude/sets-properties-prototype-9m3zu6-2-calls

Conversation

@FBumann

@FBumann FBumann commented Oct 23, 2026 •

Copy link
Copy Markdown

Prompt: 2. Calls: subject[property] in sum, at, within= and conditions, the presence condition, and the inner join for several properties.

Note

The following content was generated by AI.

What this changes

sum, at, within= and conditions now read subject[property, …], by the join and group rules of a relation column. One property reads its own table, subject.property. Several properties read the inner join of their tables. subject[property] alone tests that a row has the property. Stacked on #1.

The PR also fixes one bug. position(..., within=...) in a condition named no table in names_read, for relations too, so a consumer that attaches what a mask reads left the groups out.

Why

This is PR 2 of the stack in which sets and properties replace relations.

How a read lowers

Namespace.table(subject, names) decides which table a call reads:

written program node's name tables the data supplies
sum(x, over=generator, by=generator[bus]) generator.bus generator.bus
sum(x, over=generator, by=generator[bus, carrier]) generator (the inner join) generator.bus, generator.carrier
sum(x, over=start, by=cover[covered]) cover cover
within=snapshot[period] snapshot.period snapshot.period
generator[bus] == 'b1' RelationComparison('generator.bus', 'bus', …) generator.bus
line[bus0] != line[bus1] RelationPairComparison('line.bus0', …, 'line.bus1', …) both
generator[bus, carrier] alone RelationDefined on each table, joined by And both
  • The inner join is no table of the program. For several properties, the node carries a Relation with subject set, keyed by the subject's members, with one value column per property. Its missing is absent where any of the properties is.
  • JoinColumns.tables and Partition.tables name the tables the data supplies. Mask.names_read reads them, for a join, a partition and a position counted within groups, so a mask never names the subject as if it were data.
  • JoinColumns.written and Partition.written give the subject as the file wrote it. The dimension-rule messages use it.
  • The typesetter takes each shape from the node, so it never looks up a view in program.relations.
  • Conditions: the grammar parses name[a, …] alone as a presence test. subject[a, b] == x keeps the rewrite "a comparison reads one column", which now fires at the comparator.
  • Messages name the subject as written. For example: sum(by=generator[zone]) names ['zone'], which is no property of 'generator'. Name one of its properties, ['bus', 'carrier'].
Departures, and what this PR does not do
  • The position(within=) fix rides this PR rather than a PR of its own. It also changes behaviour for relations. I first reproduced it as a strict xfail in three cases (a relation, one property, two properties) and watched all three fail. The marker came off with the fix.
  • A test changed its expected wording. The test that asserts Only a relation has columns (tests/test_validation.py) now expects Only a relation, a set or a dimension has columns, because a dimension and a set now take brackets.
  • No typesetting work. The math prints the table names as they are, such as generator.bus(g), and the reference page shows that output. PR 4 changes the legend and regenerates both.
  • No data contract. docs/reference/reading.md is PR 4.
Gates, and the mutation table
  • Passed: pixi run lint, pixi run test (3202 passed, 1 skipped) and pixi run docs-build (strict). Both YAML examples on the page load, and the math and the quoted refusal were taken from the code's output.
  • Not run: compile-tex. Tectonic cannot download its bundle in this container.
  • No CI run. GitHub Actions has never run in this fork, and dispatching ci.yml returns 404. Actions must be turned on in the fork's settings.
  • Mutation table: the same script as feat(language): a file may declare sets of labels and the properties of a dimension or a set #1 took it. It refuses a dirty tree, restores each file with git checkout --, and drops __pycache__ around each mutation. The tree came back clean.
    • In the first run, one deletion stayed green: the guard on presence for a name that is not a subject. Without it, the file was still refused, but with the wrong message. The guard also called a declared parameter "not found", which is now fixed.
    • Two probes now cover it. The second row in the table is the guard deleted again by hand after the fix: both probes fail.
guard deleted suite
a dimension read by no property caught
a column the subject lacks caught (5)
a dimension with properties takes brackets caught (15)
one property reads its own table caught (4)
the inner join is absent where a property is caught
presence of a relation is refused caught
presence of a name that is not a subject green in the first run → 2 probes added, caught (2)
presence of a property the subject lacks caught
a comparison reads the property table caught (3)
a comparison of a column the subject lacks caught (2)
a subject with a column is read as a table caught (4)
a column of a non-subject is refused caught (2)
presence parses caught (8)
the one-column rewrite after a listed read caught (2)
a view reads the tables of its properties caught (4)
a joined condition names the tables it reads caught
a dim refusal names the subject as written caught
the typesetter reads the shape off the join caught (3)
a position names the tables of its groups xfail reproduced first, 3 cases

🤖 Generated with Claude Code

https://claude.ai/code/session_01W6yvGzZN2iR4WyA9RumvvJ

…ten subject[property]

`sum`, `at`, `within=` and conditions read `subject[property, …]` by the
rules of a relation column. One property reads its own table, several read
their inner join, and `subject[property]` alone tests that a row has it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W6yvGzZN2iR4WyA9RumvvJ
…umns rather than calling it undeclared

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W6yvGzZN2iR4WyA9RumvvJ
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W6yvGzZN2iR4WyA9RumvvJ
@coderabbitai

coderabbitai Bot commented Oct 23, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

…groups are read from

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W6yvGzZN2iR4WyA9RumvvJ
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