Skip to content

Share homework Learning in Public link validation and point rules #302

Description

@alexeygrigorev

Share homework Learning in Public link validation and point rules

Goal

Move the reusable final-submit rules for Learning in Public links into community_base.homework_steps, with model-independent callbacks for site-owned cohort, homework and project records. AISL and DTC should apply the same link semantics without importing either site from the package.

Baseline: AISL's step adapter accepts HTTP(S) links up to its configured cap, but does not check reuse across cohort homework/projects and currently sets total_score to question score only. DTC already rejects reused cohort links, has an enrollment opt-out, and awards one point per eligible link. AISL #1828 owns the step guidance and authored X examples; this issue owns submitted URL rules, not X post-body length.

Related adoption: AI-Shipping-Labs/website#1828 and AI-Shipping-Labs/website#1777; DataTalksClub/website#432. The project form in AI-Shipping-Labs/website#1777 is a separate site workflow but must use the same link-eligibility rule where a project accepts Learning in Public links.

Package scope

  • Normalize and validate a submitted list of optional HTTP(S) public URLs against a server-provided cap. Match DTC’s existing within-submission deduplication; count a repeated URL only once. Make excess-cap handling an explicit adapter policy: preserve AISL’s current targeted rejection and DTC’s current truncation until a separate product decision aligns them. Reject malformed URLs, credentials in URLs, and private/link-local/metadata literal destinations. Do not fetch learner URLs or perform DNS lookup in the request path.
  • Ask a host callback for links already used by this learner in the exact course/cohort across accepted homework and project submissions. Exclude the current submission during an edit. Reject reuse with targeted, non-secret field feedback. Do not use a global cross-site query or client-provided cohort identity.
  • Return an eligible link count for scoring: one point per accepted distinct link, or zero when the host says Learning in Public is disabled for that enrollment. A zero cap hides/ignores the field and awards zero. Sites decide where score components live and when scoring is published.
  • Keep draft writes permissive enough to save incomplete work; apply eligibility, duplicate and cap validation at final submit, before any submission/enrollment/score/notification write. Failed validation retains draft values.
  • Provide an adapter seam and pure validators only; no package FK or import of either site's Homework, Submission, ProjectSubmission, or Enrollment.

Acceptance

  • The same URL and cross-submission reuse input receives the same eligibility result through synthetic AISL-shaped and DTC-shaped adapters; a valid edit can retain its own previously accepted link. The cap-excess policy is explicit per adapter until the sites choose one common UX.
  • A URL reused from a different accepted homework or project in the same learner/cohort is rejected; a link belonging to another learner or cohort does not block submission.
  • An invalid, private literal, or cross-submission reused link gives a field error and no partial final-submit side effect. Repeated entries within the same submission count once. Excess entries follow the declared site policy and never add score. The draft survives a rejection unchanged.
  • One, three and zero eligible links yield one, three and zero points respectively; an enrollment opt-out yields zero while preserving the host's existing display/privacy policy.
  • Package checks pass; AISL and DTC consumer suites are run and reported separately against the package change. An immutable package tag precedes consumer pin updates.

Browser scenarios for site adopters

  1. Submit two eligible links, then edit an answer without changing the links. The same accepted links and score remain; no false self-duplicate error appears.
  2. Reuse a link from a prior homework or project in the same cohort. Review explains which field needs correction, keeps the draft, and creates no new accepted submission or points.
  3. Try a private literal URL and more links than the configured cap, including a forged POST. The private URL is rejected. AISL rejects excess links; DTC accepts only the capped set under its current rule. Neither site gives points for excluded links or makes a partial write after a validation error.
  4. Open an assignment with a zero cap and a DTC enrollment with Learning in Public disabled. No points are awarded; disabled fields follow the site's established policy.

Boundaries and dependencies

Depends on closed community-base#292 and tagged v0.5.10. It is independent of the learner state issue. Each site keeps its own final submission transaction, ownership lookup, opt-out model, score columns and email callbacks. Follow package quality gates and report package, AISL and DTC results separately.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions