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
Browser scenarios for site adopters
- 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.
- 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.
- 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.
- 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.
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_scoreto 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
Acceptance
Browser scenarios for site adopters
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.