Let a table declare its dimensions, and a directory of data carry its sets - #931
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (3)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
3ea071e to
8d22da2
Compare
4b4cd8a to
4536f37
Compare
8d22da2 to
0327c50
Compare
4536f37 to
50080a0
Compare
0327c50 to
ea40983
Compare
50080a0 to
c21757b
Compare
ea40983 to
d624b01
Compare
|
Codex review (cross-model leg, now that credits are back). One finding, addressed:
@coderabbitai review |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '=== Changed files ==='
git diff --name-only HEAD~1..HEAD || true
printf '%s\n' '=== Candidate annotation modules and tests ==='
fd -t f -e py . | rg 'annotation|annotations|table'
printf '%s\n' '=== Symbol map ==='
ast-grep outline . --items all --type function --match 'annotations|find_annotations|_load_file|read_table' || true
printf '%s\n' '=== Relevant definitions and tests ==='
rg -n -C 5 --type py \
'^\s*(def|async def)\s+(annotations|find_annotations|_load_file|read_table)\b|dc\.annotations\s*\(|annotations\s*\(' \
. -g '!**/.git/**' || true
printf '%s\n' '=== Latest commit diff ==='
git diff --find-renames --unified=80 HEAD~1..HEAD -- '*.py' || trueLength of output: 201934 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '=== Annotation loader dispatch and bare-file loading ==='
sed -n '390,535p' dascore/core/annotation_loader.py
sed -n '880,1015p' dascore/core/annotation_loader.py
printf '%s\n' '=== AnnotationSet attribute construction ==='
ast-grep outline dascore/core/annotations.py --items all --type function --match '_build_attrs|AnnotationSet'
rg -n -A90 -B10 --type py '^\s*def _build_attrs\b|^\s*def __init__\(' dascore/core/annotations.py
printf '%s\n' '=== Table reader callers and skip coverage ==='
rg -n -C 3 --type py '\bread_table\s*\(' . -g '!**/.git/**'
rg -n -C 3 --type py 'attrs=.*dims|dims=.*attrs|attrs=\{' tests/test_core/test_annotation_loader.py
printf '%s\n' '=== Current change status ==='
git status --shortLength of output: 31378 🏁 Script executed: #!/bin/bash
set -euo pipefail
nl -ba dascore/core/annotation_loader.py | sed -n '900,990p'
nl -ba dascore/core/annotations.py | sed -n '927,951p'Length of output: 492 🏁 Script executed: #!/bin/bash
set -euo pipefail
awk 'NR >= 900 && NR <= 990 { printf "%6d %s\n", NR, $0 }' \
dascore/core/annotation_loader.py
awk 'NR >= 927 && NR <= 951 { printf "%6d %s\n", NR, $0 }' \
dascore/core/annotations.pyLength of output: 6042
You are interacting with an AI system. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d624b0184d
ℹ️ 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".
c21757b to
137fc32
Compare
d624b01 to
3ee47e9
Compare
Description
Phase 3b of the annotation roadmap, second half, and the last of the store conventions. Stacked on #930 — review that one first; this PR's own diff is the second commit.
Two things a stored set could not do yet.
A table may declare its own dimensions. A bare table has no attrs file to state them in, so the call had to, and a picker handing over
picks.csvhad to hand over its dimensions separately. It may now say so above its header:A comment, deliberately: a reader which knows nothing of this convention still reads the table, which column-name markup or a second header row would break. Restating the dimensions is allowed where the spellings agree and refused where they differ, as everywhere else in this format — there is no precedence rule between two spellings of one fact. Vertices declare nothing: they are read in the dimensions of the set they belong to, which states them once. Comment lines above either table are otherwise just comments.
They are read, not written.
to_csvkeeps writing a plain table, because one every reader can open is worth more here than a self-describing one; the pragma is the hand-authoring spelling, and the docstrings now say so.read_tablegrew askipargument for this — lines above the header — and row numbers in its errors still count from the top of the file, so they name the line a reader would look at.A directory of data carries what it was annotated with. Hidden, under
.annotations, exactly as it carries its inventory under.inventory: the directory.annotations/holds a set or a directory of sets, and.annotations.csvis the bare-table spelling. Hidden so the file scanner does not read it as data, and so a directory holding a visibleannotations.csvstays a set rather than something carrying one — the discovery only fires where a directory states nothing itself. Two spellings at once, or something under the name in a form that name does not take, are refused rather than guessed at, asfind_inventoryrefuses them.find_annotationsis the sibling offind_inventory; there is nocarries_annotationsuntil a spool asks the cheap question.So
dc.annotations(path)now takes the same pathdc.spool(path)does.Still outstanding in 3b: the optional Parquet encoding. It wants a decision rather than a default — nothing in DASCore reads or writes Parquet today and
pyarrowis in no test environment, so it would land untested unless it is added as a test dependency. Happy to do it either way.Changelog
# dims: distance, timeline above its header..annotations, anddc.annotationsreads it from the data directory.dascore.utils.tables.read_tabletakes askipargument for lines above the header.Checklist
I have:
docs/contributing/general_guidelines.qmd).I have (if applicable):
Review
Five-lens adversarial pass (Codex is over its usage limit until Aug 20, so Claude-only). 33 findings; answered in the second commit:
#. A column named#notehad its header eaten as a comment and the first row of data promoted to header — silently, and a regression against the previous PR where nothing was ever skipped. Found by the correctness and blast-radius reviewers independently. A comment is now the mark and a space, a doubled mark, or the pragma itself.skipcounted csv records where pandas counted lines, so a quote inside a skipped comment could hand pandas a different header than the one this checked.read_tablenow opens once and lets pandas read on from the same stream;skiprowsis gone.attrs.jsonand failed with a pragma. And a message told the caller their dims "was given" when the dims came from the directory beside the sets.find_annotationsraisedParameterErrorwhere its documented siblingfind_inventoryraises the inventory's own error, and where every other failure ofdc.annotationsis anInvalidAnnotationError.pd.read_csvtakes the pragma for the header) and thedimsparameter's promise that a caller may override what a source states..dimsechoed the pragma back — dropping the skip entirely left them green while the loaded table's only column was the comment. They now assert the table parsed. Added: a#-header regression test, a struck-out## dims:, case-insensitivity, a blank line above the declaration, a comment holding an unbalanced quote, an unreadable table, and a data directory whose ownattrs.jsonmust not block discovery.Not taken:
find_annotationsstill duplicatesfind_inventory's shape rather than sharing a helper — the two differ in error type and wording, and unifying them would edit the inventory's tested messages for no behavior change.