Skip to content

docs(controller): name controller members for what they do - #174

Merged
simontaurus merged 1 commit into
mainfrom
docs/controller-method-names
Oct 15, 2026
Merged

simontaurus merged 1 commit into
mainfrom
docs/controller-method-names

Conversation

@simontaurus

Copy link
Copy Markdown
Contributor

Adds two guidelines to the controller how-to.

A controller extends a model whose field names come from a schema, so a
noun-named method or property competes with a field the schema may gain at the
next regeneration: it shadows the field, or the field shadows it, and the two
are hard to tell apart because both answer to attribute access. A verb is
almost never a field name.

A property is the worst case: it reads like data, so callers reach for it with
getattr(), and whatever it does on the way surfaces where a plain attribute
read was expected.

Both come from the file controllers in
opensemantic.core:

  • path was a model field in one implementation and a property derived from
    local_path in another, so the same noun meant two different things.
  • url on the wiki controller is a property that opens a session, which made a
    caller probing download_url / url / access_url with getattr() raise
    instead of answering.
  • get(), put(), put_from() and materialize_data() have never collided
    with anything.

A noun-named method or property competes with a schema field the model
may gain on the next regeneration; a property makes it worse by doing
work where a plain attribute read is expected.
@github-actions

Copy link
Copy Markdown
Contributor

Release preview

No version bump from the current commits (stays at v2.3.0). Use conventional commit types (feat, fix, ...) to trigger a release.

Changelog preview (truncated)

Preview via python-semantic-release and conventional commits.

@github-actions

Copy link
Copy Markdown
Contributor

📊 Benchmark Results

Click to see benchmark comparison
📊 Benchmark Comparison (threshold: 1.3x)
============================================================

➖ Unchanged (within threshold):
  ➖ test_simple_dict_document_store: 0.0020s → 0.0020s (-0.3%)
  ➖ test_sqlite_document_store: 0.0021s → 0.0021s (-0.6%)
  ➖ test_local_sparql_store: 0.0391s → 0.0410s (+4.7%)
  ➖ test_oneof_subschema: 0.0637s → 0.0625s (-1.9%)
  ➖ test_enum_docstrings: 0.0534s → 0.0537s (+0.5%)
  ➖ test_subclass_inheritance: 0.0578s → 0.0552s (-4.5%)
  ➖ test_class_hierarchy: 0.0551s → 0.0529s (-4.1%)
  ➖ test_core[v1]: 0.0370s → 0.0366s (-1.1%)
  ➖ test_core[v2]: 0.0453s → 0.0454s (+0.2%)
  ➖ test_schema_generation[v1]: 0.0017s → 0.0017s (+0.7%)
  ➖ test_schema_generation[v2]: 0.0038s → 0.0038s (-0.3%)
  ➖ test_simple_json: 0.0007s → 0.0007s (+2.0%)
  ➖ test_complex_graph: 0.0016s → 0.0016s (+0.8%)

============================================================
Summary: 0 regressions, 0 improvements, 13 unchanged
============================================================

✅ No significant performance regressions

Threshold: 1.3x (30% slower triggers a regression warning)

Note: Benchmarks are informational only and won't fail the build.

💡 Tip: Download the benchmark-results artifact for detailed JSON data

@codecov

codecov Bot commented Oct 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@simontaurus
simontaurus merged commit 25c7880 into main Oct 15, 2026
21 checks passed
@simontaurus
simontaurus deleted the docs/controller-method-names branch October 15, 2026 11:28
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