Generator: OSchema marker parser uses substring matching, miscategorizes adjacent markers #67
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_blueprint#67
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Discovered by the #261 agent while bootstrapping the
hero_servicetemplate repo.The OSchema marker parser identifies section markers via substring matching, which means markers that share a prefix can be matched against the wrong section (e.g., a
enumblock being read as a fragment of a longer marker, or two adjacent block markers colliding when one is a prefix of the other).What to do
crates/oschema/(or wherever section markers are tokenised).contains/starts_withchecks with whole-line / delimiter-aware matching.@rootvs@rootobject), markers inside string literals (must not match).Acceptance
example/,hero_compute/,hero_osis/,hero_serviceall parse identically post-fix.Related
PR #78 opened against
development.Root cause:
c.text.contains("[rootobject]")(inoschema/parser.rsandgenerator/schemas/oschema.rs) andsource.find("# ===SCHEMA===")(inoschema/parser.rs) are raw substring lookups. Adjacent markers, prefix-colliding names, markers mentioned inside string literals, and any longer comment line that happens to contain the header delimiter could all be miscategorised.Fix: new
crates/oschema/src/markers.rswith a delimiter- and string-literal-awareparse_markers/has_marker/strip_markers/is_header_delimiter_line. The oschema parser uses it for[rootobject]detection and a newsplit_headerhelper that requires the# ===SCHEMA===delimiter to be a whole comment line. The generator (schemas/oschema.rs,generator.rs,domain.rs) is routed through the same helpers so the two crates cannot diverge.Regression coverage
markers.rs— adjacent markers, prefix-collision, string-literal escapes, case-insensitivity, whole-line delimiter.parser.rsexercising the failure modes hit by the #261 agent:marker_regression_adjacent_markers,marker_regression_prefix_collision,marker_regression_string_literal_mention_does_not_match,marker_regression_header_delimiter_must_be_whole_line.oschema/tests/real_schemas.rsparsing every.oschemashipped in the repo (basic OSIS example, recipe_serverschemas/+src/recipes/+src/recipes/core/,example/recipe_server) and asserting the set of root objects is unchanged.Acceptance: 79 oschema lib + 7 integration tests pass; 125 generator tests pass; all real schemas parse identically (same root-object sets).