Repository navigation
fix(core): let frontmatter keys satisfy schema fields - #2047
Conversation
A Picoschema field matched only observations, so a note with `attendees: 4` in frontmatter failed `attendees: integer`, and infer and diff ignored frontmatter. Scalar facts live in frontmatter, where bm_write(metadata=...) and set_metadata put them. - validate: a non-relation field takes its values from a frontmatter key first, then from [field] observations. Enum checks apply to either. - infer/diff: analyze_fields replaces analyze_observations and counts frontmatter keys as fields, once per note, skipping title, type, permalink, tags and schema. A field's source is where most of its notes keep it. - bm-schema(3) states the rule. Closes #1973 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CMYVL4TcbWdXhdvAzxfqjo Signed-off-by: phernandez <paul@basicmachines.co>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
โน๏ธ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with ๐ while any review is running, comments if it has suggestions, and reacts with ๐ once all reviews finish with no findings. |
There was a problem hiding this comment.
๐ก Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c749a37046
โน๏ธ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with ๐.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
โฆhema diff Codex review on #2047: - An entity-reference field is satisfied only by relations, as in validation, so frontmatter or an observation of the same name no longer hides that no note has the relation. - Keys declared under settings.frontmatter count as declared, so they are not reported as new fields. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CMYVL4TcbWdXhdvAzxfqjo Signed-off-by: phernandez <paul@basicmachines.co>
There was a problem hiding this comment.
๐ก Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fe072e8724
โน๏ธ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with ๐.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Inference skips keys every note carries (title, type, tags, ...). Drift skipped them too, so a schema that declares tags reported it as dropped while every note used it. Drift now skips only the built-in keys the schema does not declare. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CMYVL4TcbWdXhdvAzxfqjo Signed-off-by: phernandez <paul@basicmachines.co>
Closes #1973. Implements the decision on the issue: a schema field is satisfied by a frontmatter key or an observation category, frontmatter checked first, with no per-field source syntax.
Changes
picoschema/validator.py): a non-relation field takes its values from the note's frontmatter key first, then from[field]observations. Details:Missing required field: attendees (expected attendees: in frontmatter or a [attendees] observation).picoschema/inference.py,diff.py):analyze_fieldsreplacesanalyze_observations.title,type,permalink,tags,schema.FieldFrequency.sourcecan now befrontmatter: the place most of a field's notes keep it, frontmatter on a tie.NoteDatafor infer/diff now carries the entity's frontmatter.Tests
tests/picoschema/test_frontmatter_fields.pycovers:tests/api/v2/test_schema_router.py::test_frontmatter_satisfies_schema_fields_in_validate_infer_and_diffruns the report's Meeting /attendees: 4case through validate, infer and diff.just fast-check; picoschema, schema router andtests/mcpsuites pass (1,495 tests); the router tests also pass on Postgres.๐ค Generated with Claude Code
https://claude.ai/code/session_01CMYVL4TcbWdXhdvAzxfqjo