Skip to content

feat: add a read-only submit --dry-run - #47

Merged
rabesss merged 4 commits into
mainfrom
feat/submit-dry-run
Oct 1, 2026
Merged

rabesss merged 4 commits into
mainfrom
feat/submit-dry-run

Conversation

@rabesss

@rabesss rabesss commented Sep 24, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a read-only submit --dry-run, the part of #28 that is still useful for Lighthouse:

lighthouse submit COURSE_ID FOLDER_ID --file answer.pdf --dry-run --json
  • Resolves the course and dropbox folder with a read-only client, then prints the destination: course, folder, and the file's name and size.
  • Never reads the file body and never uploads. It needs no --yes, even when run non-interactively.
  • Reports folder_verified: false with a warning when the folder name couldn't be confirmed.
  • Resolution errors keep the usual JSON-only stdout contract.
  • A real submit is unchanged: it still requires --yes when non-interactive and builds its client as before.

#28's --site option and trial session messages are intentionally not ported; #46 removes trial support.

Validation

  • Local gate: ruff, mypy, lint-imports, xenon and check_secrets.py all pass; pytest reports 1580 passed.
  • 5 new tests cover: no file read and no upload, no --yes needed, an unverified folder, a resolution error, and a real submit still requiring --yes.
  • Live check on Lighthouse: blocked, because the stored session had expired. The error output was one clean JSON document.

Refs #28 #25

@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-24T11:45:51.352006Z 1471802 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@factory-droid

factory-droid Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Droid encountered an error —— View job

Droid Exec exited with code 1:
Tool "Edit" skipped (GPT-5.2 uses ApplyPatch instead).
Tool "Create" skipped (GPT-5.2 uses ApplyPatch instead).

Security Review

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ℹ️ Minor suggestions only — one consistency nit inline.

Reviewed changes
Read-only submit --dry-run across lighthouse_cli/cli.py, lighthouse_cli/submit.py, and tests/test_submit.py (1 commit). Verified locally: tests/test_submit.py passes 95/95, including the 5 new dry-run tests.

  • --dry-run flag wiring — cli.py adds the flag and threads it into cmd_submit, which resolves the course and folder as usual, then reports the destination and exits before the confirmation prompt, the file-body read, and the upload.
  • Read-only client, no --yes gate — dry-run builds LighthouseClient(read_only_auth=True) (no cookie migration/CDP refresh; same pattern as quiz_preview_session.py and auth.py) and bypasses the non-interactive --yes refusal. The real submit path is untouched and still gated.
  • _submit_dry_run output — stats the file for size only, reports folder_verified: false with a fixed warning when the folder-detail lookup falls back to the default name, and keeps the --json stdout-only contract (human text only without --json; errors via _submit_error to stderr). No secrets reach output — names go through safe_display_text and the warning is a fixed string.
  • Tests — TestSubmitDryRun pins the right invariants: Path.read_bytes patched to raise (no body read), client_cls.assert_called_once_with(read_only_auth=True), submit_file never called, the --yes bypass, the unverified-folder warning, resolution-error JSON on stdout, and the unchanged real-submit gate. Assertions are exact (full-payload equality), so they fail if the behavior drifts.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using openai-compatible/glm-5.3 | 𝕏

Comment thread lighthouse_cli/submit.py Outdated
Comment thread lighthouse_cli/submit.py Outdated
Comment thread lighthouse_cli/cli.py
@kilo-code-bot

kilo-code-bot Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Fix these issues in Kilo Cloud

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
lighthouse_cli/submit.py 27 Dry-run warning says the folder name "could not be read", but since 40b827f the unverified path also fires when the name was read yet rejected by display filtering (e.g. >256 chars) — misleading wording that points the user at the folder ID
Files Reviewed (4 files)
  • README.md - 0 issues
  • lighthouse_cli/cli.py - 0 issues
  • lighthouse_cli/submit.py - 1 issue
  • tests/test_submit.py - 0 issues
Previous Review Summaries (2 snapshots, latest commit 44a9602)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 44a9602)

Status: 1 Issue Found | Recommendation: Address before merge

Fix these issues in Kilo Cloud

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
lighthouse_cli/submit.py 361 folder_verified: true can pair with the fallback name Unknown folder and no warning when the folder detail is read but its Name is unusable
Files Reviewed (3 files)
  • lighthouse_cli/cli.py - 0 issues
  • lighthouse_cli/submit.py - 1 issue
  • tests/test_submit.py - 0 issues

Previous review (commit 1471802)

Status: 2 Issues Found | Recommendation: Address before merge

Fix these issues in Kilo Cloud

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 2
Issue Details (click to expand)

SUGGESTION

File Line Issue
lighthouse_cli/submit.py 180 folder_verified sentinel comparison conflates "lookup failed" with a folder genuinely named Unknown folder
lighthouse_cli/cli.py 531 Docstring's "On success" JSON shape is now inaccurate for --dry-run --json (no submission_id/submitted_at; different payload)
Files Reviewed (3 files)
  • lighthouse_cli/cli.py - 1 issue
  • lighthouse_cli/submit.py - 1 issue
  • tests/test_submit.py - 0 issues

Reviewed by glm-5.3-flash · Input: 0 · Output: 0 · Cached: 0

Review guidance: REVIEW.md from base branch main

'lighthouse submit COURSE FOLDER --file F --dry-run [--json]' resolves the
course and dropbox folder with a read-only client and prints the
destination (course, folder, file name and size). It never reads the file
body or uploads, needs no --yes, and flags a folder name it could not
verify. Ported from the MAHE-useful part of #28 without its trial --site
option.

Refs #28 #25
From pullfrog and Kilo reviews of 1471802:
- folder_verified now means the folder's details were read, not that its
  name differs from the display fallback, so a folder literally named
  "Unknown folder" is no longer flagged.
- Build the client as LighthouseClient(read_only_auth=dry_run), like
  download --dry-run.
- submit --help documents the dry-run JSON shape.
@rabesss
rabesss force-pushed the feat/submit-dry-run branch from 1471802 to 44a9602 Compare October 1, 2026 11:56
@factory-droid

factory-droid Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Droid finished @rabesss's task —— View job


Security Review

LGTM. The submit --dry-run path appears read-only and keeps the JSON-only stdout contract; the added tests cover the intended invariants.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ℹ️ No critical issues — one documentation gap inline.

Reviewed changes
Delta since the prior pullfrog review (44a9602): verification is now reported explicitly instead of being inferred from the fallback folder name, and the run-1 consistency nit is applied. Verified locally: tests/test_submit.py 96/96, plus test_cli_contracts.py + test_read_only_auth.py 146/146.

  • Applied read_only_auth=dry_run — the client is now constructed with the flag passed straight through (tests pin read_only_auth=False for real submits), matching the download --dry-run precedent and closing the run-1 thread.
  • Moved verification into _get_folder_name — it returns (name, verified) based on whether the folder-detail lookup actually succeeded, replacing the folder_name != _DEFAULT_FOLDER_NAME heuristic; a folder literally named "Unknown folder" is no longer falsely reported unverified (test-pinned in both directions), and the warning was reworded to "The folder details could not be read…".
  • Documented the dry-run output — the submit help and docstring now list the dry-run JSON fields (dry_run, folder_verified, …) and the warning condition.

No secrets reach output (names go through safe_display_text, the warning is a fixed string), the --json stdout-only contract holds on every new path, and resolution errors still emit the usual single JSON error document.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using openai-compatible/glm-5.3 | 𝕏

Comment thread lighthouse_cli/cli.py
Comment thread lighthouse_cli/submit.py Outdated
@factory-droid

factory-droid Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Droid encountered an error —— View job


Security Review

From Kilo's review of 44a9602: a readable folder whose Name is missing,
empty or rejected for display came back as "Unknown folder" with
folder_verified true and no warning. folder_verified now also requires a
usable name.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes
Delta since the prior pullfrog review (44a9602) is documentation only, and it closes that review's inline thread: the README submit section now covers --dry-run. The full diff was re-read for context; no code or tests changed in this delta.

  • Documented --dry-run in the README — usage line, a flags-table row (read-only resolve, no file-body read, no upload, no --yes needed), a dedicated dry-run JSON example, and the folder_verified: false + warning note; each documented field and claim was checked against _submit_dry_run's payload (lighthouse_cli/submit.py:182-193) and matches, including the warning semantics (added only when the folder-detail lookup failed, exit code still 0).

Pullfrog  | View workflow run | Using openai-compatible/glm-5.3 | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes
Delta since the prior pullfrog review (f18d089): one commit tightening when a dry-run reports folder_verified: true. Verified locally: tests/test_submit.py passes 99/99 (dry-run selection 8/8).

  • Required a usable folder name for verification — _get_folder_name (lighthouse_cli/submit.py:353-362) now returns verified=False when the detail lookup succeeds but the projected name is empty (missing/blank, over the 256-char display cap, non-printable, or redacted by safe_display_text), closing the empty-Name edge the prior run had noted; a folder literally named "Unknown folder" still verifies. The real-submit path is unaffected — its display name resolves identically to before, and only dry-run reads the flag.
  • Kept wording in sync — the warning string, README note, and docstrings now say "name" instead of "details", matching the tightened semantics.
  • Strengthened the test — the unusable-detail case is now parametrized over a lookup failure, {"Name": ""}, {}, and an overlong name, asserting the exact fallback name and warning text, so it can actually fail on drift.

Pullfrog  | View workflow run | Using openai-compatible/glm-5.3 | 𝕏

@rabesss
rabesss merged commit 8965f68 into main Oct 1, 2026
12 checks passed
@rabesss
rabesss deleted the feat/submit-dry-run branch October 1, 2026 12:15
Comment thread lighthouse_cli/submit.py
_DEFAULT_FILE_NAME = "Unknown file"
_CLIENT_INIT_ERROR = "Could not initialize Lighthouse client."
_DRY_RUN_UNVERIFIED_WARNING = (
"The folder name could not be read; check the folder ID. No submission was sent."

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SUGGESTION: Warning says the folder name "could not be read", but the unverified path now also fires when the name was read yet unusable for display

Since 40b827f, _get_folder_name returns (_DEFAULT_FOLDER_NAME, False) whenever safe_display_text rejects Name — including a successfully read name that only fails the display projection: longer than _MAX_DISPLAY_NAME_LENGTH (256), whitespace-only, or caught by the secret/object heuristics. The new {"Name": "x" * 300} test case pins this. For such input the emitted warning "The folder name could not be read; check the folder ID" is misleading: the name was read, only its display projection was rejected, and folder resolution itself succeeded, so "check the folder ID" sends the user down the wrong path. Consider wording that covers both cases. The same "could not be read" phrasing also appears in the README note (README.md:969-970) and the submit docstring (cli.py:534), and the parametrized test name asserts "could not be read" for the over-long case.

Suggested change
"The folder name could not be read; check the folder ID. No submission was sent."
"The folder name could not be confirmed; check the folder ID. No submission was sent."

Reply with @kilocode-bot fix it to have Kilo Code address this issue.

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