Skip to content

fix: [good first issue] Add a sample archive generator for demos and onboarding - #18

Open
webbrain-one wants to merge 1 commit into
atomize-lab:mainfrom
webbrain-one:webbrain/issue-3
Open

webbrain-one wants to merge 1 commit into
atomize-lab:mainfrom
webbrain-one:webbrain/issue-3

Conversation

@webbrain-one

Copy link
Copy Markdown

Closes #3

Introduce `tools/scripts/sample_archive.py` to create small synthetic
archives with realistic metadata and placeholder media. Includes validation
checks, corresponding tests, and CLI integration to streamline user onboarding
and demo workflows.

Closes atomize-lab#3

@atomize-lab atomize-lab left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintainer review

Thanks for the contribution. I reviewed commit 6354ea2 in an isolated worktree. This needs changes before merge because the current implementation does not pass its own tests and misses required safety/CLI/documentation acceptance criteria.

Blocking results

  • python -m pytest tests/test_sample_archive.py -v: 2 failed. The generator invokes tweet_validate.py with the accounts/ directory as one tweet directory, so validation returns E001 (missing tweet.json). Use the validator's recursive --root mode.
  • Full suite: 242 passed, 2 failed (the same two sample tests). python tools/citeseal.py lint passes.
  • python tools/citeseal.py sample --help: exits 2 (invalid choice). The PR does not add the required unified sample subcommand.
  • The PR changes only the generator and its test; the required README quickstart update is absent.
  • Reusing an output path overwrites an existing deterministic tweet.json before the command fails. A controlled sentinel changed and was not preserved.
  • If <output>/accounts is an existing symlink, generation writes outside the resolved output root. A controlled probe confirmed the escaped file was created.
  • --count 10 creates malformed paths/datetimes such as 202608010_... and 2026-08-010T...; non-positive counts also need an explicit policy.

Please make generation fail safely before writing: preserve unrelated/existing archive data by default, enforce resolved-path containment for every generated path, validate the count/date range, wire cs sample, update the README, and add regression tests for collision/non-destruction, symlink/traversal containment, invalid counts, and unified CLI registration. Then rerun the targeted suite, full suite, CLI lint, and a manual generate + recursive validate smoke test.

validate_target = out / "accounts"
print(f"Validating generated archive at {validate_target}...")
result = subprocess.run(
[sys.executable, str(validate_script), str(validate_target)],

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Blocking correctness issue: tweet_validate.py treats a positional path as one tweet directory. Here accounts/ has no tweet.json, so both new tests fail with E001. Invoke the recursive interface (--root, followed by this path) and keep a test that asserts the validator actually inspected the generated item directories.

tweet_json["media"] = [{"file": "01.png", "type": "image", "alt_text": "placeholder blue square"}]
tweet_json["components"] = ["text", "images"]

tweet_json_path = item_dir / "tweet.json"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Blocking data-safety issue: this deterministically overwrites an existing tweet.json when --output is reused. I pre-created the first generated path with a sentinel; the command exited 1 but the sentinel was replaced. Refuse collisions/non-empty archive targets before any writes (or use an explicit ownership-aware policy), and add a regression test proving existing data remains byte-for-byte unchanged.

handle = "demo_user"
year = "2026"
month = "2026-08"
base_dir = out / "accounts" / handle / "tweets" / year / month

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Blocking path-containment issue: joining beneath out is not sufficient when an existing component is a symlink. With <output>/accounts symlinked to an external directory, the generator created the tweet tree outside the requested output root. Resolve the output root and every destination, reject symlink/traversal escapes before writing, and add a containment regression test.


for i in range(count):
day = i + 1
ts = f"2026080{day}_100000"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Count/date correctness: this formatting only works for days 1–9. --count 10 creates 202608010_... and datetime_utc=2026-08-010T...; zero/negative counts currently generate nothing and can appear successful once root validation is fixed. Either validate a documented range or generate dates with a real date type, with boundary tests.

@atomize-lab atomize-lab added enhancement New feature or request good first issue Good for newcomers labels Aug 14, 2026
@atomize-lab

Copy link
Copy Markdown
Owner

Nightly maintainer follow-up (2026-08-20): this PR is still at 6354ea285cfec016af8f5c692c3114355c009af6, with no new contributor commit since 2026-08-12, and the existing CHANGES_REQUESTED review remains unresolved.

I re-ran the exact Head in an isolated worktree using the repository .venv:

  • pytest tests/test_sample_archive.py -v: 2 failed
  • full pytest: 242 passed, 2 failed
  • tools/citeseal.py lint: passed
  • tools/citeseal.py sample --help: still not registered (exit 2)
  • controlled probes still reproduce existing-data overwrite, symlink escape outside the output root, and malformed count=10 dates/paths
  • GitHub currently reports no check-runs for this Head

Please push a new commit to this same PR addressing the existing blocking review: recursive validation invocation, unified sample CLI registration, README quickstart, non-destructive/contained output handling with regression tests, and explicit count/date boundary behavior. Maintainers will rerun the gates on the new Head. This PR is not ready to merge yet.

@atomize-lab

Copy link
Copy Markdown
Owner

Nightly maintainer CI update (2026-08-21): after reviewing the exact Head 6354ea285cfec016af8f5c692c3114355c009af6, I approved the first-time-contributor workflow run.

The remote matrix has now completed and confirms the local result:

  • Ubuntu lint + validate: failed at pytest — 242 passed, 2 failed
  • Windows lint + validate: failed at pytest — 242 passed, 2 failed
  • On both jobs, dependency install, pyflakes, and fixture validation passed; the two failures are the existing tests/test_sample_archive.py failures caused by invoking tweet_validate.py without recursive --root mode.

CI run: https://github.com/atomize-lab/citeseal/actions/runs/31636935868

The existing CHANGES_REQUESTED review remains authoritative. Please push fixes to this PR; maintainers will rerun the full acceptance and safety gates on the new Head.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request good first issue Good for newcomers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[good first issue] Add a sample archive generator for demos and onboarding

2 participants