Skip to content

Fix round-41 schema parser findings: raw literals, path keywords - #519

Open
owjs3901 wants to merge 1 commit into
mainfrom
fix/parser-round41
Open

owjs3901 wants to merge 1 commit into
mainfrom
fix/parser-round41

Conversation

@owjs3901

Copy link
Copy Markdown
Contributor

Round-41 parser fixes (both LOW, from the parser-3 and parser-4 audit batches).

R41-P3-L1: raw string literals on the serde raw-token fallback

serde_attrs/fallback.rs: leading_string_literal accepted only "...", so when the structured #[serde(...)] walk fails, default = r"f" / rename = r#"f"# read as absent. It now also accepts raw literals (r"...", r#"..."#), decoded by syn::LitStr as before. Test: test_fallback_reads_raw_and_plain_literal_values (plain, raw, raw hashed, raw keeping a backslash; default and rename). The raw cases fail without the fix.

R41-P4-01: crate::Schema / self::Schema / super::Schema picked a CrateSchema-style component

type_schema/conversion.rs: the <module>Schema convention took the path keyword as a module name. The convention now skips a crate / self / super parent, so the bare Schema is named. Test: sidecar conversion/tests_path_keyword.rs (three cases). They fail without the fix.

Scope: crates/vespera_macro/src/parser/** only. Changepack: .changepacks/changepack_log_parser_round41.json (all seven packages, Patch).

Checks: cargo test -p vespera_macro (all suites), cargo clippy -p vespera_macro --all-targets -- -D warnings, cargo fmt --check. Files stay under 1000 lines (fallback.rs 986, conversion.rs 944).

Not changed, noted in the audit: in_string_literal in fallback.rs does not know raw strings, so a raw literal containing \" (for example r"C:\") can hide a later key from the fallback scan. No finding was filed for it.

🤖 Generated with Claude Code

- serde_attrs fallback: the raw-token fallback reads a raw string literal
  (r"..." / r#"..."#) as a default or rename value, as the structured walk
  already does, instead of reading it as absent.
- type_schema conversion: crate::Schema, self::Schema and super::Schema no
  longer apply the <module>Schema convention (a path keyword is no module
  name), so they name the bare Schema component, not CrateSchema-style ones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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