Skip to content

fix(rule): add @JsonIgnoreProperties(ignoreUnknown=true) for Change Feed + harness improvements#36

Closed
Dereku92 wants to merge 2 commits into
AzureCosmosDB:mainfrom
Dereku92:fix/test-harness-improvements
Closed

fix(rule): add @JsonIgnoreProperties(ignoreUnknown=true) for Change Feed + harness improvements#36
Dereku92 wants to merge 2 commits into
AzureCosmosDB:mainfrom
Dereku92:fix/test-harness-improvements

Conversation

@Dereku92
Copy link
Copy Markdown

@Dereku92 Dereku92 commented Mar 21, 2026

Summary

Fixes #28 — Adds @JsonIgnoreProperties(ignoreUnknown = true) requirement to model-json-serialization rule. This was the most prevalent defect in the SCOPE evaluation (94% hit rate across all profiles), causing UnrecognizedPropertyException on Cosmos DB system metadata fields (_lsn, _rid, _ts, _etag, _self) during Change Feed deserialization.

Also includes two small harness improvements:

  • Fix hardcoded default database name in conftest_base.py (gaming-leaderboard-dbtest-db)
  • Add .gitignore to iterations directories to prevent accidental commits of build artifacts

Changes

  • skills/cosmosdb-best-practices/rules/model-json-serialization.md — add Rule 5 for @JsonIgnoreProperties
  • testing-v2/harness/conftest_base.py — use generic default database name
  • testing-v2/scenarios/*/iterations/.gitignore — new file (all 5 scenarios)

Testing

Rule changes are additive (new Rule 5 added, existing rules unchanged). The harness default database change only affects edge cases where iteration-config.yaml omits the database field.

- Change hardcoded default database name in cosmos_database fixture from
  'gaming-leaderboard-db' to 'test-db'. The previous default was specific
  to the gaming-leaderboard scenario and would silently use the wrong
  database for other scenarios when iteration-config.yaml omits the
  'database' field.

- Add .gitignore to each scenario's iterations/ directory to prevent
  accidentally committing language-specific build artifacts (node_modules,
  __pycache__, bin/obj, target, etc.) and CI temp files.
@Dereku92
Copy link
Copy Markdown
Author

/aggregate 1,2,3

Addresses AzureCosmosDB#28 — Cosmos DB entity classes without this annotation fail
with UnrecognizedPropertyException on system metadata fields (_lsn,
_rid, _ts, _etag, _self) during Change Feed deserialization.

This was the most prevalent defect in SCOPE evaluation (94% hit rate
across all profiles). Added as Rule 5 in model-json-serialization.
@Dereku92 Dereku92 changed the title fix: use generic default database name and add iterations .gitignore fix(rule): add @JsonIgnoreProperties(ignoreUnknown=true) for Change Feed + harness improvements Mar 21, 2026
@TheovanKraay
Copy link
Copy Markdown
Contributor

Thanks for this! A few things need to be adjusted before merge:

  1. AGENTS.md not regenerated. Agents consume the compiled AGENTS.md, not individual rule files. Please run npm run build and commit the result, otherwise this change has no effect.

  2. Rule approach. @JsonIgnoreProperties works but needs to be on every entity. The more robust fix is configuring this globally at the ObjectMapper level (FAIL_ON_UNKNOWN_PROPERTIES=false) or via Spring Boot properties. Also, this affects all Cosmos DB reads, not just Change Feed.

  3. Drop the conftest_base.py change. Every iteration provides a database field in iteration-config.yaml, so this default is never reached. Also, drop the .gitignore additions. These paths match the CI workflow's pull_request_target path filter, which is why the test pipeline is firing on this PR. The root .gitignore already covers pycache/, and iteration directories are only created on PR branches and built on ephemeral CI runners, so there's no risk of accidentally committing build artifacts.

I'll fix the CI trigger issue separately by narrowing the path filter in auto-trigger-tests.yaml from testing-v2/scenarios//iterations/** to testing-v2/scenarios//iterations/iteration-*/** so that only actual iteration subdirectories trigger the test pipeline. Please scope this PR to just the rule change (with the AGENTS.md rebuild).

@TheovanKraay
Copy link
Copy Markdown
Contributor

Closed as fixed by PR: #45

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.

Java Gaming Leaderboard — Missing @JsonIgnoreProperties(ignoreUnknown = true) — Change Feed fails on system metadata in 94% of runs (all profiles)

2 participants