Skip to content

Add syntax for declarative record descriptors#233

Open
Schamper wants to merge 1 commit into
mainfrom
declarative
Open

Add syntax for declarative record descriptors#233
Schamper wants to merge 1 commit into
mainfrom
declarative

Conversation

@Schamper

@Schamper Schamper commented Jul 1, 2026

Copy link
Copy Markdown
Member

This resolves #195.

Disclaimer: this is mostly vibed but with good steering, iteration and a manual check of the code afterwards.

Instead of completely revamping the type system of flow.record, I opted for it to just be a flavor on top of the existing code. That way it should retain complete backwards compatibility. Then in the future we can decide how much of the original code we would want to change towards this style.

Example from the README, showing various options:

class HttpRequestRecord(RecordBase, name="http/request"):
    ts: datetime
    url: str  # native types map (e.g. str -> string)
    status: Annotated[int, "uint32"]  # or field(typename="uint32")
    remote: str

Using docstrings also "works" and has a helper to retrieve them.

@Schamper Schamper requested a review from yunzheng July 1, 2026 14:48
@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 191 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (e6b58fd) to head (1178dc0).

Files with missing lines Patch % Lines
flow/record/declarative.py 0.00% 185 Missing ⚠️
flow/record/base.py 0.00% 6 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (e6b58fd) and HEAD (1178dc0). Click for more details.

HEAD has 2 uploads less than BASE
Flag BASE (e6b58fd) HEAD (1178dc0)
unittests 14 12
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #233       +/-   ##
==========================================
- Coverage   84.29%   0.00%   -84.30%     
==========================================
  Files          35      36        +1     
  Lines        3756    3941      +185     
==========================================
- Hits         3166       0     -3166     
- Misses        590    3941     +3351     
Flag Coverage Δ
unittests 0.00% <0.00%> (-84.30%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codspeed-hq

codspeed-hq Bot commented Jul 1, 2026

Copy link
Copy Markdown

Congrats! CodSpeed is installed 🎉

🆕 2 new benchmarks were detected.

You will start to see performance impacts in the reports once the benchmarks are run from your default branch.

Detected benchmarks


Open in CodSpeed

@Schamper Schamper force-pushed the declarative branch 3 times, most recently from 0ed4854 to 6998c7d Compare July 1, 2026 16:47
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.

POC adding dataclass-style declaration to flow.record

1 participant